Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hklion committed Dec 10, 2023
1 parent 5cefe81 commit f9d9f54
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Exec/Upwelling/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST = TRUE
USE_ASSERTION = TRUE

# Debugging
DEBUG = FALSE
DEBUG = TRUE

TEST = TRUE
USE_ASSERTION = TRUE
Expand Down
7 changes: 4 additions & 3 deletions Exec/Upwelling/inputs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Source/TimeIntegration/ROMSX_TimeStepML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
73 changes: 23 additions & 50 deletions Source/TimeIntegration/ROMSX_prestep_t_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
});

//-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Source/TimeIntegration/ROMSX_rhs_uv_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f9d9f54

Please sign in to comment.