2Info <<
"*********************************************************" << endl;
3Info <<
"Performing test for the CG inverse solver" << endl;
4Info <<
"Changint the position of the thermocouples on y" << endl;
6word outputFolder =
"./ITHACAoutput/thermocouplesNumberTest_CG/";
7volScalarField gTrueField = example_CG.list2Field(example_paramBC.gTrue);
11example_CG.saveSolInLists = 1;
15Eigen::VectorXi numberTCperAxis = Eigen::VectorXi::LinSpaced(testSize, 1,
20for (
int i = 0;
i < testSize;
i++)
22 Info <<
"\n**************************************************** " << endl;
23 Info <<
"\nTest " <<
i << endl;
24 Info <<
"\n**************************************************** " << endl;
25 Eigen::VectorXd TCcoord_temp = Eigen::VectorXd::LinSpaced(numberTCperAxis(
27 Eigen::VectorXd TCcoord = TCcoord_temp.segment(1, numberTCperAxis(
i));
28 example_CG.thermocouplesPos.resize(numberTCperAxis(
i) * numberTCperAxis(
i));
29 double TCyCoord = 0.2;
32 for (
int Xi = 0; Xi < numberTCperAxis(
i); Xi++)
34 for (
int Zi = 0; Zi < numberTCperAxis(
i); Zi++)
36 example_CG.thermocouplesPos[TCi][0] = TCcoord(Xi);
37 example_CG.thermocouplesPos[TCi][1] = TCyCoord;
38 example_CG.thermocouplesPos[TCi][2] = TCcoord(Zi);
39 Info <<
"thermocouplesPos[" << TCi <<
"] = " << example_CG.thermocouplesPos[TCi]
46 if ( remove(
"./thermocouplesCellsID_mat.txt" ) != 0 )
48 perror(
"\nError deleting thermocouples file\n" );
52 puts(
"\nThermocouples file successfully deleted\n" );
55 example_CG.thermocouplesRead = 0;
56 example_CG.readThermocouples();
57 example_CG.Tmeas = example_CG.fieldValueAtThermocouples(T_true);
59 if (example_CG.conjugateGradient())
61 Info <<
"\nCG converged" << endl;
63 example_CG.gList[example_CG.gList.size() - 1]);
65 std::to_string(
i + 1), outputFolder,
67 Info <<
"************************************" << endl;
72 Info <<
"CG did not converged" << endl;
73 Info <<
"************************************" << endl;
78example_CG.postProcess(outputFolder,
"g");
81if ( remove(
"./thermocouplesCellsID_mat.txt" ) != 0 )
83 perror(
"\nError deleting thermocouples file\n" );
87 puts(
"\nThermocouples file successfully deleted\n" );
std::cout<< "Duration = "<< duration<< " seconds"<< std::endl;Info<< "CG converged"<< endl;PtrList< volScalarField > heatFluxField
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 ...