Skip to content

Commit

Permalink
host vs device variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hklion committed Dec 13, 2023
1 parent ebb679a commit 2c827d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Source/TimeIntegration/ROMSX_advance_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ ROMSX::advance_2d (int lev,

auto weight1 = vec_weight1.dataPtr();
auto weight2 = vec_weight2.dataPtr();

Real coriolis_f0 = solverChoice.coriolis_f0;
Real coriolis_beta = solverChoice.coriolis_beta;

if ((verbose > 2) && predictor_2d_step && my_iif == 0) {
amrex::PrintToFile("ru_startadvance").SetPrecision(18)<<FArrayBox(ru)<<std::endl;
amrex::PrintToFile("rv_startadvance").SetPrecision(18)<<FArrayBox(rv)<<std::endl;
Expand Down Expand Up @@ -438,7 +442,7 @@ ROMSX::advance_2d (int lev,
//defined UPWELLING
Real Esize=geomdata.ProbHi()[1] - geomdata.ProbLo()[1];
Real y = prob_lo[1] + (j + 0.5) * dx[1];
Real f=solverChoice.coriolis_f0 + solverChoice.coriolis_beta*(y-.5*Esize);
Real f=coriolis_f0 + coriolis_beta*(y-.5*Esize);
fomn(i,j,0)=f*(1.0/(pm(i,j,0)*pn(i,j,0)));
});

Expand Down
5 changes: 4 additions & 1 deletion Source/TimeIntegration/ROMSX_setup_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ ROMSX::setup_step (int lev, Real time, Real dt_lev)
auto pnom_v=fab_pnom_v.array();
auto fomn=fab_fomn.array();

Real coriolis_f0 = solverChoice.coriolis_f0;
Real coriolis_beta = solverChoice.coriolis_beta;

ParallelFor(tbxp2D,
[=] AMREX_GPU_DEVICE (int i, int j, int )
{
Expand All @@ -392,7 +395,7 @@ ROMSX::setup_step (int lev, Real time, Real dt_lev)
pn(i,j,0) = dxi[1];
Real Esize=geom[lev].ProbHi()[1] - geom[lev].ProbLo()[1];
Real y = prob_lo[1] + (j + 0.5) * dx[1];
Real f=solverChoice.coriolis_f0 + solverChoice.coriolis_beta*(y-.5*Esize);
Real f=coriolis_f0 + coriolis_beta*(y-.5*Esize);
fomn(i,j,0)=f*(1.0/(pm(i,j,0)*pn(i,j,0)));
});
amrex::ParallelFor(ubx, [=] AMREX_GPU_DEVICE (int i, int j, int )
Expand Down

0 comments on commit 2c827d8

Please sign in to comment.