fvMesh: Added meshPhi to the geometricFields set
Also provide fields and curFields functions which return the list of registered fields not including the geometryFields and current registered fields not including the geometryFields or old-time fields to simplify mapping code for NCC, mesh-to-mesh mapping and load-balancing.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,6 +49,8 @@ void MapDimensionedFields(const MeshMapper& mapper)
|
||||
|
||||
forAllConstIter(typename TableType, fields, fieldIter)
|
||||
{
|
||||
if (fvMesh::geometryFields.found(fieldIter()->name())) continue;
|
||||
|
||||
FieldType& field = const_cast<FieldType&>(*fieldIter());
|
||||
|
||||
if (&field.mesh() == &mapper.mesh())
|
||||
|
||||
@ -86,6 +86,8 @@ void MapGeometricFields
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
if (GeoMesh::Mesh::geometryFields.found(fieldIter()->name())) continue;
|
||||
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
|
||||
(*fieldIter());
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,8 @@ namespace Foam
|
||||
defineTypeNameAndDebug(pointMesh, 0);
|
||||
}
|
||||
|
||||
const Foam::HashSet<Foam::word> Foam::pointMesh::geometryFields;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,12 +69,20 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Public Typedefs
|
||||
|
||||
typedef pointMesh Mesh;
|
||||
typedef pointBoundaryMesh BoundaryMesh;
|
||||
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("pointMesh");
|
||||
|
||||
|
||||
typedef pointMesh Mesh;
|
||||
typedef pointBoundaryMesh BoundaryMesh;
|
||||
// Static data
|
||||
|
||||
//- Set of names of registered geometric fields
|
||||
const static HashSet<word> geometryFields;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -41,11 +41,10 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(polyMesh, 0);
|
||||
|
||||
word polyMesh::defaultRegion = "region0";
|
||||
word polyMesh::meshSubDir = "polyMesh";
|
||||
}
|
||||
|
||||
Foam::word Foam::polyMesh::defaultRegion = "region0";
|
||||
Foam::word Foam::polyMesh::meshSubDir = "polyMesh";
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -263,11 +263,15 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("polyMesh");
|
||||
|
||||
//- Return the default region name
|
||||
static word defaultRegion;
|
||||
|
||||
//- Return the mesh sub-directory name (usually "polyMesh")
|
||||
static word meshSubDir;
|
||||
// Static data
|
||||
|
||||
//- Return the default region name
|
||||
static word defaultRegion;
|
||||
|
||||
//- Return the mesh sub-directory name (usually "polyMesh")
|
||||
static word meshSubDir;
|
||||
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -276,6 +276,8 @@ void Foam::fvMeshAdder::MapVolFields
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
if (fvMesh::geometryFields.found(fieldIter()->name())) continue;
|
||||
|
||||
VolField<Type>& fld =
|
||||
const_cast<VolField<Type>&>
|
||||
(
|
||||
@ -569,6 +571,8 @@ void Foam::fvMeshAdder::MapSurfaceFields
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
if (fvMesh::geometryFields.found(fieldIter()->name())) continue;
|
||||
|
||||
SurfaceField<Type>& fld = const_cast<SurfaceField<Type>&>(*fieldIter());
|
||||
|
||||
if (fieldsToAdd.found(fld.name()))
|
||||
@ -870,6 +874,8 @@ void Foam::fvMeshAdder::MapPointFields
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
if (fvMesh::geometryFields.found(fieldIter()->name())) continue;
|
||||
|
||||
PointField<Type>& fld = const_cast<PointField<Type>&>(*fieldIter());
|
||||
|
||||
if (fieldsToAdd.found(fld.name()))
|
||||
|
||||
@ -24,24 +24,15 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvMeshDistribute.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
#include "fvMeshAdder.H"
|
||||
#include "faceCoupleInfo.H"
|
||||
#include "processorFvPatchField.H"
|
||||
#include "processorFvsPatchField.H"
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "processorCyclicFvPatchField.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "removeCells.H"
|
||||
#include "polyModifyFace.H"
|
||||
#include "polyRemovePoint.H"
|
||||
#include "polyDistributionMap.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pointFields.H"
|
||||
#include "syncTools.H"
|
||||
#include "CompactListList.H"
|
||||
#include "fvMeshTools.H"
|
||||
#include "ListOps.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -218,9 +209,29 @@ Foam::labelList Foam::fvMeshDistribute::select
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::fvMeshDistribute::fieldNames
|
||||
(
|
||||
const word& typeName,
|
||||
label& nFields
|
||||
) const
|
||||
{
|
||||
wordList fieldNames(mesh_.names(typeName));
|
||||
|
||||
if (fieldNames.size())
|
||||
{
|
||||
HashSet<word> fieldSet(fieldNames);
|
||||
fieldSet -= fvMesh::geometryFields;
|
||||
fieldNames = fieldSet.toc();
|
||||
nFields += checkEqualWordList(typeName, fieldNames);
|
||||
}
|
||||
|
||||
return fieldNames;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::fvMeshDistribute::checkEqualWordList
|
||||
(
|
||||
const string& msg,
|
||||
const word& typeName,
|
||||
const wordList& lst
|
||||
)
|
||||
{
|
||||
@ -234,10 +245,11 @@ Foam::label Foam::fvMeshDistribute::checkEqualWordList
|
||||
if (allNames[proci] != allNames[0])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "When checking for equal " << msg.c_str() << " :" << endl
|
||||
<< "processor0 has:" << allNames[0] << endl
|
||||
<< "processor" << proci << " has:" << allNames[proci] << endl
|
||||
<< msg.c_str() << " need to be synchronised on all processors."
|
||||
<< "When checking for equal numbers of " << typeName
|
||||
<< " :" << nl
|
||||
<< "processor0 has:" << allNames[0] << nl
|
||||
<< "processor" << proci << " has:" << allNames[proci] << nl
|
||||
<< typeName << " need to be synchronised on all processors."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -561,16 +573,16 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::repatch
|
||||
// is currently not supported by topoChange.
|
||||
|
||||
// Store boundary fields (we only do this for surfaceFields)
|
||||
PtrList<FieldField<fvsPatchField, scalar>> sFlds;
|
||||
saveBoundaryFields<scalar, surfaceMesh>(sFlds);
|
||||
PtrList<FieldField<fvsPatchField, vector>> vFlds;
|
||||
saveBoundaryFields<vector, surfaceMesh>(vFlds);
|
||||
PtrList<FieldField<fvsPatchField, sphericalTensor>> sptFlds;
|
||||
saveBoundaryFields<sphericalTensor, surfaceMesh>(sptFlds);
|
||||
PtrList<FieldField<fvsPatchField, symmTensor>> sytFlds;
|
||||
saveBoundaryFields<symmTensor, surfaceMesh>(sytFlds);
|
||||
PtrList<FieldField<fvsPatchField, tensor>> tFlds;
|
||||
saveBoundaryFields<tensor, surfaceMesh>(tFlds);
|
||||
PtrList<FieldField<fvsPatchField, scalar>> sFields;
|
||||
saveBoundaryFields<scalar, surfaceMesh>(sFields);
|
||||
PtrList<FieldField<fvsPatchField, vector>> vFields;
|
||||
saveBoundaryFields<vector, surfaceMesh>(vFields);
|
||||
PtrList<FieldField<fvsPatchField, sphericalTensor>> sptFields;
|
||||
saveBoundaryFields<sphericalTensor, surfaceMesh>(sptFields);
|
||||
PtrList<FieldField<fvsPatchField, symmTensor>> sytFields;
|
||||
saveBoundaryFields<symmTensor, surfaceMesh>(sytFields);
|
||||
PtrList<FieldField<fvsPatchField, tensor>> tFields;
|
||||
saveBoundaryFields<tensor, surfaceMesh>(tFields);
|
||||
|
||||
// Change the mesh (no inflation). Note: parallel comms allowed.
|
||||
//
|
||||
@ -586,11 +598,11 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::repatch
|
||||
|
||||
// Map patch fields using stored boundary fields. Note: assumes order
|
||||
// of fields has not changed in object registry!
|
||||
mapBoundaryFields<scalar, surfaceMesh>(map, sFlds);
|
||||
mapBoundaryFields<vector, surfaceMesh>(map, vFlds);
|
||||
mapBoundaryFields<sphericalTensor, surfaceMesh>(map, sptFlds);
|
||||
mapBoundaryFields<symmTensor, surfaceMesh>(map, sytFlds);
|
||||
mapBoundaryFields<tensor, surfaceMesh>(map, tFlds);
|
||||
mapBoundaryFields<scalar, surfaceMesh>(map, sFields);
|
||||
mapBoundaryFields<vector, surfaceMesh>(map, vFields);
|
||||
mapBoundaryFields<sphericalTensor, surfaceMesh>(map, sptFields);
|
||||
mapBoundaryFields<symmTensor, surfaceMesh>(map, sytFields);
|
||||
mapBoundaryFields<tensor, surfaceMesh>(map, tFields);
|
||||
|
||||
// Adapt constructMaps.
|
||||
|
||||
@ -1257,16 +1269,16 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::doRemoveCells
|
||||
|
||||
// Save surface fields. This is not done as GeometricField as these would
|
||||
// get mapped. Fields are flattened for convenience.
|
||||
PtrList<Field<scalar>> sFlds;
|
||||
PtrList<Field<vector>> vFlds;
|
||||
PtrList<Field<sphericalTensor>> sptFlds;
|
||||
PtrList<Field<symmTensor>> sytFlds;
|
||||
PtrList<Field<tensor>> tFlds;
|
||||
initMapExposedFaces(sFlds);
|
||||
initMapExposedFaces(vFlds);
|
||||
initMapExposedFaces(sptFlds);
|
||||
initMapExposedFaces(sytFlds);
|
||||
initMapExposedFaces(tFlds);
|
||||
PtrList<Field<scalar>> sFields;
|
||||
PtrList<Field<vector>> vFields;
|
||||
PtrList<Field<sphericalTensor>> sptFields;
|
||||
PtrList<Field<symmTensor>> sytFields;
|
||||
PtrList<Field<tensor>> tFields;
|
||||
initMapExposedFaces(sFields);
|
||||
initMapExposedFaces(vFields);
|
||||
initMapExposedFaces(sptFields);
|
||||
initMapExposedFaces(sytFields);
|
||||
initMapExposedFaces(tFields);
|
||||
|
||||
// Change the mesh. No inflation. Note: no parallel comms allowed.
|
||||
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, false, false);
|
||||
@ -1277,11 +1289,11 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::fvMeshDistribute::doRemoveCells
|
||||
// Any exposed faces in a surfaceField will not be mapped. Map the value
|
||||
// of these separately (until there is support in all PatchFields for
|
||||
// mapping from internal faces ...)
|
||||
mapExposedFaces(map(), sFlds);
|
||||
mapExposedFaces(map(), vFlds);
|
||||
mapExposedFaces(map(), sptFlds);
|
||||
mapExposedFaces(map(), sytFlds);
|
||||
mapExposedFaces(map(), tFlds);
|
||||
mapExposedFaces(map(), sFields);
|
||||
mapExposedFaces(map(), vFields);
|
||||
mapExposedFaces(map(), sptFields);
|
||||
mapExposedFaces(map(), sytFields);
|
||||
mapExposedFaces(map(), tFields);
|
||||
|
||||
return map;
|
||||
}
|
||||
@ -1609,10 +1621,6 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
||||
labelList domainAllNeighbour(fromNbr);
|
||||
PtrList<entry> patchEntries(fromNbr);
|
||||
|
||||
//*** Read the old-time volumes if present
|
||||
// scalarField V0(fromNbr);
|
||||
// scalarField V00(fromNbr);
|
||||
|
||||
CompactListList<label> zonePoints(fromNbr);
|
||||
CompactListList<label> zoneFaces(fromNbr);
|
||||
CompactListList<bool> zoneFaceFlip(fromNbr);
|
||||
@ -1662,10 +1670,6 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
||||
// Add patches; no parallel comms
|
||||
domainMesh.addFvPatches(patches, false);
|
||||
|
||||
//*** Set the old-time volumes if present
|
||||
// domainMesh.V0Ref().field() = V0;
|
||||
// domainMesh.V00Ref().field() = V00;
|
||||
|
||||
// Construct zones
|
||||
List<pointZone*> pZonePtrs(pointZoneNames.size());
|
||||
forAll(pZonePtrs, i)
|
||||
@ -1885,91 +1889,90 @@ Foam::autoPtr<Foam::polyDistributionMap> Foam::fvMeshDistribute::distribute
|
||||
label nFields = 0;
|
||||
|
||||
// Get data to send. Make sure is synchronised
|
||||
const wordList volScalars(mesh_.names(volScalarField::typeName));
|
||||
nFields += checkEqualWordList("volScalarFields", volScalars);
|
||||
const wordList volVectors(mesh_.names(volVectorField::typeName));
|
||||
nFields += checkEqualWordList("volVectorFields", volVectors);
|
||||
const wordList volScalars
|
||||
(
|
||||
fieldNames(volScalarField::typeName, nFields)
|
||||
);
|
||||
const wordList volVectors
|
||||
(
|
||||
fieldNames(volVectorField::typeName, nFields)
|
||||
);
|
||||
const wordList volSphereTensors
|
||||
(
|
||||
mesh_.names(volSphericalTensorField::typeName)
|
||||
fieldNames(volSphericalTensorField::typeName, nFields)
|
||||
);
|
||||
const wordList volSymmTensors(fieldNames
|
||||
(
|
||||
volSymmTensorField::typeName, nFields)
|
||||
);
|
||||
const wordList volTensors
|
||||
(
|
||||
fieldNames(volTensorField::typeName, nFields)
|
||||
);
|
||||
nFields += checkEqualWordList("volSphericalTensorFields", volSphereTensors);
|
||||
const wordList volSymmTensors(mesh_.names(volSymmTensorField::typeName));
|
||||
nFields += checkEqualWordList("volSymmTensorFields", volSymmTensors);
|
||||
const wordList volTensors(mesh_.names(volTensorField::typeName));
|
||||
nFields += checkEqualWordList("volTensorField", volTensors);
|
||||
|
||||
const wordList surfScalars(mesh_.names(surfaceScalarField::typeName));
|
||||
nFields += checkEqualWordList("surfaceScalarFields", surfScalars);
|
||||
const wordList surfVectors(mesh_.names(surfaceVectorField::typeName));
|
||||
nFields += checkEqualWordList("surfaceVectorFields", surfVectors);
|
||||
const wordList surfScalars
|
||||
(
|
||||
fieldNames(surfaceScalarField::typeName, nFields)
|
||||
);
|
||||
const wordList surfVectors
|
||||
(
|
||||
fieldNames(surfaceVectorField::typeName, nFields)
|
||||
);
|
||||
const wordList surfSphereTensors
|
||||
(
|
||||
mesh_.names(surfaceSphericalTensorField::typeName)
|
||||
);
|
||||
nFields += checkEqualWordList
|
||||
(
|
||||
"surfaceSphericalTensorFields",
|
||||
surfSphereTensors
|
||||
fieldNames(surfaceSphericalTensorField::typeName, nFields)
|
||||
);
|
||||
const wordList surfSymmTensors
|
||||
(
|
||||
mesh_.names(surfaceSymmTensorField::typeName)
|
||||
fieldNames(surfaceSymmTensorField::typeName, nFields)
|
||||
);
|
||||
const wordList surfTensors
|
||||
(
|
||||
fieldNames(surfaceTensorField::typeName, nFields)
|
||||
);
|
||||
nFields += checkEqualWordList("surfaceSymmTensorFields", surfSymmTensors);
|
||||
const wordList surfTensors(mesh_.names(surfaceTensorField::typeName));
|
||||
nFields += checkEqualWordList("surfaceTensorFields", surfTensors);
|
||||
|
||||
const wordList pointScalars(mesh_.names(pointScalarField::typeName));
|
||||
nFields += checkEqualWordList("pointScalarFields", pointScalars);
|
||||
const wordList pointVectors(mesh_.names(pointVectorField::typeName));
|
||||
nFields += checkEqualWordList("pointVectorFields", pointVectors);
|
||||
const wordList pointScalars
|
||||
(
|
||||
fieldNames(pointScalarField::typeName, nFields)
|
||||
);
|
||||
const wordList pointVectors
|
||||
(
|
||||
fieldNames(pointVectorField::typeName, nFields)
|
||||
);
|
||||
const wordList pointSphereTensors
|
||||
(
|
||||
mesh_.names(pointSphericalTensorField::typeName)
|
||||
);
|
||||
nFields += checkEqualWordList
|
||||
(
|
||||
"pointSphericalTensorFields",
|
||||
pointSphereTensors
|
||||
fieldNames(pointSphericalTensorField::typeName, nFields)
|
||||
);
|
||||
const wordList pointSymmTensors
|
||||
(
|
||||
mesh_.names(pointSymmTensorField::typeName)
|
||||
fieldNames(pointSymmTensorField::typeName, nFields)
|
||||
);
|
||||
const wordList pointTensors
|
||||
(
|
||||
fieldNames(pointTensorField::typeName, nFields)
|
||||
);
|
||||
nFields += checkEqualWordList("pointSymmTensorFields", pointSymmTensors);
|
||||
const wordList pointTensors(mesh_.names(pointTensorField::typeName));
|
||||
nFields += checkEqualWordList("pointTensorFields", pointTensors);
|
||||
|
||||
const wordList dimScalars(mesh_.names(volScalarField::Internal::typeName));
|
||||
nFields += checkEqualWordList("volScalarField::Internal", dimScalars);
|
||||
|
||||
const wordList dimVectors(mesh_.names(volVectorField::Internal::typeName));
|
||||
nFields += checkEqualWordList("volVectorField::Internal", dimVectors);
|
||||
|
||||
const wordList dimScalars
|
||||
(
|
||||
fieldNames(volScalarField::Internal::typeName, nFields)
|
||||
);
|
||||
const wordList dimVectors
|
||||
(
|
||||
fieldNames(volVectorField::Internal::typeName, nFields)
|
||||
);
|
||||
const wordList dimSphereTensors
|
||||
(
|
||||
mesh_.names(volSphericalTensorField::Internal::typeName)
|
||||
fieldNames(volSphericalTensorField::Internal::typeName, nFields)
|
||||
);
|
||||
nFields += checkEqualWordList
|
||||
(
|
||||
"volSphericalTensorField::Internal",
|
||||
dimSphereTensors
|
||||
);
|
||||
|
||||
const wordList dimSymmTensors
|
||||
(
|
||||
mesh_.names(volSymmTensorField::Internal::typeName)
|
||||
fieldNames(volSymmTensorField::Internal::typeName, nFields)
|
||||
);
|
||||
nFields += checkEqualWordList
|
||||
const wordList dimTensors
|
||||
(
|
||||
"volSymmTensorField::Internal",
|
||||
dimSymmTensors
|
||||
fieldNames(volTensorField::Internal::typeName, nFields)
|
||||
);
|
||||
|
||||
const wordList dimTensors(mesh_.names(volTensorField::Internal::typeName));
|
||||
nFields += checkEqualWordList("volTensorField::Internal", dimTensors);
|
||||
|
||||
// Find patch to temporarily put exposed internal and processor faces into.
|
||||
// If there are no fields patch 0 is used,
|
||||
// If there are fields the internal patch is used.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -94,9 +94,11 @@ class fvMeshDistribute
|
||||
const label value
|
||||
);
|
||||
|
||||
wordList fieldNames(const word& typeName, label& nFields) const;
|
||||
|
||||
//- Check all procs have same names and in exactly same order
|
||||
// and return the number of fields
|
||||
static label checkEqualWordList(const string&, const wordList&);
|
||||
static label checkEqualWordList(const word& typeName, const wordList&);
|
||||
|
||||
//- Merge wordlists over all processors
|
||||
static wordList mergeWordList(const wordList&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,24 +31,21 @@ License
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
const UPtrList<GeoField> fields(mesh.fields<GeoField>());
|
||||
|
||||
forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
const GeoField& field = fields[i];
|
||||
|
||||
Pout<< "Field:" << iter.key() << " internal size:" << fld.size()
|
||||
Pout<< "Field:" << field.name() << " internal size:" << field.size()
|
||||
<< endl;
|
||||
|
||||
forAll(fld.boundaryField(), patchi)
|
||||
forAll(field.boundaryField(), patchi)
|
||||
{
|
||||
Pout<< " " << patchi
|
||||
<< ' ' << fld.boundaryField()[patchi].patch().name()
|
||||
<< ' ' << fld.boundaryField()[patchi].type()
|
||||
<< ' ' << fld.boundaryField()[patchi].size()
|
||||
<< ' ' << field.boundaryField()[patchi].patch().name()
|
||||
<< ' ' << field.boundaryField()[patchi].type()
|
||||
<< ' ' << field.boundaryField()[patchi].size()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -58,28 +55,23 @@ void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
|
||||
template<class Type, class Mesh>
|
||||
void Foam::fvMeshDistribute::saveBoundaryFields
|
||||
(
|
||||
PtrList<FieldField<fvsPatchField, Type>>& bflds
|
||||
PtrList<FieldField<fvsPatchField, Type>>& bfields
|
||||
) const
|
||||
{
|
||||
// Save whole boundary field
|
||||
|
||||
HashTable<const SurfaceField<Type>*> flds
|
||||
const UPtrList<SurfaceField<Type>> fields
|
||||
(
|
||||
static_cast<const fvMesh&>(mesh_)
|
||||
.objectRegistry::lookupClass<SurfaceField<Type>>()
|
||||
mesh_.fields<SurfaceField<Type>>()
|
||||
);
|
||||
|
||||
bflds.setSize(flds.size());
|
||||
bfields.setSize(fields.size());
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename HashTable<const SurfaceField<Type>*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
const SurfaceField<Type>& fld = *iter();
|
||||
const SurfaceField<Type>& field = fields[i];
|
||||
|
||||
bflds.set(i, fld.boundaryField().clone().ptr());
|
||||
|
||||
i++;
|
||||
bfields.set(i, field.boundaryField().clone().ptr());
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +80,7 @@ template<class Type, class Mesh>
|
||||
void Foam::fvMeshDistribute::mapBoundaryFields
|
||||
(
|
||||
const polyTopoChangeMap& map,
|
||||
const PtrList<FieldField<fvsPatchField, Type>>& oldBflds
|
||||
const PtrList<FieldField<fvsPatchField, Type>>& oldBfields
|
||||
)
|
||||
{
|
||||
// Map boundary field
|
||||
@ -96,35 +88,27 @@ void Foam::fvMeshDistribute::mapBoundaryFields
|
||||
const labelList& oldPatchStarts = map.oldPatchStarts();
|
||||
const labelList& faceMap = map.faceMap();
|
||||
|
||||
HashTable<SurfaceField<Type>*> flds
|
||||
UPtrList<SurfaceField<Type>> fields
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
|
||||
mesh_.fields<SurfaceField<Type>>()
|
||||
);
|
||||
|
||||
if (flds.size() != oldBflds.size())
|
||||
forAll(fields, i)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< abort(FatalError);
|
||||
}
|
||||
SurfaceField<Type>& field = fields[i];
|
||||
typename SurfaceField<Type>::Boundary& bfield =
|
||||
field.boundaryFieldRef();
|
||||
|
||||
label fieldi = 0;
|
||||
const FieldField<fvsPatchField, Type>& oldBfield = oldBfields[i];
|
||||
|
||||
forAllIter(typename HashTable<SurfaceField<Type>*>, flds, iter)
|
||||
{
|
||||
SurfaceField<Type>& fld = *iter();
|
||||
typename SurfaceField<Type>::Boundary& bfld =
|
||||
fld.boundaryFieldRef();
|
||||
// Pull from old boundary field into bfield.
|
||||
|
||||
const FieldField<fvsPatchField, Type>& oldBfld = oldBflds[fieldi++];
|
||||
|
||||
// Pull from old boundary field into bfld.
|
||||
|
||||
forAll(bfld, patchi)
|
||||
forAll(bfield, patchi)
|
||||
{
|
||||
fvsPatchField<Type>& patchFld = bfld[patchi];
|
||||
label facei = patchFld.patch().start();
|
||||
fvsPatchField<Type>& patchField = bfield[patchi];
|
||||
label facei = patchField.patch().start();
|
||||
|
||||
forAll(patchFld, i)
|
||||
forAll(patchField, i)
|
||||
{
|
||||
label oldFacei = faceMap[facei++];
|
||||
|
||||
@ -133,9 +117,13 @@ void Foam::fvMeshDistribute::mapBoundaryFields
|
||||
{
|
||||
label oldLocalI = oldFacei - oldPatchStarts[oldPatchi];
|
||||
|
||||
if (oldLocalI >= 0 && oldLocalI < oldBfld[oldPatchi].size())
|
||||
if
|
||||
(
|
||||
oldLocalI >= 0
|
||||
&& oldLocalI < oldBfield[oldPatchi].size()
|
||||
)
|
||||
{
|
||||
patchFld[i] = oldBfld[oldPatchi][oldLocalI];
|
||||
patchField[i] = oldBfield[oldPatchi][oldLocalI];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,36 +135,32 @@ void Foam::fvMeshDistribute::mapBoundaryFields
|
||||
template<class Type>
|
||||
void Foam::fvMeshDistribute::initMapExposedFaces
|
||||
(
|
||||
PtrList<Field<Type>>& iflds
|
||||
PtrList<Field<Type>>& ifields
|
||||
) const
|
||||
{
|
||||
HashTable<const SurfaceField<Type>*> flds
|
||||
const UPtrList<SurfaceField<Type>> fields
|
||||
(
|
||||
static_cast<const fvMesh&>(mesh_).lookupClass<SurfaceField<Type>>()
|
||||
mesh_.fields<SurfaceField<Type>>()
|
||||
);
|
||||
|
||||
iflds.setSize(flds.size());
|
||||
ifields.setSize(fields.size());
|
||||
|
||||
label fieldi = 0;
|
||||
|
||||
forAllConstIter(typename HashTable<const SurfaceField<Type>*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
iflds.set(fieldi, Field<Type>(mesh_.nFaces()));
|
||||
ifields.set(i, Field<Type>(mesh_.nFaces()));
|
||||
|
||||
const SurfaceField<Type>& fld = *iter();
|
||||
const SurfaceField<Type>& field = fields[i];
|
||||
|
||||
SubList<Type>(iflds[fieldi], fld.primitiveField().size()) =
|
||||
fld.primitiveField();
|
||||
SubList<Type>(ifields[i], field.primitiveField().size()) =
|
||||
field.primitiveField();
|
||||
|
||||
forAll(fld.boundaryField(), patchi)
|
||||
forAll(field.boundaryField(), patchi)
|
||||
{
|
||||
const fvsPatchField<Type>& pfld = fld.boundaryField()[patchi];
|
||||
const fvsPatchField<Type>& pfield = field.boundaryField()[patchi];
|
||||
|
||||
SubList<Type>(iflds[fieldi], pfld.size(), pfld.patch().start()) =
|
||||
pfld;
|
||||
SubList<Type>(ifields[i], pfield.size(), pfield.patch().start()) =
|
||||
pfield;
|
||||
}
|
||||
|
||||
fieldi++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,52 +169,48 @@ template<class Type>
|
||||
void Foam::fvMeshDistribute::mapExposedFaces
|
||||
(
|
||||
const polyTopoChangeMap& map,
|
||||
const PtrList<Field<Type>>& oldFlds
|
||||
const PtrList<Field<Type>>& oldFields
|
||||
)
|
||||
{
|
||||
HashTable<SurfaceField<Type>*> flds
|
||||
UPtrList<SurfaceField<Type>> fields
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<SurfaceField<Type>>()
|
||||
mesh_.fields<SurfaceField<Type>>()
|
||||
);
|
||||
|
||||
label fieldi = 0;
|
||||
|
||||
forAllIter(typename HashTable<SurfaceField<Type>*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
SurfaceField<Type>& fld = *iter();
|
||||
SurfaceField<Type>& field = fields[i];
|
||||
|
||||
const Field<Type>& oldFld = oldFlds[fieldi];
|
||||
const Field<Type>& oldField = oldFields[i];
|
||||
|
||||
const bool negateIfFlipped = isFlux(fld);
|
||||
const bool negateIfFlipped = isFlux(field);
|
||||
|
||||
forAll(fld.boundaryField(), patchi)
|
||||
forAll(field.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchField<Type>& patchFld = fld.boundaryFieldRef()[patchi];
|
||||
fvsPatchField<Type>& patchField = field.boundaryFieldRef()[patchi];
|
||||
|
||||
forAll(patchFld, i)
|
||||
forAll(patchField, i)
|
||||
{
|
||||
const label facei = patchFld.patch().start()+i;
|
||||
const label facei = patchField.patch().start()+i;
|
||||
const label oldFacei = map.faceMap()[facei];
|
||||
|
||||
if (oldFacei < map.nOldInternalFaces())
|
||||
{
|
||||
if (negateIfFlipped && map.flipFaceFlux().found(facei))
|
||||
{
|
||||
patchFld[i] = flipOp()(oldFld[oldFacei]);
|
||||
patchField[i] = flipOp()(oldField[oldFacei]);
|
||||
}
|
||||
else
|
||||
{
|
||||
patchFld[i] = oldFld[oldFacei];
|
||||
patchField[i] = oldField[oldFacei];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
patchFld[i] = oldFld[oldFacei];
|
||||
patchField[i] = oldField[oldFacei];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fieldi++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,16 +218,13 @@ void Foam::fvMeshDistribute::mapExposedFaces
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::correctCoupledPatchFields()
|
||||
{
|
||||
HashTable<GeoField*> flds
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
UPtrList<GeoField> fields(mesh_.fields<GeoField>());
|
||||
|
||||
forAllIter(typename HashTable<GeoField*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
GeoField& fld = *iter();
|
||||
GeoField& field = fields[i];
|
||||
|
||||
typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
|
||||
typename GeoField::Boundary& bfield = field.boundaryFieldRef();
|
||||
|
||||
if
|
||||
(
|
||||
@ -257,11 +234,11 @@ void Foam::fvMeshDistribute::correctCoupledPatchFields()
|
||||
{
|
||||
label nReq = Pstream::nRequests();
|
||||
|
||||
forAll(bfld, patchi)
|
||||
forAll(bfield, patchi)
|
||||
{
|
||||
if (bfld[patchi].coupled())
|
||||
if (bfield[patchi].coupled())
|
||||
{
|
||||
bfld[patchi].initEvaluate(Pstream::defaultCommsType);
|
||||
bfield[patchi].initEvaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,11 +252,11 @@ void Foam::fvMeshDistribute::correctCoupledPatchFields()
|
||||
Pstream::waitRequests(nReq);
|
||||
}
|
||||
|
||||
forAll(bfld, patchi)
|
||||
forAll(bfield, patchi)
|
||||
{
|
||||
if (bfld[patchi].coupled())
|
||||
if (bfield[patchi].coupled())
|
||||
{
|
||||
bfld[patchi].evaluate(Pstream::defaultCommsType);
|
||||
bfield[patchi].evaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -290,16 +267,16 @@ void Foam::fvMeshDistribute::correctCoupledPatchFields()
|
||||
|
||||
forAll(patchSchedule, patchEvali)
|
||||
{
|
||||
if (bfld[patchEvali].coupled())
|
||||
if (bfield[patchEvali].coupled())
|
||||
{
|
||||
if (patchSchedule[patchEvali].init)
|
||||
{
|
||||
bfld[patchSchedule[patchEvali].patch]
|
||||
bfield[patchSchedule[patchEvali].patch]
|
||||
.initEvaluate(Pstream::commsTypes::scheduled);
|
||||
}
|
||||
else
|
||||
{
|
||||
bfld[patchSchedule[patchEvali].patch]
|
||||
bfield[patchSchedule[patchEvali].patch]
|
||||
.evaluate(Pstream::commsTypes::scheduled);
|
||||
}
|
||||
}
|
||||
@ -348,14 +325,14 @@ void Foam::fvMeshDistribute::sendFields
|
||||
|
||||
// Send all fieldNames. This has to be exactly the same set as is
|
||||
// being received!
|
||||
const GeoField& fld =
|
||||
const GeoField& field =
|
||||
subsetter.baseMesh().lookupObject<GeoField>(fieldNames[i]);
|
||||
|
||||
tmp<GeoField> tsubfld = subsetter.interpolate(fld);
|
||||
tmp<GeoField> tsubfield = subsetter.interpolate(field);
|
||||
|
||||
toNbr
|
||||
<< fieldNames[i] << token::NL << token::BEGIN_BLOCK
|
||||
<< tsubfld
|
||||
<< tsubfield
|
||||
<< token::NL << token::END_BLOCK << token::NL;
|
||||
}
|
||||
toNbr << token::END_BLOCK << token::NL;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,28 +39,30 @@ void Foam::fvMeshTools::setPatchFields
|
||||
{
|
||||
objectRegistry& obr = const_cast<objectRegistry&>(mesh.thisDb());
|
||||
|
||||
HashTable<GeoField*> flds(obr.lookupClass<GeoField>());
|
||||
HashTable<GeoField*> fields(obr.lookupClass<GeoField>());
|
||||
|
||||
forAllIter(typename HashTable<GeoField*>, flds, iter)
|
||||
forAllIter(typename HashTable<GeoField*>, fields, iter)
|
||||
{
|
||||
GeoField& fld = *iter();
|
||||
GeoField& field = *iter();
|
||||
|
||||
typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
|
||||
if (GeoField::Mesh::geometryFields.found(field.name())) continue;
|
||||
|
||||
typename GeoField::Boundary& bfield = field.boundaryFieldRef();
|
||||
|
||||
if
|
||||
(
|
||||
patchFieldDict.found(fld.name())
|
||||
patchFieldDict.found(field.name())
|
||||
|| !fvPatch::constraintType(mesh.boundary()[patchi].type())
|
||||
)
|
||||
{
|
||||
bfld.set
|
||||
bfield.set
|
||||
(
|
||||
patchi,
|
||||
GeoField::Patch::New
|
||||
(
|
||||
mesh.boundary()[patchi],
|
||||
fld(),
|
||||
patchFieldDict.subDict(fld.name())
|
||||
field(),
|
||||
patchFieldDict.subDict(field.name())
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -78,15 +80,17 @@ void Foam::fvMeshTools::setPatchFields
|
||||
{
|
||||
objectRegistry& obr = const_cast<objectRegistry&>(mesh.thisDb());
|
||||
|
||||
HashTable<GeoField*> flds(obr.lookupClass<GeoField>());
|
||||
HashTable<GeoField*> fields(obr.lookupClass<GeoField>());
|
||||
|
||||
forAllIter(typename HashTable<GeoField*>, flds, iter)
|
||||
forAllIter(typename HashTable<GeoField*>, fields, iter)
|
||||
{
|
||||
GeoField& fld = *iter();
|
||||
GeoField& field = *iter();
|
||||
|
||||
typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
|
||||
if (GeoField::Mesh::geometryFields.found(field.name())) continue;
|
||||
|
||||
bfld[patchi] == value;
|
||||
typename GeoField::Boundary& bfield = field.boundaryFieldRef();
|
||||
|
||||
bfield[patchi] == value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,20 +28,19 @@ License
|
||||
template<class Type>
|
||||
void Foam::singleRegionSolutionControl::storePrevIterTypeFields() const
|
||||
{
|
||||
HashTable<VolField<Type>*>
|
||||
flds(mesh_.objectRegistry::lookupClass<VolField<Type>>());
|
||||
UPtrList<VolField<Type>> fields(mesh_.curFields<VolField<Type>>());
|
||||
|
||||
forAllIter(typename HashTable<VolField<Type>*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
VolField<Type>& fld = *iter();
|
||||
VolField<Type>& field = fields[i];
|
||||
|
||||
const word& fName = fld.name();
|
||||
const word& fName = field.name();
|
||||
|
||||
size_t prevIterField = fName.find("PrevIter");
|
||||
const size_t prevIterField = fName.find("PrevIter");
|
||||
|
||||
if (prevIterField == word::npos && mesh_.solution().relaxField(fName))
|
||||
{
|
||||
fld.storePrevIter();
|
||||
field.storePrevIter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +60,16 @@ namespace Foam
|
||||
defineTypeNameAndDebug(fvMesh, 0);
|
||||
}
|
||||
|
||||
const Foam::HashSet<Foam::word> Foam::fvMesh::geometryFields
|
||||
{
|
||||
"Vc",
|
||||
"Sf",
|
||||
"magSf",
|
||||
"Cc",
|
||||
"Cf",
|
||||
"meshPhi"
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -222,7 +232,7 @@ void Foam::fvMesh::storeOldVol(const scalarField& V)
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"V0",
|
||||
"Vc0",
|
||||
time().name(),
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
@ -375,13 +385,13 @@ Foam::fvMesh::fvMesh
|
||||
|
||||
// Check the existence of the cell volumes and read if present
|
||||
// and set the storage of V00
|
||||
if (fileHandler().isFile(time().timePath()/"V0"))
|
||||
if (fileHandler().isFile(time().timePath()/"Vc0"))
|
||||
{
|
||||
V0Ptr_ = new DimensionedField<scalar, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"V0",
|
||||
"Vc0",
|
||||
time().name(),
|
||||
*this,
|
||||
IOobject::MUST_READ,
|
||||
@ -1249,7 +1259,7 @@ void Foam::fvMesh::topoChange(const polyTopoChangeMap& map)
|
||||
if (VPtr_ && (VPtr_->size() != map.nOldCells()))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "V:" << V().size()
|
||||
<< "Vc:" << V().size()
|
||||
<< " not equal to the number of old cells "
|
||||
<< map.nOldCells()
|
||||
<< exit(FatalError);
|
||||
@ -1258,7 +1268,7 @@ void Foam::fvMesh::topoChange(const polyTopoChangeMap& map)
|
||||
if (V0Ptr_ && (V0Ptr_->size() != map.nOldCells()))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "V0:" << V0Ptr_->size()
|
||||
<< "Vc0:" << V0Ptr_->size()
|
||||
<< " not equal to the number of old cells "
|
||||
<< map.nOldCells()
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -231,11 +231,6 @@ private:
|
||||
//- Preserve old volume(s)
|
||||
void storeOldVol(const scalarField&);
|
||||
|
||||
//- Return the list of current fields of type GeoField<Type>
|
||||
// i.e. fields that are not old-time or old-old-time etc.
|
||||
template<class Type, template<class> class GeoField>
|
||||
UPtrList<GeoField<Type>> curFields();
|
||||
|
||||
//- Store old times fields for all fields of a given type and class
|
||||
template<class Type, template<class> class GeoField>
|
||||
void storeOldTimeFields();
|
||||
@ -316,11 +311,16 @@ public:
|
||||
typedef fvBoundaryMesh BoundaryMesh;
|
||||
|
||||
friend fvMeshTopoChangers::list;
|
||||
friend fvMeshDistributor;
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("fvMesh");
|
||||
|
||||
// Static data
|
||||
|
||||
//- Set of names of registered geometric fields
|
||||
// V, Sf, magSf, C, Cf
|
||||
const static HashSet<word> geometryFields;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -521,6 +521,16 @@ public:
|
||||
//- Return cell face motion fluxes
|
||||
const surfaceScalarField& phi() const;
|
||||
|
||||
//- Return the list of fields of type GeoField
|
||||
// i.e. fields that are not geometry
|
||||
template<class GeoField>
|
||||
UPtrList<GeoField> fields(const bool strict = false) const;
|
||||
|
||||
//- Return the list of current fields of type GeoField
|
||||
// i.e. fields that are not old-times or geometry
|
||||
template<class GeoField>
|
||||
UPtrList<GeoField> curFields() const;
|
||||
|
||||
//- Return a labelType of valid component indicators
|
||||
// 1 : valid (solved)
|
||||
// -1 : invalid (not solved)
|
||||
|
||||
@ -92,11 +92,4 @@ void Foam::fvMeshDistributor::velocityMotionCorrection::update() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fvMeshDistributor::update()
|
||||
{
|
||||
mesh_.clearGeomNotOldVol();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -126,7 +126,7 @@ void Foam::fvMesh::makeC() const
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"C",
|
||||
"Cc",
|
||||
pointsInstance(),
|
||||
meshSubDir,
|
||||
*this,
|
||||
@ -184,7 +184,7 @@ Foam::volScalarField::Internal& Foam::fvMesh::V0Ref()
|
||||
if (!V0Ptr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "V0 is not available"
|
||||
<< "Vc0 is not available"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V() const
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"V",
|
||||
"Vc",
|
||||
time().name(),
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
@ -293,7 +293,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V0() const
|
||||
if (!V0Ptr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "V0 is not available"
|
||||
<< "Vc0 is not available"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V00() const
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"V00",
|
||||
"Vc00",
|
||||
time().name(),
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
|
||||
@ -43,13 +43,13 @@ Description
|
||||
template<class Type, template<class> class GeoField>
|
||||
void Foam::fvMeshStitcher::resizePatchFields()
|
||||
{
|
||||
HashTable<GeoField<Type>*> fields(mesh_.lookupClass<GeoField<Type>>());
|
||||
forAllIter(typename HashTable<GeoField<Type>*>, fields, iter)
|
||||
UPtrList<GeoField<Type>> fields(mesh_.fields<GeoField<Type>>());
|
||||
forAll(fields, i)
|
||||
{
|
||||
forAll(mesh_.boundary(), patchi)
|
||||
{
|
||||
typename GeoField<Type>::Patch& pf =
|
||||
iter()->boundaryFieldRef()[patchi];
|
||||
fields[i].boundaryFieldRef()[patchi];
|
||||
|
||||
if (isA<nonConformalFvPatch>(pf.patch()))
|
||||
{
|
||||
@ -73,25 +73,11 @@ void Foam::fvMeshStitcher::resizePatchFields()
|
||||
template<class Type>
|
||||
void Foam::fvMeshStitcher::preConformSurfaceFields()
|
||||
{
|
||||
HashTable<SurfaceField<Type>*> fields
|
||||
(
|
||||
mesh_.lookupClass<SurfaceField<Type>>()
|
||||
);
|
||||
UPtrList<SurfaceField<Type>> fields(mesh_.curFields<SurfaceField<Type>>());
|
||||
|
||||
const surfaceScalarField* phiPtr =
|
||||
mesh_.foundObject<surfaceScalarField>("meshPhi")
|
||||
? &mesh_.lookupObject<surfaceScalarField>("meshPhi")
|
||||
: nullptr;
|
||||
|
||||
forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
SurfaceField<Type>& field = *iter();
|
||||
|
||||
if
|
||||
(
|
||||
&field == static_cast<const regIOobject*>(phiPtr)
|
||||
|| field.isOldTime()
|
||||
) continue;
|
||||
SurfaceField<Type>& field = fields[i];
|
||||
|
||||
autoPtr<SurfaceField<Type>> nccFieldPtr
|
||||
(
|
||||
@ -107,11 +93,11 @@ void Foam::fvMeshStitcher::preConformSurfaceFields()
|
||||
)
|
||||
);
|
||||
|
||||
for (label i = 0; i <= field.nOldTimes(); ++ i)
|
||||
for (label ti=0; ti<=field.nOldTimes(); ti++)
|
||||
{
|
||||
SurfaceField<Type>& field0 = field.oldTime(i);
|
||||
SurfaceField<Type>& field0 = field.oldTime(ti);
|
||||
|
||||
nccFieldPtr->oldTime(i).boundaryFieldRef() =
|
||||
nccFieldPtr->oldTime(ti).boundaryFieldRef() =
|
||||
conformalNccBoundaryField<Type>(field0.boundaryField());
|
||||
|
||||
field0.boundaryFieldRef() =
|
||||
@ -135,81 +121,76 @@ inline void Foam::fvMeshStitcher::preConformSurfaceFields()
|
||||
template<class Type>
|
||||
void Foam::fvMeshStitcher::postNonConformSurfaceFields()
|
||||
{
|
||||
HashTable<SurfaceField<Type>*> fields
|
||||
(
|
||||
mesh_.lookupClass<SurfaceField<Type>>()
|
||||
);
|
||||
UPtrList<SurfaceField<Type>> fields(mesh_.curFields<SurfaceField<Type>>());
|
||||
|
||||
const surfaceScalarField* phiPtr =
|
||||
mesh_.foundObject<surfaceScalarField>("meshPhi")
|
||||
? &mesh_.lookupObject<surfaceScalarField>("meshPhi")
|
||||
: nullptr;
|
||||
|
||||
forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
|
||||
if (!mesh_.topoChanged())
|
||||
{
|
||||
if (iter.key()(nccFieldPrefix_.size()) == nccFieldPrefix_) continue;
|
||||
|
||||
SurfaceField<Type>& field = *iter();
|
||||
|
||||
if
|
||||
(
|
||||
&field == static_cast<const regIOobject*>(phiPtr)
|
||||
|| field.isOldTime()
|
||||
|| mesh_.topoChanged()
|
||||
) continue;
|
||||
|
||||
const word nccFieldName = nccFieldPrefix_ + field.name();
|
||||
|
||||
const SurfaceField<Type>& nccField =
|
||||
mesh_.lookupObject<SurfaceField<Type>>(nccFieldName);
|
||||
|
||||
for (label i = 0; i <= field.nOldTimes(); ++ i)
|
||||
forAll(fields, i)
|
||||
{
|
||||
SurfaceField<Type>& field0 = field.oldTime(i);
|
||||
if (fields[i].name()(nccFieldPrefix_.size()) == nccFieldPrefix_)
|
||||
continue;
|
||||
|
||||
field0.boundaryFieldRef() =
|
||||
nonConformalBoundaryField<Type>
|
||||
(
|
||||
nccField.oldTime(i).boundaryField(),
|
||||
field0.boundaryField()
|
||||
);
|
||||
SurfaceField<Type>& field = fields[i];
|
||||
|
||||
field0.boundaryFieldRef() =
|
||||
synchronisedBoundaryField<Type>(field0.boundaryField());
|
||||
const word nccFieldName = nccFieldPrefix_ + field.name();
|
||||
|
||||
const SurfaceField<Type>& nccField =
|
||||
mesh_.lookupObject<SurfaceField<Type>>(nccFieldName);
|
||||
|
||||
for (label ti=0; ti<=field.nOldTimes(); ti++)
|
||||
{
|
||||
SurfaceField<Type>& field0 = field.oldTime(ti);
|
||||
|
||||
field0.boundaryFieldRef() =
|
||||
nonConformalBoundaryField<Type>
|
||||
(
|
||||
nccField.oldTime(ti).boundaryField(),
|
||||
field0.boundaryField()
|
||||
);
|
||||
|
||||
field0.boundaryFieldRef() =
|
||||
synchronisedBoundaryField<Type>(field0.boundaryField());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove NCC fields after all fields have been mapped. This is so that
|
||||
// old-time fields aren't removed by current-time fields in advance of the
|
||||
// old-time field being mapped.
|
||||
forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
|
||||
|
||||
// Cache the nccField pointers
|
||||
DynamicList<SurfaceField<Type>*> nccFields;
|
||||
forAll(fields, i)
|
||||
{
|
||||
if (iter.key()(nccFieldPrefix_.size()) == nccFieldPrefix_) continue;
|
||||
if (fields[i].name()(nccFieldPrefix_.size()) == nccFieldPrefix_)
|
||||
continue;
|
||||
|
||||
SurfaceField<Type>& field = *iter();
|
||||
|
||||
if
|
||||
(
|
||||
&field == static_cast<const regIOobject*>(phiPtr)
|
||||
|| field.isOldTime()
|
||||
) continue;
|
||||
SurfaceField<Type>& field = fields[i];
|
||||
|
||||
const word nccFieldName = nccFieldPrefix_ + field.name();
|
||||
|
||||
SurfaceField<Type>& nccField =
|
||||
mesh_.lookupObjectRef<SurfaceField<Type>>(nccFieldName);
|
||||
|
||||
nccField.checkOut();
|
||||
nccFields.append(&nccField);
|
||||
}
|
||||
|
||||
// Checkout the nccFields after the loop over fields
|
||||
// to avoid deleting a subsequent field in the list
|
||||
forAll(nccFields, i)
|
||||
{
|
||||
nccFields[i]->checkOut();
|
||||
}
|
||||
|
||||
// Check there are no NCC fields left over
|
||||
fields = mesh_.lookupClass<SurfaceField<Type>>();
|
||||
forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
|
||||
fields = mesh_.curFields<SurfaceField<Type>>();
|
||||
forAll(fields, i)
|
||||
{
|
||||
if (iter.key()(nccFieldPrefix_.size()) != nccFieldPrefix_) continue;
|
||||
if (fields[i].name()(nccFieldPrefix_.size()) != nccFieldPrefix_)
|
||||
continue;
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Stitching mapping field \"" << iter()->name()
|
||||
<< "Stitching mapping field \"" << fields[i].name()
|
||||
<< "\" found, but the field it corresponds to no longer exists"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -228,15 +209,15 @@ inline void Foam::fvMeshStitcher::postNonConformSurfaceFields()
|
||||
template<class Type>
|
||||
void Foam::fvMeshStitcher::evaluateVolFields()
|
||||
{
|
||||
HashTable<VolField<Type>*> fields(mesh_.lookupClass<VolField<Type>>());
|
||||
forAllIter(typename HashTable<VolField<Type>*>, fields, iter)
|
||||
UPtrList<VolField<Type>> fields(mesh_.fields<VolField<Type>>());
|
||||
forAll(fields, i)
|
||||
{
|
||||
const label nReq = Pstream::nRequests();
|
||||
|
||||
forAll(mesh_.boundary(), patchi)
|
||||
{
|
||||
typename VolField<Type>::Patch& pf =
|
||||
iter()->boundaryFieldRef()[patchi];
|
||||
fields[i].boundaryFieldRef()[patchi];
|
||||
|
||||
if (isA<nonConformalFvPatch>(pf.patch()))
|
||||
{
|
||||
@ -256,7 +237,7 @@ void Foam::fvMeshStitcher::evaluateVolFields()
|
||||
forAll(mesh_.boundary(), patchi)
|
||||
{
|
||||
typename VolField<Type>::Patch& pf =
|
||||
iter()->boundaryFieldRef()[patchi];
|
||||
fields[i].boundaryFieldRef()[patchi];
|
||||
|
||||
if (isA<nonConformalFvPatch>(pf.patch()))
|
||||
{
|
||||
@ -280,14 +261,11 @@ inline void Foam::fvMeshStitcher::postNonConformSurfaceVelocities()
|
||||
{
|
||||
if (mesh_.topoChanged())
|
||||
{
|
||||
HashTable<surfaceVectorField*> Ufs
|
||||
(
|
||||
mesh_.lookupClass<surfaceVectorField>()
|
||||
);
|
||||
UPtrList<surfaceVectorField> Ufs(mesh_.fields<surfaceVectorField>());
|
||||
|
||||
forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
|
||||
forAll(Ufs, i)
|
||||
{
|
||||
surfaceVectorField& Uf = *iter();
|
||||
surfaceVectorField& Uf = Ufs[i];
|
||||
|
||||
const volVectorField& U = surfaceToVolVelocity(Uf);
|
||||
|
||||
@ -336,12 +314,12 @@ void Foam::fvMeshStitcher::resizeFieldPatchFields
|
||||
GeoField& field
|
||||
)
|
||||
{
|
||||
for (label i = 0; i <= field.nOldTimes(); ++ i)
|
||||
for (label ti=0; ti<=field.nOldTimes(); ti++)
|
||||
{
|
||||
resizeBoundaryFieldPatchFields
|
||||
(
|
||||
polyFacesBf,
|
||||
field.oldTime(i).boundaryFieldRef()
|
||||
field.oldTime(ti).boundaryFieldRef()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,16 +42,42 @@ typename Foam::pTraits<Type>::labelType Foam::fvMesh::validComponents() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class GeoField>
|
||||
Foam::UPtrList<GeoField<Type>> Foam::fvMesh::curFields()
|
||||
template<class GeoField>
|
||||
Foam::UPtrList<GeoField> Foam::fvMesh::fields(const bool strict) const
|
||||
{
|
||||
HashTable<GeoField<Type>*> fields(lookupClass<GeoField<Type>>());
|
||||
UPtrList<GeoField<Type>> curFields(fields.size());
|
||||
HashTable<GeoField*> fields
|
||||
(
|
||||
const_cast<fvMesh&>(*this).lookupClass<GeoField>(strict)
|
||||
);
|
||||
UPtrList<GeoField> curFields(fields.size());
|
||||
|
||||
label i = 0;
|
||||
forAllIter(typename HashTable<GeoField<Type>*>, fields, iter)
|
||||
forAllIter(typename HashTable<GeoField*>, fields, iter)
|
||||
{
|
||||
if (!iter()->isOldTime())
|
||||
if (!geometryFields.found(iter()->name()))
|
||||
{
|
||||
curFields.set(i++, iter());
|
||||
}
|
||||
}
|
||||
curFields.setSize(i);
|
||||
|
||||
return curFields;
|
||||
}
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
Foam::UPtrList<GeoField> Foam::fvMesh::curFields() const
|
||||
{
|
||||
HashTable<GeoField*> fields
|
||||
(
|
||||
const_cast<fvMesh&>(*this).lookupClass<GeoField>()
|
||||
);
|
||||
UPtrList<GeoField> curFields(fields.size());
|
||||
|
||||
label i = 0;
|
||||
forAllIter(typename HashTable<GeoField*>, fields, iter)
|
||||
{
|
||||
if (!geometryFields.found(iter()->name()) && !iter()->isOldTime())
|
||||
{
|
||||
curFields.set(i++, iter());
|
||||
}
|
||||
@ -65,7 +91,7 @@ Foam::UPtrList<GeoField<Type>> Foam::fvMesh::curFields()
|
||||
template<class Type, template<class> class GeoField>
|
||||
void Foam::fvMesh::storeOldTimeFields()
|
||||
{
|
||||
UPtrList<GeoField<Type>> curFields(this->curFields<Type, GeoField>());
|
||||
UPtrList<GeoField<Type>> curFields(this->curFields<GeoField<Type>>());
|
||||
|
||||
forAll(curFields, i)
|
||||
{
|
||||
@ -87,7 +113,7 @@ void Foam::fvMesh::storeOldTimeFields()
|
||||
template<class Type, template<class> class GeoField>
|
||||
void Foam::fvMesh::nullOldestTimeFields()
|
||||
{
|
||||
UPtrList<GeoField<Type>> curFields(this->curFields<Type, GeoField>());
|
||||
UPtrList<GeoField<Type>> curFields(this->curFields<GeoField<Type>>());
|
||||
|
||||
forAll(curFields, i)
|
||||
{
|
||||
|
||||
@ -233,11 +233,11 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||
reverseFieldMap_.resize(2*fieldSet_.size());
|
||||
forAll(fieldSet_, seti)
|
||||
{
|
||||
const word& fldName = fieldSet_[seti].first();
|
||||
const word& sampleFldName = fieldSet_[seti].second();
|
||||
const word& fieldName = fieldSet_[seti].first();
|
||||
const word& sampleFieldName = fieldSet_[seti].second();
|
||||
|
||||
fieldMap_.insert(fldName, sampleFldName);
|
||||
reverseFieldMap_.insert(sampleFldName, fldName);
|
||||
fieldMap_.insert(fieldName, sampleFieldName);
|
||||
reverseFieldMap_.insert(sampleFieldName, fieldName);
|
||||
}
|
||||
|
||||
Log << type() << " " << name()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,48 +30,48 @@ License
|
||||
template<class Type>
|
||||
void Foam::functionObjects::nearWallFields::createFields
|
||||
(
|
||||
PtrList<VolField<Type>>& sflds
|
||||
PtrList<VolField<Type>>& sfields
|
||||
) const
|
||||
{
|
||||
HashTable<const VolField<Type>*> flds(obr_.lookupClass<VolField<Type>>());
|
||||
const UPtrList<VolField<Type>> fields(mesh_.fields<VolField<Type>>());
|
||||
|
||||
forAllConstIter(typename HashTable<const VolField<Type>*>, flds, iter)
|
||||
forAll(fields, i)
|
||||
{
|
||||
const VolField<Type>& fld = *iter();
|
||||
const VolField<Type>& field = fields[i];
|
||||
|
||||
if (fieldMap_.found(fld.name()))
|
||||
if (fieldMap_.found(field.name()))
|
||||
{
|
||||
const word& sampleFldName = fieldMap_[fld.name()];
|
||||
const word& sampleFieldName = fieldMap_[field.name()];
|
||||
|
||||
if (obr_.found(sampleFldName))
|
||||
if (obr_.found(sampleFieldName))
|
||||
{
|
||||
Log << " a field " << sampleFldName
|
||||
Log << " a field " << sampleFieldName
|
||||
<< " already exists on the mesh."
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
label sz = sflds.size();
|
||||
sflds.setSize(sz+1);
|
||||
label sz = sfields.size();
|
||||
sfields.setSize(sz+1);
|
||||
|
||||
sflds.set
|
||||
sfields.set
|
||||
(
|
||||
sz,
|
||||
new VolField<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
sampleFldName,
|
||||
sampleFieldName,
|
||||
time_.name(),
|
||||
mesh_
|
||||
),
|
||||
fld,
|
||||
field,
|
||||
calculatedFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
Log << " created " << sflds[sz].name()
|
||||
<< " to sample " << fld.name() << endl;
|
||||
Log << " created " << sfields[sz].name()
|
||||
<< " to sample " << field.name() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ template<class Type>
|
||||
void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
(
|
||||
const interpolationCellPoint<Type>& interpolator,
|
||||
VolField<Type>& fld
|
||||
VolField<Type>& field
|
||||
) const
|
||||
{
|
||||
// Construct flat fields for all patch faces to be sampled
|
||||
@ -107,7 +107,7 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
);
|
||||
|
||||
typename VolField<Type>::
|
||||
Boundary& fldBf = fld.boundaryFieldRef();
|
||||
Boundary& fieldBf = field.boundaryFieldRef();
|
||||
|
||||
// Pick up data
|
||||
label nPatchFaces = 0;
|
||||
@ -115,15 +115,15 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
{
|
||||
label patchi = iter.key();
|
||||
|
||||
fvPatchField<Type>& pfld = fldBf[patchi];
|
||||
fvPatchField<Type>& pfield = fieldBf[patchi];
|
||||
|
||||
Field<Type> newFld(pfld.size());
|
||||
forAll(pfld, i)
|
||||
Field<Type> newField(pfield.size());
|
||||
forAll(pfield, i)
|
||||
{
|
||||
newFld[i] = sampledValues[nPatchFaces++];
|
||||
newField[i] = sampledValues[nPatchFaces++];
|
||||
}
|
||||
|
||||
pfld == newFld;
|
||||
pfield == newField;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,22 +131,23 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField
|
||||
template<class Type>
|
||||
void Foam::functionObjects::nearWallFields::sampleFields
|
||||
(
|
||||
PtrList<VolField<Type>>& sflds
|
||||
PtrList<VolField<Type>>& sfields
|
||||
) const
|
||||
{
|
||||
forAll(sflds, i)
|
||||
forAll(sfields, i)
|
||||
{
|
||||
const word& fldName = reverseFieldMap_[sflds[i].name()];
|
||||
const VolField<Type>& fld = obr_.lookupObject<VolField<Type>>(fldName);
|
||||
const word& fieldName = reverseFieldMap_[sfields[i].name()];
|
||||
const VolField<Type>& field =
|
||||
obr_.lookupObject<VolField<Type>>(fieldName);
|
||||
|
||||
// Take over internal and boundary values
|
||||
sflds[i] == fld;
|
||||
sfields[i] == field;
|
||||
|
||||
// Construct interpolation method
|
||||
interpolationCellPoint<Type> interpolator(fld);
|
||||
interpolationCellPoint<Type> interpolator(field);
|
||||
|
||||
// Override sampled values
|
||||
sampleBoundaryField(interpolator, sflds[i]);
|
||||
sampleBoundaryField(interpolator, sfields[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -70,9 +70,6 @@ void Foam::fvMeshDistributors::distributor::distribute
|
||||
// Mesh distribution engine
|
||||
fvMeshDistribute distributor(mesh);
|
||||
|
||||
// Clear sliced and other non-distributable mesh data
|
||||
fvMeshDistributor::update();
|
||||
|
||||
// Do actual sending/receiving of mesh
|
||||
autoPtr<polyDistributionMap> map
|
||||
(
|
||||
|
||||
@ -1006,10 +1006,12 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi
|
||||
// Wherever we find a movingWall-type boundary condition on an original
|
||||
// patch, override the corresponding error patch condition to
|
||||
// movingWallSlipVelocity
|
||||
HashTable<volVectorField*> fields(mesh().lookupClass<volVectorField>());
|
||||
forAllIter(typename HashTable<volVectorField*>, fields, iter)
|
||||
UPtrList<volVectorField> fields(mesh().fields<volVectorField>());
|
||||
forAll(fields, i)
|
||||
{
|
||||
typename volVectorField::Boundary& Ub = iter()->boundaryFieldRef();
|
||||
volVectorField& field = fields[i];
|
||||
|
||||
typename volVectorField::Boundary& Ub = field.boundaryFieldRef();
|
||||
|
||||
forAll(origPatchIDs, i)
|
||||
{
|
||||
@ -1031,7 +1033,7 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi
|
||||
new movingWallSlipVelocityFvPatchVectorField
|
||||
(
|
||||
mesh().boundary()[errorPatchi],
|
||||
*iter()
|
||||
field
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -53,42 +53,14 @@ void MeshToMeshMapVolFields
|
||||
const fvMeshToFvMesh& mapper
|
||||
)
|
||||
{
|
||||
HashTable<const VolField<Type>*> fields
|
||||
(
|
||||
mesh.objectRegistry::template lookupClass<VolField<Type>>()
|
||||
);
|
||||
UPtrList<VolField<Type>> fields(mesh.curFields<VolField<Type>>());
|
||||
|
||||
// Deleted old time fields
|
||||
for
|
||||
(
|
||||
typename HashTable<const VolField<Type>*>::
|
||||
iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
forAll(fields, i)
|
||||
{
|
||||
VolField<Type>& field =
|
||||
const_cast<VolField<Type>&>
|
||||
(*fieldIter());
|
||||
VolField<Type>& field = fields[i];
|
||||
|
||||
// Delete old time fields
|
||||
field.clearOldTimes();
|
||||
}
|
||||
|
||||
fields =
|
||||
(
|
||||
mesh.objectRegistry::template lookupClass<VolField<Type>>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const VolField<Type>*>::
|
||||
iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
VolField<Type>& field =
|
||||
const_cast<VolField<Type>&>(*fieldIter());
|
||||
|
||||
if (fvMeshToFvMesh::debug)
|
||||
{
|
||||
@ -110,22 +82,14 @@ void MeshToMeshMapVolInternalFields
|
||||
const fvMeshToFvMesh& mapper
|
||||
)
|
||||
{
|
||||
// Note: use strict flag on lookupClass to avoid picking up volFields
|
||||
HashTable<const VolInternalField<Type>*> fields
|
||||
UPtrList<VolInternalField<Type>> fields
|
||||
(
|
||||
mesh.objectRegistry::template lookupClass<VolInternalField<Type>>(true)
|
||||
mesh.fields<VolInternalField<Type>>(true)
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const VolInternalField<Type>*>::
|
||||
iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
forAll(fields, i)
|
||||
{
|
||||
VolInternalField<Type>& field =
|
||||
const_cast<VolInternalField<Type>&>(*fieldIter());
|
||||
VolInternalField<Type>& field = fields[i];
|
||||
|
||||
if (fvMeshToFvMesh::debug)
|
||||
{
|
||||
@ -155,26 +119,6 @@ void NaNGeometricFields
|
||||
{
|
||||
typedef GeometricField<Type, PatchField, GeoMesh> GField;
|
||||
|
||||
HashTable<const GField*> fields
|
||||
(
|
||||
mesh.objectRegistry::template lookupClass<GField>()
|
||||
);
|
||||
|
||||
// Deleted old time fields
|
||||
for
|
||||
(
|
||||
typename HashTable<const GField*>::
|
||||
iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
GField& field = const_cast<GField&>(*fieldIter());
|
||||
field.clearOldTimes();
|
||||
}
|
||||
|
||||
fields = mesh.objectRegistry::template lookupClass<GField>();
|
||||
|
||||
Type NaN;
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
@ -182,14 +126,14 @@ void NaNGeometricFields
|
||||
setComponent(NaN, cmpt) = std::numeric_limits<scalar>::signaling_NaN();
|
||||
}
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GField*>::iterator fieldIter = fields.begin();
|
||||
fieldIter != fields.end();
|
||||
++fieldIter
|
||||
)
|
||||
UPtrList<GField> fields(mesh.curFields<GField>());
|
||||
|
||||
forAll(fields, i)
|
||||
{
|
||||
GField& field = const_cast<GField&>(*fieldIter());
|
||||
GField& field = fields[i];
|
||||
|
||||
// Delete old time fields
|
||||
field.clearOldTimes();
|
||||
|
||||
if (fvMeshToFvMesh::debug)
|
||||
{
|
||||
|
||||
@ -94,15 +94,11 @@ Foam::scalar Foam::fvMeshTopoChangers::meshToMesh::meshTime() const
|
||||
void Foam::fvMeshTopoChangers::meshToMesh::interpolateUfs()
|
||||
{
|
||||
// Interpolate U to Uf
|
||||
UPtrList<surfaceVectorField> Ufs(mesh().curFields<surfaceVectorField>());
|
||||
|
||||
HashTable<surfaceVectorField*> Ufs
|
||||
(
|
||||
mesh().lookupClass<surfaceVectorField>()
|
||||
);
|
||||
|
||||
forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
|
||||
forAll(Ufs, i)
|
||||
{
|
||||
surfaceVectorField& Uf = *iter();
|
||||
surfaceVectorField& Uf = Ufs[i];
|
||||
|
||||
const volVectorField& U = surfaceToVolVelocity(Uf);
|
||||
|
||||
|
||||
@ -456,45 +456,45 @@ void Foam::fvMeshTopoChangers::refiner::refineFluxes
|
||||
{
|
||||
if (correctFluxes_.size())
|
||||
{
|
||||
HashTable<surfaceScalarField*> fluxes
|
||||
UPtrList<surfaceScalarField> fluxes
|
||||
(
|
||||
mesh().lookupClass<surfaceScalarField>()
|
||||
mesh().fields<surfaceScalarField>()
|
||||
);
|
||||
|
||||
forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
|
||||
forAll(fluxes, i)
|
||||
{
|
||||
if (!correctFluxes_.found(iter.key()))
|
||||
surfaceScalarField& flux = fluxes[i];
|
||||
|
||||
if (!correctFluxes_.found(flux.name()))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find surfaceScalarField " << iter.key()
|
||||
<< "Cannot find surfaceScalarField " << flux.name()
|
||||
<< " in user-provided flux mapping table "
|
||||
<< correctFluxes_ << endl
|
||||
<< " The flux mapping table is used to recreate the"
|
||||
<< " flux on newly created faces." << endl
|
||||
<< " Either add the entry if it is a flux or use ("
|
||||
<< iter.key() << " none) to suppress this warning."
|
||||
<< flux.name() << " none) to suppress this warning."
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
const word& method = correctFluxes_[iter.key()];
|
||||
const word& method = correctFluxes_[flux.name()];
|
||||
|
||||
if (method == "none")
|
||||
{}
|
||||
else if (method == "NaN")
|
||||
{
|
||||
Pout<< "Setting surfaceScalarField " << iter.key()
|
||||
Pout<< "Setting surfaceScalarField " << flux.name()
|
||||
<< " to NaN" << endl;
|
||||
|
||||
surfaceScalarField& phi = *iter();
|
||||
|
||||
sigFpe::fillNan(phi.primitiveFieldRef());
|
||||
sigFpe::fillNan(flux.primitiveFieldRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown refinement method " << method
|
||||
<< " for surfaceScalarField " << iter.key()
|
||||
<< " for surfaceScalarField " << flux.name()
|
||||
<< " in user-provided flux mapping table "
|
||||
<< correctFluxes_
|
||||
<< exit(FatalError);
|
||||
@ -513,34 +513,36 @@ void Foam::fvMeshTopoChangers::refiner::unrefineFluxes
|
||||
{
|
||||
if (correctFluxes_.size())
|
||||
{
|
||||
HashTable<surfaceScalarField*> fluxes
|
||||
UPtrList<surfaceScalarField> fluxes
|
||||
(
|
||||
mesh().lookupClass<surfaceScalarField>()
|
||||
mesh().fields<surfaceScalarField>()
|
||||
);
|
||||
|
||||
forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
|
||||
forAll(fluxes, i)
|
||||
{
|
||||
if (!correctFluxes_.found(iter.key()))
|
||||
surfaceScalarField& flux = fluxes[i];
|
||||
|
||||
if (!correctFluxes_.found(flux.name()))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find surfaceScalarField " << iter.key()
|
||||
<< "Cannot find surfaceScalarField " << flux.name()
|
||||
<< " in user-provided flux mapping table "
|
||||
<< correctFluxes_ << endl
|
||||
<< " The flux mapping table is used to recreate the"
|
||||
<< " flux on newly created faces." << endl
|
||||
<< " Either add the entry if it is a flux or use ("
|
||||
<< iter.key() << " none) to suppress this warning."
|
||||
<< flux.name() << " none) to suppress this warning."
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
const word& method = correctFluxes_[iter.key()];
|
||||
const word& method = correctFluxes_[flux.name()];
|
||||
|
||||
if (method != "none")
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown unrefinement method " << method
|
||||
<< " for surfaceScalarField " << iter.key()
|
||||
<< " for surfaceScalarField " << flux.name()
|
||||
<< " in user-provided flux mapping table "
|
||||
<< correctFluxes_
|
||||
<< exit(FatalError);
|
||||
@ -561,13 +563,11 @@ void Foam::fvMeshTopoChangers::refiner::refineUfs
|
||||
const labelList& reverseFaceMap = map.reverseFaceMap();
|
||||
|
||||
// Interpolate U to Uf for added faces
|
||||
HashTable<surfaceVectorField*> Ufs
|
||||
(
|
||||
mesh().lookupClass<surfaceVectorField>()
|
||||
);
|
||||
forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
|
||||
UPtrList<surfaceVectorField> Ufs(mesh().fields<surfaceVectorField>());
|
||||
|
||||
forAll(Ufs, i)
|
||||
{
|
||||
surfaceVectorField& Uf = *iter();
|
||||
surfaceVectorField& Uf = Ufs[i];
|
||||
|
||||
const word Uname(this->Uname(Uf));
|
||||
|
||||
@ -666,13 +666,11 @@ void Foam::fvMeshTopoChangers::refiner::unrefineUfs
|
||||
const labelList& reverseFaceMap = map.reverseFaceMap();
|
||||
|
||||
// Interpolate U to Uf for added faces
|
||||
HashTable<surfaceVectorField*> Ufs
|
||||
(
|
||||
mesh().lookupClass<surfaceVectorField>()
|
||||
);
|
||||
forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
|
||||
UPtrList<surfaceVectorField> Ufs(mesh().fields<surfaceVectorField>());
|
||||
|
||||
forAll(Ufs, i)
|
||||
{
|
||||
surfaceVectorField& Uf = *iter();
|
||||
surfaceVectorField& Uf = Ufs[i];
|
||||
|
||||
const word Uname(this->Uname(Uf));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user