2Info <<
"*********************************************************" << endl;
3Info <<
"Performing test for the paramBC inverse solver" << endl;
4Info <<
"Changing the position of the thermocouples on y" << endl;
6word outputFolder =
"./ITHACAoutput/thermocouplesNumberTest_paramBC/";
7word outputFolder_bestFit =
8 "./ITHACAoutput/thermocouplesNumberTest_paramBC_bestFit/";
9word outputFolder_bestInt =
10 "./ITHACAoutput/thermocouplesNumberTest_paramBC_bestInt/";
11volScalarField gTrueField = example_paramBC.list2Field(example_paramBC.gTrue);
18Eigen::VectorXi numberTCperAxis = Eigen::VectorXi::LinSpaced(testSize, 1,
23for (
int i = 0;
i < testSize;
i++)
25 Info <<
"\n**************************************************** " << endl;
26 Info <<
"\nTest " <<
i << endl;
27 Info <<
"\n**************************************************** " << endl;
28 Eigen::VectorXd TCcoord_temp = Eigen::VectorXd::LinSpaced(numberTCperAxis(
30 Eigen::VectorXd TCcoord = TCcoord_temp.segment(1, numberTCperAxis(
i));
31 example_paramBC.thermocouplesPos.resize(numberTCperAxis(
i) * numberTCperAxis(
33 double TCyCoord = 0.2;
36 for (
int Zi = 0; Zi < numberTCperAxis(
i); Zi++)
38 for (
int Xi = 0; Xi < numberTCperAxis(
i); Xi++)
40 example_paramBC.thermocouplesPos[TCi][0] = TCcoord(Xi);
41 example_paramBC.thermocouplesPos[TCi][1] = TCyCoord;
42 example_paramBC.thermocouplesPos[TCi][2] = TCcoord(Zi);
43 Info <<
"thermocouplesPos[" << TCi <<
"] = " <<
44 example_paramBC.thermocouplesPos[TCi] << endl;
50 if ( remove(
"./thermocouplesCellsID_mat.txt" ) != 0 )
52 perror(
"\nError deleting thermocouples file\n" );
56 puts(
"\nThermocouples file successfully deleted\n" );
59 volScalarField Ttrue(example_paramBC._T());
61 for (label
i = 0;
i < Ttrue.internalField().size();
i++)
63 auto cx = Ttrue.mesh().C()[
i].component(vector::X);
64 auto cy = Ttrue.mesh().C()[
i].component(vector::Y);
65 auto cz = Ttrue.mesh().C()[
i].component(vector::Z);
66 Ttrue.ref()[
i] = a * cx * cx + b * cx * cy + c * cy - a * cz * cz + c;
69 example_paramBC.thermocouplesRead = 0;
70 example_paramBC.readThermocouples();
71 example_paramBC.Tmeas = Eigen::VectorXd::Zero(numberTCperAxis(
72 i) * numberTCperAxis(
i));
73 example_paramBC.Tmeas = example_paramBC.fieldValueAtThermocouples(Ttrue);
74 example_paramBC.set_gParametrized(
"rbf", rbfShapePar);
75 example_paramBC.parameterizedBCoffline(1);
76 example_paramBC.parameterizedBC(
"fullPivLU");
77 volScalarField gParametrizedField = example_paramBC.list2Field(
80 std::to_string(
i + 1),
83 volScalarField&
T(example_paramBC._T());
85 std::to_string(
i + 1),
89 example_paramBC.parameterizedBCpostProcess(example_paramBC.bestApproximator());
90 gParametrizedField = example_paramBC.list2Field(
93 std::to_string(
i + 1),
96 volScalarField& T2(example_paramBC._T());
98 std::to_string(
i + 1),
102 example_paramBC.parameterizedBCpostProcess(example_paramBC.bestInterpolation());
103 gParametrizedField = example_paramBC.list2Field(
106 std::to_string(
i + 1),
107 outputFolder_bestInt,
109 volScalarField& T3(example_paramBC._T());
111 std::to_string(
i + 1),
112 outputFolder_bestInt,
116example_paramBC.postProcess(outputFolder,
"g");
117example_paramBC.postProcess(outputFolder_bestFit,
"g");
118example_paramBC.postProcess(outputFolder_bestInt,
"g");
121if ( remove(
"./thermocouplesCellsID_mat.txt" ) != 0 )
123 perror(
"\nError deleting thermocouples file\n" );
127 puts(
"\nThermocouples file successfully deleted\n" );
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 ...