mappedFilmSurface patches: New patch types to map between the film surface and fluid region

This commit is contained in:
Henry Weller
2023-03-02 21:49:10 +00:00
parent 390c588cd4
commit 46e312679e
9 changed files with 621 additions and 53 deletions

View File

@ -12,6 +12,10 @@ patches/mappedFilmWall/mappedFilmWallFvPatch/mappedFilmWallFvPatch.C
patches/mappedFilmWall/mappedFilmWallPointPatch/mappedFilmWallPointPatch.C
patches/mappedFilmWall/mappedFilmWallPolyPatch/mappedFilmWallPolyPatch.C
patches/mappedFilmSurface/mappedFilmSurfacePolyPatch/mappedFilmSurfacePolyPatch.C
patches/mappedFilmSurface/mappedFilmSurfacePointPatch/mappedFilmSurfacePointPatch.C
patches/mappedFilmSurface/mappedFilmSurfaceFvPatch/mappedFilmSurfaceFvPatch.C
derivedFvPatchFields/alphaOne/alphaOneFvPatchScalarField.C
derivedFvPatchFields/filmContactAngle/filmContactAngleFvPatchScalarField.C

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mappedFilmSurfaceFvPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mappedFilmSurfaceFvPatch, 0);
addToRunTimeSelectionTable(fvPatch, mappedFilmSurfaceFvPatch, polyPatch);
}
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::mappedFilmSurfaceFvPatch
SourceFiles
mappedFilmSurfaceFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef mappedFilmSurfaceFvPatch_H
#define mappedFilmSurfaceFvPatch_H
#include "filmSurfaceFvPatch.H"
#include "mappedFilmSurfacePolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mappedFilmSurfaceFvPatch Declaration
\*---------------------------------------------------------------------------*/
class mappedFilmSurfaceFvPatch
:
public filmSurfaceFvPatch
{
public:
//- Runtime type information
TypeName(mappedFilmSurfacePolyPatch::typeName_());
// Constructors
//- Construct from components
mappedFilmSurfaceFvPatch
(
const polyPatch& patch,
const fvBoundaryMesh& bm
)
:
filmSurfaceFvPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mappedFilmSurfacePointPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(mappedFilmSurfacePointPatch, 0);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
mappedFilmSurfacePointPatch,
polyPatch
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::mappedFilmSurfacePointPatch
SourceFiles
mappedFilmSurfacePointPatch.C
\*---------------------------------------------------------------------------*/
#ifndef mappedFilmSurfacePointPatch_H
#define mappedFilmSurfacePointPatch_H
#include "filmSurfacePointPatch.H"
#include "mappedFilmSurfacePolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mappedFilmSurfacePointPatch Declaration
\*---------------------------------------------------------------------------*/
class mappedFilmSurfacePointPatch
:
public filmSurfacePointPatch
{
public:
//- Runtime type information
TypeName(mappedFilmSurfacePolyPatch::typeName_());
// Constructors
//- Construct from polyPatch
mappedFilmSurfacePointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
)
:
filmSurfacePointPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,178 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mappedFilmSurfacePolyPatch.H"
#include "mappedPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mappedFilmSurfacePolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, mappedFilmSurfacePolyPatch, word);
addToRunTimeSelectionTable
(
polyPatch,
mappedFilmSurfacePolyPatch,
dictionary
);
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::mappedFilmSurfacePolyPatch::mappedFilmSurfacePolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
filmSurfacePolyPatch(name, size, start, index, bm, patchType),
mappedExtrudedPatchBase(static_cast<const polyPatch&>(*this))
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
{
inGroups().append(mappedPolyPatch::typeName);
}
}
Foam::mappedFilmSurfacePolyPatch::mappedFilmSurfacePolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& neighbourRegion,
const word& neighbourPatch,
const word& bottomPatch,
const polyBoundaryMesh& bm
)
:
filmSurfacePolyPatch(name, size, start, index, bm, typeName),
mappedExtrudedPatchBase
(
*this,
neighbourRegion,
neighbourPatch,
bottomPatch,
cyclicTransform(true)
)
{}
Foam::mappedFilmSurfacePolyPatch::mappedFilmSurfacePolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
filmSurfacePolyPatch(name, dict, index, bm, patchType),
mappedExtrudedPatchBase(*this, dict, true)
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
{
inGroups().append(mappedPolyPatch::typeName);
}
}
Foam::mappedFilmSurfacePolyPatch::mappedFilmSurfacePolyPatch
(
const mappedFilmSurfacePolyPatch& pp,
const polyBoundaryMesh& bm
)
:
filmSurfacePolyPatch(pp, bm),
mappedExtrudedPatchBase(*this, pp)
{}
Foam::mappedFilmSurfacePolyPatch::mappedFilmSurfacePolyPatch
(
const mappedFilmSurfacePolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
filmSurfacePolyPatch(pp, bm, index, newSize, newStart),
mappedExtrudedPatchBase(*this, pp)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::mappedFilmSurfacePolyPatch::~mappedFilmSurfacePolyPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mappedFilmSurfacePolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
filmSurfacePolyPatch::calcGeometry(pBufs);
mappedExtrudedPatchBase::clearOut();
}
void Foam::mappedFilmSurfacePolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
filmSurfacePolyPatch::movePoints(pBufs, p);
mappedExtrudedPatchBase::clearOut();
}
void Foam::mappedFilmSurfacePolyPatch::topoChange(PstreamBuffers& pBufs)
{
filmSurfacePolyPatch::topoChange(pBufs);
mappedExtrudedPatchBase::clearOut();
}
void Foam::mappedFilmSurfacePolyPatch::write(Ostream& os) const
{
filmSurfacePolyPatch::write(os);
mappedExtrudedPatchBase::write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::mappedFilmSurfacePolyPatch
Description
Film surface patch which holds a mapping engine to map values
from another patch
SourceFiles
mappedFilmSurfacePolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef mappedFilmSurfacePolyPatch_H
#define mappedFilmSurfacePolyPatch_H
#include "filmSurfacePolyPatch.H"
#include "mappedExtrudedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class mappedFilmSurfacePolyPatch Declaration
\*---------------------------------------------------------------------------*/
class mappedFilmSurfacePolyPatch
:
public filmSurfacePolyPatch,
public mappedExtrudedPatchBase
{
protected:
// Protected Member Functions
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Update of the patch topology
virtual void topoChange(PstreamBuffers&);
public:
//- Runtime type information
TypeName("mappedFilmSurface");
// Constructors
//- Construct from components
mappedFilmSurfacePolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
);
//- Construct from components
mappedFilmSurfacePolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& neighbourRegion,
const word& neighbourPatch,
const word& bottomPatch,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
mappedFilmSurfacePolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
);
//- Construct as copy, resetting the boundary mesh
mappedFilmSurfacePolyPatch
(
const mappedFilmSurfacePolyPatch&,
const polyBoundaryMesh&
);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
mappedFilmSurfacePolyPatch
(
const mappedFilmSurfacePolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>
(
new mappedFilmSurfacePolyPatch(*this, bm)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new mappedFilmSurfacePolyPatch
(
*this,
bm,
index,
newSize,
newStart
)
);
}
//- Destructor
virtual ~mappedFilmSurfacePolyPatch();
// Member Functions
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -56,8 +56,7 @@ Foam::mappedFilmWallPolyPatch::mappedFilmWallPolyPatch
)
:
filmWallPolyPatch(name, size, start, index, bm, patchType),
mappedPatchBase(static_cast<const polyPatch&>(*this)),
reMapAfterMove_(true)
mappedPatchBase(static_cast<const polyPatch&>(*this))
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
@ -85,8 +84,7 @@ Foam::mappedFilmWallPolyPatch::mappedFilmWallPolyPatch
neighbourRegion,
neighbourPatch,
cyclicTransform(true)
),
reMapAfterMove_(true)
)
{}
@ -100,8 +98,7 @@ Foam::mappedFilmWallPolyPatch::mappedFilmWallPolyPatch
)
:
filmWallPolyPatch(name, dict, index, bm, patchType),
mappedPatchBase(*this, dict, true),
reMapAfterMove_(dict.lookupOrDefault<bool>("reMapAfterMove", true))
mappedPatchBase(*this, dict, true)
{
// mapped is not constraint type so add mapped group explicitly
if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1)
@ -118,8 +115,7 @@ Foam::mappedFilmWallPolyPatch::mappedFilmWallPolyPatch
)
:
filmWallPolyPatch(pp, bm),
mappedPatchBase(*this, pp),
reMapAfterMove_(true)
mappedPatchBase(*this, pp)
{}
@ -133,8 +129,7 @@ Foam::mappedFilmWallPolyPatch::mappedFilmWallPolyPatch
)
:
filmWallPolyPatch(pp, bm, index, newSize, newStart),
mappedPatchBase(*this, pp),
reMapAfterMove_(true)
mappedPatchBase(*this, pp)
{}
@ -146,12 +141,6 @@ Foam::mappedFilmWallPolyPatch::~mappedFilmWallPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mappedFilmWallPolyPatch::initCalcGeometry(PstreamBuffers& pBufs)
{
filmWallPolyPatch::initCalcGeometry(pBufs);
}
void Foam::mappedFilmWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
filmWallPolyPatch::calcGeometry(pBufs);
@ -159,16 +148,6 @@ void Foam::mappedFilmWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
}
void Foam::mappedFilmWallPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
filmWallPolyPatch::initMovePoints(pBufs, p);
}
void Foam::mappedFilmWallPolyPatch::movePoints
(
PstreamBuffers& pBufs,
@ -176,16 +155,7 @@ void Foam::mappedFilmWallPolyPatch::movePoints
)
{
filmWallPolyPatch::movePoints(pBufs, p);
if (reMapAfterMove_)
{
mappedPatchBase::clearOut();
}
}
void Foam::mappedFilmWallPolyPatch::initTopoChange(PstreamBuffers& pBufs)
{
filmWallPolyPatch::initTopoChange(pBufs);
mappedPatchBase::clearOut();
}
@ -200,7 +170,6 @@ void Foam::mappedFilmWallPolyPatch::write(Ostream& os) const
{
filmWallPolyPatch::write(os);
mappedPatchBase::write(os);
writeEntryIfDifferent<bool>(os, "reMapAfterMove", true, reMapAfterMove_);
}

View File

@ -55,32 +55,16 @@ class mappedFilmWallPolyPatch
public filmWallPolyPatch,
public mappedPatchBase
{
// Private Data
//- Do we need to re-calculate the mapping if mesh motion takes place?
// Defaults to true.
const bool reMapAfterMove_;
protected:
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initCalcGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initTopoChange(PstreamBuffers&);
//- Update of the patch topology
virtual void topoChange(PstreamBuffers&);