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_));
177 fvm::laplacian(
rAtU(),
p_)
196 volScalarField&
alphat =
const_cast<volScalarField&
>(
197 mesh_.thisDb().lookupObject<volScalarField>(
"alphat"));
199 volScalarField&
T =
const_cast<volScalarField&
>(
200 mesh_.thisDb().lookupObject<volScalarField>(
"T"));
226 const labelUList& owner =
mesh_.owner();
227 const labelUList& neighbour =
mesh_.neighbour();
234 scalar UScaling = 1.0;
235 if (normStateDict.found(
"U"))
237 UScaling = normStateDict.getScalar(
"U");
239 scalar UResScaling = 1.0;
243 + fvm::div(
phi_,
U_,
"div(pc)")
252 if (normResDict.found(
"URes"))
254 UResScaling =
mesh_.V()[cellI];
256 for (label i = 0; i < 3; i++)
259 PetscInt colI = rowI;
260 scalarField
D =
UEqn.D();
261 scalar val1 =
D[cellI] * UScaling / UResScaling;
263 MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
270 label ownerCellI = owner[faceI];
271 label neighbourCellI = neighbour[faceI];
273 if (normResDict.found(
"URes"))
275 UResScaling =
mesh_.V()[neighbourCellI];
278 for (label i = 0; i < 3; i++)
282 scalar val1 =
UEqn.lower()[faceI] * UScaling / UResScaling;
284 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
291 label ownerCellI = owner[faceI];
292 label neighbourCellI = neighbour[faceI];
294 if (normResDict.found(
"URes"))
296 UResScaling =
mesh_.V()[ownerCellI];
299 for (label i = 0; i < 3; i++)
303 scalar val1 =
UEqn.upper()[faceI] * UScaling / UResScaling;
305 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
312 volScalarField
rAU(1.0 /
UEqn.A());
313 autoPtr<volVectorField>
HbyAPtr =
nullptr;
321 HbyAPtr.reset(
new volVectorField(
"HbyA",
U_));
333 fvm::laplacian(
rAtU(),
p_)
339 scalar pScaling = 1.0;
340 if (normStateDict.found(
"p"))
342 pScaling = normStateDict.getScalar(
"p");
344 scalar pResScaling = 1.0;
348 if (normResDict.found(
"pRes"))
350 pResScaling =
mesh_.V()[cellI];
354 PetscInt colI = rowI;
355 scalarField
D = pEqn.D();
356 scalar val1 =
D[cellI] * pScaling / pResScaling;
358 MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
364 label ownerCellI = owner[faceI];
365 label neighbourCellI = neighbour[faceI];
367 if (normResDict.found(
"pRes"))
369 pResScaling =
mesh_.V()[neighbourCellI];
374 scalar val1 = pEqn.lower()[faceI] * pScaling / pResScaling;
376 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
382 label ownerCellI = owner[faceI];
383 label neighbourCellI = neighbour[faceI];
385 if (normResDict.found(
"pRes"))
387 pResScaling =
mesh_.V()[ownerCellI];
392 scalar val1 = pEqn.upper()[faceI] * pScaling / pResScaling;
394 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
399 volScalarField&
alphat =
const_cast<volScalarField&
>(
400 mesh_.thisDb().lookupObject<volScalarField>(
"alphat"));
402 volScalarField&
T =
const_cast<volScalarField&
>(
403 mesh_.thisDb().lookupObject<volScalarField>(
"T"));
414 scalar TScaling = 1.0;
415 if (normStateDict.found(
"T"))
417 TScaling = normStateDict.getScalar(
"T");
419 scalar TResScaling = 1.0;
423 if (normResDict.found(
"TRes"))
425 TResScaling =
mesh_.V()[cellI];
429 PetscInt colI = rowI;
430 scalarField
D =
TEqn.D();
431 scalar val1 =
D[cellI] * TScaling / TResScaling;
433 MatSetValues(PCMat, 1, &rowI, 1, &colI, &val, INSERT_VALUES);
439 label ownerCellI = owner[faceI];
440 label neighbourCellI = neighbour[faceI];
442 if (normResDict.found(
"TRes"))
444 TResScaling =
mesh_.V()[neighbourCellI];
449 scalar val1 =
TEqn.lower()[faceI] * TScaling / TResScaling;
451 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
457 label ownerCellI = owner[faceI];
458 label neighbourCellI = neighbour[faceI];
460 if (normResDict.found(
"TRes"))
462 TResScaling =
mesh_.V()[ownerCellI];
467 scalar val1 =
TEqn.upper()[faceI] * TScaling / TResScaling;
469 MatSetValues(PCMat, 1, &colI, 1, &rowI, &val, INSERT_VALUES);
491 U_.correctBoundaryConditions();
492 p_.correctBoundaryConditions();
495 volScalarField&
T =
const_cast<volScalarField&
>(
496 mesh_.thisDb().lookupObject<volScalarField>(
"T"));
497 T.correctBoundaryConditions();