Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
ldz_electric_field.cpp File Reference
#include <algorithm>
#include <cstdlib>
#include "fs_common.h"
#include "ldz_electric_field.hpp"
Include dependency graph for ldz_electric_field.cpp:

Go to the source code of this file.

Classes

struct  Wavespeeds
struct  Limits
struct  Reconstructions
struct  UpwindField
struct  CardinalIndices
struct  DataArrays

Functions

Wavespeeds calculateWaveSpeedYZ (fsgrids::perbspan perB, fsgrids::constmomentsspan moments, fsgrids::constdperbspan dPerB, fsgrids::constdmomentsspan dMoments, fsgrids::constbgbspan BgB, const std::array< Real, 3 > &gridSpacing, const Limits &rhomLimits, size_t self, size_t nbr, Real By, Real Bz, Real dBydx, Real dBydz, Real dBzdx, Real dBzdy, Real ydir, Real zdir)
 Low-level helper function.
Wavespeeds calculateWaveSpeedXZ (fsgrids::perbspan perB, fsgrids::constmomentsspan moments, fsgrids::constdperbspan dPerB, fsgrids::constdmomentsspan dMoments, fsgrids::constbgbspan BgB, const std::array< Real, 3 > &gridSpacing, const Limits &rhomLimits, size_t self, size_t nbr, Real Bx, Real Bz, Real dBxdy, Real dBxdz, Real dBzdx, Real dBzdy, Real xdir, Real zdir)
 Low-level helper function.
Wavespeeds calculateWaveSpeedXY (fsgrids::perbspan perB, fsgrids::constmomentsspan moments, fsgrids::constdperbspan dPerB, fsgrids::constdmomentsspan dMoments, fsgrids::constbgbspan BgB, const std::array< Real, 3 > &gridSpacing, const Limits &rhomLimits, size_t self, size_t nbr, Real Bx, Real By, Real dBxdy, Real dBxdz, Real dBydx, Real dBydz, Real xdir, Real ydir)
 Low-level helper function.
void fsdebugCheck (const fsgrid::FsStencil &stencil, size_t len, const char *file, uint32_t line)
Limits getRhomLimits (const std::array< std::array< Real, fsgrids::moments::N_MOMENTS >, 4 > &moments)
Real resistiveTerm (const auto &bgb, const auto &perb, const auto &dperb, Real rhoq, std::array< size_t, 2 > indices, std::array< Real, 2 > spacing)
void calculateEdgeElectricFieldX (fsgrids::perbspan perb, fsgrids::constdperbspan dperb, fsgrids::efieldspan e, fsgrids::constehallspan ehall, fsgrids::constegradpespan egradpe, fsgrids::constmomentsspan moments, fsgrids::constdmomentsspan dmoments, fsgrids::constbgbspan bgb, fsgrids::technicalspan technical, const fsgrid::FsStencil &stencil, int32_t RKCase, const std::array< Real, 3 > &gridSpacing)
 Low-level electric field propagation function.
void calculateEdgeElectricFieldY (fsgrids::perbspan perb, fsgrids::constdperbspan dperb, fsgrids::efieldspan e, fsgrids::constehallspan ehall, fsgrids::constegradpespan egradpe, fsgrids::constmomentsspan moments, fsgrids::constdmomentsspan dmoments, fsgrids::constbgbspan bgb, fsgrids::technicalspan technical, const fsgrid::FsStencil &stencil, int32_t RKCase, const std::array< Real, 3 > &gridSpacing)
 Low-level electric field propagation function.
void calculateEdgeElectricFieldZ (fsgrids::perbspan perb, fsgrids::constdperbspan dperb, fsgrids::efieldspan e, fsgrids::constehallspan ehall, fsgrids::constegradpespan egradpe, fsgrids::constmomentsspan moments, fsgrids::constdmomentsspan dmoments, fsgrids::constbgbspan bgb, fsgrids::technicalspan technical, const fsgrid::FsStencil &stencil, int32_t RKCase, const std::array< Real, 3 > &gridSpacing)
 Low-level electric field propagation function.
void calculateElectricField (fsgrids::perbspan perb, fsgrids::constdperbspan dperb, fsgrids::efieldspan e, fsgrids::constehallspan ehall, fsgrids::constegradpespan egradpe, fsgrids::constmomentsspan moments, fsgrids::constdmomentsspan dmoments, fsgrids::constbgbspan bgb, fsgrids::technicalspan technical, const fsgrid::FsStencil &stencil, const std::array< Real, 3 > &gridSpacing, SysBoundary &sysBoundaries, int32_t RKCase)
 Electric field propagation function.
void calculateUpwindedElectricFieldSimple (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::technicalspan technical, FieldSolverGrid &fsgrid, SysBoundary &sysBoundaries, int32_t RKCase, const bool communicateEGradPeOrMomentsDerivatives)
 High-level electric field computation function.

Function Documentation

◆ calculateEdgeElectricFieldX()

void calculateEdgeElectricFieldX ( fsgrids::perbspan perb,
fsgrids::constdperbspan dperb,
fsgrids::efieldspan e,
fsgrids::constehallspan ehall,
fsgrids::constegradpespan egradpe,
fsgrids::constmomentsspan moments,
fsgrids::constdmomentsspan dmoments,
fsgrids::constbgbspan bgb,
fsgrids::technicalspan technical,
const fsgrid::FsStencil & stencil,
int32_t RKCase,
const std::array< Real, 3 > & gridSpacing )

Low-level electric field propagation function.

Computes the upwinded electric field X component along the cell's corresponding edge as the cross product of B and V in the YZ plane. Also includes the calculation of the maximally allowed time step.

Expects that the correct RHO and B fields are being passed, depending on the stage of the Runge-Kutta time stepping method.

Note that the background B field is excluded from the diffusive term calculations because they are equivalent to a current term and the background field is curl-free.

Parameters
perbfsGrid holding the perturbed B quantities
dperbfsGrid holding the derivatives of perturbed B
efsGrid holding the electric field
ehallfsGrid holding the Hall contributions to the electric field
egradpefsGrid holding the electron pressure gradient E field
momentsfsGrid holding the moment quantities
dmomentsfsGrid holding the derviatives of moments
bgbfsGrid holding the background B quantities
technicalfsGrid holding technical information (such as boundary types)
stencilcurrent cell's fsgrid stencil
RKCaseElement in the enum defining the Runge-Kutta method steps
gridSpacingfsgrid cell size in x,y,z

Definition at line 448 of file ldz_electric_field.cpp.

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

◆ calculateEdgeElectricFieldY()

void calculateEdgeElectricFieldY ( fsgrids::perbspan perb,
fsgrids::constdperbspan dperb,
fsgrids::efieldspan e,
fsgrids::constehallspan ehall,
fsgrids::constegradpespan egradpe,
fsgrids::constmomentsspan moments,
fsgrids::constdmomentsspan dmoments,
fsgrids::constbgbspan bgb,
fsgrids::technicalspan technical,
const fsgrid::FsStencil & stencil,
int32_t RKCase,
const std::array< Real, 3 > & gridSpacing )

Low-level electric field propagation function.

Computes the upwinded electric field Y component along the cell's corresponding edge as the cross product of B and V in the XZ plane. Also includes the calculation of the maximally allowed time step.

Expects that the correct RHO and B fields are being passed, depending on the stage of the Runge-Kutta time stepping method.

Note that the background B field is excluded from the diffusive term calculations because they are equivalent to a current term and the background field is curl-free.

Parameters
perbfsGrid holding the perturbed B quantities
dperbfsGrid holding the derivatives of perturbed B
efsGrid holding the electric field
ehallfsGrid holding the Hall contributions to the electric field
egradpefsGrid holding the electron pressure gradient E field
momentsfsGrid holding the moment quantities
dmomentsfsGrid holding the derviatives of moments
bgbfsGrid holding the background B quantities
technicalfsGrid holding technical information (such as boundary types)
stencilcurrent cell's fsgrid stencil
RKCaseElement in the enum defining the Runge-Kutta method steps
gridSpacingfsgrid cell size in x,y,z

Definition at line 671 of file ldz_electric_field.cpp.

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

◆ calculateEdgeElectricFieldZ()

void calculateEdgeElectricFieldZ ( fsgrids::perbspan perb,
fsgrids::constdperbspan dperb,
fsgrids::efieldspan e,
fsgrids::constehallspan ehall,
fsgrids::constegradpespan egradpe,
fsgrids::constmomentsspan moments,
fsgrids::constdmomentsspan dmoments,
fsgrids::constbgbspan bgb,
fsgrids::technicalspan technical,
const fsgrid::FsStencil & stencil,
int32_t RKCase,
const std::array< Real, 3 > & gridSpacing )

Low-level electric field propagation function.

Computes the upwinded electric field Z component along the cell's corresponding edge as the cross product of B and V in the XY plane. Also includes the calculation of the maximally allowed time step.

Expects that the correct RHO and B fields are being passed, depending on the stage of the Runge-Kutta time stepping method.

Note that the background B field is excluded from the diffusive term calculations because they are equivalent to a current term and the background field is curl-free.

Parameters
perbfsGrid holding the perturbed B quantities
dperbfsGrid holding the derivatives of perturbed B
efsGrid holding the electric field
ehallfsGrid holding the Hall contributions to the electric field
egradpefsGrid holding the electron pressure gradient E field
momentsfsGrid holding the moment quantities
dmomentsfsGrid holding the derviatives of moments
bgbfsGrid holding the background B quantities
technicalfsGrid holding technical information (such as boundary types)
stencilcurrent cell's fsgrid stencil
RKCaseElement in the enum defining the Runge-Kutta method steps
gridSpacingfsgrid cell size in x,y,z

Definition at line 891 of file ldz_electric_field.cpp.

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

◆ calculateElectricField()

void calculateElectricField ( fsgrids::perbspan perb,
fsgrids::constdperbspan dperb,
fsgrids::efieldspan e,
fsgrids::constehallspan ehall,
fsgrids::constegradpespan egradpe,
fsgrids::constmomentsspan moments,
fsgrids::constdmomentsspan dmoments,
fsgrids::constbgbspan bgb,
fsgrids::technicalspan technical,
const fsgrid::FsStencil & stencil,
const std::array< Real, 3 > & gridSpacing,
SysBoundary & sysBoundaries,
int32_t RKCase )

Electric field propagation function.

Calls the general or the system boundary electric field propagation functions.

Parameters
perbfsGrid holding the perturbed B quantities
dperbfsGrid holding the derivatives of perturbed B
efsGrid holding the electric field
ehallfsGrid holding the Hall contributions to the electric field
egradpefsGrid holding the electron pressure gradient E field
momentsfsGrid holding the moment quantities
dmomentsfsGrid holding the derviatives of moments
bgbfsGrid holding the background B quantities
technicalfsGrid holding technical information (such as boundary types)
stencilcurrent cell's fsgrid stencil
gridSpacingfsgrid cell size in x,y,z
sysBoundariesSystem boundary conditions existing
RKCaseElement in the enum defining the Runge-Kutta method steps
See also
calculateUpwindedElectricFieldSimple calculateEdgeElectricFieldX calculateEdgeElectricFieldY calculateEdgeElectricFieldZ

Definition at line 1112 of file ldz_electric_field.cpp.

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

◆ calculateUpwindedElectricFieldSimple()

void calculateUpwindedElectricFieldSimple ( 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::technicalspan technical,
FieldSolverGrid & fsgrid,
SysBoundary & sysBoundaries,
int32_t RKCase,
const bool communicateEGradPeOrMomentsDerivatives )

High-level electric field computation function.

Transfers the derivatives, calculates the edge electric fields and transfers the new electric fields.

Parameters
perbfsGrid holding the perturbed B quantities at runge-kutta t=0
perbdt2fsGrid holding the perturbed B quantities at runge-kutta t=0.5
efsGrid holding the Electric field quantities at runge-kutta t=0
edt2fsGrid holding the Electric field quantities at runge-kutta t=0.5
ehallfsGrid holding the Hall contributions to the electric field
egradpefsGrid holding the electron pressure gradient E field
egradpedt2fsGrid holding the electron pressure gradient E field
momentsfsGrid holding the moment quantities at runge-kutta t=0
momentsdt2fsGrid holding the moment quantities at runge-kutta t=0.5
dperbfsGrid holding the derivatives of perturbed B
dmomentsfsGrid holding the derivatives of moments
dmomentsdt2fsGrid holding the derivatives of moments at runge-kutta t=0.5
bgbfsGrid holding the background B quantities
technicalfsGrid holding technical information (such as boundary types)
fsgridfsgrids container
sysBoundariesSystem boundary conditions existing
RKCaseElement in the enum defining the Runge-Kutta method steps
communicateEGradPeOrMomentsDerivativesBoolean flag whether grad(Pe) electric field or moments need a ghost update
See also
calculateElectricField calculateEdgeElectricFieldX calculateEdgeElectricFieldY calculateEdgeElectricFieldZ

Definition at line 1177 of file ldz_electric_field.cpp.

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

◆ calculateWaveSpeedXY()

Wavespeeds calculateWaveSpeedXY ( fsgrids::perbspan perB,
fsgrids::constmomentsspan moments,
fsgrids::constdperbspan dPerB,
fsgrids::constdmomentsspan dMoments,
fsgrids::constbgbspan BgB,
const std::array< Real, 3 > & gridSpacing,
const Limits & rhomLimits,
size_t self,
size_t nbr,
Real Bx,
Real By,
Real dBxdy,
Real dBxdz,
Real dBydx,
Real dBydz,
Real xdir,
Real ydir )

Low-level helper function.

Computes the magnetosonic speed in the XY plane. Used in upwinding the electric field Z component, at the interface between cells self and nbr.

Expects that the correct RHO and B fields are being passed, depending on the stage of the Runge-Kutta time stepping method.

If fields are not propagated, returns 0.0 as there is no information propagating.

Parameters
perBfsGrid holding the perturbed B quantities
momentsfsGrid holding the moment quantities
dPerBfsGrid holding the derivatives of perturbed B
dMomentsfsGrid holding the derviatives of moments
BgBfsGrid holding the background B quantities
gridSpacinggrid cell size in x,y,z
rhomLimitsallowed min and max density when interpolating
selfCurrent cell index
nbrNeighbor cell index
BxCurrent cell's Bx
ByCurrent cell's By
dBxdydBxdy derivative
dBxdzdBxdz derivative
dBydxdBydx derivative
dBydzdBydz derivative
xdir+1 or -1 depending on the interpolation direction in x
ydir+1 or -1 depending on the interpolation direction in y

Definition at line 301 of file ldz_electric_field.cpp.

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

◆ calculateWaveSpeedXZ()

Wavespeeds calculateWaveSpeedXZ ( fsgrids::perbspan perB,
fsgrids::constmomentsspan moments,
fsgrids::constdperbspan dPerB,
fsgrids::constdmomentsspan dMoments,
fsgrids::constbgbspan BgB,
const std::array< Real, 3 > & gridSpacing,
const Limits & rhomLimits,
size_t self,
size_t nbr,
Real Bx,
Real Bz,
Real dBxdy,
Real dBxdz,
Real dBzdx,
Real dBzdy,
Real xdir,
Real zdir )

Low-level helper function.

Computes the magnetosonic speed in the XZ plane. Used in upwinding the electric field Y component, at the interface between cells self and nbr.

Expects that the correct RHO and B fields are being passed, depending on the stage of the Runge-Kutta time stepping method.

If fields are not propagated, returns 0.0 as there is no information propagating.

Parameters
perBfsGrid holding the perturbed B quantities
momentsfsGrid holding the moment quantities
dPerBfsGrid holding the derivatives of perturbed B
dMomentsfsGrid holding the derviatives of moments
BgBfsGrid holding the background B quantities
gridSpacinggrid cell size in x,y,z
rhomLimitsallowed min and max density when interpolating
selfCurrent cell index
nbrNeighbor cell index
BxCurrent cell's Bx
BzCurrent cell's Bz
dBxdydBxdy derivative
dBxdzdBxdz derivative
dBzdxdBzdx derivative
dBzdydBzdy derivative
xdir+1 or -1 depending on the interpolation direction in x
zdir+1 or -1 depending on the interpolation direction in z

Definition at line 247 of file ldz_electric_field.cpp.

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

◆ calculateWaveSpeedYZ()

Wavespeeds calculateWaveSpeedYZ ( fsgrids::perbspan perB,
fsgrids::constmomentsspan moments,
fsgrids::constdperbspan dPerB,
fsgrids::constdmomentsspan dMoments,
fsgrids::constbgbspan BgB,
const std::array< Real, 3 > & gridSpacing,
const Limits & rhomLimits,
size_t self,
size_t nbr,
Real By,
Real Bz,
Real dBydx,
Real dBydz,
Real dBzdx,
Real dBzdy,
Real ydir,
Real zdir )

Low-level helper function.

Computes the magnetosonic speed in the YZ plane. Used in upwinding the electric field X component, at the interface between cells self and nbr.

Expects that the correct RHO and B fields are being passed, depending on the stage of the Runge-Kutta time stepping method.

If fields are not propagated, returns 0.0 as there is no information propagating.

Parameters
perBfsGrid holding the perturbed B quantities
momentsfsGrid holding the moment quantities
dPerBfsGrid holding the derivatives of perturbed B
dMomentsfsGrid holding the derviatives of moments
BgBfsGrid holding the background B quantities
gridSpacinggrid cell size in x,y,z
rhomLimitsallowed min and max density when interpolating
selfCurrent cell index
nbrNeighbor cell index
ByCurrent cell's By
BzCurrent cell's Bz
dBydxdBydx derivative
dBydzdBydz derivative
dBzdxdBzdx derivative
dBzdydBzdy derivative
ydir+1 or -1 depending on the interpolation direction in y
zdir+1 or -1 depending on the interpolation direction in z

Definition at line 193 of file ldz_electric_field.cpp.

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

◆ fsdebugCheck()

void fsdebugCheck ( const fsgrid::FsStencil & stencil,
size_t len,
const char * file,
uint32_t line )

Get min and max density of the four neighbors, used for limiting/clamping the results of interpolation.

Definition at line 328 of file ldz_electric_field.cpp.

Here is the caller graph for this function:

◆ getRhomLimits()

Limits getRhomLimits ( const std::array< std::array< Real, fsgrids::moments::N_MOMENTS >, 4 > & moments)

Definition at line 343 of file ldz_electric_field.cpp.

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

◆ resistiveTerm()

Real resistiveTerm ( const auto & bgb,
const auto & perb,
const auto & dperb,
Real rhoq,
std::array< size_t, 2 > indices,
std::array< Real, 2 > spacing )

Definition at line 357 of file ldz_electric_field.cpp.

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