/home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/actuator/disk/ActSrcDiskOp.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/actuator/disk/ActSrcDiskOp.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
ActSrcDiskOp.H
Go to the documentation of this file.
1#ifndef ACTSRCDISKOP_H_
2#define ACTSRCDISKOP_H_
8
10
11template <typename ActTrait>
13 ActTrait,
15 std::enable_if_t<std::is_base_of_v<DiskType, ActTrait>>>
16{
17 using TraitType = ActTrait;
18
19 template <typename T>
21 T,
23 std::enable_if_t<std::is_base_of_v<DiskType, T>>>;
24
26
27 friend SpreadType;
28
29protected:
30 typename ActTrait::DataType& m_data;
33
36
37 void copy_to_device();
38
39public:
40 // cppcheck-suppress uninitMemberVar
41 explicit ActSrcOp(typename ActTrait::DataType& data)
42 : m_data(data)
43 , m_act_src(m_data.sim().repo().get_field("actuator_src_term"))
44 {}
45
46 void initialize();
47
48 void setup_op() { copy_to_device(); }
49
50 void operator()(
51 const int lev, const amrex::MFIter& mfi, const amrex::Geometry& geom);
52};
53
54template <typename ActTrait>
55void ActSrcOp<
56 ActTrait,
58 std::enable_if_t<std::is_base_of_v<DiskType, ActTrait>>>::
59operator()(const int lev, const amrex::MFIter& mfi, const amrex::Geometry& geom)
60{
61 BL_PROFILE(
62 "amr-wind::ActSrcOp<" + ActTrait::identifier() +
64 m_spreading(*this, lev, mfi, geom);
65}
66
67template <typename ActTrait>
68void ActSrcOp<
69 ActTrait,
71 std::enable_if_t<std::is_base_of_v<DiskType, ActTrait>>>::initialize()
72{
73 const auto& grid = m_data.grid();
74 m_pos.resize(grid.pos.size());
75 m_force.resize(grid.force.size());
76 m_spreading.initialize(m_data.meta().spreading_type);
77}
78
79template <typename ActTrait>
80void ActSrcOp<
81 ActTrait,
83 std::enable_if_t<std::is_base_of_v<DiskType, ActTrait>>>::copy_to_device()
84{
85 const auto& grid = m_data.grid();
86
87 amrex::Gpu::copy(
88 amrex::Gpu::hostToDevice, grid.pos.begin(), grid.pos.end(),
89 m_pos.begin());
90 amrex::Gpu::copy(
91 amrex::Gpu::hostToDevice, grid.force.begin(), grid.force.end(),
92 m_force.begin());
93}
94
95} // namespace amr_wind::actuator::ops
96
97#endif /* ACTSRCDISKOP_H_ */
Definition Field.H:116
Definition actuator_ops.H:68
Definition ActSrcLineOp.H:9
amrex::Gpu::DeviceVector< amr_wind::vs::Vector > DeviceVecList
Definition actuator_types.H:66
Definition actuator_types.H:53
static std::string identifier()
Definition actuator_types.H:54