Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
fs_common.cpp
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include "fs_common.h"
25
33Real divideIfNonZero(creal numerator, creal denominator) {
34 if (denominator <= 0.0) {
35 return 0.0;
36 } else {
37 return numerator / denominator;
38 }
39}
40
52std::array<Real, Rec::N_REC_COEFFICIENTS>
55 const fsgrid::FsStencil& stencil, Real reconstructionOrder) {
56 std::array<Real, Rec::N_REC_COEFFICIENTS> perturbedResult;
57 const auto ooo = stencil.ooo();
58 const auto poo = stencil.poo();
59 const auto opo = stencil.opo();
60 const auto oop = stencil.oop();
61 const std::array<Real, fsgrids::dperb::N_DPERB>& der_i1j1k1 = dperb[ooo];
62 const std::array<Real, fsgrids::bfield::N_BFIELD>& cep_i1j1k1 = perb[ooo];
63
64 const bool pooOk = stencil.cellExists(1, 0, 0);
65 const bool opoOk = stencil.cellExists(0, 1, 0);
66 const bool oopOk = stencil.cellExists(0, 0, 1);
67 const std::array<Real, fsgrids::bfield::N_BFIELD>& cep_i2j1k1 = pooOk ? perb[poo] : cep_i1j1k1;
68 const std::array<Real, fsgrids::bfield::N_BFIELD>& cep_i1j2k1 = opoOk ? perb[opo] : cep_i1j1k1;
69 const std::array<Real, fsgrids::bfield::N_BFIELD>& cep_i1j1k2 = oopOk ? perb[oop] : cep_i1j1k1;
70
71#ifndef FS_1ST_ORDER_SPACE
72 // Create a dummy array for containing zero values for derivatives on non-existing cells:
73 std::array<Real, fsgrids::dperb::N_DPERB> dummyDerivatives;
74 dummyDerivatives.fill(0.0);
75
76 // Fetch neighbour cell derivatives, or in case the neighbour does not
77 // exist, use dummyDerivatives array:
78 const std::array<Real, fsgrids::dperb::N_DPERB>& der_i2j1k1 = pooOk ? dperb[poo] : dummyDerivatives;
79 const std::array<Real, fsgrids::dperb::N_DPERB>& der_i1j2k1 = opoOk ? dperb[opo] : dummyDerivatives;
80 const std::array<Real, fsgrids::dperb::N_DPERB>& der_i1j1k2 = oopOk ? dperb[oop] : dummyDerivatives;
81
82 // Calculate 3rd order reconstruction coefficients:
83 if (reconstructionOrder == 2) {
84 perturbedResult[Rec::a_yy] = 0.0;
85 perturbedResult[Rec::a_zz] = 0.0;
86 perturbedResult[Rec::a_yz] = 0.0;
87 perturbedResult[Rec::a_xxx] = 0.0;
88 perturbedResult[Rec::a_xxy] = 0.0;
89 perturbedResult[Rec::a_xxz] = 0.0;
90 perturbedResult[Rec::a_xyy] = 0.0;
91 perturbedResult[Rec::a_xyz] = 0.0;
92 perturbedResult[Rec::a_xzz] = 0.0;
93 perturbedResult[Rec::b_xx] = 0.0;
94 perturbedResult[Rec::b_xz] = 0.0;
95 perturbedResult[Rec::b_zz] = 0.0;
96 perturbedResult[Rec::b_xxy] = 0.0;
97 perturbedResult[Rec::b_xyy] = 0.0;
98 perturbedResult[Rec::b_xyz] = 0.0;
99 perturbedResult[Rec::b_yyy] = 0.0;
100 perturbedResult[Rec::b_yyz] = 0.0;
101 perturbedResult[Rec::b_yzz] = 0.0;
102 perturbedResult[Rec::c_xx] = 0.0;
103 perturbedResult[Rec::c_xy] = 0.0;
104 perturbedResult[Rec::c_yy] = 0.0;
105 perturbedResult[Rec::c_xxz] = 0.0;
106 perturbedResult[Rec::c_xyz] = 0.0;
107 perturbedResult[Rec::c_xzz] = 0.0;
108 perturbedResult[Rec::c_yyz] = 0.0;
109 perturbedResult[Rec::c_yzz] = 0.0;
110 perturbedResult[Rec::c_zzz] = 0.0;
111 } else if (reconstructionOrder == 3) {
112 perturbedResult[Rec::a_yy] = HALF*(der_i2j1k1[fsgrids::dperb::dPERBxdyy] + der_i1j1k1[fsgrids::dperb::dPERBxdyy]);
113 perturbedResult[Rec::a_zz] = HALF*(der_i2j1k1[fsgrids::dperb::dPERBxdzz] + der_i1j1k1[fsgrids::dperb::dPERBxdzz]);
114 perturbedResult[Rec::a_yz] = HALF*(der_i2j1k1[fsgrids::dperb::dPERBxdyz] + der_i1j1k1[fsgrids::dperb::dPERBxdyz]);
115 perturbedResult[Rec::a_xyy] = (der_i2j1k1[fsgrids::dperb::dPERBxdyy] - der_i1j1k1[fsgrids::dperb::dPERBxdyy]);
116 perturbedResult[Rec::a_xyz] = (der_i2j1k1[fsgrids::dperb::dPERBxdyz] - der_i1j1k1[fsgrids::dperb::dPERBxdyz]);
117 perturbedResult[Rec::a_xzz] = (der_i2j1k1[fsgrids::dperb::dPERBxdzz] - der_i1j1k1[fsgrids::dperb::dPERBxdzz]);
118
119 perturbedResult[Rec::b_xx] = HALF*(der_i1j2k1[fsgrids::dperb::dPERBydxx] + der_i1j1k1[fsgrids::dperb::dPERBydxx]);
120 perturbedResult[Rec::b_xz] = HALF*(der_i1j2k1[fsgrids::dperb::dPERBydxz] + der_i1j1k1[fsgrids::dperb::dPERBydxz]);
121 perturbedResult[Rec::b_zz] = HALF*(der_i1j2k1[fsgrids::dperb::dPERBydzz] + der_i1j1k1[fsgrids::dperb::dPERBydzz]);
122 perturbedResult[Rec::b_xxy] = (der_i1j2k1[fsgrids::dperb::dPERBydxx] - der_i1j1k1[fsgrids::dperb::dPERBydxx]);
123 perturbedResult[Rec::b_xyz] = (der_i1j2k1[fsgrids::dperb::dPERBydxz] - der_i1j1k1[fsgrids::dperb::dPERBydxz]);
124 perturbedResult[Rec::b_yzz] = (der_i1j2k1[fsgrids::dperb::dPERBydzz] - der_i1j1k1[fsgrids::dperb::dPERBydzz]);
125
126 perturbedResult[Rec::c_xx] = HALF*(der_i1j1k2[fsgrids::dperb::dPERBzdxx] + der_i1j1k1[fsgrids::dperb::dPERBzdxx]);
127 perturbedResult[Rec::c_xy] = HALF*(der_i1j1k2[fsgrids::dperb::dPERBzdxy] + der_i1j1k1[fsgrids::dperb::dPERBzdxy]);
128 perturbedResult[Rec::c_yy] = HALF*(der_i1j1k2[fsgrids::dperb::dPERBzdyy] + der_i1j1k1[fsgrids::dperb::dPERBzdyy]);
129 perturbedResult[Rec::c_xxz] = (der_i1j1k2[fsgrids::dperb::dPERBzdxx] - der_i1j1k1[fsgrids::dperb::dPERBzdxx]);
130 perturbedResult[Rec::c_xyz] = (der_i1j1k2[fsgrids::dperb::dPERBzdxy] - der_i1j1k1[fsgrids::dperb::dPERBzdxy]);
131 perturbedResult[Rec::c_yyz] = (der_i1j1k2[fsgrids::dperb::dPERBzdyy] - der_i1j1k1[fsgrids::dperb::dPERBzdyy]);
132
133 perturbedResult[Rec::a_xxx] = -THIRD*(perturbedResult[Rec::b_xxy] + perturbedResult[Rec::c_xxz]);
134 perturbedResult[Rec::a_xxy] = -FOURTH*perturbedResult[Rec::c_xyz];
135 perturbedResult[Rec::a_xxz] = -FOURTH*perturbedResult[Rec::b_xyz];
136
137 perturbedResult[Rec::b_xyy] = -FOURTH*perturbedResult[Rec::c_xyz];
138 perturbedResult[Rec::b_yyy] = -THIRD*(perturbedResult[Rec::c_yyz] + perturbedResult[Rec::a_xyy]);
139 perturbedResult[Rec::b_yyz] = -FOURTH*perturbedResult[Rec::a_xyz];
140
141 perturbedResult[Rec::c_xzz] = -FOURTH*perturbedResult[Rec::b_xyz];
142 perturbedResult[Rec::c_yzz] = -FOURTH*perturbedResult[Rec::a_xyz];
143 perturbedResult[Rec::c_zzz] = -THIRD*(perturbedResult[Rec::a_xzz] + perturbedResult[Rec::b_yzz]);
144 } else {
145 cerr << __FILE__ << ":" << __LINE__ << ":" << " Not coded yet!" << endl;
146 abort();
147 }
148
149 // Calculate 2nd order reconstruction coefficients:
150 perturbedResult[Rec::a_xy] = der_i2j1k1[fsgrids::dperb::dPERBxdy] - der_i1j1k1[fsgrids::dperb::dPERBxdy];
151 perturbedResult[Rec::a_xz] = der_i2j1k1[fsgrids::dperb::dPERBxdz] - der_i1j1k1[fsgrids::dperb::dPERBxdz];
152 perturbedResult[Rec::a_y] = HALF*(der_i2j1k1[fsgrids::dperb::dPERBxdy] + der_i1j1k1[fsgrids::dperb::dPERBxdy]) - SIXTH*perturbedResult[Rec::a_xxy];
153 perturbedResult[Rec::a_z] = HALF*(der_i2j1k1[fsgrids::dperb::dPERBxdz] + der_i1j1k1[fsgrids::dperb::dPERBxdz]) - SIXTH*perturbedResult[Rec::a_xxz];
154
155 perturbedResult[Rec::b_xy] = der_i1j2k1[fsgrids::dperb::dPERBydx] - der_i1j1k1[fsgrids::dperb::dPERBydx];
156 perturbedResult[Rec::b_yz] = der_i1j2k1[fsgrids::dperb::dPERBydz] - der_i1j1k1[fsgrids::dperb::dPERBydz];
157 perturbedResult[Rec::b_x] = HALF*(der_i1j2k1[fsgrids::dperb::dPERBydx] + der_i1j1k1[fsgrids::dperb::dPERBydx]) - SIXTH*perturbedResult[Rec::b_xyy];
158 perturbedResult[Rec::b_z] = HALF*(der_i1j2k1[fsgrids::dperb::dPERBydz] + der_i1j1k1[fsgrids::dperb::dPERBydz]) - SIXTH*perturbedResult[Rec::b_yyz];
159
160 perturbedResult[Rec::c_xz] = der_i1j1k2[fsgrids::dperb::dPERBzdx] - der_i1j1k1[fsgrids::dperb::dPERBzdx];
161 perturbedResult[Rec::c_yz] = der_i1j1k2[fsgrids::dperb::dPERBzdy] - der_i1j1k1[fsgrids::dperb::dPERBzdy];
162 perturbedResult[Rec::c_x] = HALF*(der_i1j1k2[fsgrids::dperb::dPERBzdx] + der_i1j1k1[fsgrids::dperb::dPERBzdx]) - SIXTH*perturbedResult[Rec::c_xzz];
163 perturbedResult[Rec::c_y] = HALF*(der_i1j1k2[fsgrids::dperb::dPERBzdy] + der_i1j1k1[fsgrids::dperb::dPERBzdy]) - SIXTH*perturbedResult[Rec::c_yzz];
164
165 perturbedResult[Rec::a_xx] = -HALF*(perturbedResult[Rec::b_xy] + perturbedResult[Rec::c_xz]);
166 perturbedResult[Rec::b_yy] = -HALF*(perturbedResult[Rec::a_xy] + perturbedResult[Rec::c_yz]);
167 perturbedResult[Rec::c_zz] = -HALF*(perturbedResult[Rec::a_xz] + perturbedResult[Rec::b_yz]);
168
169 perturbedResult[Rec::a_x] = cep_i2j1k1[fsgrids::bfield::PERBX] - cep_i1j1k1[fsgrids::bfield::PERBX] - TENTH*perturbedResult[Rec::a_xxx];
170 perturbedResult[Rec::b_y] = cep_i1j2k1[fsgrids::bfield::PERBY] - cep_i1j1k1[fsgrids::bfield::PERBY] - TENTH*perturbedResult[Rec::b_yyy];
171 perturbedResult[Rec::c_z] = cep_i1j1k2[fsgrids::bfield::PERBZ] - cep_i1j1k1[fsgrids::bfield::PERBZ] - TENTH*perturbedResult[Rec::c_zzz];
172
173#else
174 perturbedResult.fill(0.0);
175#endif
176
177 // Calculate 1st order reconstruction coefficients:
178 perturbedResult[Rec::a_0] = HALF*(cep_i2j1k1[fsgrids::bfield::PERBX] + cep_i1j1k1[fsgrids::bfield::PERBX]) - SIXTH*perturbedResult[Rec::a_xx];
179 perturbedResult[Rec::b_0] = HALF*(cep_i1j2k1[fsgrids::bfield::PERBY] + cep_i1j1k1[fsgrids::bfield::PERBY]) - SIXTH*perturbedResult[Rec::b_yy];
180 perturbedResult[Rec::c_0] = HALF*(cep_i1j1k2[fsgrids::bfield::PERBZ] + cep_i1j1k1[fsgrids::bfield::PERBZ]) - SIXTH*perturbedResult[Rec::c_zz];
181
182 return perturbedResult;
183}
184
200std::array<Real, 3> interpolatePerturbedB(
204 std::map<std::array<int, 3>, std::array<Real, Rec::N_REC_COEFFICIENTS>>& reconstructionCoefficientsCache, cint i,
205 cint j, cint k, const std::array<Real, 3> x) {
206 const auto stencil = fsgrid.makeStencil(i, j, k);
207
208 cuint cellSysBoundaryFlag = technical[stencil.ooo()].sysBoundaryFlag;
209 if (cellSysBoundaryFlag != sysboundarytype::NOT_SYSBOUNDARY) {
210 return {0, 0, 0};
211 }
212
213 // Balsara reconstruction formulas: x,y,z are in [-1/2, 1/2] local coordinates
214 std::array<Real, 3> xLocal = fsgrid.physicalToCellFractional(x[0], x[1], x[2]);
215 xLocal[0] -= 0.5;
216 xLocal[1] -= 0.5;
217 xLocal[2] -= 0.5;
218
219 if (fabs(xLocal[0]) > 0.5 || fabs(xLocal[1]) > 0.5 || fabs(xLocal[2]) > 0.5) {
220 cerr << __FILE__ << ":" << __LINE__ << ": Coordinate (" << xLocal[0] << "," << xLocal[1] << "," << xLocal[2] << ") outside of this cell!" << endl;
221 abort();
222 }
223
224 const std::array<Real, Rec::N_REC_COEFFICIENTS> rc = [&stencil, &reconstructionCoefficientsCache, &perb, &dperb]() {
225 const std::array<int, 3> cellIds = {stencil.i, stencil.j, stencil.k};
227 #pragma omp critical
228 {
229 // Reconstruction order of the fields after Balsara 2009, 2 used for general B, but 3 used here to
230 // allow for cache reuse, see interpolatePerturbedJ below
231 if (reconstructionCoefficientsCache.find(cellIds) == reconstructionCoefficientsCache.end()) {
232 const auto rc = reconstructionCoefficients(perb, dperb, stencil, 3);
233 reconstructionCoefficientsCache.insert({cellIds, rc});
234 }
235 }
236
237 return reconstructionCoefficientsCache.at(cellIds);
238 } else {
239 return reconstructionCoefficients(perb, dperb, stencil, 3);
240 }
241 }();
242
243 return {
244 // Eq. (7) Balsara 2009
245 rc[Rec::a_0] + rc[Rec::a_x]*xLocal[0] + rc[Rec::a_y]*xLocal[1] + rc[Rec::a_z]*xLocal[2] +
246 rc[Rec::a_xx] * (xLocal[0]*xLocal[0] - TWELWTH) + rc[Rec::a_xy]*xLocal[0]*xLocal[1] + rc[Rec::a_xz]*xLocal[0]*xLocal[2],
247 // Eq. (8) Balsara 2009
248 rc[Rec::b_0] + rc[Rec::b_x]*xLocal[0] + rc[Rec::b_y]*xLocal[1] + rc[Rec::b_z]*xLocal[2] +
249 rc[Rec::b_yy] * (xLocal[1]*xLocal[1] - TWELWTH) + rc[Rec::b_xy]*xLocal[0]*xLocal[1] + rc[Rec::b_yz]*xLocal[1]*xLocal[2],
250 // Eq. (9) Balsara 2009
251 rc[Rec::c_0] + rc[Rec::c_x]*xLocal[0] + rc[Rec::c_y]*xLocal[1] + rc[Rec::c_z]*xLocal[2] +
252 rc[Rec::c_zz] * (xLocal[2]*xLocal[2] - TWELWTH) + rc[Rec::c_xz]*xLocal[0]*xLocal[2] + rc[Rec::c_yz]*xLocal[1]*xLocal[2],
253 };
254}
255
273std::array<Real, 3> interpolateCurlB(
277 std::map<std::array<int, 3>, std::array<Real, Rec::N_REC_COEFFICIENTS>>& reconstructionCoefficientsCache, cint i,
278 cint j, cint k, const std::array<Real, 3> x) {
279 const auto stencil = fsgrid.makeStencil(i, j, k);
280
281 cuint cellSysBoundaryFlag = technical[stencil.ooo()].sysBoundaryFlag;
282 if (cellSysBoundaryFlag != sysboundarytype::NOT_SYSBOUNDARY) {
283 return {0, 0, 0};
284 }
285
286 // Balsara reconstruction formulas: x,y,z are in [-1/2, 1/2] local coordinates
287 std::array<Real, 3> xLocal = fsgrid.physicalToCellFractional(x[0], x[1], x[2]);
288 xLocal[0] -= 0.5;
289 xLocal[1] -= 0.5;
290 xLocal[2] -= 0.5;
291
292 if (fabs(xLocal[0]) > 0.5 || fabs(xLocal[1]) > 0.5 || fabs(xLocal[2]) > 0.5) {
293 cerr << __FILE__ << ":" << __LINE__ << ": Coordinate (" << xLocal[0] << "," << xLocal[1] << "," << xLocal[2] << ") outside of this cell!" << endl;
294 abort();
295 }
296
297 const std::array<Real, Rec::N_REC_COEFFICIENTS> rc = [&stencil, &reconstructionCoefficientsCache, &perb, &dperb]() {
298 std::array<int, 3> cellIds = {stencil.i, stencil.j, stencil.k};
299 // Actual use of the coefficient cache has proven not to be thread safe. But it appears to be reasonably fast even
300 // without it.
302 #pragma omp critical
303 {
304 // Reconstruction order of the fields after Balsara 2009, 3 used to obtain 2nd
305 // order curl(B) and allows for cache reuse, see interpolatePerturbedB above
306 if (reconstructionCoefficientsCache.find(cellIds) == reconstructionCoefficientsCache.end()) {
307 const auto rc = reconstructionCoefficients(perb, dperb, stencil, 3);
308 reconstructionCoefficientsCache.insert({cellIds, rc});
309 }
310 }
311 return reconstructionCoefficientsCache.at(cellIds);
312 } else {
313 return reconstructionCoefficients(perb, dperb, stencil, 3);
314 }
315 }();
316
317 return {
318 (
319 12*rc[Rec::c_yzz]*xLocal[2]*xLocal[2]
320 +24*rc[Rec::c_yyz]*xLocal[1]*xLocal[2]
321 -24*rc[Rec::b_yzz]*xLocal[1]*xLocal[2]
322 +12*rc[Rec::c_xyz]*xLocal[0]*xLocal[2]
323 +12*rc[Rec::c_yz]*xLocal[2]
324 -24*rc[Rec::b_zz]*xLocal[2]
325 -12*rc[Rec::b_yyz]*xLocal[1]*xLocal[1]
326 -12*rc[Rec::b_xyz]*xLocal[0]*xLocal[1]
327 +24*rc[Rec::c_yy]*xLocal[1]
328 -12*rc[Rec::b_yz]*xLocal[1]
329 +12*rc[Rec::c_xy]*xLocal[0]
330 -12*rc[Rec::b_xz]*xLocal[0]
331 -rc[Rec::c_yzz]
332 +12*rc[Rec::c_y]
333 -12*rc[Rec::b_z]
334 +rc[Rec::b_yyz]
335 )/12,
336 // See that minus if you ever copy again from wxMaxima!
337 -(
338 12*rc[Rec::c_xzz]*xLocal[2]*xLocal[2]
339 +12*rc[Rec::c_xyz]*xLocal[1]*xLocal[2]
340 +24*rc[Rec::c_xxz]*xLocal[0]*xLocal[2]
341 -24*rc[Rec::a_xzz]*xLocal[0]*xLocal[2]
342 +12*rc[Rec::c_xz]*xLocal[2]
343 -24*rc[Rec::a_zz]*xLocal[2]
344 -12*rc[Rec::a_xyz]*xLocal[0]*xLocal[1]
345 +12*rc[Rec::c_xy]*xLocal[1]
346 -12*rc[Rec::a_yz]*xLocal[1]
347 -12*rc[Rec::a_xxz]*xLocal[0]*xLocal[0]
348 +24*rc[Rec::c_xx]*xLocal[0]
349 -12*rc[Rec::a_xz]*xLocal[0]
350 -rc[Rec::c_xzz]
351 +12*rc[Rec::c_x]
352 -12*rc[Rec::a_z]
353 +rc[Rec::a_xxz]
354 )/12,
355 (
356 12*rc[Rec::b_xyz]*xLocal[1]*xLocal[2]
357 -12*rc[Rec::a_xyz]*xLocal[0]*xLocal[2]
358 +12*rc[Rec::b_xz]*xLocal[2]
359 -12*rc[Rec::a_yz]*xLocal[2]
360 +12*rc[Rec::b_xyy]*xLocal[1]*xLocal[1]
361 +24*rc[Rec::b_xxy]*xLocal[0]*xLocal[1]
362 -24*rc[Rec::a_xyy]*xLocal[0]*xLocal[1]
363 +12*rc[Rec::b_xy]*xLocal[1]
364 -24*rc[Rec::a_yy]*xLocal[1]
365 -12*rc[Rec::a_xxy]*xLocal[0]*xLocal[0]
366 +24*rc[Rec::b_xx]*xLocal[0]
367 -12*rc[Rec::a_xy]*xLocal[0]
368 -rc[Rec::b_xyy]
369 +12*rc[Rec::b_x]
370 -12*rc[Rec::a_y]
371 +rc[Rec::a_xxy]
372 )/12,
373 };
374}
for i
Definition Dispersion.m:24
const uint32_t cuint
Definition definitions.h:50
float Real
Definition definitions.h:41
const int cint
Definition definitions.h:45
fsgrid::FsGrid< FS_STENCIL_WIDTH > FieldSolverGrid
Definition definitions.h:78
const float creal
Definition definitions.h:42
Real divideIfNonZero(creal numerator, creal denominator)
Helper function.
Definition fs_common.cpp:33
std::array< Real, 3 > interpolateCurlB(fsgrids::perbspan perb, fsgrids::constdperbspan dperb, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, std::map< std::array< int, 3 >, std::array< Real, Rec::N_REC_COEFFICIENTS > > &reconstructionCoefficientsCache, cint i, cint j, cint k, const std::array< Real, 3 > x)
std::array< Real, Rec::N_REC_COEFFICIENTS > reconstructionCoefficients(fsgrids::perbspan perb, fsgrids::constdperbspan dperb, const fsgrid::FsStencil &stencil, Real reconstructionOrder)
Low-level helper function.
Definition fs_common.cpp:53
std::array< Real, 3 > interpolatePerturbedB(fsgrids::perbspan perb, fsgrids::constdperbspan dperb, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, std::map< std::array< int, 3 >, std::array< Real, Rec::N_REC_COEFFICIENTS > > &reconstructionCoefficientsCache, cint i, cint j, cint k, const std::array< Real, 3 > x)
const Real THIRD
Definition fs_common.h:52
const Real TWELWTH
Definition fs_common.h:57
const Real HALF
Definition fs_common.h:49
const Real TENTH
Definition fs_common.h:56
const Real SIXTH
Definition fs_common.h:54
const Real FOURTH
Definition fs_common.h:53
const int j
const int k
FieldTracingParameters fieldTracingParameters
@ b_xx
Definition fs_common.h:89
@ c_xxz
Definition fs_common.h:90
@ b_yyy
Definition fs_common.h:89
@ b_xxy
Definition fs_common.h:89
@ b_xyy
Definition fs_common.h:89
@ b_yz
Definition fs_common.h:89
@ a_x
Definition fs_common.h:88
@ a_z
Definition fs_common.h:88
@ a_xx
Definition fs_common.h:88
@ a_xy
Definition fs_common.h:88
@ a_y
Definition fs_common.h:88
@ c_xyz
Definition fs_common.h:90
@ b_yzz
Definition fs_common.h:89
@ c_yz
Definition fs_common.h:90
@ c_xzz
Definition fs_common.h:90
@ a_xxy
Definition fs_common.h:88
@ b_xyz
Definition fs_common.h:89
@ a_0
Definition fs_common.h:88
@ a_xxz
Definition fs_common.h:88
@ b_x
Definition fs_common.h:89
@ a_xxx
Definition fs_common.h:88
@ c_yy
Definition fs_common.h:90
@ b_yyz
Definition fs_common.h:89
@ a_yz
Definition fs_common.h:88
@ b_yy
Definition fs_common.h:89
@ b_y
Definition fs_common.h:89
@ c_xy
Definition fs_common.h:90
@ c_zz
Definition fs_common.h:90
@ c_y
Definition fs_common.h:90
@ b_0
Definition fs_common.h:89
@ c_yzz
Definition fs_common.h:90
@ c_xz
Definition fs_common.h:90
@ c_yyz
Definition fs_common.h:90
@ a_xyz
Definition fs_common.h:88
@ a_yy
Definition fs_common.h:88
@ a_xz
Definition fs_common.h:88
@ c_x
Definition fs_common.h:90
@ a_xyy
Definition fs_common.h:88
@ c_z
Definition fs_common.h:90
@ b_xy
Definition fs_common.h:89
@ b_z
Definition fs_common.h:89
@ a_xzz
Definition fs_common.h:88
@ b_xz
Definition fs_common.h:89
@ a_zz
Definition fs_common.h:88
@ c_xx
Definition fs_common.h:90
@ b_zz
Definition fs_common.h:89
@ c_zzz
Definition fs_common.h:90
@ c_0
Definition fs_common.h:90
std::span< std::array< Real, fsgrids::bfield::N_BFIELD > > perbspan
Definition common.h:434
std::span< technical > technicalspan
Definition common.h:452
@ PERBY
Definition common.h:276
@ PERBZ
Definition common.h:277
@ PERBX
Definition common.h:275
@ dPERBzdxy
Definition common.h:338
@ dPERBzdy
Definition common.h:329
@ dPERBzdyy
Definition common.h:337
@ dPERBzdxx
Definition common.h:336
@ dPERBydxx
Definition common.h:333
@ dPERBydx
Definition common.h:326
@ dPERBydxz
Definition common.h:335
@ dPERBzdx
Definition common.h:328
@ dPERBxdzz
Definition common.h:331
@ dPERBxdyz
Definition common.h:332
@ dPERBydzz
Definition common.h:334
@ dPERBxdy
Definition common.h:324
@ dPERBxdyy
Definition common.h:330
@ dPERBxdz
Definition common.h:325
@ dPERBydz
Definition common.h:327
std::span< const std::array< Real, fsgrids::dperb::N_DPERB > > constdperbspan
Definition common.h:443