Skip to content

Commit

Permalink
Fix bug in Nturb multifab (#1519)
Browse files Browse the repository at this point in the history
* Passing Nturb with ghost zones to fitch advance

* Fix Nturb ghost zones bug

* Make names consistent

---------

Co-authored-by: Mahesh Natarajan <[email protected]>
Co-authored-by: Ann Almgren <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent e4ff12e commit 883c91b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Source/ERF_make_new_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ void ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm
if (solverChoice.windfarm_type == WindFarmType::Fitch){
int ngrow_state = ComputeGhostCells(solverChoice.advChoice, solverChoice.use_NumDiff) + 1;
vars_fitch[lev].define(ba, dm, 5, ngrow_state); // V, dVabsdt, dudt, dvdt, dTKEdt
Nturb[lev].define(ba, dm, 1, 0); // Number of turbines in a cell
Nturb[lev].define(ba, dm, 1, ngrow_state); // Number of turbines in a cell
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Source/TimeIntegration/ERF_Advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ERF::Advance (int lev, Real time, Real dt_lev, int /*iteration*/, int /*ncycle*/
// Update with the Fitch source terms
if (solverChoice.windfarm_type == WindFarmType::Fitch) {
fitch_advance(lev, Geom(lev), dt_lev, S_old,
U_old, V_old, W_old, vars_fitch[lev]);
U_old, V_old, W_old, vars_fitch[lev], Nturb[lev]);
}
#endif

Expand Down
8 changes: 5 additions & 3 deletions Source/WindFarmParametrization/Fitch/AdvanceFitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ void fitch_advance (int lev,
const Real& dt_advance,
MultiFab& cons_in,
MultiFab& U_old, MultiFab& V_old, MultiFab& W_old,
MultiFab& mf_vars_fitch)
MultiFab& mf_vars_fitch, const amrex::MultiFab& mf_Nturb)
{
fitch_source_terms_cellcentered(geom, cons_in, U_old, V_old, W_old, mf_vars_fitch);
fitch_source_terms_cellcentered(geom, cons_in, U_old, V_old, W_old, mf_vars_fitch, mf_Nturb);
fitch_update(dt_advance, cons_in, U_old, V_old, mf_vars_fitch);
}

Expand Down Expand Up @@ -85,7 +85,7 @@ void fitch_update (const Real& dt_advance,
void fitch_source_terms_cellcentered (const Geometry& geom,
const MultiFab& cons_in,
const MultiFab& U_old, const MultiFab& V_old, const MultiFab& W_old,
MultiFab& mf_vars_fitch)
MultiFab& mf_vars_fitch, const amrex::MultiFab& mf_Nturb)
{

auto dx = geom.CellSizeArray();
Expand Down Expand Up @@ -114,6 +114,7 @@ void fitch_source_terms_cellcentered (const Geometry& geom,
const Box& gbx = mfi.growntilebox(1);
auto cons_array = cons_in.array(mfi);
auto fitch_array = mf_vars_fitch.array(mfi);
auto Nturb_array = mf_Nturb.array(mfi);
auto u_vel = U_old.array(mfi);
auto v_vel = V_old.array(mfi);
auto w_vel = W_old.array(mfi);
Expand All @@ -125,6 +126,7 @@ void fitch_source_terms_cellcentered (const Geometry& geom,
int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);


Real x = (ii+0.5) * dx[0];
Real y = (jj+0.5) * dx[1];
Real z = (kk+0.5) * dx[2];
Expand Down
4 changes: 2 additions & 2 deletions Source/WindFarmParametrization/Fitch/Fitch.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ void fitch_advance (int lev,
const amrex::Real& dt_advance,
amrex::MultiFab& cons_in,
amrex::MultiFab& U_old, amrex::MultiFab& V_old, amrex::MultiFab& W_old,
amrex::MultiFab& mf_vars_fitch);
amrex::MultiFab& mf_vars_fitch, const amrex::MultiFab& mf_Nturb);

void fitch_source_terms_cellcentered (const amrex::Geometry& geom,
const amrex::MultiFab& cons_in,
const amrex::MultiFab& U_old, const amrex::MultiFab& V_old, const amrex::MultiFab& W_old,
amrex::MultiFab& mf_vars_fitch);
amrex::MultiFab& mf_vars_fitch, const amrex::MultiFab& mf_Nturb);

void fitch_update (const amrex::Real& dt_advance,
amrex::MultiFab& cons_in,
Expand Down

0 comments on commit 883c91b

Please sign in to comment.