-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breimann+21 Wind Torque #298
Breimann+21 Wind Torque #298
Conversation
These changes look great, Sean! Thanks so much for them! The issue with passing iBody to WriteWindTorque is interesting. The fdDJDtMagBrakingStellar function governs a primary variable, and the protoype for this function expects a pointer to an array of integers (iaBody). In this case your passing a pointer to a single integer, so the code compiles and still works. The proper way to do this would be to define a new int array with size 1 in WriteWindTorque, assign iBody to its first element, pass iaBody to fdDJDtMagBrakingStellar, and then free the array. But that seems very cumbersome and I don't think the wind torque will ever be a function of other bodies, so I'm leaving it as is and merging. |
5fc4592
into
VirtualPlanetaryLaboratory:main
Thanks, Rory. I’m happy to contribute and only wish I had more time to do more. Yeah, I saw that and also was pretty sure that indexing the integer with [0] is actually ok. But it seemed dirty to me. ;-) I did put a comment in the code there, which would be easy to uncomment, in order to implement exactly what you said. Fast fix. But if you are happy with how it’s working, I don’t mind either way.
…-Sean
On Aug 12, 2024, at 4:52 PM, Rory Barnes ***@***.***> wrote:
These changes look great, Sean! Thanks so much for them!
The issue with passing iBody to WriteWindTorque is interesting. The fdDJDtMagBrakingStellar function governs a primary variable, and the protoype for this function expects a pointer to an array of integers (iaBody). In this case your passing a pointer to a single integer, so the code compiles and still works. The proper way to do this would be to define a new int array with size 1 in WriteWindTorque, assign iBody to its first element, pass iaBody to fdDJDtMagBrakingStellar, and then free the array. But that seems very cumbersome and I don't think the wind torque will ever be a function of other bodies, so I'm leaving it as is and merging.
—
Reply to this email directly, view it on GitHub <#298 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AF36HDYOZIXGCP2VMYHKPV3ZREVABAVCNFSM6AAAAABMLAMKPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBUHE3DMMZWGQ>.
You are receiving this because you authored the thread.
|
Proposed changes
I added a new option for stellar wind torques, using that of Breimann et al. (2021) "standard model" torque.
I added the option to output the stellar wind torque, for analysis.
I also updated the MagneticBraking example codes and documentation, to include calculations with the new torque and updated and added a few figures for comparisons between the different braking laws.
I tested the torque by comparing the spin evolution for a 1 & 0.1 solar-mass star to figures in Breimann+21, and to plots and calculations I've done myself with this same torque in unpublished work. I also compared the output stellar wind torques to plots from Breimann+21 and my own work and expectations (since I formulated this torque myself). The updates to the MagneticBraking example show some of the outputs of my test runs, and all seems to be working well.
Outstanding minor issues/questions
In the examples/MagneticBraking, for some reason the font size on my plots is smaller than in the original version. There is code in the makeplot.py for changing the font, but it didn't behave how I expected, so I've just submitted this with small-ish font on the plots.
In my new function WriteWindTorque (in stellar.c), I have used &iBody in call to the function fdDJDtMagBrakingStellar(). This seems to work. But I wasn't sure if I should instead do something like adding a line
int iaBody[1] = {iBody};
then call the function with iaBody, since I've seen that elsewhere in the code. I'm not sure what might be different between these two approaches or which is preferred.