Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate routines into separate files so predictor and corrector aren… #105

Merged
merged 13 commits into from
Jun 17, 2024
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ target_sources(incflo
incflo_correct_small_cells.cpp
incflo_redistribute.cpp
incflo_explicit_update.cpp
incflo_tagging.cpp
incflo_regrid.cpp
incflo_tagging.cpp
incflo_update_density.cpp
incflo_update_tracer.cpp
incflo_update_velocity.cpp
incflo_utils.cpp
main.cpp
)

Expand Down
6 changes: 5 additions & 1 deletion src/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ CEXE_sources += incflo_apply_corrector.cpp
CEXE_sources += incflo_compute_dt.cpp
CEXE_sources += incflo_compute_forces.cpp
CEXE_sources += incflo_explicit_update.cpp
CEXE_sources += incflo_tagging.cpp
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
27 changes: 15 additions & 12 deletions src/convection/incflo_compute_advection_term.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,24 @@ incflo::compute_convective_term (Vector<MultiFab*> const& conv_u,

for (int lev = 0; lev <= finest_level; ++lev) {
AMREX_D_TERM(
face_x[lev].define(u_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),Factory(lev));,
face_y[lev].define(v_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),Factory(lev));,
face_z[lev].define(w_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),Factory(lev)););
face_x[lev].define(u_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),u_mac[lev]->Factory());,
face_y[lev].define(v_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),v_mac[lev]->Factory());,
face_z[lev].define(w_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),w_mac[lev]->Factory()););
AMREX_D_TERM(
flux_x[lev].define(u_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),Factory(lev));,
flux_y[lev].define(v_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),Factory(lev));,
flux_z[lev].define(w_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),Factory(lev)););
flux_x[lev].define(u_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),u_mac[lev]->Factory());,
flux_y[lev].define(v_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),v_mac[lev]->Factory());,
flux_z[lev].define(w_mac[lev]->boxArray(),dmap[lev],n_flux_comp,0,MFInfo(),w_mac[lev]->Factory()););

divu[lev].define(vel[lev]->boxArray(),dmap[lev],1,4,MFInfo(),Factory(lev));
if (m_advect_momentum)
divu[lev].define(vel[lev]->boxArray(),dmap[lev],1,4,MFInfo(),vel[lev]->Factory());

if (m_advect_momentum) {
rhovel[lev].define(vel[lev]->boxArray(),dmap[lev],AMREX_SPACEDIM,
vel[lev]->nGrow(),MFInfo(),Factory(lev));
if (m_advect_tracer && m_ntrac > 0 && any_conserv_trac)
rhotrac[lev].define(vel[lev]->boxArray(),dmap[lev],tracer[lev]->nComp(),
tracer[lev]->nGrow(),MFInfo(),Factory(lev));
vel[lev]->nGrow(),MFInfo(),vel[lev]->Factory());
}
if (m_advect_tracer && m_ntrac > 0 && any_conserv_trac) {
rhotrac[lev].define(tracer[lev]->boxArray(),dmap[lev],tracer[lev]->nComp(),
tracer[lev]->nGrow(),MFInfo(),tracer[lev]->Factory());
}

AMREX_D_TERM(faces[lev][0] = &face_x[lev];,
faces[lev][1] = &face_y[lev];,
Expand Down
17 changes: 15 additions & 2 deletions src/incflo.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include <DiffusionTensorOp.H>
#include <DiffusionScalarOp.H>

enum struct StepType {
Predictor, Corrector
};

class incflo : public amrex::AmrCore
{
public:
Expand Down Expand Up @@ -131,8 +135,8 @@ public:
//
///////////////////////////////////////////////////////////////////////////

void ApplyPredictor(bool incremental_projection = false);
void ApplyCorrector();
void ApplyPredictor (bool incremental_projection = false);
void ApplyCorrector ();
void compute_convective_term (amrex::Vector<amrex::MultiFab*> const& conv_u,
amrex::Vector<amrex::MultiFab*> const& conv_r,
amrex::Vector<amrex::MultiFab*> const& conv_t,
Expand All @@ -158,6 +162,12 @@ 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_eta,
amrex::Vector<amrex::MultiFab>& tra_forces);
void update_velocity (StepType step_type, amrex::Vector<amrex::MultiFab>& vel_eta,
amrex::Vector<amrex::MultiFab>& vel_forces);

///////////////////////////////////////////////////////////////////////////
//
// derive
Expand Down Expand Up @@ -589,6 +599,7 @@ private:
amrex::MultiFab density;
amrex::MultiFab density_eb;
amrex::MultiFab density_o;
amrex::MultiFab density_nph;
amrex::MultiFab tracer;
amrex::MultiFab tracer_eb;
amrex::MultiFab tracer_o;
Expand Down Expand Up @@ -745,6 +756,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 @@ -768,6 +780,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
Loading
Loading