/home/runner/work/amr-wind/amr-wind/amr-wind/physics/udfs/Rankine.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/physics/udfs/Rankine.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
Rankine.H
Go to the documentation of this file.
1#ifndef RANKINE_H
2#define RANKINE_H
3
4#include "AMReX_Geometry.H"
5#include "AMReX_Gpu.H"
6
7namespace amr_wind {
8
9class Field;
10
11namespace udf {
12
13struct Rankine
14{
15 struct DeviceOp
16 {
17 amrex::Real Umax{15.0};
18 amrex::Real Rmax{125.0};
19 amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> start_location = {
20 AMREX_D_DECL(-10 * Rmax, 0.0, 0.0)};
21 amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> vel_ref = {0.0};
22
23 AMREX_GPU_DEVICE
24 inline void operator()(
25 const amrex::IntVect& iv,
26 amrex::Array4<amrex::Real> const& field,
27 amrex::GeometryData const& geom,
28 const amrex::Real time,
29 amrex::Orientation /*unused*/,
30 const int comp,
31 const int dcomp,
32 const int orig_comp) const
33 {
34 const auto* problo = geom.ProbLo();
35 const auto* dx = geom.CellSize();
36 const auto x = problo[0] + (iv[0] + 0.5) * dx[0];
37 const auto y = problo[1] + (iv[1] + 0.5) * dx[1];
38 const auto xr = x - (start_location[0] + vel_ref[0] * time);
39 const auto yr = y - (start_location[1] + vel_ref[1] * time);
40 const auto r = sqrt(xr * xr + yr * yr);
41 const auto Vazi = (r <= Rmax) ? r / Rmax * Umax : Rmax / r * Umax;
42 const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> vel = {
43 AMREX_D_DECL(
44 vel_ref[0] - yr / r * Vazi, vel_ref[1] + xr / r * Vazi,
45 vel_ref[2] + 0.0)};
46
47 field(iv[0], iv[1], iv[2], dcomp + comp) = vel[orig_comp + comp];
48 }
49 };
51
52 static std::string identifier() { return "Rankine"; }
53
54 explicit Rankine(const Field& fld);
55
56 DeviceType device_instance() const { return m_op; }
57
59};
60
61} // namespace udf
62} // namespace amr_wind
63
64#endif /* RANKINE_H */
Definition Field.H:116
Definition BCInterface.cpp:7
Definition Rankine.H:16
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > vel_ref
Definition Rankine.H:21
amrex::Real Umax
Definition Rankine.H:17
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > start_location
Definition Rankine.H:19
amrex::Real Rmax
Definition Rankine.H:18
AMREX_GPU_DEVICE void operator()(const amrex::IntVect &iv, amrex::Array4< amrex::Real > const &field, amrex::GeometryData const &geom, const amrex::Real time, amrex::Orientation, const int comp, const int dcomp, const int orig_comp) const
Definition Rankine.H:24
Definition Rankine.H:14
DeviceOp m_op
Definition Rankine.H:58
DeviceType device_instance() const
Definition Rankine.H:56
static std::string identifier()
Definition Rankine.H:52
Rankine(const Field &fld)
Definition Rankine.cpp:11