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