1Info <<
"Computing errors" << endl;
5volScalarField gTrueField = list2Field(gTrue, innerField);
6label Nsolutions = gField.size();
7Eigen::MatrixXd heatFluxL2norm;
8heatFluxL2norm.resize(Nsolutions, 1);
9Eigen::MatrixXd heatFluxLinfNorm = heatFluxL2norm;
10Eigen::VectorXd relativeErrorNorm_L2(Nsolutions);
11Eigen::VectorXd relativeErrorNorm_Linf(Nsolutions);
15 volScalarField gDiffField = (gField[solutionI] - gTrueField).ref();
17 std::to_string(solutionI + 1), folder,
20 std::to_string(solutionI + 1), folder,
29 volScalarField relativeErrorField(gDiffField);
31 for (label
i = 0;
i < relativeErrorField.internalField().size();
i++)
33 if (std::abs(gTrueField.ref()[
i]) < EPS)
35 relativeErrorField.ref()[
i] = (std::abs(gDiffField.ref()[
i])) / EPS;
39 relativeErrorField.ref()[
i] = (std::abs(gDiffField.ref()[
i])) /
45 std::to_string(solutionI + 1), folder,
46 "relativeErrorField");
forAll(example_CG.gList, solutionI)
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 ...
void read_fields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, word Name, fileName casename, int first_snap, int n_snap)
Function to read a list of fields from the name of the field and casename.
double LinfNormOnPatch(fvMesh &mesh, volScalarField &field, word patch)
Evaluate the Linf norm of a field on a boundary patch.
double L2normOnPatch(fvMesh &mesh, volScalarField &field, word patch)
Evaluate the L2 norm of a field on a boundary patch.