-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing Freesurface post-processing routine to a Sampler (#1187)
* remove incomplete, unused python script * add FreeSurfaceSampler to reg test * documentation * python scripts that pass with ctest (to be added later)
- Loading branch information
Showing
19 changed files
with
594 additions
and
464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#ifndef FREESURFACESAMPLER_H | ||
#define FREESURFACESAMPLER_H | ||
|
||
#include "amr-wind/CFDSim.H" | ||
#include "amr-wind/utilities/sampling/SamplerBase.H" | ||
|
||
namespace amr_wind::sampling { | ||
|
||
class FreeSurfaceSampler : public SamplerBase::Register<FreeSurfaceSampler> | ||
{ | ||
public: | ||
static std::string identifier() { return "FreeSurfaceSampler"; } | ||
|
||
FreeSurfaceSampler(CFDSim& /*sim*/); | ||
|
||
~FreeSurfaceSampler() override; | ||
|
||
//! Read user inputs and create mesh-based information for locating | ||
//! interface | ||
void initialize(const std::string& key) override; | ||
|
||
//! Populate and return a vector of probe locations to be sampled | ||
void sampling_locations(SampleLocType& /*locs*/) const override; | ||
void output_locations(SampleLocType& locs) const override | ||
{ | ||
return sampling_locations(locs); | ||
} | ||
|
||
//! Find heights associated with 2D sample locations | ||
void update_sampling_locations() override; | ||
|
||
//! Redo some of the initialization work when the grid changes | ||
void post_regrid_actions() override; | ||
|
||
void | ||
define_netcdf_metadata(const ncutils::NCGroup& /*unused*/) const override; | ||
void | ||
populate_netcdf_metadata(const ncutils::NCGroup& /*unused*/) const override; | ||
void output_netcdf_data( | ||
const ncutils::NCGroup& /*unused*/, | ||
const size_t /*unused*/) const override; | ||
|
||
//! Name of this sampling object | ||
std::string label() const override { return m_label; } | ||
std::string& label() override { return m_label; } | ||
|
||
//! Type of this sampling object | ||
std::string sampletype() const override { return identifier(); } | ||
|
||
//! Unique identifier for this set of probe locations | ||
int id() const override { return m_id; } | ||
int& id() override { return m_id; } | ||
|
||
//! Output functions for private variables | ||
//! Number of 2D grid points | ||
int num_gridpoints() const { return m_npts; } | ||
//! Number of instances | ||
int num_instances() const { return m_ninst; } | ||
//! Number of points, total | ||
long num_points() const override | ||
{ | ||
return static_cast<long>(m_npts) * m_ninst; | ||
} | ||
long num_output_points() const override | ||
{ | ||
return static_cast<long>(m_npts) * m_ninst; | ||
} | ||
//! Locations | ||
amrex::Vector<amrex::Array<amrex::Real, 2>> grid_locations() const | ||
{ | ||
return m_grid_locs; | ||
} | ||
//! Outputs (heights) | ||
amrex::Vector<amrex::Real> heights() const { return m_out; } | ||
|
||
private: | ||
CFDSim& m_sim; | ||
|
||
//! reference to VOF | ||
const Field& m_vof; | ||
|
||
//! Number or points on 2D grid in each direction | ||
amrex::Vector<int> m_npts_dir; | ||
int m_npts{0}; | ||
//! Number of instances (possible sampling points per location, like in the | ||
//! case of a breaking wave) | ||
int m_ninst{1}; | ||
|
||
//! Coordinate direction to search along, default is z | ||
//! (this also determines the meaning of start and end points) | ||
int m_coorddir{2}; | ||
//! Grid coordinates, determined as a function of m_coorddir | ||
int m_gc0 = 0; | ||
int m_gc1 = 1; | ||
|
||
//! Parameters to set up plane | ||
amrex::Vector<amrex::Real> m_start, m_end; | ||
//! Locations of points in 2D grid | ||
amrex::Vector<amrex::Array<amrex::Real, 2>> m_grid_locs; | ||
//! Output coordinate | ||
amrex::Vector<amrex::Real> m_out; | ||
|
||
//! Max number of sample points found in a single cell | ||
int m_ncomp{1}; | ||
//! Max number of sample points allowed in a single cell | ||
int m_ncmax{8}; | ||
|
||
std::string m_label; | ||
int m_id{-1}; | ||
}; | ||
|
||
} // namespace amr_wind::sampling | ||
|
||
#endif /* FREESURFACESAMPLER_H */ |
Oops, something went wrong.