mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
@ -86,9 +86,25 @@ if (mesh.changing())
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
//pcorrEqn.setReference(refCellI2, 0.0, true);
|
||||
scalarList values(nZones, 0.0);
|
||||
pcorrEqn.setReferences(refCells, values, true);
|
||||
|
||||
// Only set reference for cells that are CALCULATED
|
||||
{
|
||||
DynamicList<label> validCells(refCells.size());
|
||||
forAll(refCells, zoneId)
|
||||
{
|
||||
if (refCells[zoneId] != -1)
|
||||
{
|
||||
validCells.append(refCells[zoneId]);
|
||||
}
|
||||
}
|
||||
|
||||
pcorrEqn.setReferences
|
||||
(
|
||||
validCells,
|
||||
scalarList(validCells.size(), 0.0),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
const dictionary& d = mesh.solver
|
||||
(
|
||||
@ -97,6 +113,7 @@ if (mesh.changing())
|
||||
pimple.finalInnerIter()
|
||||
)
|
||||
);
|
||||
//Bypass virtual layer
|
||||
mesh.fvMesh::solve(pcorrEqn, d);
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
|
||||
@ -96,9 +96,25 @@
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
//pcorrEqn.setReference(refCellI2, 0, true);
|
||||
scalarList values(nZones, 0.0);
|
||||
pcorrEqn.setReferences(refCells, values, true);
|
||||
// Only set reference for cells that are CALCULATED
|
||||
{
|
||||
DynamicList<label> validCells(refCells.size());
|
||||
forAll(refCells, zoneId)
|
||||
{
|
||||
if (refCells[zoneId] != -1)
|
||||
{
|
||||
validCells.append(refCells[zoneId]);
|
||||
}
|
||||
}
|
||||
|
||||
pcorrEqn.setReferences
|
||||
(
|
||||
validCells,
|
||||
scalarList(validCells.size(), 0.0),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const dictionary& d = mesh.solver
|
||||
(
|
||||
@ -117,9 +133,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
volScalarField("contPhiPcorr", fvc::div(phi)).write();
|
||||
pcorr.write();
|
||||
}
|
||||
//if (runTime.outputTime())
|
||||
//{
|
||||
// volScalarField("contPhiPcorr", fvc::div(phi)).write();
|
||||
// pcorr.write();
|
||||
//}
|
||||
}
|
||||
|
||||
3
applications/test/externalCoupler/Make/files
Normal file
3
applications/test/externalCoupler/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-externalCoupler.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-externalCoupler
|
||||
7
applications/test/externalCoupler/Make/options
Normal file
7
applications/test/externalCoupler/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lumpedPointMotion/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-llumpedPointMotion
|
||||
97
applications/test/externalCoupler/Test-externalCoupler.C
Normal file
97
applications/test/externalCoupler/Test-externalCoupler.C
Normal file
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 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 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/>.
|
||||
|
||||
Application
|
||||
Test-externalCoupler
|
||||
|
||||
Description
|
||||
Test of master/slave communication etc.
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "externalCoupler.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
argList::addOption("max", "N", "max number of calls (default: 1000)");
|
||||
argList::addBoolOption("slave", "run as slave");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const label maxCount = args.optionLookupOrDefault<label>("max", 1000);
|
||||
|
||||
externalCoupler coupler;
|
||||
|
||||
if (args.optionFound("slave"))
|
||||
{
|
||||
const word role = "slave";
|
||||
Info<< "Running as " << role << " max=" << maxCount << endl;
|
||||
|
||||
for (label count = 0; count < maxCount; ++count)
|
||||
{
|
||||
// Wait for master, but stop if status=done was seen
|
||||
|
||||
Info<< role << ": waiting for master" << endl;
|
||||
if (!coupler.waitForMaster())
|
||||
{
|
||||
Info<< role << ": stopping. status=done was detected" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
Info<< role << ": switch to master" << endl;
|
||||
coupler.useMaster();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const word role = "master";
|
||||
Info<< "Running as " << role << " max=" << maxCount << endl;
|
||||
|
||||
for (label count = 0; count < maxCount; ++count)
|
||||
{
|
||||
// Wait for slave, but stop if status=done was seen
|
||||
|
||||
Info<< role << ": waiting for slave" << endl;
|
||||
if (!coupler.waitForSlave())
|
||||
{
|
||||
Info<< role << ": stopping. status=done was detected" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
Info<< role << ": switch to slave" << endl;
|
||||
coupler.useSlave();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
lumpedPointForces.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/lumpedPointForces
|
||||
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lumpedPointMotion/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llumpedPointMotion
|
||||
@ -0,0 +1,177 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016-2017 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 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/>.
|
||||
|
||||
Application
|
||||
lumpedPointForces
|
||||
|
||||
Description
|
||||
Extract force/moment information from existing calculations based
|
||||
on the segmentation of the pressure integration zones.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "timeSelector.H"
|
||||
#include "volFields.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
#include "lumpedPointTools.H"
|
||||
#include "lumpedPointIOMovement.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class GeoFieldType>
|
||||
autoPtr<GeoFieldType> loadField
|
||||
(
|
||||
const volMesh::Mesh& mesh,
|
||||
const IOobject* io
|
||||
)
|
||||
{
|
||||
if (io && io->headerClassName() == GeoFieldType::typeName)
|
||||
{
|
||||
Info<< "Reading " << GeoFieldType::typeName
|
||||
<< ' ' << io->name() << endl;
|
||||
|
||||
return autoPtr<GeoFieldType>
|
||||
(
|
||||
new GeoFieldType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io->name(),
|
||||
io->instance(),
|
||||
io->local(),
|
||||
io->db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
io->registerObject()
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return autoPtr<GeoFieldType>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Extract force/moment information from existing calculations based "
|
||||
"on the lumpedPoints pressure zones."
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"vtk",
|
||||
"create visualization files of the forces"
|
||||
);
|
||||
|
||||
timeSelector::addOptions(true, false);
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool withVTK = args.optionFound("vtk");
|
||||
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
autoPtr<lumpedPointIOMovement> movement = lumpedPointIOMovement::New
|
||||
(
|
||||
runTime
|
||||
);
|
||||
|
||||
if (!movement.valid())
|
||||
{
|
||||
Info<< "no valid movement given" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const labelList patchLst = lumpedPointTools::lumpedPointPatchList(mesh);
|
||||
if (patchLst.empty())
|
||||
{
|
||||
Info<< "no patch list found" << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
movement().setMapping(mesh, patchLst, lumpedPointTools::points0Field(mesh));
|
||||
|
||||
List<vector> forces, moments;
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
if (mesh.readUpdate())
|
||||
{
|
||||
Info<< " Read new mesh" << nl;
|
||||
}
|
||||
|
||||
// Search for list of objects for this time
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
// Pressure field
|
||||
autoPtr<volScalarField> pField
|
||||
= loadField<volScalarField>(mesh, objects.lookup("p"));
|
||||
|
||||
// The forces per zone
|
||||
if (movement().forcesAndMoments(mesh, forces, moments))
|
||||
{
|
||||
Info<<"forces per zone: " << forces << endl;
|
||||
Info<<"moments per zone: " << moments << endl;
|
||||
|
||||
if (withVTK && Pstream::master())
|
||||
{
|
||||
const word outputName =
|
||||
Foam::name("forces_%06d.vtp", runTime.timeIndex());
|
||||
|
||||
Info<<" " << outputName << endl;
|
||||
|
||||
movement().writeForcesAndMomentsVTP
|
||||
(
|
||||
outputName,
|
||||
forces,
|
||||
moments
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
lumpedPointMovement.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/lumpedPointMovement
|
||||
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lumpedPointMotion/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llumpedPointMotion
|
||||
@ -0,0 +1,263 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016-2017 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 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/>.
|
||||
|
||||
Application
|
||||
lumpedPointMovement
|
||||
|
||||
Description
|
||||
Thus utility can be used to produce VTK files to visualize the response
|
||||
points/rotations and the corresponding movement of the building surfaces.
|
||||
Uses the tabulated responses from the specified file.
|
||||
Optionally, it can also be used to a dummy responder for the
|
||||
externalCoupler logic, which makes it useful as a debugging facility
|
||||
as well demonstrating how an external application could communicate
|
||||
with the lumpedPointMovement point-patch boundary condition.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
#include "OFstream.H"
|
||||
|
||||
#include "lumpedPointTools.H"
|
||||
#include "lumpedPointIOMovement.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Visualize lumpedPoint movements or provide a slave responder "
|
||||
"for diagnostic purposes."
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
argList::addOption
|
||||
(
|
||||
"max",
|
||||
"N",
|
||||
"maximum number of outputs"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"span",
|
||||
"N",
|
||||
"increment each input by factor N (default: 1)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"scale",
|
||||
"factor",
|
||||
"relaxation/scaling factor for movement (default: 1)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"removeLock",
|
||||
"remove lock-file on termination of slave"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"slave",
|
||||
"invoke as a slave responder for testing"
|
||||
);
|
||||
argList::validArgs.insert("responseFile");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const label maxOut =
|
||||
Foam::max(0, args.optionLookupOrDefault<label>("max", 0));
|
||||
|
||||
const label span =
|
||||
Foam::max(1, args.optionLookupOrDefault<label>("span", 1));
|
||||
|
||||
const scalar relax = args.optionLookupOrDefault<scalar>("scale", 1);
|
||||
|
||||
const bool slave = args.optionFound("slave");
|
||||
const bool removeLock = args.optionFound("removeLock");
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
autoPtr<lumpedPointIOMovement> movement = lumpedPointIOMovement::New
|
||||
(
|
||||
runTime
|
||||
);
|
||||
|
||||
if (!movement.valid())
|
||||
{
|
||||
Info<< "no valid movement given" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
List<lumpedPointStateTuple> responseTable =
|
||||
lumpedPointTools::lumpedPointStates(args[1]);
|
||||
|
||||
Info<< "Using response table with " << responseTable.size()
|
||||
<< " entries" << endl;
|
||||
|
||||
Info << "Increment input by " << span << nl;
|
||||
|
||||
if (maxOut)
|
||||
{
|
||||
Info<< "Stopping after " << maxOut << " outputs" << endl;
|
||||
}
|
||||
|
||||
if (slave)
|
||||
{
|
||||
Info<< "Running as slave responder" << endl;
|
||||
|
||||
externalCoupler& coupler = movement().coupler();
|
||||
|
||||
label count = 0;
|
||||
for (label index = 0; index < responseTable.size(); index += span)
|
||||
{
|
||||
Info<< args.executable() << ": waiting for master" << endl;
|
||||
|
||||
// Wait for master, but stop if status=done was seen
|
||||
if (!coupler.waitForMaster())
|
||||
{
|
||||
Info<< args.executable()
|
||||
<< ": stopping status=done was detected" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
lumpedPointState state = responseTable[index].second();
|
||||
state.relax(relax, movement().state0());
|
||||
|
||||
// Generate input for OpenFOAM
|
||||
OFstream os(coupler.resolveFile(movement().inputName()));
|
||||
if
|
||||
(
|
||||
movement().inputFormat()
|
||||
== lumpedPointState::inputFormatType::PLAIN
|
||||
)
|
||||
{
|
||||
state.writePlain(os);
|
||||
}
|
||||
else
|
||||
{
|
||||
os.writeEntry("time", responseTable[index].first());
|
||||
state.writeDict(os);
|
||||
}
|
||||
|
||||
Info<< args.executable()
|
||||
<< ": updated to state " << index
|
||||
<< " - switch to master"
|
||||
<< endl;
|
||||
|
||||
// Let OpenFOAM know that it can continue
|
||||
coupler.useMaster();
|
||||
|
||||
if (maxOut && ++count >= maxOut)
|
||||
{
|
||||
Info<< args.executable()
|
||||
<<": stopping after " << maxOut << " outputs" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (removeLock)
|
||||
{
|
||||
Info<< args.executable() <<": removing lock file" << endl;
|
||||
coupler.useSlave(); // This removes the lock-file
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
runTime.setTime(instant(0, runTime.constant()), 0);
|
||||
|
||||
#include "createNamedPolyMesh.H"
|
||||
|
||||
const labelList patchLst = lumpedPointTools::lumpedPointPatchList(mesh);
|
||||
if (patchLst.empty())
|
||||
{
|
||||
Info<< "no patch list found" << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
pointIOField points0 = lumpedPointTools::points0Field(mesh);
|
||||
movement().setBoundBox(mesh, patchLst, points0);
|
||||
|
||||
label index = 0;
|
||||
|
||||
// Initial geometry
|
||||
movement().writeVTP("geom_init.vtp", mesh, patchLst, points0);
|
||||
|
||||
forAll(responseTable, i)
|
||||
{
|
||||
const bool output = ((i % span) == 0);
|
||||
lumpedPointState state = responseTable[i].second();
|
||||
state.relax(relax, movement().state0());
|
||||
|
||||
if (output)
|
||||
{
|
||||
Info<<"output [" << i << "/"
|
||||
<< responseTable.size() << "]" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// State/response = what comes back from FEM
|
||||
{
|
||||
const word outputName = Foam::name("state_%06d.vtp", index);
|
||||
Info<<" " << outputName << endl;
|
||||
|
||||
state.writeVTP(outputName, movement().axis());
|
||||
}
|
||||
|
||||
{
|
||||
const word outputName = Foam::name("geom_%06d.vtp", index);
|
||||
Info<<" " << outputName << endl;
|
||||
|
||||
movement().writeVTP(outputName, state, mesh, patchLst, points0);
|
||||
}
|
||||
|
||||
{
|
||||
++index;
|
||||
|
||||
bool canOutput = !maxOut || (index <= maxOut);
|
||||
if (!canOutput)
|
||||
{
|
||||
Info<<"stopping output after "
|
||||
<< maxOut << " outputs" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Info<< args.executable() << ": End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
lumpedPointZones.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/lumpedPointZones
|
||||
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lumpedPointMotion/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llumpedPointMotion
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016-2017 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 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/>.
|
||||
|
||||
Application
|
||||
lumpedPointZones
|
||||
|
||||
Description
|
||||
Produces a VTK PolyData file \c lumpedPointZones.vtp in which the
|
||||
segmentation of the pressure integration zones can be visualized
|
||||
for diagnostic purposes. Does not use external coupling.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
#include "lumpedPointTools.H"
|
||||
#include "lumpedPointIOMovement.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Create lumpedPointZones.vtp to verify the segmentation of "
|
||||
"pressure integration zones used by lumpedPoint BC."
|
||||
);
|
||||
argList::noParallel(); // The VTP writer is not yet in parallel
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
argList::addBoolOption
|
||||
(
|
||||
"verbose",
|
||||
"increased verbosity"
|
||||
);
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
|
||||
// const bool verbose = args.optionFound("verbose");
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
runTime.setTime(instant(0, runTime.constant()), 0);
|
||||
|
||||
#include "createNamedPolyMesh.H"
|
||||
|
||||
autoPtr<lumpedPointIOMovement> movement = lumpedPointIOMovement::New
|
||||
(
|
||||
runTime
|
||||
);
|
||||
|
||||
if (!movement.valid())
|
||||
{
|
||||
Info<< "no valid movement found" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const labelList patchLst = lumpedPointTools::lumpedPointPatchList(mesh);
|
||||
if (patchLst.empty())
|
||||
{
|
||||
Info<< "no patch list found" << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
pointIOField points0 = lumpedPointTools::points0Field(mesh);
|
||||
movement().setMapping(mesh, patchLst, points0);
|
||||
|
||||
// Initial geometry, but with zone colouring
|
||||
movement().writeZonesVTP("lumpedPointZones.vtp", mesh, points0);
|
||||
|
||||
// Initial positions/rotations
|
||||
movement().writeStateVTP("initialState.vtp");
|
||||
|
||||
Info<< nl
|
||||
<< "wrote 'lumpedPointZones.vtp'" << nl
|
||||
<< "wrote 'initialState.vtp'" << nl
|
||||
<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user