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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/physics/udfs/CustomScalar.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
CustomScalar.H
Go to the documentation of this file.
1#ifndef CUSTOM_SCALAR_H
2#define CUSTOM_SCALAR_H
3
4#include "AMReX_Geometry.H"
5#include "AMReX_Gpu.H"
6
7namespace amr_wind {
8
9class Field;
10
11namespace udf {
12
14{
15 struct DeviceOp
16 {
17 // clang-format off
18 // Declare parameters here if needed. For example:
19 // amrex::Real foo{1.0};
20 // clang-format on
21
22 AMREX_GPU_DEVICE
23 inline void operator()(
24 const amrex::IntVect& /*iv*/,
25 amrex::Array4<amrex::Real> const& /*field*/,
26 amrex::GeometryData const& /*geom*/,
27 const amrex::Real /*time*/,
28 amrex::Orientation /*ori*/,
29 const int /*comp*/,
30 const int /*dcomp*/,
31 const int /*orig_comp*/) const
32 {
33 // Compute quantities to set the field values. For example:
34 // clang-format off
35 // const auto* problo = geom.ProbLo();
36 // const auto* dx = geom.CellSize();
37 // const auto x = problo[0] + (iv[0] + 0.5) * dx[0];
38 // const auto y = problo[1] + (iv[1] + 0.5) * dx[1];
39 // const auto z = problo[2] + (iv[2] + 0.5) * dx[2];
40 // const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> vel = {1.0, 0.0, 0.0};
41
42 // Once the above is done, fill the field as:
43 // field(iv[0], iv[1], iv[2], dcomp + comp) = vel[orig_comp + comp];
44 // clang-format on
45 }
46 };
48
49 static std::string identifier() { return "CustomScalar"; }
50
51 explicit CustomScalar(const Field& fld);
52
53 DeviceType device_instance() const { return m_op; }
54
56};
57
58} // namespace udf
59} // namespace amr_wind
60
61#endif /* CUSTOM_SCALAR_H */
Definition Field.H:116
Definition BCInterface.cpp:7
Definition CustomScalar.H:16
AMREX_GPU_DEVICE void operator()(const amrex::IntVect &, amrex::Array4< amrex::Real > const &, amrex::GeometryData const &, const amrex::Real, amrex::Orientation, const int, const int, const int) const
Definition CustomScalar.H:23
Definition CustomScalar.H:14
CustomScalar(const Field &fld)
Definition CustomScalar.cpp:11
DeviceType device_instance() const
Definition CustomScalar.H:53
DeviceOp m_op
Definition CustomScalar.H:55
static std::string identifier()
Definition CustomScalar.H:49