mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: various: move boundaryField(), internalField() out of loop
This commit is contained in:
@ -146,6 +146,9 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
|
|
||||||
decompositionMethod& decomposer = decomposerPtr_();
|
decompositionMethod& decomposer = decomposerPtr_();
|
||||||
|
|
||||||
|
volScalarField::InternalField& icellWeights = cellWeights.internalField();
|
||||||
|
|
||||||
|
|
||||||
// For each cell in the mesh has it been determined if it is fully
|
// For each cell in the mesh has it been determined if it is fully
|
||||||
// inside, outside, or overlaps the surface
|
// inside, outside, or overlaps the surface
|
||||||
labelList volumeStatus
|
labelList volumeStatus
|
||||||
@ -214,10 +217,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
volumeStatus[cellI] = searchableSurface::UNKNOWN;
|
volumeStatus[cellI] = searchableSurface::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
cellWeights.internalField()[cellI] = max
|
icellWeights[cellI] = max
|
||||||
(
|
(
|
||||||
1.0,
|
1.0,
|
||||||
cellWeights.internalField()[cellI]/8.0
|
icellWeights[cellI]/8.0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +408,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
|||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
mesh_.cellCentres(),
|
mesh_.cellCentres(),
|
||||||
cellWeights
|
icellWeights
|
||||||
);
|
);
|
||||||
|
|
||||||
fvMeshDistribute distributor(mesh_, mergeDist_);
|
fvMeshDistribute distributor(mesh_, mergeDist_);
|
||||||
@ -629,6 +632,8 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
|
|||||||
volScalarField& cellWeights
|
volScalarField& cellWeights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
volScalarField::InternalField& icellWeights = cellWeights.internalField();
|
||||||
|
|
||||||
labelHashSet cellsToRefine;
|
labelHashSet cellsToRefine;
|
||||||
|
|
||||||
// Determine/update the status of each cell
|
// Determine/update the status of each cell
|
||||||
@ -650,7 +655,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
|
|||||||
(
|
(
|
||||||
cellI,
|
cellI,
|
||||||
volumeStatus[cellI],
|
volumeStatus[cellI],
|
||||||
cellWeights.internalField()[cellI]
|
icellWeights[cellI]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -871,15 +876,17 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
mesh_.write();
|
mesh_.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volScalarField::InternalField& icellWeights = cellWeights.internalField();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Refine large cells if necessary
|
// Refine large cells if necessary
|
||||||
|
|
||||||
label nOccupiedCells = 0;
|
label nOccupiedCells = 0;
|
||||||
|
|
||||||
forAll(cellWeights.internalField(), cI)
|
forAll(icellWeights, cI)
|
||||||
{
|
{
|
||||||
if (cellWeights.internalField()[cI] > 1 - SMALL)
|
if (icellWeights[cI] > 1 - SMALL)
|
||||||
{
|
{
|
||||||
nOccupiedCells++;
|
nOccupiedCells++;
|
||||||
}
|
}
|
||||||
@ -910,9 +917,9 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
|
|
||||||
labelHashSet cellsToRefine;
|
labelHashSet cellsToRefine;
|
||||||
|
|
||||||
forAll(cellWeights, cWI)
|
forAll(icellWeights, cWI)
|
||||||
{
|
{
|
||||||
if (cellWeights.internalField()[cWI] > cellWeightLimit)
|
if (icellWeights[cWI] > cellWeightLimit)
|
||||||
{
|
{
|
||||||
cellsToRefine.insert(cWI);
|
cellsToRefine.insert(cWI);
|
||||||
}
|
}
|
||||||
@ -943,7 +950,7 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
{
|
{
|
||||||
label cellI = newCellsToRefine[nCTRI];
|
label cellI = newCellsToRefine[nCTRI];
|
||||||
|
|
||||||
cellWeights.internalField()[cellI] /= 8.0;
|
icellWeights[cellI] /= 8.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mesh changing engine.
|
// Mesh changing engine.
|
||||||
@ -1075,9 +1082,9 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
printMeshData(mesh_);
|
printMeshData(mesh_);
|
||||||
|
|
||||||
Pout<< " Pre distribute sum(cellWeights) "
|
Pout<< " Pre distribute sum(cellWeights) "
|
||||||
<< sum(cellWeights.internalField())
|
<< sum(icellWeights)
|
||||||
<< " max(cellWeights) "
|
<< " max(cellWeights) "
|
||||||
<< max(cellWeights.internalField())
|
<< max(icellWeights)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1085,7 +1092,7 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
mesh_.cellCentres(),
|
mesh_.cellCentres(),
|
||||||
cellWeights
|
icellWeights
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Redistributing background mesh cells" << endl;
|
Info<< " Redistributing background mesh cells" << endl;
|
||||||
@ -1101,9 +1108,9 @@ Foam::backgroundMeshDecomposition::distribute
|
|||||||
printMeshData(mesh_);
|
printMeshData(mesh_);
|
||||||
|
|
||||||
Pout<< " Post distribute sum(cellWeights) "
|
Pout<< " Post distribute sum(cellWeights) "
|
||||||
<< sum(cellWeights.internalField())
|
<< sum(icellWeights)
|
||||||
<< " max(cellWeights) "
|
<< " max(cellWeights) "
|
||||||
<< max(cellWeights.internalField())
|
<< max(icellWeights)
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// const_cast<Time&>(mesh_.time())++;
|
// const_cast<Time&>(mesh_.time())++;
|
||||||
|
|||||||
@ -131,17 +131,16 @@ void MapGeometricFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Map the patch fields
|
// Map the patch fields
|
||||||
forAll(field.boundaryField(), patchi)
|
typename GeometricField<Type, PatchField, GeoMesh>
|
||||||
|
::GeometricBoundaryField& bfield = field.boundaryField();
|
||||||
|
forAll(bfield, patchi)
|
||||||
{
|
{
|
||||||
// Cannot check sizes for patch fields because of
|
// Cannot check sizes for patch fields because of
|
||||||
// empty fields in FV and because point fields get their size
|
// empty fields in FV and because point fields get their size
|
||||||
// from the patch which has already been resized
|
// from the patch which has already been resized
|
||||||
//
|
//
|
||||||
|
|
||||||
field.boundaryField()[patchi].autoMap
|
bfield[patchi].autoMap(mapper.boundaryMap()[patchi]);
|
||||||
(
|
|
||||||
mapper.boundaryMap()[patchi]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
field.instance() = field.time().timeName();
|
field.instance() = field.time().timeName();
|
||||||
|
|||||||
@ -104,16 +104,20 @@ Foam::tmp<Foam::volScalarField> Foam::consumptionSpeed::omega0Sigma
|
|||||||
|
|
||||||
volScalarField& omega0 = tomega0();
|
volScalarField& omega0 = tomega0();
|
||||||
|
|
||||||
forAll(omega0, celli)
|
volScalarField::InternalField& iomega0 = omega0.internalField();
|
||||||
|
|
||||||
|
forAll(iomega0, celli)
|
||||||
{
|
{
|
||||||
omega0[celli] = omega0Sigma(sigma[celli], 1.0);
|
iomega0[celli] = omega0Sigma(sigma[celli], 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(omega0.boundaryField(), patchi)
|
volScalarField::GeometricBoundaryField& bomega0 = omega0.boundaryField();
|
||||||
|
|
||||||
|
forAll(bomega0, patchi)
|
||||||
{
|
{
|
||||||
forAll(omega0.boundaryField()[patchi], facei)
|
forAll(bomega0[patchi], facei)
|
||||||
{
|
{
|
||||||
omega0.boundaryField()[patchi][facei] =
|
bomega0[patchi][facei] =
|
||||||
omega0Sigma
|
omega0Sigma
|
||||||
(
|
(
|
||||||
sigma.boundaryField()[patchi][facei],
|
sigma.boundaryField()[patchi][facei],
|
||||||
|
|||||||
@ -360,9 +360,11 @@ Foam::dynamicRefineFvMesh::refine
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recalculate new boundary faces.
|
// Recalculate new boundary faces.
|
||||||
forAll(phi.boundaryField(), patchI)
|
surfaceScalarField::GeometricBoundaryField& bphi =
|
||||||
|
phi.boundaryField();
|
||||||
|
forAll(bphi, patchI)
|
||||||
{
|
{
|
||||||
fvsPatchScalarField& patchPhi = phi.boundaryField()[patchI];
|
fvsPatchScalarField& patchPhi = bphi[patchI];
|
||||||
const fvsPatchScalarField& patchPhiU =
|
const fvsPatchScalarField& patchPhiU =
|
||||||
phiU.boundaryField()[patchI];
|
phiU.boundaryField()[patchI];
|
||||||
|
|
||||||
@ -404,8 +406,7 @@ Foam::dynamicRefineFvMesh::refine
|
|||||||
const fvsPatchScalarField& patchPhiU =
|
const fvsPatchScalarField& patchPhiU =
|
||||||
phiU.boundaryField()[patchI];
|
phiU.boundaryField()[patchI];
|
||||||
|
|
||||||
fvsPatchScalarField& patchPhi =
|
fvsPatchScalarField& patchPhi = bphi[patchI];
|
||||||
phi.boundaryField()[patchI];
|
|
||||||
|
|
||||||
patchPhi[i] = patchPhiU[i];
|
patchPhi[i] = patchPhiU[i];
|
||||||
}
|
}
|
||||||
@ -549,6 +550,9 @@ Foam::dynamicRefineFvMesh::unrefine
|
|||||||
}
|
}
|
||||||
|
|
||||||
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
|
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
|
||||||
|
surfaceScalarField::GeometricBoundaryField& bphi =
|
||||||
|
phi.boundaryField();
|
||||||
|
|
||||||
const surfaceScalarField phiU
|
const surfaceScalarField phiU
|
||||||
(
|
(
|
||||||
fvc::interpolate
|
fvc::interpolate
|
||||||
@ -582,10 +586,7 @@ Foam::dynamicRefineFvMesh::unrefine
|
|||||||
|
|
||||||
const fvsPatchScalarField& patchPhiU =
|
const fvsPatchScalarField& patchPhiU =
|
||||||
phiU.boundaryField()[patchI];
|
phiU.boundaryField()[patchI];
|
||||||
|
fvsPatchScalarField& patchPhi = bphi[patchI];
|
||||||
fvsPatchScalarField& patchPhi =
|
|
||||||
phi.boundaryField()[patchI];
|
|
||||||
|
|
||||||
patchPhi[i] = patchPhiU[i];
|
patchPhi[i] = patchPhiU[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,6 +81,9 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
// Patch fields from old mesh
|
// Patch fields from old mesh
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
typename GeometricField<Type, fvPatchField, volMesh>::
|
||||||
|
GeometricBoundaryField& bfld = fld.boundaryField();
|
||||||
|
|
||||||
{
|
{
|
||||||
const labelList& oldPatchMap = meshMap.oldPatchMap();
|
const labelList& oldPatchMap = meshMap.oldPatchMap();
|
||||||
const labelList& oldPatchStarts = meshMap.oldPatchStarts();
|
const labelList& oldPatchStarts = meshMap.oldPatchStarts();
|
||||||
@ -121,18 +124,18 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
|
|
||||||
|
|
||||||
// Sort deleted ones last so is now in newPatch ordering
|
// Sort deleted ones last so is now in newPatch ordering
|
||||||
fld.boundaryField().reorder(oldToNew);
|
bfld.reorder(oldToNew);
|
||||||
// Extend to covers all patches
|
// Extend to covers all patches
|
||||||
fld.boundaryField().setSize(mesh.boundaryMesh().size());
|
bfld.setSize(mesh.boundaryMesh().size());
|
||||||
// Delete unused patches
|
// Delete unused patches
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
label newPatchI = nUsedPatches;
|
label newPatchI = nUsedPatches;
|
||||||
newPatchI < fld.boundaryField().size();
|
newPatchI < bfld.size();
|
||||||
newPatchI++
|
newPatchI++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fld.boundaryField().set(newPatchI, NULL);
|
bfld.set(newPatchI, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,12 +170,12 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
// value
|
// value
|
||||||
// - hope that field mapping allows aliasing since old and new
|
// - hope that field mapping allows aliasing since old and new
|
||||||
// are same memory!
|
// are same memory!
|
||||||
fld.boundaryField().set
|
bfld.set
|
||||||
(
|
(
|
||||||
newPatchI,
|
newPatchI,
|
||||||
fvPatchField<Type>::New
|
fvPatchField<Type>::New
|
||||||
(
|
(
|
||||||
fld.boundaryField()[newPatchI], // old field
|
bfld[newPatchI], // old field
|
||||||
mesh.boundary()[newPatchI], // new fvPatch
|
mesh.boundary()[newPatchI], // new fvPatch
|
||||||
fld.dimensionedInternalField(), // new internal field
|
fld.dimensionedInternalField(), // new internal field
|
||||||
patchMapper // mapper (new to old)
|
patchMapper // mapper (new to old)
|
||||||
@ -201,7 +204,7 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
const polyPatch& oldPatch =
|
const polyPatch& oldPatch =
|
||||||
fldToAdd.mesh().boundaryMesh()[patchI];
|
fldToAdd.mesh().boundaryMesh()[patchI];
|
||||||
|
|
||||||
if (!fld.boundaryField()(newPatchI))
|
if (!bfld(newPatchI))
|
||||||
{
|
{
|
||||||
// First occurrence of newPatchI. Map from existing
|
// First occurrence of newPatchI. Map from existing
|
||||||
// patchField
|
// patchField
|
||||||
@ -221,7 +224,7 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
|
|
||||||
directFvPatchFieldMapper patchMapper(newToAdded);
|
directFvPatchFieldMapper patchMapper(newToAdded);
|
||||||
|
|
||||||
fld.boundaryField().set
|
bfld.set
|
||||||
(
|
(
|
||||||
newPatchI,
|
newPatchI,
|
||||||
fvPatchField<Type>::New
|
fvPatchField<Type>::New
|
||||||
@ -255,7 +258,7 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
const fvPatchField<Type>& addedFld =
|
const fvPatchField<Type>& addedFld =
|
||||||
fldToAdd.boundaryField()[patchI];
|
fldToAdd.boundaryField()[patchI];
|
||||||
|
|
||||||
fvPatchField<Type>& newFld = fld.boundaryField()[newPatchI];
|
fvPatchField<Type>& newFld = bfld[newPatchI];
|
||||||
|
|
||||||
forAll(newFld, i)
|
forAll(newFld, i)
|
||||||
{
|
{
|
||||||
@ -357,6 +360,9 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
const fvMesh& mesh = fld.mesh();
|
const fvMesh& mesh = fld.mesh();
|
||||||
const labelList& oldPatchStarts = meshMap.oldPatchStarts();
|
const labelList& oldPatchStarts = meshMap.oldPatchStarts();
|
||||||
|
|
||||||
|
typename GeometricField<Type, fvsPatchField, surfaceMesh>::
|
||||||
|
GeometricBoundaryField& bfld = fld.boundaryField();
|
||||||
|
|
||||||
// Internal field
|
// Internal field
|
||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -375,9 +381,9 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
// Faces that were boundary faces but are not anymore.
|
// Faces that were boundary faces but are not anymore.
|
||||||
// Use owner value (so lowest numbered cell, i.e. from 'old' not 'added'
|
// Use owner value (so lowest numbered cell, i.e. from 'old' not 'added'
|
||||||
// mesh)
|
// mesh)
|
||||||
forAll(fld.boundaryField(), patchI)
|
forAll(bfld, patchI)
|
||||||
{
|
{
|
||||||
const fvsPatchField<Type>& pf = fld.boundaryField()[patchI];
|
const fvsPatchField<Type>& pf = bfld[patchI];
|
||||||
|
|
||||||
label start = oldPatchStarts[patchI];
|
label start = oldPatchStarts[patchI];
|
||||||
|
|
||||||
@ -436,18 +442,18 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
|
|
||||||
|
|
||||||
// Sort deleted ones last so is now in newPatch ordering
|
// Sort deleted ones last so is now in newPatch ordering
|
||||||
fld.boundaryField().reorder(oldToNew);
|
bfld.reorder(oldToNew);
|
||||||
// Extend to covers all patches
|
// Extend to covers all patches
|
||||||
fld.boundaryField().setSize(mesh.boundaryMesh().size());
|
bfld.setSize(mesh.boundaryMesh().size());
|
||||||
// Delete unused patches
|
// Delete unused patches
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
label newPatchI = nUsedPatches;
|
label newPatchI = nUsedPatches;
|
||||||
newPatchI < fld.boundaryField().size();
|
newPatchI < bfld.size();
|
||||||
newPatchI++
|
newPatchI++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fld.boundaryField().set(newPatchI, NULL);
|
bfld.set(newPatchI, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -478,16 +484,16 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
// Create new patchField with same type as existing one.
|
// Create new patchField with same type as existing one.
|
||||||
// Note:
|
// Note:
|
||||||
// - boundaryField already in new order so access with newPatchI
|
// - boundaryField already in new order so access with newPatchI
|
||||||
// - fld.boundaryField()[newPatchI] both used for type and old
|
// - bfld[newPatchI] both used for type and old
|
||||||
// value
|
// value
|
||||||
// - hope that field mapping allows aliasing since old and new
|
// - hope that field mapping allows aliasing since old and new
|
||||||
// are same memory!
|
// are same memory!
|
||||||
fld.boundaryField().set
|
bfld.set
|
||||||
(
|
(
|
||||||
newPatchI,
|
newPatchI,
|
||||||
fvsPatchField<Type>::New
|
fvsPatchField<Type>::New
|
||||||
(
|
(
|
||||||
fld.boundaryField()[newPatchI], // old field
|
bfld[newPatchI], // old field
|
||||||
mesh.boundary()[newPatchI], // new fvPatch
|
mesh.boundary()[newPatchI], // new fvPatch
|
||||||
fld.dimensionedInternalField(), // new internal field
|
fld.dimensionedInternalField(), // new internal field
|
||||||
patchMapper // mapper (new to old)
|
patchMapper // mapper (new to old)
|
||||||
@ -516,7 +522,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
const polyPatch& oldPatch =
|
const polyPatch& oldPatch =
|
||||||
fldToAdd.mesh().boundaryMesh()[patchI];
|
fldToAdd.mesh().boundaryMesh()[patchI];
|
||||||
|
|
||||||
if (!fld.boundaryField()(newPatchI))
|
if (!bfld(newPatchI))
|
||||||
{
|
{
|
||||||
// First occurrence of newPatchI. Map from existing
|
// First occurrence of newPatchI. Map from existing
|
||||||
// patchField
|
// patchField
|
||||||
@ -536,7 +542,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
|
|
||||||
directFvPatchFieldMapper patchMapper(newToAdded);
|
directFvPatchFieldMapper patchMapper(newToAdded);
|
||||||
|
|
||||||
fld.boundaryField().set
|
bfld.set
|
||||||
(
|
(
|
||||||
newPatchI,
|
newPatchI,
|
||||||
fvsPatchField<Type>::New
|
fvsPatchField<Type>::New
|
||||||
@ -570,8 +576,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
const fvsPatchField<Type>& addedFld =
|
const fvsPatchField<Type>& addedFld =
|
||||||
fldToAdd.boundaryField()[patchI];
|
fldToAdd.boundaryField()[patchI];
|
||||||
|
|
||||||
fvsPatchField<Type>& newFld =
|
fvsPatchField<Type>& newFld = bfld[newPatchI];
|
||||||
fld.boundaryField()[newPatchI];
|
|
||||||
|
|
||||||
forAll(newFld, i)
|
forAll(newFld, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,10 +47,12 @@ bool Foam::adjustPhi
|
|||||||
scalar fixedMassOut = 0.0;
|
scalar fixedMassOut = 0.0;
|
||||||
scalar adjustableMassOut = 0.0;
|
scalar adjustableMassOut = 0.0;
|
||||||
|
|
||||||
forAll(phi.boundaryField(), patchi)
|
surfaceScalarField::GeometricBoundaryField& bphi = phi.boundaryField();
|
||||||
|
|
||||||
|
forAll(bphi, patchi)
|
||||||
{
|
{
|
||||||
const fvPatchVectorField& Up = U.boundaryField()[patchi];
|
const fvPatchVectorField& Up = U.boundaryField()[patchi];
|
||||||
const fvsPatchScalarField& phip = phi.boundaryField()[patchi];
|
const fvsPatchScalarField& phip = bphi[patchi];
|
||||||
|
|
||||||
if (!isA<processorFvsPatchScalarField>(phip))
|
if (!isA<processorFvsPatchScalarField>(phip))
|
||||||
{
|
{
|
||||||
@ -123,10 +125,10 @@ bool Foam::adjustPhi
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(phi.boundaryField(), patchi)
|
forAll(bphi, patchi)
|
||||||
{
|
{
|
||||||
const fvPatchVectorField& Up = U.boundaryField()[patchi];
|
const fvPatchVectorField& Up = U.boundaryField()[patchi];
|
||||||
fvsPatchScalarField& phip = phi.boundaryField()[patchi];
|
fvsPatchScalarField& phip = bphi[patchi];
|
||||||
|
|
||||||
if (!isA<processorFvsPatchScalarField>(phip))
|
if (!isA<processorFvsPatchScalarField>(phip))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,7 +75,10 @@ tmp<volScalarField> CoEulerDdtScheme<Type>::CorDeltaT() const
|
|||||||
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
|
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(corDeltaT.boundaryField(), patchi)
|
volScalarField::GeometricBoundaryField& bcorDeltaT =
|
||||||
|
corDeltaT.boundaryField();
|
||||||
|
|
||||||
|
forAll(bcorDeltaT, patchi)
|
||||||
{
|
{
|
||||||
const fvsPatchScalarField& pcofrDeltaT =
|
const fvsPatchScalarField& pcofrDeltaT =
|
||||||
cofrDeltaT.boundaryField()[patchi];
|
cofrDeltaT.boundaryField()[patchi];
|
||||||
|
|||||||
@ -73,9 +73,12 @@ average
|
|||||||
surfaceSum(mesh.magSf()*ssf)/surfaceSum(mesh.magSf())
|
surfaceSum(mesh.magSf()*ssf)/surfaceSum(mesh.magSf())
|
||||||
)().internalField();
|
)().internalField();
|
||||||
|
|
||||||
forAll(av.boundaryField(), patchi)
|
typename GeometricField<Type, fvPatchField, volMesh>::
|
||||||
|
GeometricBoundaryField& bav = av.boundaryField();
|
||||||
|
|
||||||
|
forAll(bav, patchi)
|
||||||
{
|
{
|
||||||
av.boundaryField()[patchi] = ssf.boundaryField()[patchi];
|
bav[patchi] = ssf.boundaryField()[patchi];
|
||||||
}
|
}
|
||||||
|
|
||||||
av.correctBoundaryConditions();
|
av.correctBoundaryConditions();
|
||||||
|
|||||||
@ -130,9 +130,11 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
|
|||||||
|
|
||||||
// Visit the boundaries. Coupled boundaries are taken into account
|
// Visit the boundaries. Coupled boundaries are taken into account
|
||||||
// in the construction of d vectors.
|
// in the construction of d vectors.
|
||||||
forAll(lsP.boundaryField(), patchi)
|
surfaceVectorField::GeometricBoundaryField& blsP = lsP.boundaryField();
|
||||||
|
|
||||||
|
forAll(blsP, patchi)
|
||||||
{
|
{
|
||||||
const fvPatch& p = lsP.boundaryField()[patchi].patch();
|
const fvPatch& p = blsP[patchi].patch();
|
||||||
const labelUList& faceCells = p.faceCells();
|
const labelUList& faceCells = p.faceCells();
|
||||||
|
|
||||||
// Build the d-vectors
|
// Build the d-vectors
|
||||||
@ -242,9 +244,9 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
|
|||||||
((-1.0)/magSqr(d[facei]))*(invDd[neighbour[facei]] & d);
|
((-1.0)/magSqr(d[facei]))*(invDd[neighbour[facei]] & d);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(lsP.boundaryField(), patchI)
|
forAll(blsP, patchI)
|
||||||
{
|
{
|
||||||
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
|
fvsPatchVectorField& patchLsP = blsP[patchI];
|
||||||
|
|
||||||
const fvPatch& p = patchLsP.patch();
|
const fvPatch& p = patchLsP.patch();
|
||||||
const labelUList& faceCells = p.faceCells();
|
const labelUList& faceCells = p.faceCells();
|
||||||
|
|||||||
@ -121,7 +121,9 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
forAll(lsP.boundaryField(), patchi)
|
surfaceVectorField::GeometricBoundaryField& blsP = lsP.boundaryField();
|
||||||
|
|
||||||
|
forAll(blsP, patchi)
|
||||||
{
|
{
|
||||||
const fvsPatchScalarField& pw = w.boundaryField()[patchi];
|
const fvsPatchScalarField& pw = w.boundaryField()[patchi];
|
||||||
const fvsPatchScalarField& pMagSf = magSf.boundaryField()[patchi];
|
const fvsPatchScalarField& pMagSf = magSf.boundaryField()[patchi];
|
||||||
@ -172,9 +174,9 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||||||
lsN[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] & d);
|
lsN[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] & d);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(lsP.boundaryField(), patchi)
|
forAll(blsP, patchi)
|
||||||
{
|
{
|
||||||
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchi];
|
fvsPatchVectorField& patchLsP = blsP[patchi];
|
||||||
|
|
||||||
const fvsPatchScalarField& pw = w.boundaryField()[patchi];
|
const fvsPatchScalarField& pw = w.boundaryField()[patchi];
|
||||||
const fvsPatchScalarField& pMagSf = magSf.boundaryField()[patchi];
|
const fvsPatchScalarField& pMagSf = magSf.boundaryField()[patchi];
|
||||||
|
|||||||
@ -668,9 +668,12 @@ void Foam::MULES::limitSum(SurfaceScalarFieldList& phiPsiCorrs)
|
|||||||
limitSum(phiPsiCorrsInternal);
|
limitSum(phiPsiCorrsInternal);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(phiPsiCorrs[0].boundaryField(), patchi)
|
surfaceScalarField::GeometricBoundaryField& bfld =
|
||||||
|
phiPsiCorrs[0].boundaryField();
|
||||||
|
|
||||||
|
forAll(bfld, patchi)
|
||||||
{
|
{
|
||||||
if (phiPsiCorrs[0].boundaryField()[patchi].coupled())
|
if (bfld[patchi].coupled())
|
||||||
{
|
{
|
||||||
UPtrList<scalarField> phiPsiCorrsPatch(phiPsiCorrs.size());
|
UPtrList<scalarField> phiPsiCorrsPatch(phiPsiCorrs.size());
|
||||||
forAll(phiPsiCorrs, phasei)
|
forAll(phiPsiCorrs, phasei)
|
||||||
|
|||||||
@ -76,18 +76,18 @@ if (runTime.outputTime())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(totalVelocity.internalField(), tV)
|
volVectorField::InternalField& itotalVelocity =
|
||||||
|
totalVelocity.internalField();
|
||||||
|
|
||||||
|
forAll(itotalVelocity, tV)
|
||||||
{
|
{
|
||||||
if (totalMass_sum[tV] > VSMALL)
|
if (totalMass_sum[tV] > VSMALL)
|
||||||
{
|
{
|
||||||
totalVelocity.internalField()[tV] =
|
itotalVelocity[tV] = totalMomentum_sum[tV]/totalMass_sum[tV];
|
||||||
totalMomentum_sum[tV]
|
|
||||||
/totalMass_sum[tV];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalVelocity.internalField()[tV] =
|
itotalVelocity[tV] = vector::zero;
|
||||||
vector::zero;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,17 +150,20 @@ if (runTime.outputTime())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(totalTemperature.internalField(), tT)
|
volScalarField::InternalField& itotalTemperature =
|
||||||
|
totalTemperature.internalField();
|
||||||
|
|
||||||
|
forAll(itotalTemperature, tT)
|
||||||
{
|
{
|
||||||
if (totalN_sum[tT] > 0)
|
if (totalN_sum[tT] > 0)
|
||||||
{
|
{
|
||||||
totalTemperature.internalField()[tT] =
|
itotalTemperature[tT] =
|
||||||
totalTemperatureVTerms_sum[tT]
|
totalTemperatureVTerms_sum[tT]
|
||||||
/(3.0 * moleculeCloud::kb * totalN_sum[tT]);
|
/(3.0 * moleculeCloud::kb * totalN_sum[tT]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalTemperature.internalField()[tT] = 0.0;
|
itotalTemperature[tT] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,17 +209,19 @@ if (runTime.outputTime())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(totalMeanKE.internalField(), tMKE)
|
volScalarField::InternalField& itotalMeanKE = totalMeanKE.internalField();
|
||||||
|
|
||||||
|
forAll(itotalMeanKE, tMKE)
|
||||||
{
|
{
|
||||||
if (totalN_sum[tMKE] > 0)
|
if (totalN_sum[tMKE] > 0)
|
||||||
{
|
{
|
||||||
totalMeanKE.internalField()[tMKE] =
|
itotalMeanKE[tMKE] =
|
||||||
totalKE_sum[tMKE]
|
totalKE_sum[tMKE]
|
||||||
/totalN_sum[tMKE];
|
/totalN_sum[tMKE];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalMeanKE.internalField()[tMKE] = 0.0;
|
itotalMeanKE[tMKE] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,18 +76,18 @@ if (runTime.outputTime())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(totalVelocity.internalField(), tV)
|
volVectorField::InternalField& itotalVelocity =
|
||||||
|
totalVelocity.internalField();
|
||||||
|
|
||||||
|
forAll(itotalVelocity, tV)
|
||||||
{
|
{
|
||||||
if (totalMass_sum[tV] > VSMALL)
|
if (totalMass_sum[tV] > VSMALL)
|
||||||
{
|
{
|
||||||
totalVelocity.internalField()[tV] =
|
itotalVelocity[tV] = totalMomentum_sum[tV]/totalMass_sum[tV];
|
||||||
totalMomentum_sum[tV]
|
|
||||||
/totalMass_sum[tV];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalVelocity.internalField()[tV] =
|
itotalVelocity[tV] = vector::zero;
|
||||||
vector::zero;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,17 +150,20 @@ if (runTime.outputTime())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(totalTemperature.internalField(), tT)
|
volScalarField::InternalField& itotalTemperature =
|
||||||
|
totalTemperature.internalField();
|
||||||
|
|
||||||
|
forAll(itotalTemperature, tT)
|
||||||
{
|
{
|
||||||
if (totalN_sum[tT] > 0)
|
if (totalN_sum[tT] > 0)
|
||||||
{
|
{
|
||||||
totalTemperature.internalField()[tT] =
|
itotalTemperature[tT] =
|
||||||
totalTemperatureVTerms_sum[tT]
|
totalTemperatureVTerms_sum[tT]
|
||||||
/(3.0 * moleculeCloud::kb * totalN_sum[tT]);
|
/(3.0 * moleculeCloud::kb * totalN_sum[tT]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalTemperature.internalField()[tT] = 0.0;
|
itotalTemperature[tT] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,18 +209,19 @@ if (runTime.outputTime())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(totalMeanKE.internalField(), tMKE)
|
volScalarField::InternalField& itotalMeanKE = totalMeanKE.internalField();
|
||||||
|
|
||||||
|
forAll(itotalMeanKE, tMKE)
|
||||||
{
|
{
|
||||||
if (totalN_sum[tMKE] > 0)
|
if (totalN_sum[tMKE] > 0)
|
||||||
{
|
{
|
||||||
totalMeanKE.internalField()[tMKE] =
|
itotalMeanKE[tMKE] =
|
||||||
totalKE_sum[tMKE]
|
totalKE_sum[tMKE]
|
||||||
/totalN_sum[tMKE];
|
/totalN_sum[tMKE];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalMeanKE.internalField()[tMKE] = 0.0;
|
itotalMeanKE[tMKE] = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,16 +39,20 @@ void Foam::solidMixtureThermo<MixtureType>::calculate()
|
|||||||
scalarField& sigmaSCells = sigmaS_.internalField();
|
scalarField& sigmaSCells = sigmaS_.internalField();
|
||||||
scalarField& emissivityCells = emissivity_.internalField();
|
scalarField& emissivityCells = emissivity_.internalField();
|
||||||
|
|
||||||
forAll(T_.internalField(), celli)
|
const volScalarField::InternalField& iT = T_.internalField();
|
||||||
|
|
||||||
|
forAll(iT, celli)
|
||||||
{
|
{
|
||||||
rhoCells[celli] = MixtureType::rho(T_[celli], celli);
|
rhoCells[celli] = MixtureType::rho(iT[celli], celli);
|
||||||
kappaCells[celli] = MixtureType::kappa(T_[celli], celli);
|
kappaCells[celli] = MixtureType::kappa(iT[celli], celli);
|
||||||
sigmaSCells[celli] = MixtureType::sigmaS(T_[celli], celli);
|
sigmaSCells[celli] = MixtureType::sigmaS(iT[celli], celli);
|
||||||
KCells[celli] = MixtureType::K(T_[celli], celli);
|
KCells[celli] = MixtureType::K(iT[celli], celli);
|
||||||
emissivityCells[celli] = MixtureType::emissivity(T_[celli], celli);
|
emissivityCells[celli] = MixtureType::emissivity(iT[celli], celli);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(T_.boundaryField(), patchI)
|
const volScalarField::GeometricBoundaryField& bT = T_.boundaryField();
|
||||||
|
|
||||||
|
forAll(bT, patchI)
|
||||||
{
|
{
|
||||||
rho_.boundaryField()[patchI] == this->rho(patchI)();
|
rho_.boundaryField()[patchI] == this->rho(patchI)();
|
||||||
K_.boundaryField()[patchI] == this->K(patchI)();
|
K_.boundaryField()[patchI] == this->K(patchI)();
|
||||||
@ -158,14 +162,18 @@ Foam::solidMixtureThermo<MixtureType>::Cp() const
|
|||||||
);
|
);
|
||||||
volScalarField& Cp = tCp();
|
volScalarField& Cp = tCp();
|
||||||
|
|
||||||
forAll(T_.internalField(), celli)
|
const volScalarField::InternalField& iT = T_.internalField();
|
||||||
|
|
||||||
|
forAll(iT, celli)
|
||||||
{
|
{
|
||||||
Cp[celli] = MixtureType::Cp(T_[celli], celli);
|
Cp[celli] = MixtureType::Cp(T_[celli], celli);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(Cp.boundaryField(), patchI)
|
volScalarField::GeometricBoundaryField& bCp = Cp.boundaryField();
|
||||||
|
|
||||||
|
forAll(bCp, patchI)
|
||||||
{
|
{
|
||||||
Cp.boundaryField()[patchI] == this->Cp(patchI)();
|
bCp[patchI] == this->Cp(patchI)();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tCp;
|
return tCp;
|
||||||
@ -194,14 +202,18 @@ Foam::solidMixtureThermo<MixtureType>::hs() const
|
|||||||
);
|
);
|
||||||
volScalarField& hs = ths();
|
volScalarField& hs = ths();
|
||||||
|
|
||||||
forAll(T_.internalField(), celli)
|
const volScalarField::InternalField& iT = T_.internalField();
|
||||||
|
|
||||||
|
forAll(iT, celli)
|
||||||
{
|
{
|
||||||
hs[celli] = MixtureType::hs(T_[celli], celli);
|
hs[celli] = MixtureType::hs(T_[celli], celli);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(hs.boundaryField(), patchI)
|
volScalarField::GeometricBoundaryField& bHs = hs.boundaryField();
|
||||||
|
|
||||||
|
forAll(bHs, patchI)
|
||||||
{
|
{
|
||||||
hs.boundaryField()[patchI] == this->hs(patchI)();
|
bHs[patchI] == this->hs(patchI)();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ths;
|
return ths;
|
||||||
@ -230,14 +242,18 @@ Foam::solidMixtureThermo<MixtureType>::Hf() const
|
|||||||
);
|
);
|
||||||
volScalarField& hf = thF();
|
volScalarField& hf = thF();
|
||||||
|
|
||||||
forAll(T_.internalField(), celli)
|
const volScalarField::InternalField& iT = T_.internalField();
|
||||||
|
|
||||||
|
forAll(iT, celli)
|
||||||
{
|
{
|
||||||
hf[celli] = MixtureType::hf(T_[celli], celli);
|
hf[celli] = MixtureType::hf(T_[celli], celli);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(hf.boundaryField(), patchI)
|
volScalarField::GeometricBoundaryField& bhf = hf.boundaryField();
|
||||||
|
|
||||||
|
forAll(bhf, patchI)
|
||||||
{
|
{
|
||||||
hf.boundaryField()[patchI] == this->Hf(patchI)();
|
bhf[patchI] == this->Hf(patchI)();
|
||||||
}
|
}
|
||||||
|
|
||||||
return thF;
|
return thF;
|
||||||
|
|||||||
@ -760,11 +760,11 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
volScalarField& gasHs = tHs();
|
volScalarField::InternalField& gasHs = tHs().internalField();
|
||||||
|
|
||||||
const GasThermo& mixture = gasThermo_[index];
|
const GasThermo& mixture = gasThermo_[index];
|
||||||
|
|
||||||
forAll(gasHs.internalField(), cellI)
|
forAll(gasHs, cellI)
|
||||||
{
|
{
|
||||||
gasHs[cellI] = mixture.Hs(T[cellI]);
|
gasHs[cellI] = mixture.Hs(T[cellI]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user