/home/runner/work/amr-wind/amr-wind/amr-wind/ocean_waves/OceanWavesModel.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/ocean_waves/OceanWavesModel.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
OceanWavesModel.H
Go to the documentation of this file.
1#ifndef WAVE_MODEL_H
2#define WAVE_MODEL_H
3
8
9namespace amr_wind {
10
11class CFDSim;
12
13namespace ocean_waves {
14
22 : public Factory<OceanWavesModel, CFDSim&, const std::string&, const int>
23{
24public:
25 static std::string base_identifier() { return "OceanWaveModel"; }
26
27 ~OceanWavesModel() override = default;
28
29 virtual const std::string& label() const = 0;
30
31 virtual int id() const = 0;
32
33 virtual void read_inputs(const ::amr_wind::utils::MultiParser&) = 0;
34
35 virtual void init_waves(int, const amrex::Geometry&) = 0;
36
37 virtual void update_relax_zones() = 0;
38
39 virtual void apply_relax_zones() = 0;
40
41 virtual void prepare_outputs(const std::string&) = 0;
42
43 virtual void write_outputs() = 0;
44
45 virtual void record_regrid_flag() = 0;
46
47 virtual void reset_regrid_flag() = 0;
48};
49
60template <typename WaveTheoryTrait>
61class OWModel : public OceanWavesModel::Register<OWModel<WaveTheoryTrait>>
62{
63private:
65 typename WaveTheoryTrait::DataType m_data;
66
69
70public:
71 static std::string identifier() { return WaveTheoryTrait::identifier(); }
72
78 OWModel(CFDSim& sim, const std::string& label, const int id)
79 : m_data(sim, label, id), m_out_op(m_data)
80 {}
81
83 const std::string& label() const override { return m_data.info().label; }
84
86 int id() const override { return m_data.info().id; }
87
88 void read_inputs(const ::amr_wind::utils::MultiParser& pp) override
89 {
91 m_out_op.read_io_options(pp);
92 }
93
98
103
104 void prepare_outputs(const std::string& out_dir) override
105 {
106 m_out_op.prepare_outputs(out_dir);
107 }
108
109 void record_regrid_flag() override { m_data.meta().regrid_occurred = true; }
110
111 void reset_regrid_flag() override { m_data.meta().regrid_occurred = false; }
112
113 void write_outputs() override { m_out_op.write_outputs(); }
114
115 void init_waves(int level, const amrex::Geometry& geom) override
116 {
118 }
119};
120
121} // namespace ocean_waves
122} // namespace amr_wind
123
124#endif /* OWMODEL_H */
Definition CFDSim.H:47
Definition OceanWavesModel.H:62
void record_regrid_flag() override
Definition OceanWavesModel.H:109
const std::string & label() const override
Return the unique identifier (name) for this instance.
Definition OceanWavesModel.H:83
void update_relax_zones() override
Definition OceanWavesModel.H:94
static std::string identifier()
Definition OceanWavesModel.H:71
void apply_relax_zones() override
Definition OceanWavesModel.H:99
void reset_regrid_flag() override
Definition OceanWavesModel.H:111
WaveTheoryTrait::DataType m_data
Instance that holds all data related to a particular wave type.
Definition OceanWavesModel.H:65
OWModel(CFDSim &sim, const std::string &label, const int id)
Definition OceanWavesModel.H:78
void init_waves(int level, const amrex::Geometry &geom) override
Definition OceanWavesModel.H:115
int id() const override
Return the unique tag (integer ID) for this instance.
Definition OceanWavesModel.H:86
void read_inputs(const ::amr_wind::utils::MultiParser &pp) override
Definition OceanWavesModel.H:88
void write_outputs() override
Definition OceanWavesModel.H:113
void prepare_outputs(const std::string &out_dir) override
Definition OceanWavesModel.H:104
ops::ProcessOutputsOp< WaveTheoryTrait > m_out_op
Outputs processor.
Definition OceanWavesModel.H:68
Definition OceanWavesModel.H:23
virtual void read_inputs(const ::amr_wind::utils::MultiParser &)=0
virtual void prepare_outputs(const std::string &)=0
static std::string base_identifier()
Definition OceanWavesModel.H:25
virtual const std::string & label() const =0
virtual void init_waves(int, const amrex::Geometry &)=0
Definition BCInterface.cpp:7
Definition Factory.H:65
Definition OceanWavesOps.H:32
Definition OceanWavesOps.H:19