5 #define DEBUG_MAXWELL_RHS_BFIELD 0 6 #define DEBUG_MAXWELL_RHS_DFIELD 0 7 #define DEBUG_MAXWELL_ComputeRecipEpsMu 0 8 #define DEBUG_MAXWELL_CONVERT_ETODFIELD 0 9 #define DEBUG_MAXWELL_CONVERT_DTOEFIELD 0 10 #define DEBUG_MAXWELL_CONVERT_BTOHFIELD 0 11 #define DEBUG_MAXWELL_CONVERT_HTOBFIELD 0 21 double *recipDeltaX,
double *inputField,
double *outputField)
30 int comp1plusOne, comp2plusOne;
31 double *partDDx1 =
new double [
numPoints];
32 double *partDDx2 =
new double [
numPoints];
34 for (
int compCurl=0; compCurl<numDim; compCurl++) {
36 comp1 = (compCurl+1)%3;
39 comp1plusOne = comp1+1;
40 comp2plusOne = comp2+1;
50 &stencilID[comp1xnumPoints],
51 &inputField[comp2xnumPoints], partDDx1);
58 &stencilID[comp2xnumPoints],
59 &inputField[comp1xnumPoints], partDDx2);
61 size_t compCurlxnumPoints = compCurl*
numPoints;
63 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
65 partDDx1[iPoint] *= recipDeltaX[comp1xnumPoints+iPoint];
66 partDDx2[iPoint] *= recipDeltaX[comp2xnumPoints+iPoint];
68 outputField[compCurlxnumPoints+iPoint] = partDDx1[iPoint] - partDDx2[iPoint];
85 double *recipDeltaX,
double *Efield,
double *dBdt)
93 if (
ComputeCurl(numDim, numX, numComponents, numPoints, opInterval, stencilID,
94 inOperator, recipDeltaX, Efield, dBdt))
101 for (
int iDim=0; iDim<numDim; iDim++) {
105 #if DEBUG_MAXWELL_RHS_BFIELD 107 for (
int iDim=0; iDim<numDim; iDim++) {
109 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
110 std::cout <<
"[Maxwell RHS B-field] dim=" << iDim <<
", point=" << iPoint <<
", Efield=" << Efield[iDimxnumPoints+iPoint] <<
", dBdt=" << dBdt[iDimxnumPoints+iPoint] << std::endl;
123 double *recipDeltaX,
double *Hfield,
double *J,
double *dDdt)
131 if (
ComputeCurl(numDim, numX, numComponents, numPoints, opInterval, stencilID,
132 inOperator, recipDeltaX, Hfield, dDdt))
137 double negOne = -1.0;
139 for (
int iDim=0; iDim<numDim; iDim++) {
143 #if DEBUG_MAXWELL_RHS_DFIELD 145 for (
int iDim=0; iDim<numDim; iDim++) {
147 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
148 std::cout <<
"[Maxwell RHS D-field] dim=" << iDim <<
", point=" << iPoint <<
", Hfield=" << Hfield[iDimxnumPoints+iPoint] <<
", J=" << J[iDimxnumPoints+iPoint] <<
", dDdt=" << dDdt[iDimxnumPoints+iPoint] << std::endl;
159 double *epsMu,
double *recipEpsMu)
176 #if DEBUG_MAXWELL_ComputeRecipEpsMu 178 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
179 std::cout <<
"[Maxwell Compute reciprocal eps, mu] point=" << iPoint <<
", eps=" << epsMu[iPoint] <<
", 1/eps=" << recipEpsMu[iPoint] <<
", mu=" << epsMu[numPoints+iPoint] <<
", 1/mu=" << recipEpsMu[numPoints+iPoint] << std::endl;
189 double *epsMu,
double *Efield,
double *Dfield)
201 for (
int iDim=0; iDim<numDim; iDim++) {
206 #if DEBUG_MAXWELL_CONVERT_ETODFIELD 208 for (
int iDim=0; iDim<numDim; iDim++) {
210 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
211 std::cout <<
"[Maxwell Convert E->D] dim=" << iDim <<
", point=" << iPoint <<
", eps=" << epsMu[iPoint] <<
", Efield=" << Efield[iDimxnumPoints+iPoint] <<
", Dfield=" << Dfield[iDimxnumPoints+iPoint] << std::endl;
222 double *recipEpsMu,
double *Dfield,
double *Efield)
234 for (
int iDim=0; iDim<numDim; iDim++) {
239 #if DEBUG_MAXWELL_CONVERT_DTOEFIELD 241 for (
int iDim=0; iDim<numDim; iDim++) {
243 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
244 std::cout <<
"[Maxwell Convert D->E] dim=" << iDim <<
", point=" << iPoint <<
", 1/eps=" << recipEpsMu[iPoint] <<
", Dfield=" << Dfield[iDimxnumPoints+iPoint] <<
", Efield=" << Efield[iDimxnumPoints+iPoint] << std::endl;
255 double *recipEpsMu,
double *Bfield,
double *Hfield)
267 for (
int iDim=0; iDim<numDim; iDim++) {
272 #if DEBUG_MAXWELL_CONVERT_BTOHFIELD 274 for (
int iDim=0; iDim<numDim; iDim++) {
276 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
277 std::cout <<
"[Maxwell Convert B->H] dim=" << iDim <<
", point=" << iPoint <<
", 1/mu=" << recipEpsMu[numPoints+iPoint] <<
", Bfield=" << Bfield[iDimxnumPoints+iPoint] <<
", Hfield=" << Hfield[iDimxnumPoints+iPoint] << std::endl;
288 double *epsMu,
double *Hfield,
double *Bfield)
300 for (
int iDim=0; iDim<numDim; iDim++) {
305 #if DEBUG_MAXWELL_CONVERT_HTOBFIELD 307 for (
int iDim=0; iDim<numDim; iDim++) {
309 for (
size_t iPoint=0; iPoint<
numPoints; iPoint++) {
310 std::cout <<
"[Maxwell Convert H->B] dim=" << iDim <<
", point=" << iPoint <<
", mu=" << epsMu[numPoints+iPoint] <<
", Hfield=" << Hfield[iDimxnumPoints+iPoint] <<
", Bfield=" << Bfield[iDimxnumPoints+iPoint] << std::endl;
int ComputeMaxwellRHS_Bfield(int numDim, size_t *numX, int numComponents, size_t numPoints, size_t *opInterval, int *stencilID, plascom2::operators::sbp::base &inOperator, double *recipDeltaX, double *Efield, double *dBdt)
int ConvertBfieldtoHfield(int numDim, size_t numPoints, size_t *numX, size_t *opInterval, double *recipEpsMu, double *Bfield, double *Hfield)
int * stencilSizes
The number of weights for each stencil.
void const size_t * numPoints
int ComputeMaxwellRHS_Dfield(int numDim, size_t *numX, int numComponents, size_t numPoints, size_t *opInterval, int *stencilID, plascom2::operators::sbp::base &inOperator, double *recipDeltaX, double *Hfield, double *J, double *dDdt)
subroutine applyoperator(numDim, dimSizes, numComponents, numPoints, opDir, opInterval, numStencils, stencilSizes, stencilStarts, numValues, stencilWeights, stencilOffsets, stencilID, U, dU)
applyoperator applies an operator specified as a stencil set to the provided state data ...
int ComputeCurl(int numDim, size_t *numX, int numComponents, size_t numPoints, size_t *opInterval, int *stencilID, plascom2::operators::sbp::base &inOperator, double *recipDeltaX, double *inputField, double *outputField)
int * stencilStarts
The starting index into the stencilWeight and stencilOffset arrays for each stencil.
int * stencilOffsets
The offsets wrt the grid point at which the stencil is being applied.
void const size_t const size_t const size_t * opInterval
void size_t int size_t int size_t int int int int double int int * stencilID
int ConvertHfieldtoBfield(int numDim, size_t numPoints, size_t *numX, size_t *opInterval, double *epsMu, double *Hfield, double *Bfield)
Encapsulation for a collection of operator stencils.
int numValues
The total number of weights for all stencils (reqd for Fortran)
int ConvertEfieldtoDfield(int numDim, size_t numPoints, size_t *numX, size_t *opInterval, double *epsMu, double *Efield, double *Dfield)
subroutine zxy(numDim, numPoints, bufferSize, bufferInterval, X, Y, Z)
ZXY point-wise operator performing Z = XY (all vectors)
int ComputeRecipEpsMu(int numDim, size_t numPoints, size_t *numX, size_t *opInterval, double *epsMu, double *recipEpsMu)
double * stencilWeights
The stencil weights.
int numStencils
The number of stencils (e.g. interior + boundary)
int ConvertDfieldtoEfield(int numDim, size_t numPoints, size_t *numX, size_t *opInterval, double *recipEpsMu, double *Dfield, double *Efield)
subroutine yaxpy(N1, N2, N3, localInterval, a, X, Y)
subroutine yaxm1(numDim, numPoints, bufferSize, bufferInterval, a, X, Y)
YAXM1 point-wise operator performing Y = a/X (scalar a)
void size_t int * numComponents
subroutine xax(numDim, numPoints, bufferSize, bufferInterval, a, X)
XAX point-wise operator performing X = aX (scalar a)
void FC_MODULE(euler, flux1d, EULER, FLUX1D)(const int *numDim