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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/sampling/FieldNorms.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
FieldNorms.H
Go to the documentation of this file.
1#ifndef FIELDNORMS_H
2#define FIELDNORMS_H
3
4#include "amr-wind/CFDSim.H"
6
7namespace amr_wind::field_norms {
8
16class FieldNorms : public PostProcessBase::Register<FieldNorms>
17{
18public:
19 static std::string identifier() { return "FieldNorms"; }
20
21 FieldNorms(CFDSim& /*sim*/, std::string /*label*/);
22
23 ~FieldNorms() override;
24
26 void pre_init_actions() override {}
27
29 void initialize() override;
30
32 void post_advance_work() override;
33
34 void post_regrid_actions() override {}
35
37 static amrex::Real
38 l2_norm(amr_wind::Field& field, const int comp, const bool use_mask);
39
40 const amrex::Vector<std::string>& var_names() const { return m_var_names; }
41
42 const amrex::Vector<amrex::Real>& field_norms() const { return m_fnorms; }
43
44private:
46 virtual void prepare_ascii_file();
47
49 virtual void write_ascii();
50
53
56
58 amrex::Vector<std::string> m_var_names;
59
61 amrex::Vector<amrex::Real> m_fnorms;
62
68 const std::string m_label;
69
71 std::string m_out_fname;
72
74 int m_out_freq{10};
75
77 int m_width{18};
78
80 int m_precision{12};
81
83 bool m_use_mask{true};
84};
85
86} // namespace amr_wind::field_norms
87
88#endif /* FIELDNORMS_H */
Definition CFDSim.H:47
Definition Field.H:116
Definition FieldNorms.H:17
void process_field_norms()
process all fields and calculate norms
Definition FieldNorms.cpp:99
std::string m_out_fname
filename for ASCII output
Definition FieldNorms.H:71
const amrex::Vector< amrex::Real > & field_norms() const
Definition FieldNorms.H:42
void initialize() override
Read user inputs and create the different data probe instances.
Definition FieldNorms.cpp:17
FieldNorms(CFDSim &, std::string)
Definition FieldNorms.cpp:11
const std::string m_label
Definition FieldNorms.H:68
int m_width
width in ASCII output
Definition FieldNorms.H:77
const amrex::Vector< std::string > & var_names() const
Definition FieldNorms.H:40
amrex::Vector< amrex::Real > m_fnorms
List holding norms for all fields and their components.
Definition FieldNorms.H:61
int m_out_freq
Frequency of data sampling and output.
Definition FieldNorms.H:74
bool m_use_mask
Mask redundant grids (finest available grid only)
Definition FieldNorms.H:83
virtual void prepare_ascii_file()
prepare ASCII file and directory
Definition FieldNorms.cpp:123
int m_precision
precision in ASCII output
Definition FieldNorms.H:80
CFDSim & m_sim
Reference to the CFD sim.
Definition FieldNorms.H:55
virtual void write_ascii()
Output sampled data in ASCII format.
Definition FieldNorms.cpp:144
static amrex::Real l2_norm(amr_wind::Field &field, const int comp, const bool use_mask)
calculate the L2 norm of a given field and component
Definition FieldNorms.cpp:38
void post_regrid_actions() override
Definition FieldNorms.H:34
static std::string identifier()
Definition FieldNorms.H:19
void post_advance_work() override
Interpolate fields at a given timestep and output to disk.
Definition FieldNorms.cpp:109
amrex::Vector< std::string > m_var_names
List of variable names for output.
Definition FieldNorms.H:58
void pre_init_actions() override
Perform actions before mesh is created.
Definition FieldNorms.H:26
Definition FieldNorms.cpp:9