Microphysics icon indicating copy to clipboard operation
Microphysics copied to clipboard

implement a simple C++ backward Euler integrator

Open zingale opened this issue 4 years ago • 4 comments

zingale avatar Jan 02 '21 14:01 zingale

this can integrate aprox13

it only uses rtol_spec and atol_spec for error estimation.

zingale avatar Feb 25 '21 15:02 zingale

Here's a comparison using burn_cell between VODE and Backward Euler:

be_compare

zingale avatar Mar 02 '21 16:03 zingale

Can we use the linpack routines from util/?

maximumcats avatar Mar 04 '21 12:03 maximumcats

yes, I just need to make that not depend on VODE. I'll do that in a separate PR.

zingale avatar Mar 04 '21 14:03 zingale

okay, this builds and seems to work once again.

zingale avatar Nov 12 '22 20:11 zingale

I was able to integrate both a pynucastro net and an aprox net with this integrator

zingale avatar Nov 12 '22 22:11 zingale

Results of this integrator on the test in #632:

$ ./main3d.gnu.ex inputs_aprox13_mott unit_test.tmax = 1.e2
AMReX (22.11-14-ge0afc82f63ce) initialized
starting the single zone burn...
Maximum Time (s): 100
State Density (g/cm^3): 10000000
State Temperature (K): 5000000000
Mass Fraction (He4): 0
Mass Fraction (C12): 0.5
Mass Fraction (O16): 0.5
Mass Fraction (Ne20): 0
Mass Fraction (Mg24): 0
Mass Fraction (Si28): 0
Mass Fraction (S32): 0
Mass Fraction (Ar36): 0
Mass Fraction (Ca40): 0
Mass Fraction (Ti44): 0
Mass Fraction (Cr48): 0
Mass Fraction (Fe52): 0
Mass Fraction (Ni56): 0
RHS at t = 0
   He4 18982072.69
   C12 -37920721.9
   O16 -483268.4495
  Ne20 18722989.58
  Mg24 237221.6847
  Si28 239033.521
   S32 206.7673375
  Ar36 -6.80347759e-25
  Ca40 2.671937993e-24
  Ti44 -2.870067494e-24
  Cr48 -1.64899539e-26
  Fe52 -7.334826867e-27
  Ni56 -3.889639522e-27
integration summary:
dens: 10000000 temp: 5000000000
energy released: 6.541799691e+17
number of steps taken: 6074
number of f evaluations: 26408
------------------------------------
successful? 1
 - Hnuc = 6.541799691e+15
 - added e = 6.541799691e+17
 - final T = 5000000000
------------------------------------
e initial = 1.328677169e+18
e final =   1.982857138e+18
------------------------------------
new mass fractions:
He4 0.04129594208
C12 1.891873058e-07
O16 7.519834653e-07
Ne20 9.083521524e-09
Mg24 4.072337551e-06
Si28 0.008131179773
S32 0.01341589955
Ar36 0.01043788741
Ca40 0.01983642858
Ti44 0.000434485126
Cr48 0.003588685605
Fe52 0.05204526759
Ni56 0.8508092017
------------------------------------
species creation rates:
omegadot(He4): 0.0004129594208
omegadot(C12): -0.004999998108
omegadot(O16): -0.00499999248
omegadot(Ne20): 9.083521524e-11
omegadot(Mg24): 4.072337551e-08
omegadot(Si28): 8.131179773e-05
omegadot(S32): 0.0001341589955
omegadot(Ar36): 0.0001043788741
omegadot(Ca40): 0.0001983642858
omegadot(Ti44): 4.34485126e-06
omegadot(Cr48): 3.588685605e-05
omegadot(Fe52): 0.0005204526759
omegadot(Ni56): 0.008508092017
number of steps taken: 1070229712
AMReX (22.11-14-ge0afc82f63ce) finalized

This matches pretty closely. It's an order of magnitude more timesteps than VODE, but several orders of magnitude fewer timesteps than the forward Euler integrator.

maximumcats avatar Nov 13 '22 00:11 maximumcats