Loading...
Searching...
No Matches
parameterizedBCtest.H
Go to the documentation of this file.
1Info << endl;
2Info << "*********************************************************" << endl;
3Info << "Performing test for the parameterized BC inverse solver" << endl;
4Info << endl;
5word outputFolder = "./ITHACAoutput/parameterizedBCtest/";
6volScalarField gTrueField = example_paramBC.list2Field(example_paramBC.gTrue);
8 "1", outputFolder,
9 "gTrue");
10List<word> linSys_solvers;
12linSys_solvers[0] = "fullPivLU";
13Eigen::VectorXd residualNorms;
15auto tO1 = std::chrono::high_resolution_clock::now();
16example_paramBC.set_gParametrized("rbf", rbfShapePar);
17example_paramBC.parameterizedBCoffline();
18auto tO2 = std::chrono::high_resolution_clock::now();
19auto duration = std::chrono::duration_cast<std::chrono::microseconds>
20 ( tO2 - tO1 ).count() / 1e6;
21std::cout << "Duration offline part = " << duration << " seconds" << std::endl;
22forAll(linSys_solvers, solverI)
23{
24 Info << "Solver " << linSys_solvers[solverI] << endl;
25 Info << endl;
26 auto t1 = std::chrono::high_resolution_clock::now();
27 example_paramBC.parameterizedBC(linSys_solvers[solverI], 6);
28 auto t2 = std::chrono::high_resolution_clock::now();
29 auto duration = std::chrono::duration_cast<std::chrono::microseconds>
30 ( t2 - t1 ).count() / 1e6;
31 std::cout << "Duration online part = " << duration << " seconds" << std::endl;
32 volScalarField gParametrizedField = example_paramBC.list2Field(
33 example_paramBC.g);
34 ITHACAstream::exportSolution(gParametrizedField,
35 std::to_string(solverI + 1),
36 outputFolder,
37 "gParametrized");
38 volScalarField& T(example_paramBC._T());
40 std::to_string(solverI + 1),
41 outputFolder,
42 "T");
43 residualNorms(solverI) = Foam::sqrt(
44 example_paramBC.residual.squaredNorm());
45}
46Eigen::MatrixXd A = example_paramBC.Theta.transpose() * example_paramBC.Theta;
47ITHACAstream::exportMatrix(residualNorms, "residuals2norm", "eigen",
48 outputFolder);
49example_paramBC.postProcess(outputFolder, "gParametrized");
50Info << "*********************************************************" << endl;
51Info << endl;
forAll(example_CG.gList, solutionI)
Definition CGtest.H:21
volScalarField & T
Definition createT.H:46
volScalarField & A
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 ...
auto tO2
Eigen::VectorXd residualNorms
Info<< endl;Info<< "*********************************************************"<< endl;Info<< "Performing test for the parameterized BC inverse solver"<< endl;Info<< endl;word outputFolder="./ITHACAoutput/parameterizedBCtest/";volScalarField gTrueField=example_paramBC.list2Field(example_paramBC.gTrue);ITHACAstream::exportSolution(gTrueField, "1", outputFolder, "gTrue");List< word > linSys_solvers
auto duration
auto tO1