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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/sampling/WaveEnergy.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
WaveEnergy.H
Go to the documentation of this file.
1#ifndef WAVEENERGY_H
2#define WAVEENERGY_H
3
4#include "amr-wind/CFDSim.H"
6
7namespace amr_wind::wave_energy {
8
29class WaveEnergy : public PostProcessBase::Register<WaveEnergy>
30{
31public:
32 static std::string identifier() { return "WaveEnergy"; }
33
34 WaveEnergy(CFDSim& /*sim*/, std::string /*label*/);
35
36 ~WaveEnergy() override;
37
39 void pre_init_actions() override {}
40
42 void initialize() override;
43
45 void post_advance_work() override;
46
47 void post_regrid_actions() override {}
48
50 amrex::Real calculate_kinetic_energy();
51 amrex::Real calculate_potential_energy();
52
54 void wave_energy(amrex::Real& ke, amrex::Real& pe) const
55 {
58 };
59
60private:
62 virtual void prepare_ascii_file();
63
65 virtual void write_ascii();
66
68 amrex::Real m_wave_kinetic_energy{0.0};
69 amrex::Real m_wave_potential_energy{0.0};
70
73
79 const std::string m_label;
80
84 const Field& m_vof;
85
87 amrex::Vector<amrex::Real> m_gravity{0.0, 0.0, -9.81};
88
90 amrex::Real m_pe_off = 0.0;
92 amrex::Real m_escl = 1.0;
93
95 std::string m_out_fname;
96
98 int m_out_freq{10};
99
101 int m_width{22};
102
104 int m_precision{12};
105};
106
107} // namespace amr_wind::wave_energy
108
109#endif /* WAVEENERGY_H */
Definition CFDSim.H:47
Definition Field.H:116
Definition WaveEnergy.H:30
std::string m_out_fname
filename for ASCII output
Definition WaveEnergy.H:95
const std::string m_label
Definition WaveEnergy.H:79
int m_out_freq
Frequency of data sampling and output.
Definition WaveEnergy.H:98
amrex::Real m_escl
volumetric scaling for each energy
Definition WaveEnergy.H:92
int m_width
width in ASCII output
Definition WaveEnergy.H:101
amrex::Real m_wave_kinetic_energy
store the total wave energy
Definition WaveEnergy.H:68
virtual void prepare_ascii_file()
prepare ASCII file and directory
Definition WaveEnergy.cpp:183
void initialize() override
Read user inputs and get information needed for calculations.
Definition WaveEnergy.cpp:21
amrex::Real m_pe_off
offset for potential energy calculation
Definition WaveEnergy.H:90
void wave_energy(amrex::Real &ke, amrex::Real &pe) const
Output private variables that store energy measurements.
Definition WaveEnergy.H:54
void post_advance_work() override
Integrate energy components and output to file.
Definition WaveEnergy.cpp:167
CFDSim & m_sim
Reference to the CFD sim.
Definition WaveEnergy.H:72
const Field & m_vof
reference to vof
Definition WaveEnergy.H:84
void post_regrid_actions() override
Definition WaveEnergy.H:47
amrex::Vector< amrex::Real > m_gravity
gravity vector
Definition WaveEnergy.H:87
const Field & m_velocity
reference to velocity
Definition WaveEnergy.H:82
static std::string identifier()
Definition WaveEnergy.H:32
amrex::Real calculate_kinetic_energy()
Calculate the sum of stated energy in liquid phase.
Definition WaveEnergy.cpp:47
WaveEnergy(CFDSim &, std::string)
Definition WaveEnergy.cpp:12
void pre_init_actions() override
Perform actions before mesh is created.
Definition WaveEnergy.H:39
virtual void write_ascii()
Output sampled data in ASCII format.
Definition WaveEnergy.cpp:200
amrex::Real calculate_potential_energy()
Definition WaveEnergy.cpp:103
int m_precision
precision in ASCII output
Definition WaveEnergy.H:104
amrex::Real m_wave_potential_energy
Definition WaveEnergy.H:69
Definition WaveEnergy.cpp:10