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

Multiphase Hybrid - FY23 Q4 milestone (reinitialization/sharpening and pressure approach) #1065

Merged
merged 33 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f7005d2
compiles; a couple things still need to be added
mbkuhn May 17, 2024
3324a73
prescribed velocity simulations should not need special treatment
mbkuhn May 17, 2024
6cc387b
provide options for decoupling projections in overset
mbkuhn May 17, 2024
98f417a
formatting
mbkuhn May 17, 2024
dcd5e36
CI
mbkuhn May 17, 2024
998a91e
testing neumann vof normal calc
mbkuhn May 20, 2024
d0bba36
unit test for alpha flux
mbkuhn May 21, 2024
f8685c0
generalize to test every direction
mbkuhn May 21, 2024
8baac51
velocity_face unit test
mbkuhn May 21, 2024
f5bad9e
verbosity for output on each sharpen step
mbkuhn May 21, 2024
8efaee9
Merge branch 'main' into mphase_hybrid_overset_ops1
mbkuhn Jun 5, 2024
1486fe9
multiple changes from regression testing
mbkuhn Jun 7, 2024
e18c0b7
make hydrostatic_ops unit test harder to pass (fails with old impleme…
mbkuhn Jun 7, 2024
a78a35c
verbosity output tweaks
mbkuhn Jun 7, 2024
9f05c8d
Merge branch 'main' into mphase_hybrid_overset_ops1
mbkuhn Jun 11, 2024
8ebe11e
first set of review edits
mbkuhn Jul 5, 2024
9210f29
correcting logic
mbkuhn Jul 5, 2024
34a8b66
verbose names, remove comments
mbkuhn Jul 5, 2024
d489027
const
mbkuhn Jul 5, 2024
429d268
remove unnecessary intermediate variables
mbkuhn Jul 8, 2024
21c865f
better ibdy code
mbkuhn Jul 8, 2024
84182bd
fd = finite_difference
mbkuhn Jul 8, 2024
7cc5799
fix weird alpha logic in levelset2vof
mbkuhn Jul 8, 2024
c8fe66d
mm1, mm2 declarations
mbkuhn Jul 8, 2024
81e7914
some IntVect stuff
mbkuhn Jul 8, 2024
dee3540
correct IntVect declaration
mbkuhn Jul 8, 2024
aa332f9
run_algorithm tweaks
mbkuhn Jul 8, 2024
e7805c8
remove wrong comments
mbkuhn Jul 8, 2024
ba313a0
IntVect tweaks
mbkuhn Jul 8, 2024
de635d4
initialize things that come from elsewhere with quiet_NaN
mbkuhn Jul 8, 2024
1be8734
fused mfiters for most loops in overset_ops_routines
mbkuhn Jul 8, 2024
e3ba6fb
more fused MFIter
mbkuhn Jul 8, 2024
e976aff
remove "_arrs" suffix; seems repetitive and unnecessary for this file
mbkuhn Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions amr-wind/equation_systems/icns/icns_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ MacProjOp::MacProjOp(
{
amrex::ParmParse pp("incflo");
pp.query("density", m_rho_0);
amrex::ParmParse pp_ovst("Overset");
bool disable_ovst_mac = false;
pp.query("disable_coupled_mac_proj", disable_ovst_mac);
if (m_has_overset && disable_ovst_mac) {
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved
m_has_overset = false;
}
}

void MacProjOp::init_projector(const MacProjOp::FaceFabPtrVec& beta) noexcept
Expand Down
60 changes: 60 additions & 0 deletions amr-wind/equation_systems/vof/volume_fractions.H
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,66 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void youngs_fd_normal(
mz = mm1 - mm2;
}


AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void youngs_fd_normal_neumann(
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved
int i,
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved
int j,
int k,
int ibdy,
int jbdy,
int kbdy,
amrex::Array4<amrex::Real const> const& volfrac,
amrex::Real& mx,
amrex::Real& my,
amrex::Real& mz) noexcept
{
amrex::Real mm1, mm2;
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved

// Do neumann condition via indices
int im1 = ibdy == -1 ? i : i - 1;
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved
int jm1 = jbdy == -1 ? j : j - 1;
marchdf marked this conversation as resolved.
Show resolved Hide resolved
int km1 = kbdy == -1 ? k : k - 1;
int ip1 = ibdy == +1 ? i : i + 1;
int jp1 = jbdy == +1 ? j : j + 1;
int kp1 = kbdy == +1 ? k : k + 1;

mm1 = volfrac(im1, jm1, km1) + volfrac(im1, jm1, kp1) +
volfrac(im1, jp1, km1) + volfrac(im1, jp1, kp1) +
2.0 * (volfrac(im1, jm1, k) + volfrac(im1, jp1, k) +
volfrac(im1, j, km1) + volfrac(im1, j, kp1)) +
4.0 * volfrac(im1, j, k);
mm2 = volfrac(ip1, jm1, km1) + volfrac(ip1, jm1, kp1) +
volfrac(ip1, jp1, km1) + volfrac(ip1, jp1, kp1) +
2.0 * (volfrac(ip1, jm1, k) + volfrac(ip1, jp1, k) +
volfrac(ip1, j, km1) + volfrac(ip1, j, kp1)) +
4.0 * volfrac(ip1, j, k);
mx = mm1 - mm2;

mm1 = volfrac(im1, jm1, km1) + volfrac(im1, jm1, kp1) +
volfrac(ip1, jm1, km1) + volfrac(ip1, jm1, kp1) +
2.0 * (volfrac(im1, jm1, k) + volfrac(ip1, jm1, k) +
volfrac(i, jm1, km1) + volfrac(i, jm1, kp1)) +
4.0 * volfrac(i, jm1, k);
mm2 = volfrac(im1, jp1, km1) + volfrac(im1, jp1, kp1) +
volfrac(ip1, jp1, km1) + volfrac(ip1, jp1, kp1) +
2.0 * (volfrac(im1, jp1, k) + volfrac(ip1, jp1, k) +
volfrac(i, jp1, km1) + volfrac(i, jp1, kp1)) +
4.0 * volfrac(i, jp1, k);
my = mm1 - mm2;

mm1 = volfrac(im1, jm1, km1) + volfrac(im1, jp1, km1) +
volfrac(ip1, jm1, km1) + volfrac(ip1, jp1, km1) +
2.0 * (volfrac(im1, j, km1) + volfrac(ip1, j, km1) +
volfrac(i, jm1, km1) + volfrac(i, jp1, km1)) +
4.0 * volfrac(i, j, km1);
mm2 = volfrac(im1, jm1, kp1) + volfrac(im1, jp1, kp1) +
volfrac(ip1, jm1, kp1) + volfrac(ip1, jp1, kp1) +
2.0 * (volfrac(im1, j, kp1) + volfrac(ip1, j, kp1) +
volfrac(i, jm1, kp1) + volfrac(i, jp1, kp1)) +
4.0 * volfrac(i, j, kp1);
mz = mm1 - mm2;
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mixed_youngs_central_normal(
int i,
int j,
Expand Down
3 changes: 3 additions & 0 deletions amr-wind/incflo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ void incflo::do_advance()
} else {
advance();
}
if (m_sim.has_overset()) {
m_ovst_ops.post_advance_work();
}
}

// Make a new level from scratch using provided BoxArray and
Expand Down
42 changes: 42 additions & 0 deletions amr-wind/overset/OversetOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,52 @@ public:

void initialize(CFDSim& sim);
void pre_advance_work();
void post_advance_work();

void update_gradp();

private:
// Functions called within public functions
void parameter_output();
void sharpen_nalu_data();
void set_hydrostatic_gradp();
void replace_masked_gradp();

// Check for multiphase sim
bool m_vof_exists{false};
// Check for perturbational pressure
// (will be removed soon)
bool m_perturb_p{false};

// This is the only option for now
const bool m_use_hs_pgrad{true};
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved

// Coupling options
bool m_disable_nodal_proj{false};
bool m_disable_mac_proj{false};
bool m_replace_gp{false};

// Verbosity
int m_verbose{0};

// Reinitialization parameters
int m_niterations{10};
int m_calcconvint{1}; // calctolniter, cconv
mbkuhn marked this conversation as resolved.
Show resolved Hide resolved
amrex::Real m_tol = 1e-12;
amrex::Real m_rlscale = 1.5;
amrex::Real m_margin = 0.1;
amrex::Real m_target_cutoff = 0.0; // proc_tgvof_tol

// Tolerance for VOF-related bound checks
const amrex::Real m_vof_tol = 1e-12;
// Small number for approximate signed distance function
const amrex::Real m_asdf_tiny = 1e-12;

// Pointer for pressure gradient copy field
amr_wind::Field* m_gp_copy{nullptr};
// Pointer for MultiPhase physics
amr_wind::MultiPhase* m_mphase{nullptr};

CFDSim* m_sim_ptr;
};

Expand Down
Loading