Skip to content

Commit

Permalink
Only call setVal on defined p_nd/p_cc (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilet authored Dec 3, 2024
1 parent 9315bfa commit 5ef9c86
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
14 changes: 10 additions & 4 deletions src/incflo_regrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ void incflo::MakeNewLevelFromCoarse (int lev,
}
fillcoarsepatch_gradp(lev, time, new_leveldata->gp, 0);

new_leveldata->p_cc.setVal(0.0);
new_leveldata->p_nd.setVal(0.0);
if (m_use_cc_proj) {
new_leveldata->p_cc.setVal(0.0);
} else {
new_leveldata->p_nd.setVal(0.0);
}

m_leveldata[lev] = std::move(new_leveldata);
m_factory[lev] = std::move(new_fact);
Expand Down Expand Up @@ -85,8 +88,11 @@ void incflo::RemakeLevel (int lev, Real time, const BoxArray& ba,
}
fillpatch_gradp(lev, time, new_leveldata->gp, 0);

new_leveldata->p_cc.setVal(0.0);
new_leveldata->p_nd.setVal(0.0);
if (m_use_cc_proj) {
new_leveldata->p_cc.setVal(0.0);
} else {
new_leveldata->p_nd.setVal(0.0);
}

m_leveldata[lev] = std::move(new_leveldata);
m_factory[lev] = std::move(new_fact);
Expand Down
7 changes: 5 additions & 2 deletions src/prob/prob_init_fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ void incflo::prob_init_fluid (int lev)
auto const& problo = geom[lev].ProbLoArray();
auto const& probhi = geom[lev].ProbHiArray();

ld.p_cc.setVal(0.0);
ld.p_nd.setVal(0.0);
if (m_use_cc_proj) {
ld.p_cc.setVal(0.0);
} else {
ld.p_nd.setVal(0.0);
}

ld.gp.setVal(0.0);

Expand Down
7 changes: 5 additions & 2 deletions src/setup/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,11 @@ void incflo::InitialProjection()
// We set p and gp back to zero (p0 may still be still non-zero)
for (int lev = 0; lev <= finest_level; lev++)
{
m_leveldata[lev]->p_nd.setVal(0.0);
m_leveldata[lev]->p_cc.setVal(0.0);
if (m_use_cc_proj) {
m_leveldata[lev]->p_cc.setVal(0.0);
} else {
m_leveldata[lev]->p_nd.setVal(0.0);
}
m_leveldata[lev]->gp.setVal(0.0);
}
}
Expand Down

0 comments on commit 5ef9c86

Please sign in to comment.