diff --git a/applications/test/mappedPatch/Make/files b/applications/test/mappedPatch/Make/files index 468940aaec..7bdf4c6bf1 100644 --- a/applications/test/mappedPatch/Make/files +++ b/applications/test/mappedPatch/Make/files @@ -1,3 +1,3 @@ -Test-MappedPatch.C +Test-mappedPatch.C -EXE = $(FOAM_USER_APPBIN)/Test-MappedPatch +EXE = $(FOAM_USER_APPBIN)/Test-mappedPatch diff --git a/applications/test/mappedPatch/Make/options b/applications/test/mappedPatch/Make/options index d76bd10c8f..0390752329 100644 --- a/applications/test/mappedPatch/Make/options +++ b/applications/test/mappedPatch/Make/options @@ -1,6 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude EXE_LIBS = \ - -lfiniteVolume + -lmeshTools \ + -lfiniteVolume \ + -lfileFormats diff --git a/applications/test/mappedPatch/Test-MappedPatch.C b/applications/test/mappedPatch/Test-mappedPatch.C similarity index 65% rename from applications/test/mappedPatch/Test-MappedPatch.C rename to applications/test/mappedPatch/Test-mappedPatch.C index 41e5720991..29c0cc53cd 100644 --- a/applications/test/mappedPatch/Test-MappedPatch.C +++ b/applications/test/mappedPatch/Test-mappedPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,31 +22,30 @@ License along with OpenFOAM. If not, see . Application - testMappedPatch + Test-mappedPatch 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 "fvMesh.H" #include "volFields.H" #include "meshTools.H" #include "Time.H" -#include "OFstream.H" +#include "OBJstream.H" #include "volFields.H" #include "mappedPolyPatch.H" -#include "mappedFixedValueFvPatchFields.H" +#include "mappedInternalPolyPatch.H" +#include "mappedValueFvPatchFields.H" +#include "mappedInternalValueFvPatchFields.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Main program: - int main(int argc, char *argv[]) { #include "addTimeOptions.H" @@ -65,12 +64,15 @@ int main(int argc, char *argv[]) if (isA(mesh.boundaryMesh()[patchi])) { patchFieldTypes[patchi] = - mappedFixedValueFvPatchVectorField::typeName; + mappedValueFvPatchVectorField::typeName; + } + if (isA(mesh.boundaryMesh()[patchi])) + { + patchFieldTypes[patchi] = + mappedInternalValueFvPatchVectorField::typeName; } } - Pout<< "patchFieldTypes:" << patchFieldTypes << endl; - volVectorField cc ( IOobject @@ -81,44 +83,36 @@ int main(int argc, char *argv[]) IOobject::NO_READ, IOobject::AUTO_WRITE ), - mesh, - dimensionedVector(dimLength, Zero), + mesh.C(), patchFieldTypes ); - cc.primitiveFieldRef() = mesh.C().primitiveField(); - cc.boundaryFieldRef().updateCoeffs(); + cc.correctBoundaryConditions(); forAll(cc.boundaryField(), patchi) { + const fvPatchVectorField& ccp = cc.boundaryField()[patchi]; + if ( - isA - ( - cc.boundaryField()[patchi] - ) + isA(ccp) + || isA(ccp) ) { - Pout<< "Detected a mapped patch:" << patchi << endl; + OBJstream obj(mesh.boundaryMesh()[patchi].name() + ".obj"); - OFstream str(mesh.boundaryMesh()[patchi].name() + ".obj"); - Pout<< "Writing mapped values to " << str.name() << endl; + Pout<< "Detected a " << ccp.patch().type() << " field on patch \"" + << ccp.patch().name() << "\". Writing point connections to " + << obj.name() << "." << endl; - label vertI = 0; - const fvPatchVectorField& fvp = cc.boundaryField()[patchi]; - - forAll(fvp, i) + forAll(ccp, i) { - meshTools::writeOBJ(str, fvp.patch().Cf()[i]); - vertI++; - meshTools::writeOBJ(str, fvp[i]); - vertI++; - str << "l " << vertI-1 << ' ' << vertI << nl; + obj.write(linePointRef(ccp.patch().Cf()[i], ccp[i])); } } } - Info<< "End\n" << endl; + Info<< nl << "End" << nl << endl; return 0; }