-
Notifications
You must be signed in to change notification settings - Fork 14
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
improve convergence rate of the radiation Newton-Raphson solver #720
improve convergence rate of the radiation Newton-Raphson solver #720
Conversation
for more information, see https://pre-commit.ci
…tps://github.com/quokka-astro/quokka into chong/avoid-ComputeEintFromEgas-in-AddSourceTerm
for more information, see https://pre-commit.ci
…tps://github.com/quokka-astro/quokka into chong/avoid-ComputeEintFromEgas-in-AddSourceTerm
We should not do this. The auxiliary internal energy should never be used as a primary source of truth for the internal energy. It should only be used when sync'ing with the total energy in the hydro update. |
The dominant source of error in the internal energy is due to truncation errors, not round off errors. These are not the same, and the distinction is very important. |
A better way to solve this would be to add a call to SyncInternalEnergy after each timestep for radiation-only test problems. In real problems, this is done already during the hydro update. |
@@ -1286,6 +1285,7 @@ | |||
auto p_num_failed_coupling_local = p_num_failed_coupling; | |||
auto p_num_failed_dust_local = p_num_failed_dust; | |||
auto p_num_failed_outer_local = p_num_failed_outer_ite; | |||
auto p_iteration_counter_local = p_iteration_counter; |
Check notice
Code scanning / CodeQL
Unused local variable Note
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
I believe it is roundoff error in this case. What happens in this test is that the gas has an equilibrium temperature of 1 because I set the radiation temperature to 1. However, because the specific heat of radiation is very large, due to conservation of momentum, the gas momentum increases to 10^13 after the first step. Then, in the second time step, because the internal energy is derived from subtracting the total energy from the kinetic energy, the result is 0 due to roundoff error. |
Why shouldn't we use the auxiliary internal energy? |
The source of error in this test comes from the radiation subcycle it self and has nothing to do with hydro update. Here is the relavent code: In the end of the first radiation subcycle:
In the beginning of the second radiation subcycle:
The internal energy is lost in this back-and-forth calculation. I don't think // Li et al. sync method
// replace Eint with Eint_cons == (Etot - Ekin) if (Eint_cons / E) > eta
if (Eint_cons > eta * Etot) {
consVar[bx](i, j, k, internalEnergy_index) = Eint_cons;
} else { // non-conservative sync
consVar[bx](i, j, k, internalEnergy_index) = Eint_aux;
consVar[bx](i, j, k, energy_index) = Eint_aux + Ekin;
} The problem is |
If it is roundoff error due to catastrophic cancellation, that means that the kinetic energy is Unphysically enormous: a kinetic to internal ratio of |
OK, that totally makes sense. I will change the parameters in this test to make the Mach number more realistic. However, I still don't understand why you can't use the auxiliary internal energy. The code I pasted above from |
for more information, see https://pre-commit.ci
…tps://github.com/quokka-astro/quokka into chong/avoid-ComputeEintFromEgas-in-AddSourceTerm
for more information, see https://pre-commit.ci
…tps://github.com/quokka-astro/quokka into chong/avoid-ComputeEintFromEgas-in-AddSourceTerm
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
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.
Just two minor comments below.
|
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Description
Changes:
radiation.print_iteration_counts
parameter to enable counting the mean and max number of Newton-Raphson iterations in each radiation step. When set totrue
, the log file would look like:RadMarshakDust
. Initially, the gas is set with a density and temperature of 1, and the initial radiation energy density is 0. Radiation with a temperatureIn a future PR, I will extend this test by incorporating a multigroup model. This will demonstrate how FUV radiation from the left boundary is absorbed by the dust, which then re-radiates in IR.
Related issues
None.
Checklist
Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an
x
inside the square brackets[ ]
in the Markdown source below:/azp run
.