1#ifndef DISK_SPREADING_H_
2#define DISK_SPREADING_H_
27 const amrex::MFIter& mfi,
28 const amrex::Geometry& geom)
40 const amrex::Geometry&);
45 const amrex::MFIter& mfi,
46 const amrex::Geometry& geom)
48 const auto& bx = mfi.tilebox();
51 actObj.m_data.info().bound_box, geom);
52 const auto& bxi = bx & bxa;
57 const auto& sarr = actObj.m_act_src(lev).array(mfi);
58 const auto& problo = geom.ProbLoArray();
59 const auto& dx = geom.CellSizeArray();
61 const auto& data = actObj.m_data.meta();
65 const auto* pos = actObj.m_pos.data();
66 const auto* force = actObj.m_force.data();
67 const int npts = data.num_force_pts;
68 const int nForceTheta = data.num_force_theta_pts;
72 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
noexcept {
74 problo[0] + (i + 0.5) * dx[0],
75 problo[1] + (j + 0.5) * dx[1],
76 problo[2] + (k + 0.5) * dx[2],
79 amrex::RealArray src_force = {0.0};
80 for (
int ip = 0; ip < npts; ++ip) {
81 const auto& pforce = force[ip] / nForceTheta;
82 const auto pLoc = pos[ip];
84 for (
int it = 0; it < nForceTheta; ++it) {
85 const amrex::Real angle =
88 const auto diskPoint = pLoc & rotMatrix;
89 const auto distance = diskPoint - cc;
90 const auto projection_weight =
93 src_force[0] += projection_weight * pforce.x();
94 src_force[1] += projection_weight * pforce.y();
95 src_force[2] += projection_weight * pforce.z();
99 sarr(i, j, k, 0) += src_force[0];
100 sarr(i, j, k, 1) += src_force[1];
101 sarr(i, j, k, 2) += src_force[2];
108 const amrex::MFIter& mfi,
109 const amrex::Geometry& geom)
111 const auto& bx = mfi.tilebox();
114 actObj.m_data.info().bound_box, geom);
115 const auto& bxi = bx & bxa;
120 const auto& sarr = actObj.m_act_src(lev).array(mfi);
121 const auto& problo = geom.ProbLoArray();
122 const auto& dx = geom.CellSizeArray();
124 const auto& data = actObj.m_data.meta();
126 const amrex::Real dR = data.dr;
127 const amrex::Real epsilon = data.epsilon;
130 const auto* pos = actObj.m_pos.data();
131 const auto* force = actObj.m_force.data();
132 const int npts = data.num_force_pts;
135 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
noexcept {
137 problo[0] + (i + 0.5) * dx[0],
138 problo[1] + (j + 0.5) * dx[1],
139 problo[2] + (k + 0.5) * dx[2],
142 amrex::RealArray src_force = {0.0};
143 for (
int ip = 0; ip < npts; ++ip) {
145 m_origin, m_normal, m_origin, pos[ip])
147 const auto dist_on_disk =
149 const auto& pforce = force[ip];
151 const amrex::Real weight_R =
153 const amrex::Real weight_T =
155 const amrex::Real weight_N =
157 const auto projection_weight =
158 weight_R * weight_T * weight_N;
160 src_force[0] += projection_weight * pforce.x();
161 src_force[1] += projection_weight * pforce.y();
162 src_force[2] += projection_weight * pforce.z();
165 sarr(i, j, k, 0) += src_force[0];
166 sarr(i, j, k, 1) += src_force[1];
167 sarr(i, j, k, 2) += src_force[2];
173 const amrex::MFIter& mfi,
174 const amrex::Geometry& geom)
176 const auto& bx = mfi.tilebox();
179 actObj.m_data.info().bound_box, geom);
180 const auto& bxi = bx & bxa;
185 const auto& sarr = actObj.m_act_src(lev).array(mfi);
186 const auto& problo = geom.ProbLoArray();
187 const auto& dx = geom.CellSizeArray();
189 const auto& data = actObj.m_data.meta();
191 const amrex::Real dR = data.dr;
192 const amrex::Real dTheta =
194 const amrex::Real epsilon = data.epsilon;
197 const auto* pos = actObj.m_pos.data();
198 const auto* force = actObj.m_force.data();
199 const int npts = data.num_force_pts;
202 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
noexcept {
204 problo[0] + (i + 0.5) * dx[0],
205 problo[1] + (j + 0.5) * dx[1],
206 problo[2] + (k + 0.5) * dx[2],
209 amrex::RealArray src_force = {0.0};
210 for (
int ip = 0; ip < npts; ++ip) {
213 m_origin, m_normal, m_origin, pos[ip])
215 const auto dArc = radius * dTheta;
216 const auto dist_on_disk =
218 const amrex::Real arclength = dist_on_disk.y() * radius;
219 const auto& pforce = force[ip];
221 const amrex::Real weight_R =
223 const amrex::Real weight_T =
225 const amrex::Real weight_N =
227 const auto projection_weight =
228 weight_R * weight_T * weight_N;
230 src_force[0] += projection_weight * pforce.x();
231 src_force[1] += projection_weight * pforce.y();
232 src_force[2] += projection_weight * pforce.z();
235 sarr(i, j, k, 0) += src_force[0];
236 sarr(i, j, k, 1) += src_force[1];
237 sarr(i, j, k, 2) += src_force[2];
245 if (std::is_same<UniformCt, typename OwnerType::TraitType>::value) {
246 if (key ==
"UniformGaussian") {
248 }
else if (key ==
"LinearBasis") {
251 amrex::Abort(
"Invalid spreading type");
A collection of spreading functions This class allows for polymorphic spreading functions....
Definition disk_spreading.H:20
void linear_basis_spreading(const T &actObj, const int lev, const amrex::MFIter &mfi, const amrex::Geometry &geom)
Definition disk_spreading.H:105
SpreadingFunction()
Definition disk_spreading.H:241
void linear_basis_in_theta(const T &actObj, const int lev, const amrex::MFIter &mfi, const amrex::Geometry &geom)
Definition disk_spreading.H:170
void uniform_gaussian_spreading(const T &actObj, const int lev, const amrex::MFIter &mfi, const amrex::Geometry &geom)
Definition disk_spreading.H:42
T OwnerType
Definition disk_spreading.H:22
void initialize(const std::string &key)
Definition disk_spreading.H:243
SpreadingFunction(const SpreadingFunction &)=delete
void operator()(const T &actObj, const int lev, const amrex::MFIter &mfi, const amrex::Geometry &geom)
Definition disk_spreading.H:24
void(SpreadingFunction::* m_function)(const T &actObj, const int, const amrex::MFIter &, const amrex::Geometry &)
Definition disk_spreading.H:36
void operator=(const SpreadingFunction &)=delete
Definition ActSrcLineOp.H:9
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE vs::Vector delta_pnts_cyl(const vs::Vector &origin, const vs::Vector &normal, const vs::Vector &point1, const vs::Vector &point2)
Definition actuator_utils.H:86
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real gaussian3d(const vs::Vector &dist, const vs::Vector &eps)
Definition actuator_utils.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real gaussian1d(const amrex::Real &dist, const amrex::Real &eps)
Definition actuator_utils.H:68
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real linear_basis_1d(const amrex::Real distance, const amrex::Real dX)
Definition actuator_utils.H:126
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr amrex::Real two_pi()
Return .
Definition trig_ops.H:22
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real degrees(const amrex::Real rad_val)
Convert from radians to degrees.
Definition trig_ops.H:42
amrex::Box realbox_to_box(const amrex::RealBox &rbx, const amrex::Geometry &geom)
Definition index_operations.cpp:5
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Tensor quaternion(const Vector &axis, const amrex::Real angle)
Definition tensorI.H:215
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr VectorT< T > one()
Definition vector.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T & x() &noexcept
Definition vector.H:97