ENH: createExternalCoupledPatchGeometry updates

This commit is contained in:
Andrew Heather 2015-11-26 10:18:42 +00:00
parent cfe8704418
commit e67ee68033
4 changed files with 27 additions and 166 deletions

View File

@ -1,9 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/postProcessing/functionObjects/jobControl/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lfiniteVolume \
-lmeshTools
-ljobControl

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,15 +26,19 @@ Application
Description
Application to generate the patch geometry (points and faces) for use
with the externalCoupled boundary condition.
with the externalCoupled functionObject.
Usage:
Usage
- createExternalCoupledPatchGeometry \<patchGroup\> [OPTION]
createExternalCoupledPatchGeometry \<fieldName\>
\param -commsDir \<commsDir\> \n
Specify an alternative communications directory (default is comms
in the case directory)
On execution, the field \<fieldName\> is read, and its boundary conditions
interrogated for the presence of an \c externalCoupled type. If found,
the patch geometry (points and faces) for the coupled patches are output
\param -region \<name\> \n
Specify an alternative mesh region.
On execution, the combined patch geometry (points and faces) are output
to the communications directory.
Note:
@ -42,12 +46,12 @@ Note:
used for face addressing starts at index 0.
SeeAlso
externalCoupledMixedFvPatchField
externalCoupledFunctionObject
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "createExternalCoupledPatchGeometryTemplates.H"
#include "externalCoupledFunctionObject.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,28 +59,25 @@ SeeAlso
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
argList::validArgs.append("fieldName");
argList::validArgs.append("patchGroup");
argList::addOption
(
"commsDir",
"dir",
"specify alternate communications directory. default is 'comms'"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const word fieldName = args[1];
const wordRe patchGroup(args[1]);
IOobjectList objects(IOobjectList(mesh, mesh.time().timeName()));
fileName commsDir(runTime.path()/"comms");
args.optionReadIfPresent("commsDir", commsDir);
label processed = -1;
processField<scalar>(mesh, objects, fieldName, processed);
processField<vector>(mesh, objects, fieldName, processed);
processField<sphericalTensor>(mesh, objects, fieldName, processed);
processField<symmTensor>(mesh, objects, fieldName, processed);
processField<tensor>(mesh, objects, fieldName, processed);
if (processed == -1)
{
Info<< "Field " << fieldName << " not found" << endl;
}
externalCoupledFunctionObject::writeGeometry(mesh, commsDir, patchGroup);
Info<< "\nEnd\n" << endl;

View File

@ -1,90 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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 "createExternalCoupledPatchGeometryTemplates.H"
#include "externalCoupledMixedFvPatchField.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void processField
(
const fvMesh& mesh,
const IOobjectList& objects,
const word& fieldName,
label& processed
)
{
if (processed != -1)
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const word timeName(mesh.time().timeName());
IOobjectList fieldObjbjects(objects.lookupClass(fieldType::typeName));
if (fieldObjbjects.lookup(fieldName) != NULL)
{
fieldType vtf(*fieldObjbjects.lookup(fieldName), mesh);
const typename fieldType::GeometricBoundaryField& bf =
vtf.boundaryField();
forAll(bf, patchI)
{
if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
{
Info<< "Generating external coupled geometry for field "
<< fieldName << endl;
const externalCoupledMixedFvPatchField<Type>& pf =
refCast<const externalCoupledMixedFvPatchField<Type> >
(
bf[patchI]
);
pf.writeGeometry();
processed = 1;
break;
}
}
if (processed != 1)
{
processed = 0;
Info<< "Field " << fieldName << " found, but does not have any "
<< externalCoupledMixedFvPatchField<Type>::typeName
<< " boundary conditions" << endl;
}
}
}
// ************************************************************************* //

View File

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 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/>.
\*---------------------------------------------------------------------------*/
#ifndef createExternalCoupledPatchGeometryTemplates_H
#define createExternalCoupledPatchGeometryTemplates_H
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class Type>
void processField(bool& processed, const word& fieldName);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "createExternalCoupledPatchGeometryTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //