From f9d9f5450e09950e1f7d8357e721762de91459b4 Mon Sep 17 00:00:00 2001 From: Hannah Klion Date: Sat, 9 Dec 2023 23:17:15 -0800 Subject: [PATCH] Cleanup --- Exec/Upwelling/GNUmakefile | 2 +- Exec/Upwelling/inputs | 7 +- Source/TimeIntegration/ROMSX_TimeStepML.cpp | 2 +- Source/TimeIntegration/ROMSX_prestep_t_3d.cpp | 73 ++++++------------- Source/TimeIntegration/ROMSX_rhs_uv_2d.cpp | 4 +- 5 files changed, 31 insertions(+), 57 deletions(-) diff --git a/Exec/Upwelling/GNUmakefile b/Exec/Upwelling/GNUmakefile index 6274bde3..06b885da 100644 --- a/Exec/Upwelling/GNUmakefile +++ b/Exec/Upwelling/GNUmakefile @@ -21,7 +21,7 @@ TEST = TRUE USE_ASSERTION = TRUE # Debugging -DEBUG = FALSE +DEBUG = TRUE TEST = TRUE USE_ASSERTION = TRUE diff --git a/Exec/Upwelling/inputs b/Exec/Upwelling/inputs index 2d499516..d24fd275 100644 --- a/Exec/Upwelling/inputs +++ b/Exec/Upwelling/inputs @@ -22,7 +22,7 @@ zhi.type = "SlipWall" # TIME STEP CONTROL romsx.fixed_dt = 300.0 # Timestep size (seconds) # NDTFAST = 30.0 # Number of baratropic steps => 300.0/30.0 = 10.0 -romsx.fixed_fast_dt = 10.0 # Baratropic timestep size (seconds) +#romsx.fixed_fast_dt = 10.0 # Baratropic timestep size (seconds) # romsx.fixed_fast_dt = 300.0 # Baratropic timestep size (seconds) testing value romsx.fixed_ndtfast_ratio = 30 # Baratropic timestep size (seconds) @@ -39,13 +39,14 @@ romsx.check_file = chk # root name of checkpoint file romsx.check_int = -57600 # number of timesteps between checkpoints # PLOTFILES -romsx.plot_file_1 = plt # prefix of plotfile name -romsx.plot_int_1 = 100 # number of timesteps between plotfiles +romsx.plot_file_1 = plt_dt30_ # prefix of plotfile name +romsx.plot_int_1 = 1 # number of timesteps between plotfiles romsx.plot_vars_1 = omega salt temp x_velocity y_velocity z_velocity romsx.plotfile_type = amrex # SOLVER CHOICE romsx.use_coriolis = true +romsx.flat_bathymetry = false romsx.horizontal_advection_scheme = "upstream3" # upstream3 or centered4 romsx.spatial_order = 2 diff --git a/Source/TimeIntegration/ROMSX_TimeStepML.cpp b/Source/TimeIntegration/ROMSX_TimeStepML.cpp index 68bbbbe3..7f997978 100644 --- a/Source/TimeIntegration/ROMSX_TimeStepML.cpp +++ b/Source/TimeIntegration/ROMSX_TimeStepML.cpp @@ -6,7 +6,7 @@ using namespace amrex; // Advance all levels by dt // void -ROMSX::timeStepML (Real time, int iteration) +ROMSX::timeStepML (Real time, int /*iteration*/) { // HACK HACK so lev is defined and compiler won't complain, but always say regrid_int=-1 for (int lev=0; lev <= finest_level;lev++) { diff --git a/Source/TimeIntegration/ROMSX_prestep_t_3d.cpp b/Source/TimeIntegration/ROMSX_prestep_t_3d.cpp index 41a41128..f5189bb6 100644 --- a/Source/TimeIntegration/ROMSX_prestep_t_3d.cpp +++ b/Source/TimeIntegration/ROMSX_prestep_t_3d.cpp @@ -303,50 +303,31 @@ ROMSX::prestep_t_3d (const Box& tbx, const Box& gbx, // continuity equation. // amrex::ParallelFor(tbx, - [=] AMREX_GPU_DEVICE (int i, int j, int k) + [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + //----------------------------------------------------------------------- + // Add in vertical advection. + //----------------------------------------------------------------------- + if (k>=1 && k<=N-2) { - //----------------------------------------------------------------------- - // Add in vertical advection. - //----------------------------------------------------------------------- - - Real cff1=0.5; - Real cff2=7.0/12.0; - Real cff3=1.0/12.0; - - if (k>=1 && k<=N-2) - { - FC(i,j,k)=( cff2*(tempold(i ,j,k ,nrhs)+ tempold(i,j,k+1,nrhs)) - -cff3*(tempold(i ,j,k-1,nrhs)+ tempold(i,j,k+2,nrhs)) )* - ( W(i,j,k)); - } - else // this needs to be split up so that the following can be concurrent - { - FC(i,j,N)=0.0; - - FC(i,j,N-1)=( cff2*tempold(i ,j,N-1,nrhs)+ cff1*tempold(i,j,N ,nrhs) - -cff3*tempold(i ,j,N-2,nrhs) )* - ( W(i ,j,N-1)); - - FC(i,j,0)=( cff2*tempold(i ,j,1,nrhs)+ cff1*tempold(i,j,0,nrhs) - -cff3*tempold(i ,j,2,nrhs) )* - ( W(i ,j,0)); - - // FC(i,0,-1)=0.0; - } + FC(i,j,k)=( 7.0/12.0*(tempold(i ,j,k ,nrhs)+ tempold(i,j,k+1,nrhs)) + -1.0/12.0*(tempold(i ,j,k-1,nrhs)+ tempold(i,j,k+2,nrhs)) )* + ( W(i,j,k)); + } + else // this needs to be split up so that the following can be concurrent + { + FC(i,j,N)=0.0; - }); - // exit(0); -/* - Real cff; + FC(i,j,N-1)=( 7.0/12.0*tempold(i ,j,N-1,nrhs)+ 0.5_rt*tempold(i,j,N ,nrhs) + -1.0/12.0*tempold(i ,j,N-2,nrhs) )* + ( W(i ,j,N-1)); - Real GammaT = 1.0/6.0; + FC(i,j,0)=( 7.0/12.0*tempold(i ,j,1,nrhs)+ 0.5_rt*tempold(i,j,0,nrhs) + -1.0/12.0*tempold(i ,j,2,nrhs) )* + ( W(i ,j,0)); + } - if (iic==ntfirst) - { - cff=0.5*dt_lev; - } else { - cff=(1-GammaT)*dt_lev; - }*/ + }); amrex::ParallelFor(tbxp1, [=] AMREX_GPU_DEVICE (int i, int j, int k) @@ -364,27 +345,19 @@ ROMSX::prestep_t_3d (const Box& tbx, const Box& gbx, Hvom(i,j+1,k)-Hvom(i,j,k)+ (W(i,j,k)))); } - - /* - tempstore(i,j,k,3)=Hz(i,j,k)*(cff1*tempold(i,j,k,nstp)+ - cff2*temp(i,j,k,nnew))- - cff*pm(i,j,0)*pn(i,j,0)* - (FC(i+1,j)-FC(i,j)+ - DC(i,j+1)-DC(i,j));*/ }); amrex::ParallelFor(tbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - Real cff1=cff*pm(i,j,0)*pn(i,j,0); + Real pmn_dt=cff*pm(i,j,0)*pn(i,j,0); Real cff4; if(k-1>=0) { cff4=FC(i,j,k)-FC(i,j,k-1); } else { cff4=FC(i,j,k); } - tempstore(i,j,k)=DC(i,j,k)*(tempstore(i,j,k)-cff1*cff4); -// temp(i,j,k)=tempold(i,j,k); + tempstore(i,j,k)=DC(i,j,k)*(tempstore(i,j,k)-pmn_dt*cff4); }); //----------------------------------------------------------------------- diff --git a/Source/TimeIntegration/ROMSX_rhs_uv_2d.cpp b/Source/TimeIntegration/ROMSX_rhs_uv_2d.cpp index 954f20e7..444e7b8f 100644 --- a/Source/TimeIntegration/ROMSX_rhs_uv_2d.cpp +++ b/Source/TimeIntegration/ROMSX_rhs_uv_2d.cpp @@ -94,7 +94,7 @@ ROMSX::rhs_uv_2d (const Box& xbx, const Box& ybx, // // Add in horizontal advection. // - amrex::ParallelFor(makeSlab(xbx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int) + amrex::ParallelFor(xbx, [=] AMREX_GPU_DEVICE (int i, int j, int ) { Real cff1=UFx(i,j ,0)-UFx(i-1,j,0); Real cff2=UFe(i,j+1,0)-UFe(i ,j,0); @@ -139,7 +139,7 @@ ROMSX::rhs_uv_2d (const Box& xbx, const Box& ybx, }); amrex::ParallelFor(growLo(ybx,1,1), - [=] AMREX_GPU_DEVICE (int i, int j, int) + [=] AMREX_GPU_DEVICE (int i, int j, int ) { Real vee_j = vbar(i,j-1,0,krhs)-2.0*vbar(i,j ,0,krhs)+vbar(i,j+1,0,krhs); Real vee_jp1 = vbar(i,j ,0,krhs)-2.0*vbar(i,j+1,0,krhs)+vbar(i,j+2,0,krhs);