/home/runner/work/amr-wind/amr-wind/amr-wind/immersed_boundary/bluff_body/bluff_body_ops.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/immersed_boundary/bluff_body/bluff_body_ops.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
bluff_body_ops.H
Go to the documentation of this file.
1#ifndef BLUFF_BODY_OPS_H
2#define BLUFF_BODY_OPS_H
3
9
10#include "AMReX_MultiFabUtil.H"
11
12namespace amr_wind::ib {
13namespace bluff_body {
14
18void read_inputs(
19 BluffBodyBaseData& /*wdata*/,
20 IBInfo& /*unused*/,
21 const ::amr_wind::utils::MultiParser& /*pp*/);
22
26
29void apply_mms_vel(CFDSim& /*sim*/);
30
34 CFDSim& /*sim*/, const amrex::Vector<amrex::Real>& vel_bc);
35
37 const std::string& /*ncfile*/,
38 const BluffBodyBaseData& /*meta*/,
39 const IBInfo& /*info*/);
40
41void write_netcdf(
42 const std::string& /*ncfile*/,
43 const BluffBodyBaseData& /*meta*/,
44 const IBInfo& /*info*/,
45 const amrex::Real /*time*/);
46
47} // namespace bluff_body
48
49namespace ops {
50
51template <typename GeomTrait>
53{
54 static constexpr bool update_pos = true;
55 static constexpr bool update_vel = true;
56 static constexpr bool compute_force = true;
57 static constexpr bool process_outputs = true;
58};
59
60template <typename GeomTrait>
62 GeomTrait,
63 typename std::enable_if_t<std::is_base_of_v<BluffBodyType, GeomTrait>>>
64{
65 void operator()(typename GeomTrait::DataType& /*unused*/) {}
66};
67
68template <typename GeomTrait>
70 GeomTrait,
71 typename std::enable_if_t<std::is_base_of_v<BluffBodyType, GeomTrait>>>
72{
73 void operator()(typename GeomTrait::DataType& data)
74 {
75 BL_PROFILE("amr-wind::ib::IB::update_velocities");
76
77 const auto& wdata = data.meta();
78 auto& sim = data.sim();
79
80 if (wdata.is_mms) {
82 } else {
83 bluff_body::apply_dirichlet_vel(sim, wdata.vel_bc);
84 }
85 }
86};
87
88template <typename GeomTrait>
90 GeomTrait,
91 typename std::enable_if_t<std::is_base_of_v<BluffBodyType, GeomTrait>>>
92{
93 void operator()(typename GeomTrait::DataType& /*unused*/) {}
94};
95
96template <typename GeomTrait>
98 GeomTrait,
99 typename std::enable_if_t<std::is_base_of_v<BluffBodyType, GeomTrait>>>
100{
101private:
102 typename GeomTrait::DataType& m_data;
103
104 std::string m_out_dir;
105 std::string m_nc_filename;
106 int m_out_freq{10};
107
108public:
109 explicit ProcessOutputsOp(typename GeomTrait::DataType& data) : m_data(data)
110 {}
111
112 void read_io_options(const ::amr_wind::utils::MultiParser& pp)
113 {
114 pp.query("output_frequency", m_out_freq);
115 }
116
117 void prepare_outputs(const std::string& out_dir)
118 {
119 m_nc_filename = out_dir + "/" + m_data.info().label + ".nc";
121 m_nc_filename, m_data.meta(), m_data.info());
122 }
123
125 {
126 const auto& time = m_data.sim().time();
127 const int tidx = time.time_index();
128 if (tidx % m_out_freq != 0) {
129 return;
130 }
131
133 m_nc_filename, m_data.meta(), m_data.info(), time.new_time());
134 }
135};
136
137} // namespace ops
138
139} // namespace amr_wind::ib
140
141#endif /* BLUFF_BODY_OPS_H */
Definition CFDSim.H:47
void read_inputs(BluffBodyBaseData &wdata, IBInfo &, const ::amr_wind::utils::MultiParser &pp)
Definition bluff_body_ops.cpp:16
void apply_dirichlet_vel(CFDSim &sim, const amrex::Vector< amrex::Real > &vel_bc)
Definition bluff_body_ops.cpp:75
void prepare_netcdf_file(const std::string &ncfile, const BluffBodyBaseData &meta, const IBInfo &info)
Definition bluff_body_ops.cpp:136
void apply_mms_vel(CFDSim &sim)
Definition bluff_body_ops.cpp:29
void write_netcdf(const std::string &ncfile, const BluffBodyBaseData &meta, const IBInfo &info, const amrex::Real time)
Definition bluff_body_ops.cpp:144
void init_data_structures(BluffBodyBaseData &)
Definition bluff_body_ops.cpp:27
Definition bluff_body_ops.cpp:14
Definition BluffBody.H:16
Definition IBTypes.H:39
Definition IBOps.H:43
Definition IBOps.H:54
Definition bluff_body_ops.H:53
static constexpr bool update_pos
Definition bluff_body_ops.H:54
static constexpr bool update_vel
Definition bluff_body_ops.H:55
static constexpr bool process_outputs
Definition bluff_body_ops.H:57
static constexpr bool compute_force
Definition bluff_body_ops.H:56