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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/ocean_waves/relaxation_zones/relaxation_zones_ops.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
relaxation_zones_ops.H
Go to the documentation of this file.
1#ifndef RELAX_ZONES_OPS_H
2#define RELAX_ZONES_OPS_H
3
10
11#include "AMReX_MultiFabUtil.H"
12
13namespace amr_wind::ocean_waves {
14namespace relaxation_zones {
15
18void read_inputs(
19 RelaxZonesBaseData& /*wdata*/,
20 OceanWavesInfo& /*unused*/,
21 const ::amr_wind::utils::MultiParser& /*pp*/);
22
26
29void apply_relaxation_zones(CFDSim& sim, const RelaxZonesBaseData& wdata);
30
32 const std::string& /*ncfile*/,
33 const RelaxZonesBaseData& /*meta*/,
34 const OceanWavesInfo& /*info*/);
35
36void write_netcdf(
37 const std::string& /*ncfile*/,
38 const RelaxZonesBaseData& /*meta*/,
39 const OceanWavesInfo& /*info*/,
40 const amrex::Real /*time*/);
41
42} // namespace relaxation_zones
43
44namespace ops {
45
46template <typename WaveTheoryTrait>
48{
49 static constexpr bool update_relaxation_zones = true;
50 static constexpr bool apply_relaxation_zones = true;
51};
52
53template <typename WaveTheoryTrait>
55 WaveTheoryTrait,
56 typename std::enable_if_t<
57 std::is_base_of_v<RelaxZonesType, WaveTheoryTrait>>>
58{
59 void operator()(typename WaveTheoryTrait::DataType& /*unused*/) {}
60};
61
62template <typename WaveTheoryTrait>
64 WaveTheoryTrait,
65 typename std::enable_if_t<
66 std::is_base_of_v<RelaxZonesType, WaveTheoryTrait>>>
67{
68 void operator()(typename WaveTheoryTrait::DataType& data)
69 {
70 BL_PROFILE("amr-wind::ocean_waves::OceanWaves::update_velocities");
71
72 const auto& wdata = data.meta();
73 auto& sim = data.sim();
74
76 }
77};
78
79template <typename WaveTheoryTrait>
81 WaveTheoryTrait,
82 typename std::enable_if_t<
83 std::is_base_of_v<RelaxZonesType, WaveTheoryTrait>>>
84{
85private:
86 typename WaveTheoryTrait::DataType& m_data;
87
88 std::string m_out_dir;
89 std::string m_nc_filename;
90 int m_out_freq{10};
91
92public:
93 explicit ProcessOutputsOp(typename WaveTheoryTrait::DataType& data)
94 : m_data(data)
95 {}
96
97 void read_io_options(const ::amr_wind::utils::MultiParser& pp)
98 {
99 pp.query("output_frequency", m_out_freq);
100 }
101
102 void prepare_outputs(const std::string& out_dir)
103 {
104 m_nc_filename = out_dir + "/" + m_data.info().label + ".nc";
106 m_nc_filename, m_data.meta(), m_data.info());
107 }
108
110 {
111 const auto& time = m_data.sim().time();
112 const int tidx = time.time_index();
113 if (tidx % m_out_freq != 0) {
114 return;
115 }
116
118 m_nc_filename, m_data.meta(), m_data.info(), time.new_time());
119 }
120};
121
122} // namespace ops
123
124} // namespace amr_wind::ocean_waves
125
126#endif /* RELAX_ZONES_OPS_H */
Definition CFDSim.H:51
void init_data_structures(RelaxZonesBaseData &)
Definition relaxation_zones_ops.cpp:47
void write_netcdf(const std::string &ncfile, const RelaxZonesBaseData &meta, const OceanWavesInfo &info, const amrex::Real time)
Definition relaxation_zones_ops.cpp:242
void apply_relaxation_zones(CFDSim &sim, const RelaxZonesBaseData &wdata)
Definition relaxation_zones_ops.cpp:49
void read_inputs(RelaxZonesBaseData &wdata, OceanWavesInfo &, const ::amr_wind::utils::MultiParser &pp)
Definition relaxation_zones_ops.cpp:15
void prepare_netcdf_file(const std::string &ncfile, const RelaxZonesBaseData &meta, const OceanWavesInfo &info)
Definition relaxation_zones_ops.cpp:234
Definition OceanWaves.cpp:11
Definition OceanWavesTypes.H:35
Definition RelaxationZones.H:16
Definition relaxation_zones_ops.H:48
static constexpr bool update_relaxation_zones
Definition relaxation_zones_ops.H:49
static constexpr bool apply_relaxation_zones
Definition relaxation_zones_ops.H:50