Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
fs_common.h File Reference
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stdint.h>
#include <fsgrid.hpp>
#include <phiprof.hpp>
#include "../definitions.h"
#include "../common.h"
#include "../parameters.h"
#include "../projects/project.h"
#include "../sysboundary/sysboundary.h"
#include "../sysboundary/sysboundarycondition.h"
Include dependency graph for fs_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Rec

Enumerations

enum  Rec::Rec {
  Rec::a_0 , Rec::a_x , Rec::a_y , Rec::a_z ,
  Rec::a_xx , Rec::a_yy , Rec::a_zz , Rec::a_xy ,
  Rec::a_xz , Rec::a_yz , Rec::a_xxx , Rec::a_xxy ,
  Rec::a_xyy , Rec::a_xxz , Rec::a_xzz , Rec::a_xyz ,
  Rec::b_0 , Rec::b_x , Rec::b_y , Rec::b_z ,
  Rec::b_xx , Rec::b_yy , Rec::b_zz , Rec::b_xy ,
  Rec::b_xz , Rec::b_yz , Rec::b_xxy , Rec::b_xyy ,
  Rec::b_yyy , Rec::b_yyz , Rec::b_yzz , Rec::b_xyz ,
  Rec::c_0 , Rec::c_x , Rec::c_y , Rec::c_z ,
  Rec::c_xx , Rec::c_yy , Rec::c_zz , Rec::c_xy ,
  Rec::c_xz , Rec::c_yz , Rec::c_xxz , Rec::c_xzz ,
  Rec::c_yyz , Rec::c_yzz , Rec::c_xyz , Rec::c_zzz ,
  Rec::N_REC_COEFFICIENTS
}

Functions

bool propagateFields (fsgrids::perbspan perb, fsgrids::perbspan perbdt2, fsgrids::efieldspan e, fsgrids::efieldspan edt2, fsgrids::ehallspan ehall, fsgrids::egradpespan egradpe, fsgrids::egradpespan egradpedt2, fsgrids::momentsspan moments, fsgrids::momentsspan momentsdt2, fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, fsgrids::dmomentsspan dmomentsdt2, fsgrids::bgbspan bgb, fsgrids::volspan vol, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, SysBoundary &sysBoundaries, creal &dt, cuint subcycles)
 Top-level field propagation function.
Real divideIfNonZero (creal rhoV, creal rho)
 Helper function.
std::array< Real, Rec::N_REC_COEFFICIENTSreconstructionCoefficients (fsgrids::perbspan perb, fsgrids::constdperbspan dperb, const fsgrid::FsStencil &stencil, Real reconstructionOrder)
 Low-level helper function.
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)
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)

Variables

const Real HALF = 0.5
const Real MINUS = -1.0
const Real PLUS = +1.0
const Real THIRD = 1.0/3.0
const Real FOURTH = 1.0/4.0
const Real SIXTH = 1.0/6.0
const Real EIGTH = 1.0/8.0
const Real TENTH = 1.0/10.0
const Real TWELWTH = 1.0/12.0
const Real TWO = 2.0
const Real ZERO = 0.0
static creal EPS = 1.0e-30

Function Documentation

◆ divideIfNonZero()

Real divideIfNonZero ( creal numerator,
creal denominator )

Helper function.

Divides the first value by the second or returns zero if the denominator is zero.

Parameters
numeratorNumerator
denominatorDenominator

Definition at line 33 of file fs_common.cpp.

Here is the caller graph for this function:

◆ interpolateCurlB()

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 )

Interpolate curl(perturbed B) to arbitrary x,y,z in cell Uses the reconstruction coefficients and equations from Divergence-free reconstruction of magnetic fields and WENO schemes for magnetohydrodynamics D.S. Balsara, J. Comp. Phys., 228, 2009 doi:10.1016/j.jcp.2009.03.038 and the wxMaxima file at doc/fieldsolver/Balsara_curlB_at_arbitrary_xyz.wxmx

Parameters
perbperturbed B fsGrid
dperbperturbed B derivatives fsGrid
technicaltechnical fsGrid
fsgridfsgfrid container
ilocal fsGrid x-index
jlocal fsGrid y-index
klocal fsGrid z-index
x3D global simulation x,y,z coordinates of point to interpolate to

Definition at line 273 of file fs_common.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ interpolatePerturbedB()

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 )

Interpolate perturbed B to arbitrary x,y,z in cell Uses the reconstruction coefficients and equations from Divergence-free reconstruction of magnetic fields and WENO schemes for magnetohydrodynamics D.S. Balsara, J. Comp. Phys., 228, 2009 doi:10.1016/j.jcp.2009.03.038

Parameters
perbperturbed B fsGrid
dperbperturbed B derivatives fsGrid
technicaltechnical fsGrid
reconstructionCoefficientsCachemap for cached values
ilocal fsGrid x-index
jlocal fsGrid y-index
klocal fsGrid z-index
x3D global simulation x,y,z coordinates of point to interpolate to

Definition at line 200 of file fs_common.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ propagateFields()

Top-level field propagation function.

Propagates the magnetic field, computes the derivatives and the upwinded electric field, then computes the volume-averaged field values. Takes care of the Runge-Kutta iteration at the top level, the functions called get as an argument the element from the enum defining the current stage and handle their job correspondingly.

Parameters
perbfsgrid holding perturbed magnetic field
perbdt2fsgrid holding perturbed magnetic field at Runge-Kutta half-step
efsgrid holding electric field
edt2fsgrid holding electric field
ehallfsgrid holding Hall term electric field
egradpefsgrid holding gradient of electron pressure electric field
egradpedt2fsgrid holding gradient of electron pressure electric field at Runge-Kutta half-step
momentsfsgrid holding moments
momentsdt2fsgrid holding moments at Runge-Kutta half-step
dperbfsgrid holding perturbed magnetic field derivatives
dmomentsfsgrid holding moments derivatives
dmomentsdt2fsgrid holding moments derivatives at Runge-Kutta half-step
bgbfsgrid holding background magnetic field
volfsgrid holding volume magnetic field
technicalfsgrid holding technical parameters
fsgridfsgrids container
sysBoundariesContainer of existing system boundaries
dtLength of the time step
subcyclesNumber of subcycles to compute.
See also
propagateMagneticFieldSimple calculateDerivativesSimple calculateUpwindedElectricFieldSimple calculateVolumeAveragedFields calculateBVOLDerivativesSimple

Definition at line 91 of file ldz_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reconstructionCoefficients()

std::array< Real, Rec::N_REC_COEFFICIENTS > reconstructionCoefficients ( fsgrids::perbspan perb,
fsgrids::constdperbspan dperb,
const fsgrid::FsStencil & stencil,
Real reconstructionOrder )

Low-level helper function.

Computes the reconstruction coefficients used for field component reconstruction. Only implemented for 2nd and 3rd order.

Parameters
perbfsGrid holding the perturbed B quantities
dperbfsGrid holding the derivatives of perturbed B
stencilfsgrid stencil for the current cell
reconstructionOrderReconstruction order of the fields after Balsara 2009, 2 used for BVOL, 3 used for 2nd-order Hall term calculations.

Definition at line 53 of file fs_common.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ EIGTH

const Real EIGTH = 1.0/8.0

Definition at line 55 of file fs_common.h.

◆ EPS

creal EPS = 1.0e-30
static

Definition at line 61 of file fs_common.h.

◆ FOURTH

const Real FOURTH = 1.0/4.0

Definition at line 53 of file fs_common.h.

◆ HALF

const Real HALF = 0.5

Definition at line 49 of file fs_common.h.

◆ MINUS

const Real MINUS = -1.0

Definition at line 50 of file fs_common.h.

◆ PLUS

const Real PLUS = +1.0

Definition at line 51 of file fs_common.h.

◆ SIXTH

const Real SIXTH = 1.0/6.0

Definition at line 54 of file fs_common.h.

◆ TENTH

const Real TENTH = 1.0/10.0

Definition at line 56 of file fs_common.h.

◆ THIRD

const Real THIRD = 1.0/3.0

Definition at line 52 of file fs_common.h.

◆ TWELWTH

const Real TWELWTH = 1.0/12.0

Definition at line 57 of file fs_common.h.

◆ TWO

const Real TWO = 2.0

Definition at line 58 of file fs_common.h.

◆ ZERO

const Real ZERO = 0.0

Definition at line 59 of file fs_common.h.