Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The magnetic field is added. I created a new file
magnfrom which I import the needed stuff to other modules. The two main additions are:In$dP/dz$ . Then I created a class
BaseVerticalStructure, I added two functions returning zero but to be overwritten by mixins: an additional pressure at the photosphere and an additional source ofMagneticFieldwhich defines these functions (I collected all magn. fields args into a dictionarymagn_args) and passed thisMagneticFieldtoBaseVerticalStructureorBaseMesaVerticalStructureas a mixin, creating a "magnetic" class for every VS non-mangetic one. I did it for all non-magnetic VS classes without irradiation; irrad. classes were not changed. Everywhere below when I say: 'it was tested for everything' or 'everything takes a new argument', I mean "everything that's without an irradiation".I created a class$\dot{M}$ from $T_\mathrm{eff}$ or $F_\mathrm{vis}$ . In case of $r_{in} = r_{ISCO} = 3r_g, F = F_{in} + \dot{M} h (1 -\sqrt{(r_{in}/r)} )$ , while for the magnetic field, the equations are generalized. The inner radius is now found using the function $F_\mathrm{magn}$ to $F$ calculated by $r_0$ from $F$ (e.g., it recalculates $F \rightarrow \dot{M} \rightarrow r_{in}$ ).
ViscousTorquewhich takes the same dictionary + some other parameters. This class takes care of everything that can be found prior to the VS calculation: torques, inner radius, Teff..., including the functions that determinemagn_args=None, it gives the standard expressions:magn.radius_inner, and there is a magnetic contributionmagn.magnetic_torque. Note that the mixinMagneticFieldalso initializesViscousTorquesinside, as it needs to calculateSo introducing these two main things, I also rewrote all references to the inner radius and viscous torques everywhere in
profiles, e.g., now inStructureChoicethe classTorques = ViscousTorques(...)is created, and it takes care of converting Mdot <-> F <-> Teff, and calculates r_in. Now inStructureChoice, ifmagn_args is None, the old classes are initialized, while ifmagn_args is not None, the new magnetic classes for VS are chosen. Subsequently, other classes ofprofiles:VerticalProfile,S_Curve, andRadial_Structureare now taking magn_args as an argument.The
BaseVerticalStructure, and all subsequent functions (VS classes and classes defined inprofile) can now take a boolean argumentrad_pressure_includewhich determines whether to take the radiation pressure into account in calculations. Everywhere when it was clear that something like $...+4\sigma_b T^4/3c $ appears, I changed it torad_pressure(T)that returns the same ifrad_pressure_include==Trueand zero ifrad_pressure_include==False.The classes
VerticalProfile,S_Curve, andRadial_Structurenow can return namedtuples (ifto_return=True) containing some results of calculations. These classes now all have an argumentto_savewhich tells whether to save results in a file. They all now have their correspondingverbose_scurve/verbose_radarguments which determine whether to print the information as the calculation proceeds.All additions to the existing methods and functions were made as to follow the backward compatibility. If a user uses the new model as they were using it before, nothing should change for this user.
Using the provided 'tests', I made sure that the tests are successful for the non-magnetic case.
I changed
ReadMeslightly; I updated a version number inpyproject.toml, and added a.gitignore.