52int main(
int argc,
char* argv[])
54 solverPerformance::debug = 1;
62 example_paramBC.
a = a;
63 example_paramBC.
b = b;
64 example_paramBC.
c = c;
65 example_paramBC.
d = d;
73 label CGtest = para->ITHACAdict->lookupOrDefault<
int>(
"CGtest", 0);
74 label CGnoiseTest = para->ITHACAdict->lookupOrDefault<
int>(
"CGnoiseTest", 0);
75 label CGnoiseLevelTest =
76 para->ITHACAdict->lookupOrDefault<
int>(
"CGnoiseLevelTest", 0);
77 label parameterizedBCtest =
78 para->ITHACAdict->lookupOrDefault<
int>(
"parameterizedBCtest", 0);
79 label parameterizedBCtest_RBFwidth =
80 para->ITHACAdict->lookupOrDefault<
int>(
"parameterizedBCtest_RBFwidth", 0);
81 label thermocouplesLocationTest_CG =
82 para->ITHACAdict->lookupOrDefault<
int>(
"thermocouplesLocationTest_CG", 0);
83 label thermocouplesLocationTest_paramBC =
84 para->ITHACAdict->lookupOrDefault<
int>(
"thermocouplesLocationTest_paramBC", 0);
85 label thermocouplesNumberTest_CG =
86 para->ITHACAdict->lookupOrDefault<
int>(
"thermocouplesNumberTest_CG", 0);
87 label thermocouplesNumberTest_paramBC =
88 para->ITHACAdict->lookupOrDefault<
int>(
"thermocouplesNumberTest_paramBC", 0);
90 example_CG.
cgIterMax = para->ITHACAdict->lookupOrDefault<
int>(
"cgIterMax", 100);
91 example_CG.
Jtol = para->ITHACAdict->lookupOrDefault<
double>(
"Jtolerance",
94 para->ITHACAdict->lookupOrDefault<
double>(
"JrelativeTolerance",
96 double rbfShapePar = para->ITHACAdict->lookupOrDefault<
double>(
"rbfShapePar",
98 M_Assert(rbfShapePar > 0,
"rbfShapePar not specified");
100 para->ITHACAdict->lookupOrDefault<
double>(
"thermalConductivity", 0);
101 M_Assert(example_paramBC.
k > 0,
"thermalConductivity, k, not specified");
103 para->ITHACAdict->lookupOrDefault<
double>(
"heatTranferCoeff", 0);
104 M_Assert(example_paramBC.
H > 0,
"Heat transfer coeff, H, not specified");
105 example_CG.
k = example_paramBC.
k;
106 example_CG.
H = example_paramBC.
H;
107 int rbfWidthTest_size =
108 para->ITHACAdict->lookupOrDefault<
int>(
"rbfWidthTest_size", 0);
110 volScalarField T_true(example_paramBC.
_T());
112 for (label i = 0; i < T_true.internalField().size(); i++)
114 auto cx = T_true.mesh().C()[i].component(vector::X);
115 auto cy = T_true.mesh().C()[i].component(vector::Y);
116 auto cz = T_true.mesh().C()[i].component(vector::Z);
117 T_true.ref()[i] = a * cx * cx + b * cx * cy + c * cy - a * cz * cz + c;
121 fvMesh& mesh = example_paramBC.
_mesh();
122 example_paramBC.
hotSide_ind = mesh.boundaryMesh().findPatchID(
"hotSide");
123 label hotSideSize = T_true.boundaryField()[example_paramBC.
hotSide_ind].size();
124 example_paramBC.
g.resize(hotSideSize);
125 example_paramBC.
gTrue.resize(hotSideSize);
126 forAll(example_paramBC.
g, faceI)
129 mesh.boundaryMesh()[example_paramBC.
hotSide_ind].faceCentres()[faceI].x();
130 example_paramBC.
g[faceI] = example_paramBC.
k * (b * faceX + c) ;
132 example_paramBC.
gTrue = example_paramBC.
g;
134 example_CG.
g = example_paramBC.
g;
135 example_CG.
gTrue = example_paramBC.
g;
137 volScalarField& T(example_paramBC.
_T());
138 Info <<
"Exporting analytical solution" << endl;
141 volScalarField error = (T_true - T).ref();
145 Info <<
"Linf norm of the relative error = " <<
147 Info <<
"L2 norm of the error = " << ITHACAutilities::errorL2Abs(T_true,
149 Info <<
"Linf norm of the error = " << ITHACAutilities::LinfNorm(error) << endl;
166 if (parameterizedBCtest)
168#include"parameterizedBCtest.H"
172 if (parameterizedBCtest_RBFwidth)
174#include"parameterizedBCtest_RBFwidth.H"
178 if (thermocouplesLocationTest_CG)
180#include"thermocouplesLocation_CG.H"
184 if (thermocouplesLocationTest_paramBC)
186#include"thermocouplesLocation_paramBC.H"
190 if (thermocouplesNumberTest_CG)
192#include"thermocouplesNumberTest_CG.H"
196 if (thermocouplesNumberTest_paramBC)
198#include"thermocouplesNumberTest_paramBC.H"
void exportSolution(GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
Export a field to file in a certain folder and subfolder.
double errorLinfRel(GeometricField< T, fvPatchField, volMesh > &field1, GeometricField< T, fvPatchField, volMesh > &field2, List< label > *labels)
Computes the relative error between two geometric Fields in Linf norm.
double errorL2Rel(GeometricField< T, fvPatchField, volMesh > &field1, GeometricField< T, fvPatchField, volMesh > &field2, List< label > *labels)
Computes the relative error between two geometric Fields in L2 norm.