Loading...
Searching...
No Matches
Tm.C
Go to the documentation of this file.
1#include "Tm.H"
2
4
5Tm::Tm(int argc, char* argv[], label Nsampled)
6{
7 Npoints = Nsampled;
8 modelOutput.resize(Npoints);
9 modelOutput.setZero();
10 name = {"Tm"};
11#include "setRootCase.H"
12#include "createTime.H"
13#include "createMesh.H"
14#include "createT.H"
15}
16
17void Tm::buildMO(std::string dir)
18{
19 Time& runTime = _runTime();
20 fvMesh& mesh = _mesh();
21 volScalarField& T = _T();
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) = k.weightedAverage(mesh.V()).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 exit(0);
44 }
45}
46
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
Tm()
Definition Tm.C:3
void buildMO(std::string dir)
Method that computes the average temperature (integral average) at the last time instant of the simul...
Definition Tm.C:17
autoPtr< volScalarField > _T
List of pointers to temperature field.
Definition Tm.H:51
volScalarField & T
Definition createT.H:46
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.