Loading...
Searching...
No Matches
thermocouplesLocation_CG.H
Go to the documentation of this file.
1Info << endl;
2Info << "*********************************************************" << endl;
3Info << "Performing test for the CG inverse solver" << endl;
4Info << "Changint the position of the thermocouples on y" << endl;
5Info << endl;
6word outputFolder = "./ITHACAoutput/thermocouplesLocationTest_CG/";
7volScalarField gTrueField = example_CG.list2Field(example_paramBC.gTrue);
9 "1", outputFolder,
10 "gTrue");
11example_CG.saveSolInLists = 1;
12
13
14int testSize = 20;
15Eigen::VectorXd TCplane_Y = Eigen::VectorXd::LinSpaced(testSize, 0.1, 0.9);
16ITHACAstream::exportMatrix(TCplane_Y, "TCplane_Y", "eigen",
17 outputFolder);
18
19for (int i = 0; i < testSize; i++)
20{
21 Info << "\n**************************************************** " << endl;
22 Info << "\nTest " << i << endl;
23 Info << "\n**************************************************** " << endl;
24 forAll(example_CG.thermocouplesPos, TCi)
25 {
26 example_CG.thermocouplesPos[TCi][1] = TCplane_Y(i);
27 }
28
30 if ( remove( "./thermocouplesCellsID_mat.txt" ) != 0 )
31 {
32 perror( "\nError deleting thermocouples file\n" );
33 }
34 else
35 {
36 puts( "\nThermocouples file successfully deleted\n" );
37 }
38
39 example_CG.thermocouplesRead = 0;
40 example_CG.readThermocouples();
41 example_CG.Tmeas = example_CG.fieldValueAtThermocouples(T_true);
42
43 if (example_CG.conjugateGradient())
44 {
45 Info << "\nCG converged" << endl;
46 volScalarField heatFluxField = example_CG.list2Field(
47 example_CG.gList[example_CG.gList.size() - 1]);
49 std::to_string(i + 1), outputFolder,
50 "g");
51 Info << "************************************" << endl;
52 Info << endl << endl;
53 }
54 else
55 {
56 Info << "CG did not converged" << endl;
57 Info << "************************************" << endl;
58 Info << endl << endl;
59 }
60}
61
62example_CG.postProcess(outputFolder, "g");
63
65if ( remove( "./thermocouplesCellsID_mat.txt" ) != 0 )
66{
67 perror( "\nError deleting thermocouples file\n" );
68}
69else
70{
71 puts( "\nThermocouples file successfully deleted\n" );
72}
forAll(example_CG.gList, solutionI)
Definition CGtest.H:21
std::cout<< "Duration = "<< duration<< " seconds"<< std::endl;Info<< "CG converged"<< endl;PtrList< volScalarField > heatFluxField
Definition CGtest.H:20
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