14 meshFile = os.path.join(
15 os.path.dirname(__file__),
"..",
"..",
"data",
"mesh",
"NACA0012_H2.cgns"
18 meshFile = os.path.join(
19 os.path.dirname(__file__),
"..",
"..",
"data",
"mesh",
"Uniform_3x3.cgns"
22 mesh, reader, name2Id = create_mesh_from_CGNS(
27 "translation1": [3, 0, 0],
28 "translation2": [0, 3, 0],
32 meshBnd, readerBnd = create_bnd_mesh(mesh)
34 vfvSettings = json.loads(
37 line
if not line.strip().startswith(
"//")
else ""
42 "cacheDiffBase": true,
45 "smoothThreshold": 1e-3,
49 "subs2ndOrderGGScheme": 0,
51 "localOrientation": false,
52 "anisotropicLengths": false
54 "functionalSettings": {
55 // "scaleType": "MeanAACBB",
56 "dirWeightScheme": "HQM_OPT",
57 // "dirWeightScheme": "ManualDirWeight",
58 // "manualDirWeights": [
64 "geomWeightScheme": "HQM_SD",
65 "geomWeightPower": 0.5,
67 // "geomWeightScheme": "SD_Power",
68 // "geomWeightPower1": -0.5,
69 // "geomWeightPower2": 0.5,
70 // "useAnisotropicFunctional": true,
71 // // "anisotropicType": "InertiaCoordBB",
72 // "inertiaWeightPower": 0,
73 // "scaleMultiplier": 1,
83 vfv = CFV.VariationalReconstruction_2(mpi, mesh)
84 vfv.ParseSettings(vfvSettings)
85 vfv.SetPeriodicTransformationsNoOp()
87 bcid_2_bcweight_map = {}
88 for name, id
in name2Id.n2id_map.items():
90 bcid_2_bcweight_map[(id, 0)] = 1.0
91 if name.startswith(
"PERIODIC"):
92 bcid_2_bcweight_map[(id, 0)] = 1.0
93 bcid_2_bcweight_map[(id, 1)] = 1.0
94 bcid_2_bcweight_map[(id, 2)] = 1.0
95 bcid_2_bcweight_map[(id, 3)] = 1.0
96 vfv.ConstructMetrics()
97 vfv.ConstructBaseAndWeight_map(bcid_2_bcweight_map)
98 vfv.ConstructRecCoeff()
102 uRec, uRecNew = [CFV.tURec_D()
for _
in range(2)]
104 vfv.BuildUDof_D(u_, 1)
105 for uRec_
in [uRec, uRecNew]:
106 vfv.BuildURec_D(uRec_, 1)
107 for i
in range(mesh.NumCell()):
108 u_i = np.array(u[i], copy=
False)
109 u_i[0] = vfv.GetCellBary(i)[0]
110 print(vfv.GetCellBary(i))
111 print(np.array(u[i], copy=
False))
114 f
"rank [{mpi.rank}], u.Size() = {u.Size()}, u.father.Size() = {u.father.Size()}"
118 eval = CFV.ModelEvaluator(mesh, vfv, {}, 1)
119 eval.EvaluateRHS(rhs, u, uRec, 0.0)
120 for i
in range(mesh.NumCell()):
121 print(np.array(rhs[i], copy=
False))
122 FBoundary = eval.get_FBoundary(0.5)
123 eval.DoReconstructionIter(uRec, uRecNew, u, 0.0,
False)
124 for i
in range(mesh.NumCell()):
125 print(np.array(uRec[i], copy=
False))