14 #ifndef SFCSORTBENCH_RKTRANSPORT_H 15 #define SFCSORTBENCH_RKTRANSPORT_H 18 #include "fdCoefficient.h" 20 #include "checkPoint.h" 21 #include "rkTransportUtils.h" 27 #define IO_OUTPUT_FREQ 10 28 #define REMESH_TEST_FREQ 10 // test for remeshing every 10 steps. 29 #define IO_OUTPUT_GAP 1 // output IO after each 1 second of traversal. 44 std::vector<double> m_uiU;
47 std::vector<double> m_uiPrevU;
50 std::vector<double> m_uiVecIm;
53 std::vector<double> m_uiStage_1;
56 std::vector<double> m_uiStage_2;
59 std::vector<double> m_uiStage_3;
62 std::vector<double> m_uiStage_4;
65 std::vector<double> m_uiStage_5;
68 std::vector<double> m_uiStage_6;
71 std::vector<double> m_uiRHS;
75 std::vector<double>m_uiDxU;
77 std::vector<double>m_uiDyU;
79 std::vector<double>m_uiDzU;
83 std::vector<double> m_uiUZipVecIn;
86 std::vector<double> m_uiUZipVecOut;
107 double m_uiCoef_b[3];
110 std::function<double(double,double,double)> m_uiFunc_g;
113 std::function<double(double,double,double,double)> m_uiFunc_f;
116 std::function<double(double,double,double)> m_uiFunc_f1;
119 char* m_uiFilePrefix;
122 double m_uiWaveletTol;
125 double m_uiLoadImbTol;
128 unsigned int m_uiSplitterFix;
131 double m_uiLastIOTimeValue;
151 void setParameters(
double *b, std::function<
double(
double,
double,
double)>g , std::function<
double (
double,
double,
double,
double)> f ,
const char * fprefix,
double wltTol );
170 template <
typename T>
186 int restoreRK45Solver(
const char * fNamePrefix,
const unsigned int step,
const MPI_Comm comm);
207 template <
typename T>
211 unsigned int x,y,z,sz;
214 const double grid_min=0;
215 const double grid_max=1u<<(m_uiMaxDepth);
216 const double d_min=-M_PI;
217 const double d_max=M_PI;
224 unsigned int owner,ii_x,jj_y,kk_z;
229 if((pNodes[ele].minX()==grid_min) || (pNodes[ele].minY()==grid_min) || ((pNodes[ele].minZ()==grid_min) ))
232 for(
unsigned int k=0;k<(eleOrder+1);k++)
233 for(
unsigned int j=0;j<(eleOrder+1);j++)
234 for(
unsigned int i=0;i<(eleOrder+1);i++)
238 m_uiMesh->
dg2eijk(e2n_dg[ele*nPe+k*(eleOrder+1)*(eleOrder+1)+j*(eleOrder+1)+i],owner,ii_x,jj_y,kk_z);
239 sz=1u<<(m_uiMaxDepth-pNodes[owner].
getLevel());
240 x=pNodes[owner].
getX()+ ii_x*(sz/eleOrder);
241 y=pNodes[owner].getY()+ jj_y*(sz/eleOrder);
242 z=pNodes[owner].getZ()+ kk_z*(sz/eleOrder);
243 if(((x==grid_min)|| (y==grid_min) || (z==grid_min) ))
246 x1=((x-grid_min)/(grid_max-grid_min))*(d_max-d_min)+d_min;
247 y1=((y-grid_min)/(grid_max-grid_min))*(d_max-d_min)+d_min;
248 z1=((z-grid_min)/(grid_max-grid_min))*(d_max-d_min)+d_min;
254 value=sin(x1-m_uiCoef_b[0]*time)*sin(y1-m_uiCoef_b[1]*time)*sin(z1-m_uiCoef_b[2]*time);
257 vec[e2n[ele*nPe+k*(eleOrder+1)*(eleOrder+1)+j*(eleOrder+1)+i]]=value;
275 #endif //SFCSORTBENCH_RKTRANSPORT_H
RK45Transport(ot::Mesh *pMesh, double pTBegin, double pTEnd, double pTh)
Default constructor.
Definition: rkTransport.cpp:17
int restoreRK45Solver(const char *fNamePrefix, const unsigned int step, const MPI_Comm comm)
: restore rk45 solver from a given checkpoint. This will overwrite the parameters given in the origin...
Definition: rkTransport.cpp:509
void applyBoundaryConditions()
: Implementation of the base class function to apply boundary conditions.
Definition: rkTransport.cpp:318
void applyInitialConditions()
Definition: rkTransport.cpp:98
A class to manage octants.
Definition: TreeNode.h:35
const std::vector< unsigned int > & getE2NMapping_DG() const
Definition: mesh.h:1082
void rkSolve()
: starts the rk-45 solver.
Definition: rkTransport.cpp:322
bool isNodeLocal(unsigned int eleID, unsigned int ix, unsigned int jy, unsigned int kz) const
: Returns true if the specified node (e,i,j,k) is local.
Definition: mesh.h:1358
~RK45Transport()
Definition: rkTransport.cpp:42
unsigned int getElementLocalBegin() const
return the begin location of element local
Definition: mesh.h:1030
int storeCheckPoint(const char *fNamePrefix)
: stores the all the variables that is required to restore the rk45 solver at a given stage...
Definition: rkTransport.cpp:456
ot::Mesh * m_uiMesh
Definition: rk.h:26
const std::vector< ot::TreeNode > & getAllElements() const
returns the pointer to All elements array.
Definition: mesh.h:1058
unsigned int getNumNodesPerElement() const
return the number of nodes per element.
Definition: mesh.h:1090
unsigned int getLevel() const
return the level of the of the octant
Definition: TreeNode.h:387
This file contains the base class for the Rungge-Kutta 45 Method.
Definition: rk4nlsm.h:33
bool isNodeHanging(unsigned int eleID, unsigned int ix, unsigned int jy, unsigned int kz) const
: Returns true if the specified node (e,i,j,k) is hanging.
Definition: mesh.cpp:8943
void setLDImbParameters(double ldTol=0.1, unsigned int sfK=2)
Used to set the load balancing parameters for the solver.
Definition: rkTransport.cpp:92
void setParameters(double *b, std::function< double(double, double, double)>g, std::function< double(double, double, double, double)> f, const char *fprefix, double wltTol)
: set parameters for transport equation
Definition: rkTransport.cpp:47
void performSingleIteration()
: Implementation of the base class time step function
Definition: rkTransport.cpp:105
const std::vector< unsigned int > & getE2NMapping() const
Definition: mesh.h:1073
unsigned int getX() const
get integer values of the octree coordinates.
Definition: TreeNode.h:366
void dg2eijk(unsigned int dg_index, unsigned int &e, unsigned int &i, unsigned int &j, unsigned int &k) const
: Decompose the DG index to element id and it's i,j,k values.
Definition: mesh.h:1147
unsigned int getElementOrder() const
returns the order of an element
Definition: mesh.h:1093
Definition: rkTransport.h:39
unsigned int getElementLocalEnd() const
return the end location of element local
Definition: mesh.h:1032