mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added rawTopoFvChanger mesh
This commit is contained in:
@ -9,6 +9,7 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldynamicFvMesh \
|
||||
-ltopoChangerFvMesh \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools \
|
||||
-lincompressibleTransportModels \
|
||||
|
||||
@ -16,5 +16,6 @@ EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools \
|
||||
-ldynamicFvMesh
|
||||
-ldynamicFvMesh \
|
||||
-ltopoChangerFvMesh
|
||||
|
||||
|
||||
@ -16,16 +16,13 @@ $(enrichedPatch)/enrichedPatchPointPoints.C
|
||||
$(enrichedPatch)/enrichedPatchCutFaces.C
|
||||
$(enrichedPatch)/enrichedPatchMasterPoints.C
|
||||
|
||||
/* polyTopoChange/polyTopoChange/polyTopoChange.C */
|
||||
polyTopoChange/polyTopoChange/topoAction/topoActions.C
|
||||
|
||||
polyMeshModifier = polyTopoChange/polyMeshModifier
|
||||
$(polyMeshModifier)/polyMeshModifier.C
|
||||
$(polyMeshModifier)/newPolyMeshModifier.C
|
||||
|
||||
polyTopoChange/polyTopoChange/topoAction/topoActions.C
|
||||
polyTopoChange/polyTopoChanger/polyTopoChanger.C
|
||||
/* polyTopoChange/polyTopoChanger/polyTopoChangerChangeMesh.C */
|
||||
|
||||
polyTopoChange/polyTopoChange/polyTopoChange.C
|
||||
polyTopoChange/polyTopoChange/addPatchCellLayer.C
|
||||
polyTopoChange/polyTopoChange/edgeCollapser.C
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
topoChangerFvMesh/topoChangerFvMesh.C
|
||||
rawTopoChangerFvMesh/rawTopoChangerFvMesh.C
|
||||
|
||||
/*
|
||||
linearValveFvMesh/linearValveFvMesh.C
|
||||
|
||||
@ -0,0 +1,180 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rawTopoChangerFvMesh.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
#include "linear.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(rawTopoChangerFvMesh, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
topoChangerFvMesh,
|
||||
rawTopoChangerFvMesh,
|
||||
IOobject
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh(const IOobject& io)
|
||||
:
|
||||
topoChangerFvMesh(io)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::rawTopoChangerFvMesh::~rawTopoChangerFvMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::rawTopoChangerFvMesh::update()
|
||||
{
|
||||
// Do mesh changes (use inflation - put new points in topoChangeMap)
|
||||
Info<< "rawTopoChangerFvMesh : Checking for topology changes..."
|
||||
<< endl;
|
||||
autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(true);
|
||||
|
||||
bool hasChanged = topoChangeMap.valid();
|
||||
|
||||
if (hasChanged)
|
||||
{
|
||||
Info<< "rawTopoChangerFvMesh : Done topology changes..."
|
||||
<< endl;
|
||||
|
||||
// Temporary: fix fields on patch faces created out of nothing
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Two situations:
|
||||
// - internal faces inflated out of nothing
|
||||
// - patch faces created out of previously internal faces
|
||||
|
||||
// Is face mapped in any way
|
||||
PackedList<1> mappedFace(nFaces());
|
||||
|
||||
const label nOldInternal = topoChangeMap().oldPatchStarts()[0];
|
||||
|
||||
const labelList& faceMap = topoChangeMap().faceMap();
|
||||
for (label faceI = 0; faceI < nInternalFaces(); faceI++)
|
||||
{
|
||||
if (faceMap[faceI] >= 0)
|
||||
{
|
||||
mappedFace[faceI] = 1;
|
||||
}
|
||||
}
|
||||
for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++)
|
||||
{
|
||||
if (faceMap[faceI] >= 0 && faceMap[faceI] >= nOldInternal)
|
||||
{
|
||||
mappedFace[faceI] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
const List<objectMap>& fromFaces = topoChangeMap().facesFromFacesMap();
|
||||
|
||||
forAll(fromFaces, i)
|
||||
{
|
||||
mappedFace[fromFaces[i].index()] = 1;
|
||||
}
|
||||
|
||||
const List<objectMap>& fromEdges = topoChangeMap().facesFromEdgesMap();
|
||||
|
||||
forAll(fromEdges, i)
|
||||
{
|
||||
mappedFace[fromEdges[i].index()] = 1;
|
||||
}
|
||||
|
||||
const List<objectMap>& fromPts = topoChangeMap().facesFromPointsMap();
|
||||
|
||||
forAll(fromPts, i)
|
||||
{
|
||||
mappedFace[fromPts[i].index()] = 1;
|
||||
}
|
||||
|
||||
// Set unmapped faces to zero
|
||||
Info<< "rawTopoChangerFvMesh : zeroing unmapped boundary values."
|
||||
<< endl;
|
||||
zeroUnmappedValues<scalar, fvPatchField, volMesh>(mappedFace);
|
||||
zeroUnmappedValues<vector, fvPatchField, volMesh>(mappedFace);
|
||||
zeroUnmappedValues<sphericalTensor, fvPatchField, volMesh>(mappedFace);
|
||||
zeroUnmappedValues<symmTensor, fvPatchField, volMesh>(mappedFace);
|
||||
zeroUnmappedValues<tensor, fvPatchField, volMesh>(mappedFace);
|
||||
|
||||
// Special handling for phi: set unmapped faces to recreated phi
|
||||
Info<< "rawTopoChangerFvMesh :"
|
||||
<< " recreating phi for unmapped boundary values." << endl;
|
||||
const volVectorField& U = lookupObject<volVectorField>("U");
|
||||
surfaceScalarField& phi = const_cast<surfaceScalarField&>
|
||||
(
|
||||
lookupObject<surfaceScalarField>("phi")
|
||||
);
|
||||
setUnmappedValues
|
||||
(
|
||||
phi,
|
||||
mappedFace,
|
||||
(linearInterpolate(U) & Sf())()
|
||||
);
|
||||
|
||||
|
||||
if (topoChangeMap().hasMotionPoints())
|
||||
{
|
||||
pointField newPoints = topoChangeMap().preMotionPoints();
|
||||
|
||||
// Give the meshModifiers opportunity to modify points
|
||||
Info<< "rawTopoChangerFvMesh :"
|
||||
<< " calling modifyMotionPoints." << endl;
|
||||
topoChanger_.modifyMotionPoints(newPoints);
|
||||
|
||||
// Actually move points
|
||||
Info<< "rawTopoChangerFvMesh :"
|
||||
<< " calling movePoints." << endl;
|
||||
|
||||
movePoints(newPoints);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pout<< "rawTopoChangerFvMesh :"
|
||||
// << " no topology changes..." << endl;
|
||||
}
|
||||
|
||||
changing(hasChanged);
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,117 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::rawTopoChangerFvMesh
|
||||
|
||||
Description
|
||||
topoChangerFvMesh without any added functionality.
|
||||
|
||||
Note: run without FOAM_SETNAN. Temporary has unitialised patch
|
||||
data when faces get created out of nothing.
|
||||
|
||||
SourceFiles
|
||||
rawTopoChangerFvMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef rawTopoChangerFvMesh_H
|
||||
#define rawTopoChangerFvMesh_H
|
||||
|
||||
#include "topoChangerFvMesh.H"
|
||||
#include "PackedList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rawTopoChangerFvMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rawTopoChangerFvMesh
|
||||
:
|
||||
public topoChangerFvMesh
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Set unmapped values
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
static void setUnmappedValues
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& fld,
|
||||
const PackedList<1>& mappedFace,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& baseFld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void zeroUnmappedValues(const PackedList<1>&) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
rawTopoChangerFvMesh(const rawTopoChangerFvMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const rawTopoChangerFvMesh&);
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("rawTopoChangerFvMesh");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from database
|
||||
explicit rawTopoChangerFvMesh(const IOobject& io);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~rawTopoChangerFvMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update the mesh for both mesh motion and topology change
|
||||
virtual bool update();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "rawTopoChangerFvMeshTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rawTopoChangerFvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::rawTopoChangerFvMesh::setUnmappedValues
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& fld,
|
||||
const PackedList<1>& mappedFace,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& baseFld
|
||||
)
|
||||
{
|
||||
//Pout<< "Checking field " << fld.name() << endl;
|
||||
|
||||
forAll(fld.boundaryField(), patchI)
|
||||
{
|
||||
PatchField<Type>& fvp = const_cast<PatchField<Type>&>
|
||||
(
|
||||
fld.boundaryField()[patchI]
|
||||
);
|
||||
|
||||
label start = fvp.patch().patch().start();
|
||||
forAll(fvp, i)
|
||||
{
|
||||
if (!mappedFace[start+i])
|
||||
{
|
||||
//Pout<< "** Resetting unassigned value on patch "
|
||||
// << fvp.patch().name()
|
||||
// << " localface:" << i
|
||||
// << " to:" << baseFld.boundaryField()[patchI][i] << endl;
|
||||
fvp[i] = baseFld.boundaryField()[patchI][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
|
||||
(
|
||||
const PackedList<1>& mappedFace
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
|
||||
|
||||
const wordList fldNames(names(FieldType::typeName));
|
||||
|
||||
forAll(fldNames, i)
|
||||
{
|
||||
//Pout<< "Checking field " << fldNames[i] << endl;
|
||||
|
||||
FieldType& fld = const_cast<FieldType&>
|
||||
(
|
||||
lookupObject<FieldType>(fldNames[i])
|
||||
);
|
||||
|
||||
setUnmappedValues
|
||||
(
|
||||
fld,
|
||||
mappedFace,
|
||||
FieldType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"zero",
|
||||
time().timeName(),
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
*this,
|
||||
dimensioned<Type>("0", fld.dimensions(), pTraits<Type>::zero)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user