/home/runner/work/amr-wind/amr-wind/amr-wind/incflo.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/incflo.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
incflo.H
Go to the documentation of this file.
1#ifndef INCFLO_H_
2#define INCFLO_H_
3
4#include <AMReX_AmrCore.H>
5#include <AMReX_MultiFabUtil.H>
6#include <AMReX_ParmParse.H>
7#include <AMReX_iMultiFab.H>
8#include <hydro_NodalProjector.H>
9
11#include "amr-wind/CFDSim.H"
15
16namespace amr_wind {
17namespace pde {
18class PDEBase;
19}
20class RefinementCriteria;
21class RefineCriteriaManager;
22} // namespace amr_wind
23
49class incflo : public amrex::AmrCore
50{
51public:
52 incflo();
53 ~incflo() override;
54
55 // Initialize multilevel AMR data
56 void InitData();
57
58 // Evolve solution to final time through repeated calls to Advance()
59 void Evolve();
60
61 // Tag cells for refinement
62 void
63 ErrorEst(int lev, amrex::TagBoxArray& tags, amrex::Real time, int ngrow)
64 override;
65
66 // Make a new level from scratch using provided BoxArray and
67 // DistributionMapping Only used during initialization
69 int lev,
70 amrex::Real time,
71 const amrex::BoxArray& new_grids,
72 const amrex::DistributionMapping& new_dmap) override;
73
74 // Make a new level using provided BoxArray and DistributionMapping,
75 // and fill with interpolated coarse level data
77 int lev,
78 amrex::Real time,
79 const amrex::BoxArray& ba,
80 const amrex::DistributionMapping& dm) override;
81
82 // Remake an existing level using provided BoxArray and DistributionMapping,
83 // and fill with existing fine and coarse data
84 void RemakeLevel(
85 int lev,
86 amrex::Real time,
87 const amrex::BoxArray& ba,
88 const amrex::DistributionMapping& dm) override;
89
90 // Delete level data
91 void ClearLevel(int lev) override;
92
93 void init_mesh();
96 bool regrid_and_update();
97 void pre_advance_stage1();
98 void pre_advance_stage2();
99 void prepare_time_step();
100 void do_advance(const int fixed_point_iteration);
101 void advance(const int fixed_point_iteration);
102 void prescribe_advance();
103 void post_advance_work();
104
106 const amr_wind::SimTime& time() const { return m_time; }
108 const amr_wind::FieldRepo& repo() const { return m_repo; }
109
112 {
113 return m_sim.pde_manager().icns();
114 }
123
124 amr_wind::Field& velocity() const { return m_repo.get_field("velocity"); }
125 amr_wind::Field& density() const { return m_repo.get_field("density"); }
127 {
128 return m_repo.get_field("temperature");
129 }
130 amr_wind::Field& pressure() const { return m_repo.get_field("p"); }
131 amr_wind::Field& grad_p() const { return m_repo.get_field("gp"); }
132
133 // for cuda
134 void ComputeDt(bool explicit_diffusion);
135 void ComputePrescribeDt();
136
137 void ApplyPredictor(
138 const bool incremental_projection = false,
139 const int fixed_point_iteration = 0);
140 void ApplyCorrector();
141 void ApplyPrescribeStep();
142
143 void ApplyProjection(
144 amrex::Vector<amrex::MultiFab const*> density,
145 amrex::Real time,
146 amrex::Real scaling_factor,
147 bool incremental);
148
151
152 void ReadCheckpointFile();
153
154private:
155 //
156 // member variables
157 //
158
163
164 std::unique_ptr<amr_wind::RefineCriteriaManager> m_mesh_refiner;
165
166 // Be verbose?
167 int m_verbose = 0;
168
169 // Initial projection / iterations
170 bool m_do_initial_proj = true;
172
173 bool m_use_godunov = true;
174
175 // Prescribe advection velocity
176 bool m_prescribe_vel = false;
177
178 // Perform a dry run (0 steps, output plotfile)
179 bool m_dry_run = false;
180
181 // Fixed point iterations every timestep
183
185 amrex::Long m_cell_count{-1};
186
188
191
192 //
193 // end of member variables
194 //
195
196 amrex::FabFactory<amrex::FArrayBox> const& Factory(int lev) const noexcept
197 {
198 return m_repo.factory(lev);
199 }
200
201 bool need_divtau() const
202 {
204 }
206 //
207 // setup
208 //
210
211 void CheckAndSetUpDryRun();
212 void ReadParameters();
213 void InitialProjection();
214 void InitialIterations();
215
217 //
218 // utilities
219 //
221 void PrintMaxValues(const std::string& header);
222 void PrintMaxVelLocations(const std::string& header);
223 void PrintMaxVel(int lev) const;
224 void PrintMaxGp(int lev) const;
225 void CheckForNans(int lev) const;
226};
227
228#endif
Definition CFDSim.H:47
pde::PDEMgr & pde_manager()
Definition CFDSim.H:65
amrex::Vector< TypePtr > TypeVector
Definition CollMgr.H:25
Definition Field.H:116
Definition FieldRepo.H:86
Field & get_field(const std::string &name, const FieldState fstate=FieldState::New) const
Definition FieldRepo.cpp:149
const amrex::FabFactory< amrex::FArrayBox > & factory(int lev) const noexcept
Return factory instance at a given level.
Definition FieldRepo.H:377
Definition OversetOps.H:10
Definition SimTime.H:30
Definition PDEBase.H:51
PDEBase & icns()
Return the incompressible Navier-Stokes instance.
Definition PDEBase.H:122
TypeVector & scalar_eqns()
Definition PDEBase.H:148
Definition incflo.H:50
void Evolve()
Definition incflo.cpp:276
const amr_wind::pde::PDEMgr::TypeVector & scalar_eqns() const
Definition incflo.H:119
void ApplyPredictor(const bool incremental_projection=false, const int fixed_point_iteration=0)
Definition incflo_advance.cpp:182
const amr_wind::SimTime & time() const
Definition incflo.H:106
amr_wind::Field & density() const
Definition incflo.H:125
void ApplyPrescribeStep()
Definition incflo_advance.cpp:673
void pre_advance_stage1()
Definition incflo_advance.cpp:14
void ClearLevel(int lev) override
Definition incflo_regrid.cpp:38
incflo()
Definition incflo.cpp:16
void ApplyProjection(amrex::Vector< amrex::MultiFab const * > density, amrex::Real time, amrex::Real scaling_factor, bool incremental)
Definition incflo_apply_nodal_projection.cpp:147
void ComputePrescribeDt()
Definition incflo_compute_dt.cpp:200
amr_wind::Field & temperature() const
Definition incflo.H:126
std::unique_ptr< amr_wind::RefineCriteriaManager > m_mesh_refiner
Definition incflo.H:164
bool m_dry_run
Definition incflo.H:179
bool m_prescribe_vel
Definition incflo.H:176
amr_wind::Field & velocity() const
Definition incflo.H:124
void prepare_for_time_integration()
Definition incflo.cpp:134
void advance(const int fixed_point_iteration)
Definition incflo_advance.cpp:59
void post_advance_work()
Definition incflo.cpp:248
void InitialIterations()
Definition init.cpp:102
void init_amr_wind_modules()
Definition incflo.cpp:99
void ReadParameters()
Definition init.cpp:47
void RemakeLevel(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm) override
Definition incflo_regrid.cpp:24
amr_wind::CFDSim m_sim
Definition incflo.H:159
void do_advance(const int fixed_point_iteration)
Definition incflo.cpp:332
int m_initial_iterations
Definition incflo.H:171
void CheckAndSetUpDryRun()
Definition init.cpp:13
int m_fixed_point_iterations
Definition incflo.H:182
void ReadCheckpointFile()
Definition io.cpp:20
bool need_divtau() const
Definition incflo.H:201
void PrintMaxGp(int lev) const
Definition diagnostics.cpp:626
void PrintMaxVelLocations(const std::string &header)
Definition diagnostics.cpp:607
amr_wind::OversetOps m_ovst_ops
Definition incflo.H:162
amr_wind::Field & grad_p() const
Definition incflo.H:131
DiffusionType m_diff_type
Definition incflo.H:187
bool m_use_godunov
Definition incflo.H:173
amr_wind::pde::PDEBase & icns()
Definition incflo.H:110
amr_wind::SimTime & m_time
Definition incflo.H:160
void MakeNewLevelFromScratch(int lev, amrex::Real time, const amrex::BoxArray &new_grids, const amrex::DistributionMapping &new_dmap) override
Definition incflo.cpp:354
amrex::Long m_cell_count
number of cells on all levels including covered cells
Definition incflo.H:185
amr_wind::CFDSim & sim()
Definition incflo.H:105
void prepare_time_step()
Definition incflo_advance.cpp:33
void prescribe_advance()
Definition incflo_advance.cpp:664
amr_wind::FieldRepo & m_repo
Definition incflo.H:161
~incflo() override
void ErrorEst(int lev, amrex::TagBoxArray &tags, amrex::Real time, int ngrow) override
Definition incflo.cpp:437
bool m_do_initial_proj
Definition incflo.H:170
void MakeNewLevelFromCoarse(int lev, amrex::Real time, const amrex::BoxArray &ba, const amrex::DistributionMapping &dm) override
Definition incflo_regrid.cpp:8
void init_physics_and_pde()
Initialize Physics instances as well as PDEs (include turbulence models)
Definition incflo.cpp:385
void InitData()
Definition incflo.cpp:170
amr_wind::FieldRepo & repo()
Definition incflo.H:107
void InitialProjection()
Definition init.cpp:183
bool m_reconstruct_true_pressure
reconstruct true pressure
Definition incflo.H:190
bool regrid_and_update()
Definition incflo.cpp:183
void PrintMaxVel(int lev) const
Definition diagnostics.cpp:615
const amr_wind::pde::PDEBase & icns() const
Definition incflo.H:111
int m_verbose
Definition incflo.H:167
amr_wind::Field & pressure() const
Definition incflo.H:130
void pre_advance_stage2()
Definition incflo_advance.cpp:23
void CheckForNans(int lev) const
Definition diagnostics.cpp:635
void ComputeDt(bool explicit_diffusion)
Definition incflo_compute_dt.cpp:35
void init_mesh()
Definition incflo.cpp:43
void PrintMaxValues(const std::string &header)
Definition diagnostics.cpp:564
amr_wind::pde::PDEMgr::TypeVector & scalar_eqns()
Definition incflo.H:115
void ApplyCorrector()
Definition incflo_advance.cpp:538
const amr_wind::FieldRepo & repo() const
Definition incflo.H:108
amrex::FabFactory< amrex::FArrayBox > const & Factory(int lev) const noexcept
Definition incflo.H:196
DiffusionType
Definition incflo_enums.H:4
Definition BCInterface.cpp:7