31 fvSource_(const_cast<volVectorField&>(
32 mesh_.thisDb().lookupObject<volVectorField>(
"fvSource"))),
35 pimple_(const_cast<fvMesh&>(
mesh))
39 if (
allOptions.subDict(
"fvSource").toc().size() != 0)
52 mesh.time().timeName(),
57 dimensionedScalar(
"TRes", dimensionSet(0, 0, -1, 1, 0, 0, 0), 0.0),
58 zeroGradientFvPatchField<scalar>::typeName));
61 IOdictionary transportProperties(
63 "transportProperties",
64 mesh.time().constant(),
69 Pr_ = readScalar(transportProperties.lookup(
"Pr"));
70 Prt_ = readScalar(transportProperties.lookup(
"Prt"));
116 word divUScheme =
"div(phi,U)";
118 label isPC = options.getLabel(
"isPC");
122 divUScheme =
"div(pc)";
135 + fvm::div(
phi_,
U_, divUScheme)
152 volScalarField
rAU(1.0 /
UEqn.A());
157 autoPtr<volVectorField>
HbyAPtr =
nullptr;
165 HbyAPtr.reset(
new volVectorField(
"HbyA",
U_));
174 if (
p_.needReference())
190 fvm::laplacian(
rAtU(),
p_)
206 volScalarField&
alphat =
const_cast<volScalarField&
>(
207 mesh_.thisDb().lookupObject<volScalarField>(
"alphat"));
209 volScalarField&
T =
const_cast<volScalarField&
>(
210 mesh_.thisDb().lookupObject<volScalarField>(
"T"));
236 const labelUList& owner =
mesh_.owner();
237 const labelUList& neighbour =
mesh_.neighbour();
244 scalar UScaling = 1.0;
245 if (normStateDict.found(
"U"))
247 UScaling = normStateDict.getScalar(
"U");
249 scalar UResScaling = 1.0;
253 + fvm::div(
phi_,
U_,
"div(pc)")
262 if (normResDict.found(
"URes"))
264 UResScaling =
mesh_.V()[cellI];
266 for (label i = 0; i < 3; i++)
269 PetscInt colI = rowI;
270 scalarField
D =
UEqn.D();
271 scalar val1 =
D[cellI] * UScaling / UResScaling;
273 MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
280 label ownerCellI = owner[faceI];
281 label neighbourCellI = neighbour[faceI];
283 if (normResDict.found(
"URes"))
285 UResScaling =
mesh_.V()[neighbourCellI];
288 for (label i = 0; i < 3; i++)
292 scalar val1 =
UEqn.lower()[faceI] * UScaling / UResScaling;
294 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
301 label ownerCellI = owner[faceI];
302 label neighbourCellI = neighbour[faceI];
304 if (normResDict.found(
"URes"))
306 UResScaling =
mesh_.V()[ownerCellI];
309 for (label i = 0; i < 3; i++)
313 scalar val1 =
UEqn.upper()[faceI] * UScaling / UResScaling;
315 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
322 volScalarField
rAU(1.0 /
UEqn.A());
323 autoPtr<volVectorField>
HbyAPtr =
nullptr;
331 HbyAPtr.reset(
new volVectorField(
"HbyA",
U_));
340 if (
p_.needReference())
356 fvm::laplacian(
rAtU(),
p_)
362 scalar pScaling = 1.0;
363 if (normStateDict.found(
"p"))
365 pScaling = normStateDict.getScalar(
"p");
367 scalar pResScaling = 1.0;
371 if (normResDict.found(
"pRes"))
373 pResScaling =
mesh_.V()[cellI];
377 PetscInt colI = rowI;
378 scalarField
D = pEqn.D();
379 scalar val1 =
D[cellI] * pScaling / pResScaling;
381 MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
387 label ownerCellI = owner[faceI];
388 label neighbourCellI = neighbour[faceI];
390 if (normResDict.found(
"pRes"))
392 pResScaling =
mesh_.V()[neighbourCellI];
397 scalar val1 = pEqn.lower()[faceI] * pScaling / pResScaling;
399 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
405 label ownerCellI = owner[faceI];
406 label neighbourCellI = neighbour[faceI];
408 if (normResDict.found(
"pRes"))
410 pResScaling =
mesh_.V()[ownerCellI];
415 scalar val1 = pEqn.upper()[faceI] * pScaling / pResScaling;
417 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
422 volScalarField&
alphat =
const_cast<volScalarField&
>(
423 mesh_.thisDb().lookupObject<volScalarField>(
"alphat"));
425 volScalarField&
T =
const_cast<volScalarField&
>(
426 mesh_.thisDb().lookupObject<volScalarField>(
"T"));
437 scalar TScaling = 1.0;
438 if (normStateDict.found(
"T"))
440 TScaling = normStateDict.getScalar(
"T");
442 scalar TResScaling = 1.0;
446 if (normResDict.found(
"TRes"))
448 TResScaling =
mesh_.V()[cellI];
452 PetscInt colI = rowI;
453 scalarField
D =
TEqn.D();
454 scalar val1 =
D[cellI] * TScaling / TResScaling;
456 MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
462 label ownerCellI = owner[faceI];
463 label neighbourCellI = neighbour[faceI];
465 if (normResDict.found(
"TRes"))
467 TResScaling =
mesh_.V()[neighbourCellI];
472 scalar val1 =
TEqn.lower()[faceI] * TScaling / TResScaling;
474 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
480 label ownerCellI = owner[faceI];
481 label neighbourCellI = neighbour[faceI];
483 if (normResDict.found(
"TRes"))
485 TResScaling =
mesh_.V()[ownerCellI];
490 scalar val1 =
TEqn.upper()[faceI] * TScaling / TResScaling;
492 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
514 U_.correctBoundaryConditions();
515 p_.correctBoundaryConditions();
518 volScalarField&
T =
const_cast<volScalarField&
>(
519 mesh_.thisDb().lookupObject<volScalarField>(
"T"));
520 T.correctBoundaryConditions();