Commit 9d81b4dc authored by m.tavelli's avatar m.tavelli

Dynamic AMR

parent a99415c3
......@@ -120,7 +120,7 @@ void FOCCZ4::FOCCZ4Solver_ADERDG::boundaryValues(const double* const x,const dou
exahype::solvers::Solver::RefinementControl FOCCZ4::FOCCZ4Solver_ADERDG::refinementCriterion(const double* const luh,const tarch::la::Vector<DIMENSIONS,double>& cellCentre,const tarch::la::Vector<DIMENSIONS,double>& cellSize,double t,const int level) {
// @todo Please implement/augment if required
//return exahype::solvers::Solver::RefinementControl::Keep;
if(DIMENSIONS == 2){
/*if(DIMENSIONS == 2){
if(std::abs(cellCentre[0]) < 10){
if(std::abs(cellCentre[1]) < 10){
return exahype::solvers::Solver::RefinementControl::Refine;
......@@ -141,7 +141,75 @@ exahype::solvers::Solver::RefinementControl FOCCZ4::FOCCZ4Solver_ADERDG::refinem
if ( level > getCoarsestMeshLevel() ) {
return exahype::solvers::Solver::RefinementControl::Erase;
}
return exahype::solvers::Solver::RefinementControl::Keep;
return exahype::solvers::Solver::RefinementControl::Keep;*/
const int nVar = FOCCZ4::AbstractFOCCZ4Solver_ADERDG::NumberOfVariables;
const int order = FOCCZ4::AbstractFOCCZ4Solver_ADERDG::Order;
const int basisSize = order + 1;
int refine_flag;
double max_luh[nVar];
double min_luh[nVar];
//return exahype::solvers::Solver::RefinementControl::Keep;
//
for(int m = 0; m <nVar ; m++){
max_luh[m]=-1.e+14;
min_luh[m]=1.e+14;
}
#if DIMENSIONS==3
kernels::idx4 id_xyz_dof(basisSize,basisSize,basisSize,nVar);
#else
kernels::idx3 id_xy_dof(basisSize,basisSize,nVar);
#endif
for(int i = 0; i < basisSize; i++){
for(int j = 0; j <basisSize ; j++){
#if DIMENSIONS==3
for(int k = 0; k <basisSize ; k++){
#endif
#if DIMENSIONS==3
for(int m = 0; m <nVar ; m++){
if(luh[id_xyz_dof(i,j,k,m)]<min_luh[m]){
min_luh[m]=luh[id_xyz_dof(i,j,k,m)];
}
if(luh[id_xyz_dof(i,j,k,m)]>max_luh[m]){
max_luh[m]=luh[id_xyz_dof(i,j,k,m)];
}
}
#else
for(int m = 0; m <nVar ; m++){
if(luh[id_xy_dof(i,j,m)]<min_luh[m]){
min_luh[m]=luh[id_xy_dof(i,j,m)];
}
if(luh[id_xy_dof(i,j,m)]>max_luh[m]){
max_luh[m]=luh[id_xy_dof(i,j,m)];
}
}
#endif
#if DIMENSIONS==3
}
#endif
}
}
pderefinecriteria_(&refine_flag,&max_luh[0],&min_luh[0],&cellCentre[0]);
if(refine_flag>1){
return exahype::solvers::Solver::RefinementControl::Refine;
}else{
if(refine_flag>0){
return exahype::solvers::Solver::RefinementControl::Keep;
}else{
//return exahype::solvers::Solver::RefinementControl::Recoarse;
return exahype::solvers::Solver::RefinementControl::Keep;
};
}
}
//*****************************************************************************
......
......@@ -4014,4 +4014,30 @@ RECURSIVE SUBROUTINE PDEFusedSrcNCP(Src_BgradQ,Q,gradQin)
!
END SUBROUTINE PDEFusedSrcNCP
RECURSIVE SUBROUTINE pderefinecriteria(refine_flag, max_luh,min_luh,x)
USE MainVariables, ONLY: nVar , nDim
IMPLICIT NONE
Integer, intent(out) :: refine_flag
real, intent(in) :: max_luh(nVar),min_luh(nVar),x(nDim)
!if(abs(x(1))<10) then
! refine_flag=2
! return
!end if
!if(abs(x(2))<15) then
! refine_flag=2
! return
!end if
#ifdef CCZ4EINSTEIN
if(abs(max_luh(60)-min_luh(60))>1.e-4 .or. abs(max_luh(54)-min_luh(54))>1.e-4) then
refine_flag=2
else
refine_flag=0
end if
#endif
END SUBROUTINE pderefinecriteria
#endif
\ No newline at end of file
......@@ -24,6 +24,8 @@ void registerinitialdata_(const char* const id_name, int* id_name_len);
void pdeauxvar_(double* aux, const double* const Q,double* x, const double* const time);
void pdecritialstress_(double* CS, const double* const Q);
void pderefinecriteria_(int* refine_flag,const double* max_luh,const double* min_luh,const double* x);
//void hllemfluxfv_(double* FL, double* FR, const double* const QL, const double* const QR, const double* const QavL, const double* const QavR, const int* normalNonZeroIndex);
void hllemfluxfv_(double* FL, double* FR, const double* const QL, const double* const QR, const int* normalNonZeroIndex);
void hllemriemannsolver_(const int* basisSize, const int* normalNonZeroIndex, double* FL, double* FR, const double* const QL, const double* const QR, const double* const QavL, const double* const QavR);
......
......@@ -51,9 +51,9 @@
{
"type": "Limiting-ADER-DG",
"name": "FOCCZ4Solver",
"order": 3,
"maximum_mesh_size": 5.0,
"maximum_mesh_depth": 0,
"order": 4,
"maximum_mesh_size": 10.0,
"maximum_mesh_depth": 2,
"time_stepping": "global",
"aderdg_kernel": {
"language": "C",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment