/home/runner/work/amr-wind/amr-wind/amr-wind/equation_systems/icns/icns_bcop.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/equation_systems/icns/icns_bcop.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
icns_bcop.H
Go to the documentation of this file.
1#ifndef ICNS_BCOP_H
2#define ICNS_BCOP_H
3
7#include "AMReX_REAL.H"
8
9using namespace amrex::literals;
10
11namespace amr_wind::pde {
12
16template <>
17struct BCOp<ICNS>
18{
19 BCOp(PDEFields& fields, const SimTime& time)
20 : m_fields(fields), m_time(time)
21 {}
22
25 void init_bcs()
26 {
27 BCVelocity bc(m_fields.field);
28 bc();
29 const auto udfs = bc.get_dirichlet_udfs();
31 m_fields.field, m_fields.repo.mesh(), m_time, udfs);
32
33 auto& density = m_fields.repo.get_field("density");
34 const amrex::Real density_default = 1.0_rt;
35 BCScalar bc_den(density);
36 bc_den(density_default);
37
38 auto& pressure = m_fields.repo.get_field("p");
39 BCPressure bc_pres(pressure);
40 bc_pres();
41
42 // Used for fillpatch operation on the source term
43 BCSrcTerm bc_src(m_fields.src_term);
44 bc_src();
45
46 // Used for fillpatch operation during regrid
47 auto& gradp = m_fields.repo.get_field("gp");
48 gradp.set_default_fillpatch_bc(m_time);
49 }
50
53 void apply_bcs(const FieldState rho_state)
54 {
55 amrex::IntVect ng_diff(1);
56 auto& field = m_fields.field;
57 if ((rho_state != FieldState::Old && rho_state != FieldState::New)) {
58 amrex::Abort(
59 "icns_bcop.H apply_bcs(): a state other than New or Old was "
60 "used. The time used for fillphysbc must be evaluated before "
61 "using a different state for this routine.\n");
62 }
63 if (rho_state == FieldState::New) {
64 field.fillphysbc(m_time.new_time(), ng_diff);
65 }
66 field.apply_bc_funcs(rho_state);
67 }
68
71};
72
73} // namespace amr_wind::pde
74
75#endif /* ICNS_BCOP_H */
amrex::Array< const std::string, 3 > get_dirichlet_udfs()
User-defined functions for Dirichlet-type boundaries.
Definition BCInterface.cpp:118
Definition BCInterface.H:129
Definition BCInterface.H:114
Definition BCInterface.H:144
Definition BCInterface.H:101
Definition SimTime.H:33
FieldState
Definition FieldDescTypes.H:14
@ New
Same as FieldState::NP1.
Definition FieldDescTypes.H:20
@ Old
Same as FieldState::N.
Definition FieldDescTypes.H:21
Definition AdvOp_Godunov.H:21
void register_velocity_dirichlet(Field &field, const amrex::AmrCore &mesh, const SimTime &time, const amrex::Array< const std::string, 3 > &udfs)
Definition velocity_bcs.H:53
PDEFields & m_fields
Definition icns_bcop.H:69
const SimTime & m_time
Definition icns_bcop.H:70
void init_bcs()
Definition icns_bcop.H:25
BCOp(PDEFields &fields, const SimTime &time)
Definition icns_bcop.H:19
void apply_bcs(const FieldState rho_state)
Definition icns_bcop.H:53
Definition icns.H:34
Definition PDEFields.H:27