Namespace for SBP operators and associated data structures. More...
Namespace for SBP operators and associated data structures.
Typedefs | |
typedef stencilset | base |
The sbp::base is an SBP-specific stencilset. More... | |
Functions | |
bool | IsValidOrder (int overallOrder) |
int | Initialize (base &stencilSet, int interiorOrder) |
Initialize the sbp::base stencilset with the SBP operator of given order. More... | |
void | OperatorSetup (base &stencilSet, int interiorOrder, int boundaryDepth, int boundaryWidth, double boundaryWeight, std::vector< double > centralWeightsRight, std::vector< std::vector< double > > leftWeights, std::vector< int > leftOrders) |
Setup the SBP operator given the appropriate coefficients – called from Initialize. More... | |
int | BruteTest1 (base &inOperator, int interiorOrder, int numDim, int numComponents, int numTrials, std::vector< bool > &testResults) |
Brute-force accuracy test for SBP operators. More... | |
int | CreateStencilConnectivity (int numDim, size_t *dimSizes, size_t *opInterval, int boundaryDepth, int *stencilID, bool fortranInterval=false) |
Creates simple stencil connectivity assuming all domain boundaries are physical boundaries. More... | |
int | CreateStencilConnectivity (int numDim, size_t *dimSizes, size_t *opInterval, int boundaryDepth, int *periodicDirs, int *stencilID, bool fortranInterval=false) |
Creates simple stencil connectivity assuming all domain boundaries are either periodic or physical boundaries. More... | |
int | InvertStencilConnectivity (int numDim, size_t *dimSizes, size_t *opInterval, int numStencils, int *stencilID, size_t *dualStencilConn, size_t *numPointsStencil, bool fortranInterval=false) |
Inverts stencil connectivity to populate the so-called dual stencil connectivity More... | |
int | BoundaryStencilConnectivity (std::vector< size_t > &bufferSizes, pcpp::IndexIntervalType &partitionInterval, pcpp::IndexIntervalType &partitionBufferInterval, pcpp::IndexIntervalType &boundaryInterval, int boundaryDepth, int boundaryDirection, int *stencilConnectivity) |
Update a stencil connectivity with a boundary. More... | |
int | HoleStencilConnectivity (std::vector< size_t > &bufferSizes, pcpp::IndexIntervalType &partitionInterval, pcpp::IndexIntervalType &partitionBufferInterval, pcpp::IndexIntervalType &holeInterval, int holeStencil, int *stencilConnectivity) |
Update a stencil connectivity with a hole. More... | |
int | MaskStencilConnectivity (int numDim, size_t *dimSizes, size_t *opInterval, int boundaryDepth, int boundaryStart, int holeBit, int *inMask, int *stencilID) |
int | DetectHoles (int numDim, size_t *dimSizes, size_t *opInterval, int boundaryDepth, int holeBit, int *inMask, int *stencilID) |
Detect unstructured holes and set up boundary stencil id's accordingly. More... | |
size_t | IntervalSize (int numDim, size_t *opInterval) |
size_t | BufferSize (int numDim, size_t *dimSize) |
int | StructuredHole (int numDim, size_t *dimSizes, size_t *opInterval, size_t *holeInterval, int boundaryDepth, int boundaryStart, int holeBit, int *inMask, int *stencilID) |
typedef stencilset base |
The sbp::base is an SBP-specific stencilset.
The SBP stencilset (i.e. sbp::base) is a plascom2::operator::stencilset that contains all of the stencils implementing an SBP scheme of a given spatial order N_M (e.g. 1_2, 2_4, 4_8, etc), where N is the order of the boundary stencil and M the interior spatial order. Each scheme has an internal stencil (I) implementing an M-order finite difference (FD) operator, and some number of biased boundary stencils of order N for each of the left and right boundaries (
and
, resp), where
is the so-called boundary depth.
The total number of stencils in the SBP stencilset is , and they are arranged in the data structures in the following order:
{Interior, ,
,
,...,
,
,
,
,...,
}.
int BoundaryStencilConnectivity | ( | std::vector< size_t > & | bufferSizes, |
pcpp::IndexIntervalType & | partitionInterval, | ||
pcpp::IndexIntervalType & | partitionBufferInterval, | ||
pcpp::IndexIntervalType & | boundaryInterval, | ||
int | boundaryDepth, | ||
int | boundaryDirection, | ||
int * | stencilConnectivity | ||
) |
Update a stencil connectivity with a boundary.
Given a stencil connectivity, boundary interval, depth, and direction, this function populates the stencil connectivity with the stencil id that corresponds to the SBP biased boundary stencils needed to respect the specified boundary. This routine is not (yet) thread-safe.
[in] | bufferSizes | std::vector<size_t> that indicates the number of points in each dimension |
[in] | partitionInterval | pcpp::IndexIntervalType that indicates the local partition |
[in] | partitionBufferInterval | pcpp::IndexIntervalType that indicates the buffer interval for the lcoal partition |
[in] | boundaryInterval | pcpp::IndexIntervalType that indicates the boundary interval (wrt the global grid size) |
[in] | boundaryDepth | integer indicating the boundary depth for this SBP operator |
[in] | boundaryDirection | direction points into the domain from the boundary |
[out] | stencilConnectivity | the stencil connectivity that is update with the boundary stencils on return |
Definition at line 1114 of file Stencil.C.
References bufferInterval, sizeextent::GetFlatIndices(), sizeextent::InitSimple(), sizeextent::NNodes(), numPointsBuffer, and sizeextent::Overlap().
Referenced by rhs< GridT, StateT, OperatorT >::SetDomainBoundaries().
int BruteTest1 | ( | base & | inOperator, |
int | interiorOrder, | ||
int | numDim, | ||
int | numComponents, | ||
int | numTrials, | ||
std::vector< bool > & | testResults | ||
) |
Brute-force accuracy test for SBP operators.
This test uses the brute force ApplyOperator kernel to test the accuracy of SBP finite difference operators. It applies the indicated operator of interior order M to the N-dimensional domain , with test functions
with
. The operator is applied in each dimension using numTrials grid refinements with
to ensure that the truncation error has the proper order dependence on
.
The test results are as follows:
In short, testResults contains: for each stencil, for each dimension, for each test (i.e. accuracy + order) the test results.
[in] | inOperator | plascom2::operator::sbp::base stencilset encapsulating the operator |
[in] | interiorOrder | indicates the order of accuracy for the interior stencil |
[in] | numDim | indicates the number of dimensions in which to test |
[in] | numComponents | indicates the number of vector components for the test function |
[in] | numTrials | indicates the number of successive grid refinements to use in the test |
[out] | testResults | a vector of boolean test results (true for pass, false for fail) |
Definition at line 625 of file Stencil.C.
References operators::applyoperator(), stencilset::boundaryDepth, stencilset::boundaryWidth, CreateStencilConnectivity(), FC_MODULE(), GetFunctionOrder(), numComponents, numPoints, numStencils, stencilset::numStencils, stencilset::numValues, opDir, opInterval, stencilID, stencilset::stencilOffsets, stencilset::stencilOrders, stencilset::stencilSizes, stencilset::stencilStarts, and stencilset::stencilWeights.
Referenced by TestOperatorSBP12(), TestOperatorSBP24(), and TestOperatorSBP36().
size_t plascom2::operators::sbp::BufferSize | ( | int | numDim, |
size_t * | dimSize | ||
) |
Definition at line 1300 of file Stencil.C.
Referenced by parallel_blockstructured::FlagData(), and InvertStencilConnectivity().
int CreateStencilConnectivity | ( | int | numDim, |
size_t * | dimSizes, | ||
size_t * | opInterval, | ||
int | boundaryDepth, | ||
int * | stencilID, | ||
bool | fortranInterval = false |
||
) |
Creates simple stencil connectivity assuming all domain boundaries are physical boundaries.
This function populates the stencilID with the ID (1-numStencils) assuming an SBP operator stencilset. An example SBP stencilset with boundaryDepth=4 has the stencil ID's arranged as follows:
[in] | numDim | indicates the number of spatial dimensions |
[in] | dimSizes | array of size (numDim) that indicates the number of points in each dimension [Nx Ny Nz] |
[in] | opInterval | array of size (2*numDim) indicating the range of indices over which to determine stencilIDs |
[in] | boundaryDepth | indicates the boundary depth as described above |
[out] | stencilID | array of pre-sized to (numDim*numPoints) which on output contains the determined stencil IDs for each dimension |
[in] | fortranInterval | indicates whether the opInterval is 1-based (true) or not (false). DEFAULT=false |
Definition at line 840 of file Stencil.C.
References numPoints.
Referenced by BruteTest1(), rhs< GridT, StateT, OperatorT >::SetupStencilConnectivities(), TestApplyOperatorAppl(), TestApplyOperatorBlobs(), TestCurlOperator(), TestEulerKernels(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_RectilinearMetric(), TestHoleDetection(), TestMaxwellRHS_Bfield(), and TestMaxwellRHS_Dfield().
int CreateStencilConnectivity | ( | int | numDim, |
size_t * | dimSizes, | ||
size_t * | opInterval, | ||
int | boundaryDepth, | ||
int * | periodicDirs, | ||
int * | stencilID, | ||
bool | fortranInterval = false |
||
) |
Creates simple stencil connectivity assuming all domain boundaries are either periodic or physical boundaries.
This function populates the stencilID with the ID (1-numStencils) assuming an SBP operator stencilset. An example SBP stencilset with boundaryDepth=4 has the stencil ID's arranged as follows:
[in] | numDim | indicates the number of spatial dimensions |
[in] | dimSizes | array of size (numDim) that indicates the number of points in each dimension [Nx Ny Nz] |
[in] | opInterval | array of size (2*numDim) indicating the range of indices over which to determine stencilIDs |
[in] | boundaryDepth | indicates the boundary depth as described above |
[in] | periodicDirs | indicates the periodic directions |
[out] | stencilID | array of pre-sized to (numDim*numPoints) which on output contains the determined stencil IDs for each dimension |
[in] | fortranInterval | indicates whether the opInterval is 1-based (true) or not (false). DEFAULT=false |
Definition at line 968 of file Stencil.C.
References numPoints.
int DetectHoles | ( | int | numDim, |
size_t * | dimSizes, | ||
size_t * | opInterval, | ||
int | boundaryDepth, | ||
int | holeBit, | ||
int * | inMask, | ||
int * | stencilID | ||
) |
Detect unstructured holes and set up boundary stencil id's accordingly.
Definition at line 1454 of file Stencil.C.
References bufferInterval, sizeextent::GetFlatIndices(), numPointsBuffer, numStencils, and opInterval.
Referenced by rhs< GridT, StateT, OperatorT >::SetDomainBCs(), and TestHoleDetection().
int HoleStencilConnectivity | ( | std::vector< size_t > & | bufferSizes, |
pcpp::IndexIntervalType & | partitionInterval, | ||
pcpp::IndexIntervalType & | partitionBufferInterval, | ||
pcpp::IndexIntervalType & | holeInterval, | ||
int | holeStencil, | ||
int * | stencilConnectivity | ||
) |
Update a stencil connectivity with a hole.
Sets stencil connectivity for all points inside a "hole" or iblanked region.
Given a stencil connectivity, and a hole interval, this function populates the stencil connectivity with the stencil id that corresponds to the specified hole stencil which is usually the number of SBP stencils + 1. This routine is not (yet) thread-safe.
[in] | bufferSizes | std::vector<size_t> that indicates the number of points in each dimension |
[in] | partitionInterval | pcpp::IndexIntervalType that indicates the local partition |
[in] | partitionBufferInterval | pcpp::IndexIntervalType that indicates the buffer interval for the lcoal partition |
[in] | holeInterval | pcpp::IndexIntervalType that indicates the interval of the hole (wrt the global grid size) |
[in] | holeStencil | integer to which to set the stencil connectivity |
[out] | stencilConnectivity | the stencil connectivity that is update with the boundary stencils on return |
This routine takes the partition and hole global intervals and sets a hole stencil on every point inside the hole.
Definition at line 1230 of file Stencil.C.
References bufferInterval, sizeextent::GetFlatIndices(), sizeextent::InitSimple(), sizeextent::NNodes(), numPointsBuffer, and sizeextent::Overlap().
Referenced by rhs< GridT, StateT, OperatorT >::SetDomainBoundaries().
int Initialize | ( | base & | stencilSet, |
int | interiorOrder | ||
) |
Initialize the sbp::base stencilset with the SBP operator of given order.
Definition at line 360 of file Stencil.C.
References stencilset::Destroy(), and OperatorSetup().
Referenced by base< GridT, StateT >::ConfigureDomain(), application::ConfigureSimulation(), testfixtures::CreateSerialSimulationFixtures(), testfixtures::CreateSimulationFixtures(), euler::util::CreateSimulationFixtures(), eos::eos(), testing_parallel_program::Initialize(), euler::util::InitializeSimulationFixtures(), CommunicatorObject::NOpenRequests(), TestApplyOperatorAppl(), TestApplyOperatorBlobs(), TestCurlOperator(), TestEulerKernels(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_PBS_IntegratedHalo(), TestGrid_RectilinearMetric(), TestHDF5PBSGridIO(), TestHoleDetection(), TestMaxwellRHS(), TestMaxwellRHS_Bfield(), TestMaxwellRHS_Dfield(), TestOperatorSBP12(), TestOperatorSBP24(), TestOperatorSBP36(), TestPlasCom2Output(), and TestSBPInitialize().
size_t plascom2::operators::sbp::IntervalSize | ( | int | numDim, |
size_t * | opInterval | ||
) |
Definition at line 1293 of file Stencil.C.
Referenced by InvertStencilConnectivity().
int InvertStencilConnectivity | ( | int | numDim, |
size_t * | dimSizes, | ||
size_t * | opInterval, | ||
int | numStencils, | ||
int * | stencilID, | ||
size_t * | dualStencilConn, | ||
size_t * | numPointsStencil, | ||
bool | fortranInterval = false |
||
) |
Inverts stencil connectivity to populate the so-called dual stencil connectivity
Given a whole stencil connectivity (i.e. wrt all partition points), this function populates the dual stencil connectivity with the points to which each stencil should be applied. The dual stencil connectivity array (dualStencilConn) must have size numDim*numPointsInterval, where numPointsInterval is inferred from the opInterval argument. The numPointsStencil array must be of size (numDim*numStencils). On output, the dualStencilConn contains a list of point id's for each stencil for each dimension.
[in] | numDim | indicates the number of spatial dimensions |
[in] | dimSizes | array of size (numDim) that indicates the number of points in each dimension [Nx Ny Nz] |
[in] | opInterval | array of size (2*numDim) indicating the range of indices over which to determine stencilIDs |
[in] | numStencils | indicates the number of stencils represented in the stencilID |
[in] | stencilID | array of (numDim*numPoints) elements where numPoints = dimSize[0]*dimSize[1]....*dimSize[nDim-1] |
[out] | dualStencilConn | array of size (numDim*numPointsInterval) to store dual stencil connectivity on output |
[out] | numPointsStencil | array of size (numDim*numStencils) to store the number of points for each stencil in each dimension |
[in] | fortranInterval | indicates whether the opInterval is 1-based (true) or not (false). DEFAULT=false |
Definition at line 1739 of file Stencil.C.
References BufferSize(), IntervalSize(), numPointsBuffer, numStencils, and opInterval.
Referenced by TestApplyOperatorBlobs().
bool IsValidOrder | ( | int | overallOrder | ) |
Definition at line 352 of file Stencil.C.
Referenced by application::ConfigureSimulation().
int MaskStencilConnectivity | ( | int | numDim, |
size_t * | dimSizes, | ||
size_t * | opInterval, | ||
int | boundaryDepth, | ||
int | boundaryStart, | ||
int | holeBit, | ||
int * | inMask, | ||
int * | stencilID | ||
) |
Definition at line 1381 of file Stencil.C.
References sizeextent::GetFlatIndices(), and numPoints.
void OperatorSetup | ( | base & | stencilSet, |
int | interiorOrder, | ||
int | boundaryDepth, | ||
int | boundaryWidth, | ||
double | boundaryWeight, | ||
std::vector< double > | centralWeightsRight, | ||
std::vector< std::vector< double > > | leftWeights, | ||
std::vector< int > | leftOrders | ||
) |
Setup the SBP operator given the appropriate coefficients – called from Initialize.
Definition at line 485 of file Stencil.C.
References stencilset::boundaryDepth, stencilset::boundaryWeight, stencilset::boundaryWidth, stencilset::numStencils, stencilset::numValues, stencilset::overallOrder, stencilset::ownData, stencilset::stencilOffsets, stencilset::stencilOrders, stencilset::stencilSizes, stencilset::stencilStarts, and stencilset::stencilWeights.
Referenced by Initialize().
int plascom2::operators::sbp::StructuredHole | ( | int | numDim, |
size_t * | dimSizes, | ||
size_t * | opInterval, | ||
size_t * | holeInterval, | ||
int | boundaryDepth, | ||
int | boundaryStart, | ||
int | holeBit, | ||
int * | inMask, | ||
int * | stencilID | ||
) |
Definition at line 1307 of file Stencil.C.
References sizeextent::GetFlatIndices(), numPoints, and sizeextent::Overlap().