#include #include #include #ifdef _OPENMP #include #endif using namespace amrex; NCIGodfreyFilter::NCIGodfreyFilter(godfrey_coeff_set coeff_set_, amrex::Real cdtodz_, amrex::Real l_lower_order_in_v_){ // Store parameters into class data members coeff_set = coeff_set_; cdtodz = cdtodz_; l_lower_order_in_v = l_lower_order_in_v_; // NCI Godfrey filter has fixed size, and is applied along z only. #if (AMREX_SPACEDIM == 3) stencil_length_each_dir = {1,1,5}; slen = {1,1,5}; #else stencil_length_each_dir = {1,5}; slen = {1,5,1}; #endif } void NCIGodfreyFilter::ComputeStencils(){ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( #if ( AMREX_SPACEDIM == 3 ) slen.z==5, #else slen.y==5, #endif "ERROR: NCI filter requires 5 points in z"); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(l_lower_order_in_v==1, "ERROR: NCI corrector requires l_lower_order_in_v=1, i.e., Galerkin scheme"); // Interpolate coefficients from the table, and store into prestencil. int index = tab_length*cdtodz; index = min(index, tab_length-2); index = max(index, 0); Real weight_right = cdtodz - index/tab_length; Real prestencil[4]; for(int i=0; i