Skip to content

Commit

Permalink
pull velocity update into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren committed Jun 15, 2024
1 parent d9ac037 commit ff6374b
Show file tree
Hide file tree
Showing 8 changed files with 676 additions and 720 deletions.
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ target_sources(incflo
incflo_tagging.cpp
incflo_update_density.cpp
incflo_update_tracer.cpp
incflo_update_velocity.cpp
incflo_utils.cpp
main.cpp
)

Expand Down
2 changes: 2 additions & 0 deletions src/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CEXE_sources += incflo_regrid.cpp
CEXE_sources += incflo_tagging.cpp
CEXE_sources += incflo_update_density.cpp
CEXE_sources += incflo_update_tracer.cpp
CEXE_sources += incflo_update_velocity.cpp
CEXE_sources += incflo_utils.cpp
CEXE_sources += main.cpp

ifeq ($(USE_EB), TRUE)
Expand Down
8 changes: 6 additions & 2 deletions src/incflo.H
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ public:
void tracer_explicit_update(amrex::Vector<amrex::MultiFab> const& tra_forces);
void tracer_explicit_update_corrector(amrex::Vector<amrex::MultiFab> const& tra_forces);

void update_density (StepType step_type);
void update_tracer (StepType step_type, amrex::Vector<amrex::MultiFab>& tra_forces);
void update_density (StepType step_type);
void update_tracer (StepType step_type, amrex::Vector<amrex::MultiFab>& tra_forces);
void update_velocity (StepType step_type, amrex::Vector<amrex::MultiFab>& vel_eta,
amrex::Vector<amrex::MultiFab>& vel_forces);

///////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -753,6 +755,7 @@ private:
amrex::Vector<amrex::MultiFab*> get_tracer_eb () noexcept;
amrex::Vector<amrex::MultiFab*> get_density_old () noexcept;
amrex::Vector<amrex::MultiFab*> get_density_new () noexcept;
amrex::Vector<amrex::MultiFab*> get_density_nph () noexcept;
amrex::Vector<amrex::MultiFab*> get_tracer_old () noexcept;
amrex::Vector<amrex::MultiFab*> get_tracer_new () noexcept;
amrex::Vector<amrex::MultiFab*> get_mac_phi () noexcept;
Expand All @@ -776,6 +779,7 @@ private:
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_tracer_eb () const noexcept;
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_density_old_const () const noexcept;
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_density_new_const () const noexcept;
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_density_nph_const () const noexcept;
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_tracer_old_const () const noexcept;
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_tracer_new_const () const noexcept;
[[nodiscard]] amrex::Vector<amrex::MultiFab const*> get_vel_forces_const () const noexcept;
Expand Down
342 changes: 0 additions & 342 deletions src/incflo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,345 +295,3 @@ incflo::writeNow()

return write_now;
}

Vector<MultiFab*> incflo::get_velocity_eb () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->velocity_eb));
}
return r;
}

Vector<MultiFab*> incflo::get_density_eb () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->density_eb));
}
return r;
}

Vector<MultiFab*> incflo::get_tracer_eb () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->tracer_eb));
}
return r;
}

Vector<MultiFab*> incflo::get_velocity_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->velocity_o));
}
return r;
}

Vector<MultiFab*> incflo::get_velocity_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->velocity));
}
return r;
}

Vector<MultiFab*> incflo::get_density_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->density_o));
}
return r;
}

Vector<MultiFab*> incflo::get_density_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->density));
}
return r;
}

Vector<MultiFab*> incflo::get_tracer_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->tracer_o));
}
return r;
}

Vector<MultiFab*> incflo::get_tracer_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->tracer));
}
return r;
}

Vector<MultiFab*> incflo::get_mac_phi() noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->mac_phi));
}
return r;
}

Vector<MultiFab*> incflo::get_conv_velocity_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->conv_velocity_o));
}
return r;
}

Vector<MultiFab*> incflo::get_conv_velocity_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->conv_velocity));
}
return r;
}

Vector<MultiFab*> incflo::get_conv_density_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->conv_density_o));
}
return r;
}

Vector<MultiFab*> incflo::get_conv_density_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->conv_density));
}
return r;
}

Vector<MultiFab*> incflo::get_conv_tracer_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->conv_tracer_o));
}
return r;
}

Vector<MultiFab*> incflo::get_conv_tracer_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->conv_tracer));
}
return r;
}

Vector<MultiFab*> incflo::get_divtau_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->divtau_o));
}
return r;
}

Vector<MultiFab*> incflo::get_divtau_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->divtau));
}
return r;
}

Vector<MultiFab*> incflo::get_laps_old () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->laps_o));
}
return r;
}

Vector<MultiFab*> incflo::get_laps_new () noexcept
{
Vector<MultiFab*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->laps));
}
return r;
}

Vector<MultiFab const*> incflo::get_velocity_old_const () const noexcept
{
Vector<MultiFab const*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->velocity_o));
}
return r;
}

Vector<MultiFab const*> incflo::get_velocity_new_const () const noexcept
{
Vector<MultiFab const*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->velocity));
}
return r;
}

Vector<MultiFab const*> incflo::get_density_old_const () const noexcept
{
Vector<MultiFab const*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->density_o));
}
return r;
}

Vector<MultiFab const*> incflo::get_density_new_const () const noexcept
{
Vector<MultiFab const*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->density));
}
return r;
}

Vector<MultiFab const*> incflo::get_tracer_old_const () const noexcept
{
Vector<MultiFab const*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->tracer_o));
}
return r;
}

Vector<MultiFab const*> incflo::get_tracer_new_const () const noexcept
{
Vector<MultiFab const*> r;
r.reserve(finest_level+1);
for (int lev = 0; lev <= finest_level; ++lev) {
r.push_back(&(m_leveldata[lev]->tracer));
}
return r;
}

void incflo::copy_from_new_to_old_velocity (IntVect const& ng)
{
for (int lev = 0; lev <= finest_level; ++lev) {
copy_from_new_to_old_velocity(lev, ng);
}
}

void incflo::copy_from_new_to_old_velocity (int lev, IntVect const& ng)
{
MultiFab::Copy(m_leveldata[lev]->velocity_o,
m_leveldata[lev]->velocity, 0, 0, AMREX_SPACEDIM, ng);
}

void incflo::copy_from_old_to_new_velocity (IntVect const& ng)
{
for (int lev = 0; lev <= finest_level; ++lev) {
copy_from_old_to_new_velocity(lev, ng);
}
}

void incflo::copy_from_old_to_new_velocity (int lev, IntVect const& ng)
{
MultiFab::Copy(m_leveldata[lev]->velocity,
m_leveldata[lev]->velocity_o, 0, 0, AMREX_SPACEDIM, ng);
}

void incflo::copy_from_new_to_old_density (IntVect const& ng)
{
for (int lev = 0; lev <= finest_level; ++lev) {
copy_from_new_to_old_density(lev, ng);
}
}

void incflo::copy_from_new_to_old_density (int lev, IntVect const& ng)
{
MultiFab::Copy(m_leveldata[lev]->density_o,
m_leveldata[lev]->density, 0, 0, 1, ng);
}

void incflo::copy_from_old_to_new_density (IntVect const& ng)
{
for (int lev = 0; lev <= finest_level; ++lev) {
copy_from_old_to_new_density(lev, ng);
}
}

void incflo::copy_from_old_to_new_density (int lev, IntVect const& ng)
{
MultiFab::Copy(m_leveldata[lev]->density,
m_leveldata[lev]->density_o, 0, 0, 1, ng);
}

void incflo::copy_from_new_to_old_tracer (IntVect const& ng)
{
for (int lev = 0; lev <= finest_level; ++lev) {
copy_from_new_to_old_tracer(lev, ng);
}
}

void incflo::copy_from_new_to_old_tracer (int lev, IntVect const& ng)
{
if (m_ntrac > 0) {
MultiFab::Copy(m_leveldata[lev]->tracer_o,
m_leveldata[lev]->tracer, 0, 0, m_ntrac, ng);
}
}

void incflo::copy_from_old_to_new_tracer (IntVect const& ng)
{
for (int lev = 0; lev <= finest_level; ++lev) {
copy_from_old_to_new_tracer(lev, ng);
}
}

void incflo::copy_from_old_to_new_tracer (int lev, IntVect const& ng)
{
if (m_ntrac > 0) {
MultiFab::Copy(m_leveldata[lev]->tracer,
m_leveldata[lev]->tracer_o, 0, 0, m_ntrac, ng);
}
}
Loading

0 comments on commit ff6374b

Please sign in to comment.