Loading...
Searching...
No Matches
Ptot.C
Go to the documentation of this file.
1#include "Ptot.H"
2
4
5Ptot::Ptot(int argc, char* argv[], label Nsampled)
6{
7 Npoints = Nsampled;
8 modelOutput.resize(Npoints);
9 modelOutput.setZero();
10 name = {"Ptot"};
11#include "setRootCase.H"
12#include "createTime.H"
13#include "createMesh.H"
14#include "createpowerDens.H"
15}
16
17void Ptot::buildMO(std::string dir)
18{
19 Time& runTime = _runTime();
20 fvMesh& mesh = _mesh();
21 volScalarField& powerDens = _powerDens();
22 std::string folder = dir;
23
24 if (ITHACAutilities::check_folder(folder) == true)
25 {
26 for (label j = 0; j < Npoints; j++)
27 {
28 folder.append(std::to_string(j));
29 folder.append("/");
31 auto k = ptrfield.last();
32 modelOutput(j) = fvc::domainIntegrate(k).value();
33 folder = dir;
34 ptrfield.clear();
35 }
36
37 MObuilt = true;
38 }
39 else
40 {
41 std::cout << "Outputs of the model are not computed yet, programm aborted" <<
42 std::endl;
43 }
44}
Foam::fvMesh & mesh
Definition createMesh.H:47
Foam::Time & runTime
Definition createTime.H:33
label Npoints
Number of points for which simulation is run.
Definition FofM.H:57
std::string name
Name of the figure of merit.
Definition FofM.H:59
Eigen::VectorXd modelOutput
Vector to store the desired output of the model, i.e. the figure of merit.
Definition FofM.H:49
bool MObuilt
boolean variable to check if the model output is computed (true) or not (false)
Definition FofM.H:61
autoPtr< Time > _runTime
Definition FofM.H:52
PtrList< volScalarField > ptrfield
list of pointers to scalar and vector field
Definition FofM.H:54
autoPtr< fvMesh > _mesh
dummy variables to transform FofM into a class
Definition FofM.H:51
void buildMO(std::string dir)
Method that computes the total power at the last time instant of the simulation, output are sought in...
Definition Ptot.C:17
Ptot()
Definition Ptot.C:3
autoPtr< volScalarField > _powerDens
List of pointers to power density field.
Definition Ptot.H:52
volScalarField & powerDens
void read_fields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, word Name, fileName casename, int first_snap, int n_snap)
Function to read a list of fields from the name of the field and casename.
bool check_folder(word folder)
Checks if a folder exists.