Skip to content
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

Merged
merged 10 commits into from
Aug 12, 2024

Conversation

spmatt
Copy link
Contributor

@spmatt spmatt commented Aug 11, 2024

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.

@RoryBarnes
Copy link
Collaborator

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.

@RoryBarnes RoryBarnes merged commit 5fc4592 into VirtualPlanetaryLaboratory:main Aug 12, 2024
1 of 33 checks passed
@spmatt
Copy link
Contributor Author

spmatt commented Aug 12, 2024 via email

@spmatt spmatt deleted the BreimannTorque branch August 12, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants