Skip to content

Commit

Permalink
Extrapolate the gradient through all the ghost cells. This impact hig…
Browse files Browse the repository at this point in the history
…her order advection stencils.
  • Loading branch information
AMLattanzi committed Sep 19, 2024
1 parent 68168c1 commit 7d6a7d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Exec/SquallLine_2D/inputs_moisture_WRF
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ erf.alpha_C = 100.0
erf.moisture_model = "Kessler"
erf.use_moist_background = true

erf.dycore_horiz_adv_type = "Centered_2nd"
erf.dycore_vert_adv_type = "Centered_2nd"
erf.dryscal_horiz_adv_type = "Centered_2nd"
erf.dryscal_vert_adv_type = "Centered_2nd"
erf.moistscal_horiz_adv_type = "Centered_2nd"
erf.moistscal_vert_adv_type = "Centered_2nd"
erf.dycore_horiz_adv_type = Upwind_3rd
erf.dycore_vert_adv_type = Upwind_3rd
erf.dryscal_horiz_adv_type = Upwind_3rd
erf.dryscal_vert_adv_type = Upwind_3rd
erf.moistscal_horiz_adv_type = Upwind_3rd
erf.moistscal_vert_adv_type = Upwind_3rd

# PROBLEM PARAMETERS (optional)
prob.z_tr = 12000.0
Expand Down
18 changes: 12 additions & 6 deletions Source/BoundaryConditions/ERF_BoundaryConditions_cons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ void ERFPhysBCFunct_cons::impose_lateral_cons_bcs (const Array4<Real>& dest_arr,
} else if (l_bc_type == ERFBCType::reflect_odd) {
dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
} else if (l_bc_type == ERFBCType::hoextrapcc) {
dest_arr(i,j,k,dest_comp) = 2.0*dest_arr(dom_lo.x,j,k,dest_comp) - dest_arr(dom_lo.x+1,j,k,dest_comp) ;
Real delta_i = (dom_lo.x - i);
dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(dom_lo.x,j,k,dest_comp) - delta_i*dest_arr(dom_lo.x+1,j,k,dest_comp) ;
}
},
bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n)
Expand All @@ -183,7 +184,8 @@ void ERFPhysBCFunct_cons::impose_lateral_cons_bcs (const Array4<Real>& dest_arr,
} else if (h_bc_type == ERFBCType::reflect_odd) {
dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
} else if (h_bc_type == ERFBCType::hoextrapcc) {
dest_arr(i,j,k,dest_comp) = 2.0*dest_arr(dom_hi.x,j,k,dest_comp) - dest_arr(dom_hi.x-1,j,k,dest_comp) ;
Real delta_i = (i - dom_hi.x);
dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(dom_hi.x,j,k,dest_comp) - delta_i*dest_arr(dom_hi.x-1,j,k,dest_comp) ;
}
}
);
Expand Down Expand Up @@ -213,7 +215,8 @@ void ERFPhysBCFunct_cons::impose_lateral_cons_bcs (const Array4<Real>& dest_arr,
} else if (l_bc_type == ERFBCType::reflect_odd) {
dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
} else if (l_bc_type == ERFBCType::hoextrapcc) {
dest_arr(i,j,k,dest_comp) = 2.0*dest_arr(i,dom_lo.y,k,dest_comp) - dest_arr(i,dom_lo.y+1,k,dest_comp) ;
Real delta_j = (dom_lo.y - j);
dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,dom_lo.y,k,dest_comp) - delta_j*dest_arr(i,dom_lo.y+1,k,dest_comp) ;
}

},
Expand All @@ -231,7 +234,8 @@ void ERFPhysBCFunct_cons::impose_lateral_cons_bcs (const Array4<Real>& dest_arr,
} else if (h_bc_type == ERFBCType::reflect_odd) {
dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
} else if (h_bc_type == ERFBCType::hoextrapcc) {
dest_arr(i,j,k,dest_comp) = 2.0*dest_arr(i,dom_hi.y,k,dest_comp) - dest_arr(i,dom_hi.y-1,k,dest_comp);
Real delta_j = (j - dom_hi.y);
dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,dom_hi.y,k,dest_comp) - delta_j*dest_arr(i,dom_hi.y-1,k,dest_comp);
}
}
);
Expand Down Expand Up @@ -373,7 +377,8 @@ void ERFPhysBCFunct_cons::impose_vertical_cons_bcs (const Array4<Real>& dest_arr
dest_arr(i,j,k,dest_comp) = dest_arr(i,j,dom_lo.z,dest_comp) -
delta_z*l_bc_neumann_vals_d[bc_comp][2]*dest_arr(i,j,dom_lo.z,Rho_comp);
} else if (l_bc_type == ERFBCType::hoextrapcc) {
dest_arr(i,j,k,dest_comp) = 2.0*dest_arr(i,j,dom_lo.z,dest_comp) - dest_arr(i,j,dom_lo.z+1,dest_comp);
Real delta_k = (dom_lo.z - k);
dest_arr(i,j,k,dest_comp) = (1.0 + delta_k)*dest_arr(i,j,dom_lo.z,dest_comp) - delta_k*dest_arr(i,j,dom_lo.z+1,dest_comp);
}
},
bx_zhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n)
Expand Down Expand Up @@ -402,7 +407,8 @@ void ERFPhysBCFunct_cons::impose_vertical_cons_bcs (const Array4<Real>& dest_arr
delta_z*l_bc_neumann_vals_d[bc_comp][5]*dest_arr(i,j,dom_hi.z,Rho_comp);
}
} else if (h_bc_type == ERFBCType::hoextrapcc){
dest_arr(i,j,k,dest_comp) = 2.0*dest_arr(i,j,dom_hi.z,dest_comp) - dest_arr(i,j,dom_hi.z-1,dest_comp);
Real delta_k = (k - dom_hi.z);
dest_arr(i,j,k,dest_comp) = (1.0 + delta_k)*dest_arr(i,j,dom_hi.z,dest_comp) - delta_k*dest_arr(i,j,dom_hi.z-1,dest_comp);
}
}
);
Expand Down

0 comments on commit 7d6a7d3

Please sign in to comment.