Sampling Class Reference

AMR-Wind API: amr_wind::sampling::Sampling Class Reference
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches

#include <Sampling.H>

Inheritance diagram for amr_wind::sampling::Sampling:
[legend]
Collaboration diagram for amr_wind::sampling::Sampling:
[legend]

Public Member Functions

 Sampling (CFDSim &, std::string)
 
 ~Sampling () override
 
void pre_init_actions () override
 Perform actions before mesh is created.
 
void initialize () override
 Read user inputs and create the different data probe instances.
 
void post_advance_work () override
 Interpolate fields at a given timestep and output to disk.
 
void post_regrid_actions () override
 Actions to perform post regrid e.g. redistribute particles.
 
virtual void impl_write_native ()
 Write sampled data in binary format.
 
void sampling_workflow ()
 
void sampling_post ()
 
void fill_buffer ()
 
void create_output_buffer ()
 
void convert_velocity_lineofsight ()
 
int num_total_particles () const
 
int num_netcdf_output_particles () const
 
const amrex::Vector< std::string > & var_names () const
 

Static Public Member Functions

static std::string identifier ()
 

Protected Member Functions

void update_container ()
 Update the container by re-initializing the particles.
 
void update_sampling_locations ()
 Conduct work to update the particles.
 
virtual void process_output ()
 Output data based on user-defined format.
 
virtual void prepare_netcdf_file ()
 Prepare NetCDF metadata.
 
void write_netcdf ()
 Write sampled data into a NetCDF file.
 
virtual void write_ascii ()
 
SamplingContainersampling_container ()
 

Private Attributes

CFDSimm_sim
 
std::unique_ptr< SamplingContainerm_scontainer
 
amrex::Vector< std::unique_ptr< SamplerBase > > m_samplers
 
amrex::Vector< std::string > m_var_names
 List of variable names for output.
 
amrex::Vector< Field * > m_fields
 List of fields to be sampled for this collection of probes.
 
amrex::Vector< IntField * > m_int_fields
 List of IntFields to be sampled for this collection of probes.
 
std::unique_ptr< DerivedQtyMgrm_derived_mgr
 List of derived fields to be sampled for this collection of probes.
 
const std::string m_label
 
std::string m_out_fmt {"netcdf"}
 Format of the data output (native, ascii, netcdf, etc.)
 
std::string m_ncfile_name
 
std::vector< double > m_sample_buf
 
std::vector< double > m_output_buf
 
size_t m_netcdf_output_particles {0}
 Number of output particles in netcdf.
 
bool m_restart_sample {false}
 
int m_ncomp {0}
 
int m_nicomp {0}
 
int m_ndcomp {0}
 
size_t m_total_particles {0}
 Number of sampling container particles:
 
int m_out_freq {100}
 Frequency of data sampling and output.
 
int m_out_delay {0}
 Delay number of timestep before output.
 

Detailed Description

Collection of data sampling objects

A concrete implementation of the post-processing interface that deals with data probes. Multiple instances of sampling entities (e.g., point cloud or probes, line, or plane samplers) can be registered. Internally, the data problems are represented as amr_wind::sampling::SamplingContainer for tracking their position within the CFD mesh and updating the fields of interest.

This class manages the interpolation and the field management. The actual definition of probes are managed by subclasses of SamplerBase.

Constructor & Destructor Documentation

◆ Sampling()

amr_wind::sampling::Sampling::Sampling ( CFDSim & sim,
std::string label )

◆ ~Sampling()

amr_wind::sampling::Sampling::~Sampling ( )
overridedefault

Member Function Documentation

◆ convert_velocity_lineofsight()

void amr_wind::sampling::Sampling::convert_velocity_lineofsight ( )

◆ create_output_buffer()

void amr_wind::sampling::Sampling::create_output_buffer ( )

◆ fill_buffer()

void amr_wind::sampling::Sampling::fill_buffer ( )

◆ identifier()

static std::string amr_wind::sampling::Sampling::identifier ( )
inlinestatic

◆ impl_write_native()

void amr_wind::sampling::Sampling::impl_write_native ( )
virtual

Write sampled data in binary format.

◆ initialize()

void amr_wind::sampling::Sampling::initialize ( )
override

Read user inputs and create the different data probe instances.

◆ num_netcdf_output_particles()

int amr_wind::sampling::Sampling::num_netcdf_output_particles ( ) const
inline

◆ num_total_particles()

int amr_wind::sampling::Sampling::num_total_particles ( ) const
inline

◆ post_advance_work()

void amr_wind::sampling::Sampling::post_advance_work ( )
override

Interpolate fields at a given timestep and output to disk.

◆ post_regrid_actions()

void amr_wind::sampling::Sampling::post_regrid_actions ( )
override

Actions to perform post regrid e.g. redistribute particles.

◆ pre_init_actions()

void amr_wind::sampling::Sampling::pre_init_actions ( )
inlineoverride

Perform actions before mesh is created.

◆ prepare_netcdf_file()

void amr_wind::sampling::Sampling::prepare_netcdf_file ( )
protectedvirtual

Prepare NetCDF metadata.

◆ process_output()

void amr_wind::sampling::Sampling::process_output ( )
protectedvirtual

Output data based on user-defined format.

◆ sampling_container()

SamplingContainer & amr_wind::sampling::Sampling::sampling_container ( )
inlineprotected

◆ sampling_post()

void amr_wind::sampling::Sampling::sampling_post ( )

◆ sampling_workflow()

void amr_wind::sampling::Sampling::sampling_workflow ( )

◆ update_container()

void amr_wind::sampling::Sampling::update_container ( )
protected

Update the container by re-initializing the particles.

◆ update_sampling_locations()

void amr_wind::sampling::Sampling::update_sampling_locations ( )
protected

Conduct work to update the particles.

◆ var_names()

const amrex::Vector< std::string > & amr_wind::sampling::Sampling::var_names ( ) const
inline

◆ write_ascii()

void amr_wind::sampling::Sampling::write_ascii ( )
protectedvirtual

Output sampled data in ASCII format

Note that this should be used for debugging only and not in production runs as it can have significant impacts on code performance.

◆ write_netcdf()

void amr_wind::sampling::Sampling::write_netcdf ( )
protected

Write sampled data into a NetCDF file.

Member Data Documentation

◆ m_derived_mgr

std::unique_ptr<DerivedQtyMgr> amr_wind::sampling::Sampling::m_derived_mgr
private

List of derived fields to be sampled for this collection of probes.

◆ m_fields

amrex::Vector<Field*> amr_wind::sampling::Sampling::m_fields
private

List of fields to be sampled for this collection of probes.

◆ m_int_fields

amrex::Vector<IntField*> amr_wind::sampling::Sampling::m_int_fields
private

List of IntFields to be sampled for this collection of probes.

◆ m_label

const std::string amr_wind::sampling::Sampling::m_label
private

Name of this sampling object.

The label is used to read user inputs from file and is also used for naming files directories depending on the output format.

◆ m_ncfile_name

std::string amr_wind::sampling::Sampling::m_ncfile_name
private

◆ m_ncomp

int amr_wind::sampling::Sampling::m_ncomp {0}
private

◆ m_ndcomp

int amr_wind::sampling::Sampling::m_ndcomp {0}
private

◆ m_netcdf_output_particles

size_t amr_wind::sampling::Sampling::m_netcdf_output_particles {0}
private

Number of output particles in netcdf.

◆ m_nicomp

int amr_wind::sampling::Sampling::m_nicomp {0}
private

◆ m_out_delay

int amr_wind::sampling::Sampling::m_out_delay {0}
private

Delay number of timestep before output.

◆ m_out_fmt

std::string amr_wind::sampling::Sampling::m_out_fmt {"netcdf"}
private

Format of the data output (native, ascii, netcdf, etc.)

◆ m_out_freq

int amr_wind::sampling::Sampling::m_out_freq {100}
private

Frequency of data sampling and output.

◆ m_output_buf

std::vector<double> amr_wind::sampling::Sampling::m_output_buf
private

◆ m_restart_sample

bool amr_wind::sampling::Sampling::m_restart_sample {false}
private

◆ m_sample_buf

std::vector<double> amr_wind::sampling::Sampling::m_sample_buf
private

◆ m_samplers

amrex::Vector<std::unique_ptr<SamplerBase> > amr_wind::sampling::Sampling::m_samplers
private

◆ m_scontainer

std::unique_ptr<SamplingContainer> amr_wind::sampling::Sampling::m_scontainer
private

◆ m_sim

CFDSim& amr_wind::sampling::Sampling::m_sim
private

◆ m_total_particles

size_t amr_wind::sampling::Sampling::m_total_particles {0}
private

Number of sampling container particles:

◆ m_var_names

amrex::Vector<std::string> amr_wind::sampling::Sampling::m_var_names
private

List of variable names for output.


The documentation for this class was generated from the following files:
  • /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/sampling/Sampling.H
  • /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/sampling/Sampling.cpp