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

Go to the source code of this file.

Classes

struct  DerivativesData< T, N >

Functions

void computeMomentsDerivatives (fsgrids::constmomentsspan moments, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, const bool atSysBoundary)
void computePerbDerivatives (fsgrids::perbspan perb, fsgrids::dperbspan dperb, const fsgrid::FsStencil &stencil, bool dontCompute2ndDerivatives, bool atSysBoundary, cuint sysBoundaryFlag)
void calculateDerivatives (fsgrids::perbspan perb, fsgrids::constmomentsspan moments, fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint sysBoundaryFlag, cuint sysBoundaryLayer, const bool doMoments)
 Low-level spatial derivatives calculation.
void calculateDerivativesSimple (fsgrids::perbspan perb, fsgrids::momentsspan moments, fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, const bool doMoments)
 High-level derivative calculation wrapper function.
void calculateBVOLDerivatives (fsgrids::volspan vol, fsgrids::consttechnicalspan technical, const fsgrid::FsStencil &stencil)
 Low-level spatial derivatives calculation.
void calculateBVOLDerivativesSimple (fsgrids::volspan vol, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)
 High-level derivative calculation wrapper function.
void calculateCurvature (fsgrids::volspan vol, fsgrids::constbgbspan bgb, const fsgrid::FsStencil &stencil, const std::array< Real, 3 > &gridSpacing)
 Low-level curvature calculation.
void calculateCurvatureSimple (fsgrids::volspan vol, fsgrids::constbgbspan bgb, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)
 High-level curvature calculation wrapper function.
static std::array< Real, 3 > getPerBVol (SpatialCell *cell)
 Returns perturbed volumetric B of cell.
static std::array< Real, 3 > getBVol (SpatialCell *cell)
 Returns volumetric B of cell.
static std::array< Real, 3 > getMomentumDensity (SpatialCell *cell)
 Calculates momentum density of cell.
static Real calculateU (SpatialCell *cell)
 Calculates energy density for spatial cell.
static Real calculateAnisotropy (const Eigen::Matrix3d &rot, const std::array< Real, 6 > &P)
 Calculates pressure anistotropy from B and Pi.
void calculateScaledDeltas (SpatialCell *cell, std::vector< SpatialCell * > &neighbors)
 Low-level scaled gradients calculation.
void calculateScaledDeltasSimple (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
 High-level scaled gradient calculation wrapper function.

Function Documentation

◆ calculateAnisotropy()

Real calculateAnisotropy ( const Eigen::Matrix3d & rot,
const std::array< Real, 6 > & P )
static

Calculates pressure anistotropy from B and Pi.

Parameters
rotEigen rotation matrix for parallel/perpendicular pressure
Pelements of pressure order in order: P_11, P_22, P_33, P_23, P_13, P_12

Definition at line 505 of file derivatives.cpp.

Here is the caller graph for this function:

◆ calculateBVOLDerivatives()

void calculateBVOLDerivatives ( fsgrids::volspan vol,
fsgrids::consttechnicalspan technical,
const fsgrid::FsStencil & stencil )

Low-level spatial derivatives calculation.

Calculate the spatial derivatives of BVOL or set them to zero.

For sysBoundaryLayer 1 or 2, we are near a boundary, and we wish to use regular centered differences instead of slope limiter-adjusted values. This is to minimize oscillations as a smooth behaviour is required near artificial boundaries, unlike at boundaries and shocks inside the simulation domain.

Parameters
volfsGrid holding the volume averaged fields
technicalfsGrid holding technical information (such as boundary types)
stencilfsgrid stencil of current cell
See also
calculateDerivatives calculateBVOLDerivativesSimple calculateDerivativesSimple

Definition at line 295 of file derivatives.cpp.

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

◆ calculateBVOLDerivativesSimple()

void calculateBVOLDerivativesSimple ( fsgrids::volspan vol,
fsgrids::technicalspan technical,
FieldSolverGrid & fsgrid )

High-level derivative calculation wrapper function.

BVOL has been calculated locally by calculateVolumeAveragedFields but not communicated. For the acceleration step one needs the cross-derivatives of BVOL

Parameters
volfsGrid holding the volume averaged fields
technicalfsGrid holding technical information (such as boundary types)
fsgridfsgrid container
See also
calculateDerivatives calculateBVOLDerivatives calculateDerivativesSimple

Definition at line 361 of file derivatives.cpp.

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

◆ calculateCurvature()

void calculateCurvature ( fsgrids::volspan vol,
fsgrids::constbgbspan bgb,
const fsgrid::FsStencil & stencil,
const std::array< Real, 3 > & gridSpacing )

Low-level curvature calculation.

Parameters
volfsGrid holding the volume averaged fields
bgbfsGrid holding the background fields
stencilfsgrid stencil
gridSpacingcell sizes in x,y,z

http://fusionwiki.ciemat.es/wiki/Magnetic_curvature

See also
calculateDerivatives calculateBVOLDerivativesSimple calculateDerivativesSimple

Definition at line 393 of file derivatives.cpp.

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

◆ calculateCurvatureSimple()

void calculateCurvatureSimple ( fsgrids::volspan vol,
fsgrids::constbgbspan bgb,
fsgrids::technicalspan technical,
FieldSolverGrid & fsgrid )

High-level curvature calculation wrapper function.

Parameters
volfsGrid holding the volume averaged fields
bgbfsGrid holding the background fields
technicalfsGrid holding technical information (such as boundary types)
fsgridfsgrid container
See also
calculateDerivatives calculateBVOLDerivatives calculateDerivativesSimple

Definition at line 440 of file derivatives.cpp.

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

◆ calculateDerivatives()

void calculateDerivatives ( fsgrids::perbspan perb,
fsgrids::constmomentsspan moments,
fsgrids::dperbspan dperb,
fsgrids::dmomentsspan dmoments,
const fsgrid::FsStencil & stencil,
cuint sysBoundaryFlag,
cuint sysBoundaryLayer,
const bool doMoments )

Low-level spatial derivatives calculation.

Calculate the spatial derivatives or apply the derivative boundary conditions.

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
stencilfsgrid stencil for the cell
sysBoundaryFlagsystem boundary flag for the cell
sysBoundaryLayersystem boundary layer for the cell
doMomentsBool telling whether the derivatives for moments need updating too.
See also
calculateDerivativesSimple calculateBVOLDerivativesSimple calculateBVOLDerivatives

Definition at line 209 of file derivatives.cpp.

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

◆ calculateDerivativesSimple()

void calculateDerivativesSimple ( fsgrids::perbspan perb,
fsgrids::momentsspan moments,
fsgrids::dperbspan dperb,
fsgrids::dmomentsspan dmoments,
fsgrids::technicalspan technical,
FieldSolverGrid & fsgrid,
const bool doMoments )

High-level derivative calculation wrapper function.

B has to be updated because after the system boundary update in propagateMagneticFieldSimple there is no consistent state of B yet everywhere.

Then the derivatives are calculated.

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
technicalfsGrid holding technical information (such as boundary types)
fsgridfsgrid container
doMomentsIf true, the derivatives of moments (rho, V, P) are communicated to neighbours and their derivatives updated.
See also
calculateDerivatives calculateBVOLDerivativesSimple calculateBVOLDerivatives

Definition at line 254 of file derivatives.cpp.

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

◆ calculateScaledDeltas()

void calculateScaledDeltas ( SpatialCell * cell,
std::vector< SpatialCell * > & neighbors )

Low-level scaled gradients calculation.

For the SpatialCell* cell and its neighbors, calculate scaled gradients and their maximum alpha The gradients are the same as in the GUMICS simulation, see Janhunen, P., Palmroth, M., Laitinen, T., Honkonen, I., Juusola, L., Facsko, G., & Pulkkinen, T. I. (2012). The GUMICS-4 global MHD magnetosphere-ionosphere coupling simulation. Journal of Atmospheric and Solar - Terrestrial Physics, 80, 48-59. https://doi.org/10.1016/j.jastp.2012.03.006

Definition at line 535 of file derivatives.cpp.

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

◆ calculateScaledDeltasSimple()

void calculateScaledDeltasSimple ( dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & mpiGrid)

High-level scaled gradient calculation wrapper function.

Calculates gradients needed for alpha everywhere in the grid

Definition at line 664 of file derivatives.cpp.

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

◆ calculateU()

Real calculateU ( SpatialCell * cell)
static

Calculates energy density for spatial cell.

Definition at line 493 of file derivatives.cpp.

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

◆ computeMomentsDerivatives()

void computeMomentsDerivatives ( fsgrids::constmomentsspan moments,
fsgrids::dmomentsspan dmoments,
const fsgrid::FsStencil & stencil,
const bool atSysBoundary )

Definition at line 40 of file derivatives.cpp.

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

◆ computePerbDerivatives()

void computePerbDerivatives ( fsgrids::perbspan perb,
fsgrids::dperbspan dperb,
const fsgrid::FsStencil & stencil,
bool dontCompute2ndDerivatives,
bool atSysBoundary,
cuint sysBoundaryFlag )

Definition at line 124 of file derivatives.cpp.

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

◆ getBVol()

std::array< Real, 3 > getBVol ( SpatialCell * cell)
static

Returns volumetric B of cell.

Definition at line 474 of file derivatives.cpp.

Here is the caller graph for this function:

◆ getMomentumDensity()

std::array< Real, 3 > getMomentumDensity ( SpatialCell * cell)
static

Calculates momentum density of cell.

Definition at line 483 of file derivatives.cpp.

Here is the caller graph for this function:

◆ getPerBVol()

std::array< Real, 3 > getPerBVol ( SpatialCell * cell)
static

Returns perturbed volumetric B of cell.

Definition at line 465 of file derivatives.cpp.