|
7 | 7 |
|
8 | 8 | #include <integrator_type_simplified_sdc.H> |
9 | 9 | #include <actual_network.H> |
| 10 | +#ifdef NEW_NETWORK_IMPLEMENTATION |
| 11 | +#include <rhs.H> |
| 12 | +#else |
10 | 13 | #include <actual_rhs.H> |
11 | | -#include <numerical_jacobian.H> |
| 14 | +#endif |
12 | 15 | #ifdef NONAKA_PLOT |
13 | 16 | #include <nonaka_plot.H> |
14 | 17 | #endif |
@@ -110,94 +113,66 @@ void jac (const Real time, burn_t& state, T& int_state, MatrixType& pd) |
110 | 113 |
|
111 | 114 | } |
112 | 115 |
|
113 | | - if (int_state.jacobian_type == 3) { |
114 | | - jac_info_t jac_info; |
115 | | - jac_info.h = int_state.H; |
116 | | - |
117 | | - // the numerical Jacobian for SDC will automatically |
118 | | - // put it into the correct form (in terms of energy) |
119 | | - // so we can just operate on the integrator Jacobian storage |
120 | | - // directly |
| 116 | + // Call the specific network routine to get the Jacobian. |
121 | 117 |
|
122 | | - numerical_jac(state, jac_info, pd); |
| 118 | + actual_jac(state, pd); |
123 | 119 |
|
124 | | - // apply fudge factor: |
125 | | - |
126 | | - if (react_boost > 0.0_rt) { |
127 | | - pd.mul(react_boost); |
| 120 | + // The Jacobian from the nets is in terms of dYdot/dY, but we want |
| 121 | + // it was dXdot/dX, so convert here. |
| 122 | + for (int n = 1; n <= NumSpec; n++) { |
| 123 | + for (int m = 1; m <= neqs; m++) { |
| 124 | + pd(n,m) = pd(n,m) * aion[n-1]; |
128 | 125 | } |
| 126 | + } |
129 | 127 |
|
130 | | - // jacobian = 3 is a hybrid numerical + analytic |
131 | | - // implementation for simplified SDC. It uses a one-sided |
132 | | - // difference numerical approximation for the reactive |
133 | | - // part and then algebraically transforms it to the |
134 | | - // correct state variables for SDC. This means we need to |
135 | | - // account for the NumSpec+1 RHS evals |
136 | | - int_state.NFE += NumSpec + 1; |
137 | | - |
138 | | - } else { |
139 | | - |
140 | | - // Call the specific network routine to get the Jacobian. |
141 | | - |
142 | | - actual_jac(state, pd); |
143 | | - |
144 | | - // The Jacobian from the nets is in terms of dYdot/dY, but we want |
145 | | - // it was dXdot/dX, so convert here. |
| 128 | + for (int m = 1; m <= neqs; m++) { |
146 | 129 | for (int n = 1; n <= NumSpec; n++) { |
147 | | - for (int m = 1; m <= neqs; m++) { |
148 | | - pd(n,m) = pd(n,m) * aion[n-1]; |
149 | | - } |
150 | | - } |
151 | | - |
152 | | - for (int m = 1; m <= neqs; m++) { |
153 | | - for (int n = 1; n <= NumSpec; n++) { |
154 | | - pd(m,n) = pd(m,n) * aion_inv[n-1]; |
155 | | - } |
| 130 | + pd(m,n) = pd(m,n) * aion_inv[n-1]; |
156 | 131 | } |
| 132 | + } |
157 | 133 |
|
158 | | - // apply fudge factor: |
| 134 | + // apply fudge factor: |
159 | 135 |
|
160 | | - if (react_boost > 0.0_rt) { |
161 | | - pd.mul(react_boost); |
162 | | - } |
| 136 | + if (react_boost > 0.0_rt) { |
| 137 | + pd.mul(react_boost); |
| 138 | + } |
163 | 139 |
|
164 | | - // The system we integrate has the form (rho X_k, rho e) |
165 | | - |
166 | | - // pd is now of the form: |
167 | | - // |
168 | | - // SFS / d(rho X1dot)/dX1 d(rho X1dit)/dX2 ... 1/cv d(rho X1dot)/dT \ |
169 | | - // | d(rho X2dot)/dX1 d(rho X2dot)/dX2 ... 1/cv d(rho X2dot)/dT | |
170 | | - // SFS-1+nspec | ... | |
171 | | - // SEINT \ d(rho Edot)/dX1 d(rho Edot)/dX2 ... 1/cv d(rho Edot)/dT / |
172 | | - // |
173 | | - // SFS SEINT |
174 | | - |
175 | | - // now correct the species derivatives |
176 | | - // this constructs dy/dX_k |_e = dy/dX_k |_T - e_{X_k} |_T dy/dT / c_v |
177 | | - |
178 | | - eos_re_t eos_state; |
179 | | - eos_state.rho = state.rho; |
180 | | - eos_state.T = state.T; |
181 | | - eos_state.e = state.e; |
182 | | - for (int n = 0; n < NumSpec; n++) { |
183 | | - eos_state.xn[n] = state.xn[n]; |
184 | | - } |
| 140 | + // The system we integrate has the form (rho X_k, rho e) |
| 141 | + |
| 142 | + // pd is now of the form: |
| 143 | + // |
| 144 | + // SFS / d(rho X1dot)/dX1 d(rho X1dit)/dX2 ... 1/cv d(rho X1dot)/dT \ |
| 145 | + // | d(rho X2dot)/dX1 d(rho X2dot)/dX2 ... 1/cv d(rho X2dot)/dT | |
| 146 | + // SFS-1+nspec | ... | |
| 147 | + // SEINT \ d(rho Edot)/dX1 d(rho Edot)/dX2 ... 1/cv d(rho Edot)/dT / |
| 148 | + // |
| 149 | + // SFS SEINT |
| 150 | + |
| 151 | + // now correct the species derivatives |
| 152 | + // this constructs dy/dX_k |_e = dy/dX_k |_T - e_{X_k} |_T dy/dT / c_v |
| 153 | + |
| 154 | + eos_re_t eos_state; |
| 155 | + eos_state.rho = state.rho; |
| 156 | + eos_state.T = state.T; |
| 157 | + eos_state.e = state.e; |
| 158 | + for (int n = 0; n < NumSpec; n++) { |
| 159 | + eos_state.xn[n] = state.xn[n]; |
| 160 | + } |
185 | 161 | #ifdef AUX_THERMO |
186 | | - // make the aux data consistent with the state X's |
187 | | - set_aux_comp_from_X(eos_state); |
| 162 | + // make the aux data consistent with the state X's |
| 163 | + set_aux_comp_from_X(eos_state); |
188 | 164 | #endif |
189 | 165 |
|
190 | | - eos(eos_input_re, eos_state); |
| 166 | + eos(eos_input_re, eos_state); |
191 | 167 |
|
192 | | - eos_xderivs_t eos_xderivs = composition_derivatives(eos_state); |
| 168 | + eos_xderivs_t eos_xderivs = composition_derivatives(eos_state); |
193 | 169 |
|
194 | | - for (int m = 1; m <= neqs; m++) { |
195 | | - for (int n = 1; n <= NumSpec; n++) { |
196 | | - pd(m, n) -= eos_xderivs.dedX[n-1] * pd(m, net_ienuc); |
197 | | - } |
| 170 | + for (int m = 1; m <= neqs; m++) { |
| 171 | + for (int n = 1; n <= NumSpec; n++) { |
| 172 | + pd(m, n) -= eos_xderivs.dedX[n-1] * pd(m, net_ienuc); |
198 | 173 | } |
199 | | - |
200 | 174 | } |
201 | 175 |
|
202 | 176 | } |
| 177 | + |
203 | 178 | #endif |
0 commit comments