-
Notifications
You must be signed in to change notification settings - Fork 24
Skip radiation number density during timestep control #2004
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
base: development
Are you sure you want to change the base?
Changes from all commits
a668f7d
c3e4a01
b7ffff0
acf2e53
f57ca28
8e57b6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,10 +80,17 @@ auto computePhotoChemistry(amrex::MultiFab &mf, const Real dt, const int stage, | |
| for (int nn = 0; nn < NumSpec; ++nn) { | ||
| photochemstate.xn[nn] = state(i, j, k, RadSystem<problem_t>::scalar0_index + nn) / spmasses[nn]; | ||
| } | ||
| #ifdef SKIP_PHOTOCHEMFLUX | ||
| amrex::GpuArray<Real, NumChemBands> n_gamma_initial{}; | ||
| #endif | ||
| for (int nn = 0; nn < NumChemBands; ++nn) { | ||
| photochemstate.rn[0 + MicrophysicsNumRadVarsPerGroup * nn] = | ||
| state(i, j, k, firstChemIndex + Physics_NumVars::numRadVarsPerGroup * nn) * invChemBandQuanta[nn]; | ||
| const Real n_gamma = state(i, j, k, firstChemIndex + Physics_NumVars::numRadVarsPerGroup * nn) * invChemBandQuanta[nn]; | ||
| photochemstate.rn[0 + MicrophysicsNumRadVarsPerGroup * nn] = n_gamma; | ||
| #ifdef SKIP_PHOTOCHEMFLUX | ||
| n_gamma_initial[nn] = n_gamma; | ||
| #else | ||
| photochemstate.rn[1 + MicrophysicsNumRadVarsPerGroup * nn] = 1.0_rt; | ||
| #endif | ||
| } | ||
| photochemstate.rho = rho; | ||
| photochemstate.e = Eint / rho; | ||
|
|
@@ -125,17 +132,19 @@ auto computePhotoChemistry(amrex::MultiFab &mf, const Real dt, const int stage, | |
| state(i, j, k, RadSystem<problem_t>::scalar0_index + nn) = photochemstate.xn[nn] * spmasses[nn]; | ||
| } | ||
| for (int nn = 0; nn < NumChemBands; ++nn) { | ||
| state(i, j, k, firstChemIndex + Physics_NumVars::numRadVarsPerGroup * nn) = | ||
| photochemstate.rn[0 + MicrophysicsNumRadVarsPerGroup * nn] * chemBandQuanta[nn]; | ||
| state(i, j, k, firstChemFxIndex + Physics_NumVars::numRadVarsPerGroup * nn) = | ||
| photochemstate.rn[1 + MicrophysicsNumRadVarsPerGroup * nn] * | ||
| state(i, j, k, firstChemFxIndex + Physics_NumVars::numRadVarsPerGroup * nn); | ||
| state(i, j, k, firstChemFyIndex + Physics_NumVars::numRadVarsPerGroup * nn) = | ||
| photochemstate.rn[1 + MicrophysicsNumRadVarsPerGroup * nn] * | ||
| state(i, j, k, firstChemFyIndex + Physics_NumVars::numRadVarsPerGroup * nn); | ||
| state(i, j, k, firstChemFzIndex + Physics_NumVars::numRadVarsPerGroup * nn) = | ||
| photochemstate.rn[1 + MicrophysicsNumRadVarsPerGroup * nn] * | ||
| state(i, j, k, firstChemFzIndex + Physics_NumVars::numRadVarsPerGroup * nn); | ||
| const Real n_gamma_final = photochemstate.rn[0 + MicrophysicsNumRadVarsPerGroup * nn]; | ||
| state(i, j, k, firstChemIndex + Physics_NumVars::numRadVarsPerGroup * nn) = n_gamma_final * chemBandQuanta[nn]; | ||
| #ifdef SKIP_PHOTOCHEMFLUX | ||
| const Real flux_ratio = (n_gamma_initial[nn] > 0.0_rt) ? (n_gamma_final / n_gamma_initial[nn]) : 0.0_rt; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using const Real flux_ratio = (n_gamma_initial[nn] > 1e-100_rt) ? (n_gamma_final / n_gamma_initial[nn]) : 0.0_rt; |
||
| state(i, j, k, firstChemFxIndex + Physics_NumVars::numRadVarsPerGroup * nn) *= flux_ratio; | ||
| state(i, j, k, firstChemFyIndex + Physics_NumVars::numRadVarsPerGroup * nn) *= flux_ratio; | ||
| state(i, j, k, firstChemFzIndex + Physics_NumVars::numRadVarsPerGroup * nn) *= flux_ratio; | ||
| #else | ||
| const Real flux_norm = photochemstate.rn[1 + MicrophysicsNumRadVarsPerGroup * nn]; | ||
| state(i, j, k, firstChemFxIndex + Physics_NumVars::numRadVarsPerGroup * nn) *= flux_norm; | ||
| state(i, j, k, firstChemFyIndex + Physics_NumVars::numRadVarsPerGroup * nn) *= flux_norm; | ||
| state(i, j, k, firstChemFzIndex + Physics_NumVars::numRadVarsPerGroup * nn) *= flux_norm; | ||
| #endif | ||
| } | ||
| // Quokka uses rho*eint | ||
| const Real dEint = (photochemstate.e * photochemstate.rho) - Eint; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
StromgrenRSLA.tomlhas been updated to useintegrator.rosenbrock_tableau = 3, thesetup_target_for_microphysics_compilationcall at the beginning of this file (around line 6) should also be updated to pass"Rosenbrock"as the third argument, similar to the changes made inDTypeFrontandStromgrenSphere. Otherwise, the Rosenbrock integrator will not be compiled for this target, leading to build or runtime failures.