Test-mappedPatch: Updated following changes to mappedPatchBase
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
Test-MappedPatch.C
|
Test-mappedPatch.C
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-MappedPatch
|
EXE = $(FOAM_USER_APPBIN)/Test-mappedPatch
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume
|
-lmeshTools \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lfileFormats
|
||||||
|
|||||||
@ -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-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,31 +22,30 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
testMappedPatch
|
Test-mappedPatch
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Test mapped b.c. by mapping face centres (mesh.C().boundaryField()).
|
Test mapped patches and boundary conditions by mapping cell and face
|
||||||
|
centres and writing out the resulting point connections
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "OFstream.H"
|
#include "OBJstream.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "mappedPolyPatch.H"
|
#include "mappedPolyPatch.H"
|
||||||
#include "mappedFixedValueFvPatchFields.H"
|
#include "mappedInternalPolyPatch.H"
|
||||||
|
#include "mappedValueFvPatchFields.H"
|
||||||
|
#include "mappedInternalValueFvPatchFields.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
// Main program:
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#include "addTimeOptions.H"
|
#include "addTimeOptions.H"
|
||||||
@ -65,12 +64,15 @@ int main(int argc, char *argv[])
|
|||||||
if (isA<mappedPolyPatch>(mesh.boundaryMesh()[patchi]))
|
if (isA<mappedPolyPatch>(mesh.boundaryMesh()[patchi]))
|
||||||
{
|
{
|
||||||
patchFieldTypes[patchi] =
|
patchFieldTypes[patchi] =
|
||||||
mappedFixedValueFvPatchVectorField::typeName;
|
mappedValueFvPatchVectorField::typeName;
|
||||||
|
}
|
||||||
|
if (isA<mappedInternalPolyPatch>(mesh.boundaryMesh()[patchi]))
|
||||||
|
{
|
||||||
|
patchFieldTypes[patchi] =
|
||||||
|
mappedInternalValueFvPatchVectorField::typeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout<< "patchFieldTypes:" << patchFieldTypes << endl;
|
|
||||||
|
|
||||||
volVectorField cc
|
volVectorField cc
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -81,44 +83,36 @@ int main(int argc, char *argv[])
|
|||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh.C(),
|
||||||
dimensionedVector(dimLength, Zero),
|
|
||||||
patchFieldTypes
|
patchFieldTypes
|
||||||
);
|
);
|
||||||
|
|
||||||
cc.primitiveFieldRef() = mesh.C().primitiveField();
|
cc.correctBoundaryConditions();
|
||||||
cc.boundaryFieldRef().updateCoeffs();
|
|
||||||
|
|
||||||
forAll(cc.boundaryField(), patchi)
|
forAll(cc.boundaryField(), patchi)
|
||||||
{
|
{
|
||||||
|
const fvPatchVectorField& ccp = cc.boundaryField()[patchi];
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
isA<mappedFixedValueFvPatchVectorField>
|
isA<mappedValueFvPatchVectorField>(ccp)
|
||||||
(
|
|| isA<mappedInternalValueFvPatchVectorField>(ccp)
|
||||||
cc.boundaryField()[patchi]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Pout<< "Detected a mapped patch:" << patchi << endl;
|
OBJstream obj(mesh.boundaryMesh()[patchi].name() + ".obj");
|
||||||
|
|
||||||
OFstream str(mesh.boundaryMesh()[patchi].name() + ".obj");
|
Pout<< "Detected a " << ccp.patch().type() << " field on patch \""
|
||||||
Pout<< "Writing mapped values to " << str.name() << endl;
|
<< ccp.patch().name() << "\". Writing point connections to "
|
||||||
|
<< obj.name() << "." << endl;
|
||||||
|
|
||||||
label vertI = 0;
|
forAll(ccp, i)
|
||||||
const fvPatchVectorField& fvp = cc.boundaryField()[patchi];
|
|
||||||
|
|
||||||
forAll(fvp, i)
|
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(str, fvp.patch().Cf()[i]);
|
obj.write(linePointRef(ccp.patch().Cf()[i], ccp[i]));
|
||||||
vertI++;
|
|
||||||
meshTools::writeOBJ(str, fvp[i]);
|
|
||||||
vertI++;
|
|
||||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< nl << "End" << nl << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user