jac_cell
jac_cell
is used to test the accuracy of an analytic Jacobian
provided by a network, but comparing to a finite-difference
approximation. Given a thermodynamic state, jac_cell
evaluates
the analytic Jacobian as well as a numerical approximation to it, and
then outputs (to stdout
) the Jacobian elements side-by-side for
each method of computing the Jacobian.
Note
Some integrators, like VODE, have their own numerical Jacobian
routines. This test uses the implementation in
integration/util/numerical_jacobian.H
, which closely follows the ideas
of the VODE numerical approximation, as described in [42].
Getting Started
The jac_cell
code is located in
Microphysics/unit_test/jac_cell
. An inputs file which sets the
default parameters for your thermodynamic state is needed to run the
test.
Setting the thermodynamics
The parameters that affect the thermodynamics are:
unit_test.density
: the initial densityunit_test.temperature
: the initial temperature
The composition can be set either by specifying individual mass fractions
or setting unit_test.uniform_xn
as described in Defining composition.
If the values don’t sum to 1
initially, then the test will do a
normalization. This normalization can be disabled by setting:
unit_test.skip_initial_normalization = 1
Building and Running the Code
The code can be built simply as:
make
Note
By default, this will build with the aprox13
network, which
uses the C++ templating method (Templated Network Righthand Sides) of
building the analytic Jacobian at compile-time. The network can be
changed via the build parameter NETWORK_DIR
.
Important
The screening routines provided by Microphysics do not return the derivative of the screening factor with respect to composition. This means that the analytic Jacobian provided by the network will ignore this contribution, but the numerical Jacobian will implicitly include it.
To compare just the network Jacobian elements, it is suggested that
you build with SCREEN_METHOD=null
.
The build process will automatically create links in the build directory to any required EOS table.
To run the code, in the jac_cell
directory run:
./main3d.gnu.ex inputs
where inputs
is the provided inputs file. You may edit the
thermodynamic state in that file prior to running.
Output
All output is directed to stdout
. Example output is shown below
(this output includes screening, highlighting the difference that the
screening composition derivatives make):
Initializing AMReX (24.12-14-gb3f67385e62f)...
AMReX (24.12-14-gb3f67385e62f) initialized
starting the single zone burn...
element numerical analytic
J( He4, He4) = -386901.0562 -389364.2481
J( He4, C12) = 1538.83613 1527.484671
J( He4, O16) = -11984.43367 -11604.67208
J( He4, Ne20) = -226229.9236 -225570.3475
J( He4, Mg24) = -118533.7928 -117650.0754
J( He4, Si28) = -13102.92749 -12026.86162
J( He4, S32) = -13739.13964 -12490.59603
J( He4, Ar36) = -8735.824012 -7328.055338
J( He4, Ca40) = -1917.505444 -359.8025782
J( He4, Ti44) = -1801.580358 -100.6766494
J( He4, Cr48) = -1902.430547 -63.38388515
J( He4, Fe52) = -1987.160097 -13.86553734
J( He4, Ni56) = -2104.486528 8.889625789e-06
J( He4, e) = -3.302305762e-14 -3.302305672e-14
J( C12, He4) = -1544.888563 -1669.808542
J( C12, C12) = -14163.60628 -14170.71908
J( C12, O16) = -26.31037223 -15.90510669
J( C12, Ne20) = -22.40516055 0
J( C12, Mg24) = -31.64594981 0
J( C12, Si28) = -39.31004354 0
J( C12, S32) = -45.98896291 0
J( C12, Ar36) = -52.01096713 0
J( C12, Ca40) = -57.57313075 0
J( C12, Ti44) = -62.80086484 0
J( C12, Cr48) = -67.77757842 0
J( C12, Fe52) = -72.56164943 0
J( C12, Ni56) = -77.19392628 0
J( C12, e) = -1.637120092e-15 -1.637119821e-15
J( O16, He4) = -44251.69974 -44202.73796
J( O16, C12) = 2167.279422 2205.366875
J( O16, O16) = -46494.3376 -46450.60357
J( O16, Ne20) = 6268.468387 6319.326423
J( O16, Mg24) = -58.72063931 0
J( O16, Si28) = -67.00603097 0
J( O16, S32) = -75.55571467 0
J( O16, Ar36) = -84.28093184 0
J( O16, Ca40) = -93.12930016 0
J( O16, Ti44) = -102.0668362 0
J( O16, Cr48) = -111.0723391 0
J( O16, Fe52) = -120.129117 0
J( O16, Ni56) = -129.2264943 0
J( O16, e) = 4.384415228e-16 4.384411885e-16
J(Ne20, He4) = -1071437.231 -1077714.229
J(Ne20, C12) = 10295.4965 10403.37149
J(Ne20, O16) = 56883.61948 58036.66646
J(Ne20, Ne20) = -1145561.976 -1143650.054
J(Ne20, Mg24) = -2527.616919 0.003495578555
J(Ne20, Si28) = -3061.548719 0
J(Ne20, S32) = -3544.317148 0
J(Ne20, Ar36) = -3993.040141 0
J(Ne20, Ca40) = -4417.866583 0
J(Ne20, Ti44) = -4825.366803 0
J(Ne20, Cr48) = -5219.853315 0
J(Ne20, Fe52) = -5604.291196 0
J(Ne20, Ni56) = -5980.914429 0
J(Ne20, e) = -8.494068043e-14 -8.494067874e-14
J(Mg24, He4) = 654844.2806 657000.6182
J(Mg24, C12) = 435.4230384 15.9212509
J(Mg24, O16) = 929.9962063 15.9212509
J(Mg24, Ne20) = 1364203.922 1362901.075
J(Mg24, Mg24) = -704261.6416 -705900.4607
J(Mg24, Si28) = 1944.546334 0.0001724818945
J(Mg24, S32) = 2231.306642 0
J(Mg24, Ar36) = 2505.576486 0
J(Mg24, Ca40) = 2770.981131 0
J(Mg24, Ti44) = 3030.000681 0
J(Mg24, Cr48) = 3284.193323 0
J(Mg24, Fe52) = 3534.649522 0
J(Mg24, Ni56) = 3782.237956 0
J(Mg24, e) = 3.138100654e-14 3.138100793e-14
J(Si28, He4) = 733740.6263 739362.5011
J(Si28, C12) = -236.8292666 18.57479272
J(Si28, O16) = 574.578026 18.59079981
J(Si28, Ne20) = 1117.750234 0
J(Si28, Mg24) = 825105.1884 823550.5326
J(Si28, Si28) = -82267.7835 -84188.03177
J(Si28, S32) = 2244.127686 2.723790242
J(Si28, Ar36) = 2532.726899 0
J(Si28, Ca40) = 2803.275313 0
J(Si28, Ti44) = 3058.658852 0
J(Si28, Cr48) = 3302.735385 0
J(Si28, Fe52) = 3538.1484 0
J(Si28, Ni56) = 3766.666407 0
J(Si28, e) = 7.404959203e-14 7.404958884e-14
J( S32, He4) = -3580.328682 -3712.987952
J( S32, C12) = 8.04608259 0
J( S32, O16) = -10.40027404 0.002248083797
J( S32, Ne20) = -22.96819788 0
J( S32, Mg24) = -32.64411602 0
J( S32, Si28) = 96174.2781 96214.89322
J( S32, S32) = -99978.56511 -99930.99407
J( S32, Ar36) = -42.78877369 11.02602735
J( S32, Ca40) = -59.590923 0
J( S32, Ti44) = -64.96182659 0
J( S32, Cr48) = -70.09376854 0
J( S32, Fe52) = -75.06398858 0
J( S32, Ni56) = -79.83062948 0
J( S32, e) = -1.735789154e-15 -1.735789442e-15
J(Ar36, He4) = 46086.53162 46453.96399
J(Ar36, C12) = -24.11889018 0
J(Ar36, O16) = 26.26894988 0
J(Ar36, Ne20) = 60.49242539 0
J(Ar36, Mg24) = 86.63689247 0
J(Ar36, Si28) = 108.1539016 0
J(Ar36, S32) = 112545.6504 112418.8663
J(Ar36, Ar36) = -65833.81509 -65977.3066
J(Ar36, Ca40) = 160.4642177 1.609672543
J(Ar36, Ti44) = 173.235213 0
J(Ar36, Cr48) = 186.8760509 0
J(Ar36, Fe52) = 199.9634644 0
J(Ar36, Ni56) = 212.5928074 0
J(Ar36, e) = 4.796861622e-15 4.796861932e-15
J(Ca40, He4) = 68936.76349 69694.52161
J(Ca40, C12) = -21.37672362 0
J(Ca40, O16) = 92.60590241 0
J(Ca40, Ne20) = 172.688813 0
J(Ca40, Mg24) = 235.8250397 0
J(Ca40, Si28) = 289.279374 0
J(Ca40, S32) = 336.6818312 0
J(Ca40, Ar36) = 73674.38243 73294.33591
J(Ca40, Ca40) = -3181.015849 -3601.602832
J(Ca40, Ti44) = 605.9215887 146.8474287
J(Ca40, Cr48) = 496.0195798 0
J(Ca40, Fe52) = 531.7806992 0
J(Ca40, Ni56) = 566.6106385 0
J(Ca40, e) = 1.005604098e-14 1.00560404e-14
J(Ti44, He4) = 2668.743332 2690.820423
J(Ti44, C12) = 1.238968178 0
J(Ti44, O16) = 5.219659626 0
J(Ti44, Ne20) = 8.176705476 0
J(Ti44, Mg24) = 10.62185414 0
J(Ti44, Si28) = 12.77460702 0
J(Ti44, S32) = 14.74456604 0
J(Ti44, Ar36) = 16.5926625 0
J(Ti44, Ca40) = 3978.151195 3959.795738
J(Ti44, Ti44) = -1410.451232 -1430.507487
J(Ti44, Cr48) = 21.71303639 0.002593936486
J(Ti44, Fe52) = 23.32886523 0
J(Ti44, Ni56) = 24.91917548 0
J(Ti44, e) = 3.036977677e-16 3.036977135e-16
J(Cr48, He4) = 614.7614844 623.7272557
J(Cr48, C12) = -0.1747033379 0
J(Cr48, O16) = 1.201593305 0
J(Cr48, Ne20) = 2.1753907 0
J(Cr48, Mg24) = 2.947870284 0
J(Cr48, Si28) = 3.605375763 0
J(Cr48, S32) = 4.190958113 0
J(Cr48, Ar36) = 4.728616507 0
J(Cr48, Ca40) = 5.232734331 0
J(Cr48, Ti44) = 1390.049151 1384.336707
J(Cr48, Cr48) = -754.4384225 -760.6122813
J(Cr48, Fe52) = 6.621805499 0.0006014485747
J(Cr48, Ni56) = 7.057441608 0
J(Cr48, e) = 1.19432887e-16 1.194328695e-16
J(Fe52, He4) = 632.9421872 643.7409355
J(Fe52, C12) = -0.1711193576 0
J(Fe52, O16) = 1.500523358 0
J(Fe52, Ne20) = 2.686529769 0
J(Fe52, Mg24) = 3.629742825 0
J(Fe52, Si28) = 4.434187596 0
J(Fe52, S32) = 5.15193241 0
J(Fe52, Ar36) = 5.811846257 0
J(Fe52, Ca40) = 6.431285246 0
J(Fe52, Ti44) = 7.02131108 0
J(Fe52, Cr48) = 831.5828167 823.9935726
J(Fe52, Fe52) = -172.1130683 -180.2532886
J(Fe52, Ni56) = 8.67797769 0.0001155651353
J(Fe52, e) = 1.4407613e-16 1.440761083e-16
J(Ni56, He4) = 190.5614891 194.1182245
J(Ni56, C12) = -0.04871014481 0
J(Ni56, O16) = 0.5045792589 0
J(Ni56, Ne20) = 0.8977755497 0
J(Ni56, Mg24) = 1.210925284 0
J(Ni56, Si28) = 1.478328594 0
J(Ni56, S32) = 1.717144845 0
J(Ni56, Ar36) = 1.936906672 0
J(Ni56, Ca40) = 2.143324048 0
J(Ni56, Ti44) = 2.340035525 0
J(Ni56, Cr48) = 2.52947455 0
J(Ni56, Fe52) = 196.8315355 194.1182245
J(Ni56, Ni56) = 2.892625537 -0.0001244547611
J(Ni56, e) = 4.749774962e-17 4.749774706e-17
J( e, He4) = 8.557355646e+23 8.612933787e+23
J( e, C12) = 3.253492329e+21 3.293956754e+21
J( e, O16) = 1.407824852e+22 1.326089094e+22
J( e, Ne20) = 5.099953876e+23 5.085260898e+23
J( e, Mg24) = 2.852905494e+23 2.833327761e+23
J( e, Si28) = 2.258348807e+22 2.015807656e+22
J( e, S32) = 2.278872757e+22 2.001064883e+22
J( e, Ar36) = 1.55712523e+22 1.244521857e+22
J( e, Ca40) = 3.918079028e+21 4.446572283e+20
J( e, Ti44) = 3.973002198e+21 1.959966253e+20
J( e, Cr48) = 4.23547637e+21 1.21440394e+20
J( e, Fe52) = 4.413681758e+21 2.675297734e+19
J( e, Ni56) = 4.682037199e+21 -1.725529485e+13
J( e, e) = 74499.43446 74499.57032
AMReX (24.12-14-gb3f67385e62f) finalized