Loading...
Searching...
No Matches
thermocouplesLocation_paramBC.H
Go to the documentation of this file.
1Info << endl;
2Info << "*********************************************************" << endl;
3Info << "Performing test for the parameterized BC inverse solver" << endl;
4Info << "Changing the position of the thermocouples on y" << endl;
5Info << endl;
6word outputFolder = "./ITHACAoutput/thermocouplesLocationTest_paramBC/";
7volScalarField gTrueField = example_paramBC.list2Field(example_paramBC.gTrue);
9 "1", outputFolder,
10 "gTrue");
11
12
13int testSize = 20;
14Eigen::VectorXd TCplane_Y = Eigen::VectorXd::LinSpaced(testSize, 0.1, 0.9);
15ITHACAstream::exportMatrix(TCplane_Y, "TCplane_Y", "eigen",
16 outputFolder);
17
18for (int i = 0; i < testSize; i++)
19{
20 Info << "\n**************************************************** " << endl;
21 Info << "\nTest " << i << endl;
22 Info << "\n**************************************************** " << endl;
23 forAll(example_paramBC.thermocouplesPos, TCi)
24 {
25 example_paramBC.thermocouplesPos[TCi][1] = TCplane_Y(i);
26 }
27
29 if ( remove( "./thermocouplesCellsID_mat.txt" ) != 0 )
30 {
31 perror( "\nError deleting thermocouples file\n" );
32 }
33 else
34 {
35 puts( "\nThermocouples file successfully deleted\n" );
36 }
37
38 volScalarField Ttrue(example_paramBC._T());
39
40 for (label i = 0; i < Ttrue.internalField().size(); i++)
41 {
42 auto cx = Ttrue.mesh().C()[i].component(vector::X);
43 auto cy = Ttrue.mesh().C()[i].component(vector::Y);
44 auto cz = Ttrue.mesh().C()[i].component(vector::Z);
45 Ttrue.ref()[i] = a * cx * cx + b * cx * cy + c * cy - a * cz * cz + c;
46 }
47
48 example_paramBC.thermocouplesRead = 0;
49 example_paramBC.readThermocouples();
50 example_paramBC.Tmeas = example_paramBC.fieldValueAtThermocouples(Ttrue);
51 example_paramBC.set_gParametrized("rbf", rbfShapePar);
52 example_paramBC.parameterizedBCoffline(1);
53 example_paramBC.parameterizedBC("fullPivLU");
54 volScalarField gParametrizedField = example_paramBC.list2Field(
55 example_paramBC.g);
56 ITHACAstream::exportSolution(gParametrizedField,
57 std::to_string(i + 1),
58 outputFolder,
59 "g");
60 volScalarField& T(example_paramBC._T());
62 std::to_string(i + 1),
63 outputFolder,
64 "T");
65}
66
67example_paramBC.postProcess(outputFolder, "g");
68
70if ( remove( "./thermocouplesCellsID_mat.txt" ) != 0 )
71{
72 perror( "\nError deleting thermocouples file\n" );
73}
74else
75{
76 puts( "\nThermocouples file successfully deleted\n" );
77}
forAll(example_CG.gList, solutionI)
Definition CGtest.H:21
volScalarField & T
Definition createT.H:46
void exportSolution(GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
Export a field to file in a certain folder and subfolder.
void exportMatrix(Eigen::Matrix< T, -1, dim > &matrix, word Name, word type, word folder)
Export the reduced matrices in numpy (type=python), matlab (type=matlab) and txt (type=eigen) format ...
label i
Definition pEqn.H:46