Add optional frequency dependence to PowerLaw#70
Conversation
|
LGTM - it'd be nice to have this in soon, for testing in dependent code. |
|
Sorry to jump the gun on the dBdT fix - it looks like this PR has to be redirected to |
+ Add density, temperature, and frequency offsets to power-laws. + Add density and temperature references (scales) to power-laws. + Add stimulated-emission factor option to absorption power-law.
| Real OpacityScale_(const Real rho, const Real temp, const Real nu) const { | ||
| return OpacityPrefactor_(rho, temp) * std::pow(nu / nu_ref_, nu_exp_); | ||
| const Real freq_plaw = std::pow((nu + nu_off_) / nu_ref_, nu_exp_); | ||
| const Real stim_fact = do_stim_emit_ ? -std::expm1(-(pc::h * nu / (pc::kb * temp))) : 1.0; |
There was a problem hiding this comment.
this brings in units... can you double check that all the conversions are threaded through correctly to get the correctly unit-informed Planck and Boltzmann constant?
There was a problem hiding this comment.
Good catch - will do...
There was a problem hiding this comment.
Since this is the CGS side of the class, it seems nu and temp should be in CGS by the time they reach this function, so that leaves the question of whether pc::h and pc::kb are properly non-dimensionalizing the exponential argument (or equivalently, what the actual units of nu is - e.g. energy or 1/time). If the nu here is assumed consistent with the nu taken by the EmissivityPerNuPerOmega function, it seems this should be correct: EmissivityPerNuPerOmega calls ThermalDistributionOfNu which takes nu directly and computes the nondimensional parameter x = pc::h * nu / (pc::kb * temp) as in the stimulated emission formula here. Let me know if this reasoning misses something.
There was a problem hiding this comment.
Following on this, noticed that the parameters rho_ref and temp_ref must be in CGS when the constructor is invoked. That is maybe a bit cumbersome - noted this in the comments next to these class members in each of the power law classes (also made a note that nu_ref has to have units of 1/s, which I think is true for the same reason unless kappa0 absorbs the unit).
|
@pdmullen @RyanWollaeger is this good to go? It looks like it is... and apparently I already approved ;) |
We're making a few final changes now (adding a test for the scattering power law opacity, minor comment updates) |
+ Add comments that reference parameters are in cgs units.
|
It should be ready now, if things look okay - the new test is not exhaustive for the constructor arguments, but maybe that is not too concerning. |
Yurlungur
left a comment
There was a problem hiding this comment.
I think it's fine. Thanks @RyanWollaeger !
This PR used generative AI.
Adds optional frequency dependence to the
PowerLawopacity.