/home/runner/work/amr-wind/amr-wind/amr-wind/utilities/sampling/FreeSurfaceSampler.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/sampling/FreeSurfaceSampler.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
FreeSurfaceSampler.H
Go to the documentation of this file.
1#ifndef FREESURFACESAMPLER_H
2#define FREESURFACESAMPLER_H
3
4#include "amr-wind/CFDSim.H"
6
7namespace amr_wind::sampling {
8
9class FreeSurfaceSampler : public SamplerBase::Register<FreeSurfaceSampler>
10{
11public:
12 static std::string identifier() { return "FreeSurfaceSampler"; }
13
14 FreeSurfaceSampler(CFDSim& /*sim*/);
15
17
20 void initialize(const std::string& key) override;
21
23 void check_bounds() override;
24
26 void sampling_locations(SampleLocType& /*sample_locs*/) const override;
27
31 SampleLocType& /*sample_locs*/,
32 const amrex::Box& /*box*/) const override;
33
34 void output_locations(SampleLocType& sample_locs) const override
35 {
36 sampling_locations(sample_locs);
37 }
38
40 bool update_sampling_locations() override;
41
43 void post_regrid_actions() override;
44
45 void
46 define_netcdf_metadata(const ncutils::NCGroup& /*unused*/) const override;
47 void
48 populate_netcdf_metadata(const ncutils::NCGroup& /*unused*/) const override;
50 const ncutils::NCGroup& /*unused*/,
51 const size_t /*unused*/) const override;
52
54 std::string label() const override { return m_label; }
55 std::string& label() override { return m_label; }
56
58 std::string sampletype() const override { return identifier(); }
59
61 int id() const override { return m_id; }
62 int& id() override { return m_id; }
63
66 int num_gridpoints() const { return m_npts; }
68 int num_instances() const { return m_ninst; }
70 long num_points() const override
71 {
72 return static_cast<long>(m_npts) * m_ninst;
73 }
74 long num_output_points() const override
75 {
76 return static_cast<long>(m_npts) * m_ninst;
77 }
79 amrex::Vector<amrex::Array<amrex::Real, 2>> grid_locations() const
80 {
81 return m_grid_locs;
82 }
84 amrex::Vector<amrex::Real> heights() const { return m_out; }
85
86private:
88
90 const Field& m_vof;
91
93 amrex::Vector<int> m_npts_dir;
94 int m_npts{0};
97 int m_ninst{1};
98
103 int m_gc0 = 0;
104 int m_gc1 = 1;
105
107 amrex::Vector<amrex::Real> m_start, m_end;
109 amrex::Vector<amrex::Array<amrex::Real, 2>> m_grid_locs;
111 amrex::Vector<amrex::Real> m_out;
112
114 int m_ncomp{1};
116 int m_ncmax{8};
117
118 std::string m_label;
119 int m_id{-1};
120};
121
122} // namespace amr_wind::sampling
123
124#endif /* FREESURFACESAMPLER_H */
Definition CFDSim.H:47
Definition Field.H:116
Definition FreeSurfaceSampler.H:10
int m_gc0
Grid coordinates, determined as a function of m_coorddir.
Definition FreeSurfaceSampler.H:103
amrex::Vector< int > m_npts_dir
Number or points on 2D grid in each direction.
Definition FreeSurfaceSampler.H:93
amrex::Vector< amrex::Array< amrex::Real, 2 > > grid_locations() const
Locations.
Definition FreeSurfaceSampler.H:79
amrex::Vector< amrex::Real > m_out
Output coordinate.
Definition FreeSurfaceSampler.H:111
void initialize(const std::string &key) override
Definition FreeSurfaceSampler.cpp:18
static std::string identifier()
Definition FreeSurfaceSampler.H:12
amrex::Vector< amrex::Array< amrex::Real, 2 > > m_grid_locs
Locations of points in 2D grid.
Definition FreeSurfaceSampler.H:109
int m_npts
Definition FreeSurfaceSampler.H:94
CFDSim & m_sim
Definition FreeSurfaceSampler.H:87
std::string label() const override
Name of this sampling object.
Definition FreeSurfaceSampler.H:54
std::string m_label
Definition FreeSurfaceSampler.H:118
int m_gc1
Definition FreeSurfaceSampler.H:104
int m_coorddir
Definition FreeSurfaceSampler.H:101
void output_locations(SampleLocType &sample_locs) const override
Definition FreeSurfaceSampler.H:34
void output_netcdf_data(const ncutils::NCGroup &, const size_t) const override
Definition FreeSurfaceSampler.cpp:739
FreeSurfaceSampler(CFDSim &)
Definition FreeSurfaceSampler.cpp:12
long num_points() const override
Number of points, total.
Definition FreeSurfaceSampler.H:70
int m_id
Definition FreeSurfaceSampler.H:119
std::string sampletype() const override
Type of this sampling object.
Definition FreeSurfaceSampler.H:58
int num_gridpoints() const
Definition FreeSurfaceSampler.H:66
amrex::Vector< amrex::Real > m_end
Definition FreeSurfaceSampler.H:107
amrex::Vector< amrex::Real > heights() const
Outputs (heights)
Definition FreeSurfaceSampler.H:84
long num_output_points() const override
Definition FreeSurfaceSampler.H:74
void check_bounds() override
Check and fix the bounds of the sampler so the probes are in the domain.
Definition FreeSurfaceSampler.cpp:336
void sampling_locations(SampleLocType &) const override
Populate and return a vector of probe locations to be sampled.
Definition FreeSurfaceSampler.cpp:369
int num_instances() const
Number of instances.
Definition FreeSurfaceSampler.H:68
std::string & label() override
Definition FreeSurfaceSampler.H:55
bool update_sampling_locations() override
Find heights associated with 2D sample locations.
Definition FreeSurfaceSampler.cpp:405
int m_ncomp
Max number of sample points found in a single cell.
Definition FreeSurfaceSampler.H:114
const Field & m_vof
reference to VOF
Definition FreeSurfaceSampler.H:90
void define_netcdf_metadata(const ncutils::NCGroup &) const override
Definition FreeSurfaceSampler.cpp:723
int m_ninst
Definition FreeSurfaceSampler.H:97
int & id() override
Definition FreeSurfaceSampler.H:62
int m_ncmax
Max number of sample points allowed in a single cell.
Definition FreeSurfaceSampler.H:116
void post_regrid_actions() override
Redo some of the initialization work when the grid changes.
Definition FreeSurfaceSampler.cpp:579
amrex::Vector< amrex::Real > m_start
Parameters to set up plane.
Definition FreeSurfaceSampler.H:107
int id() const override
Unique identifier for this set of probe locations.
Definition FreeSurfaceSampler.H:61
void populate_netcdf_metadata(const ncutils::NCGroup &) const override
Definition FreeSurfaceSampler.cpp:736
Representation of a NetCDF group.
Definition nc_interface.H:166
Definition DTUSpinnerSampler.cpp:16
Definition SamplerBase.H:15