mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: moveDynamicMesh: added option to dump AMI weights
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,19 +32,98 @@ Description
|
|||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "dynamicFvMesh.H"
|
#include "dynamicFvMesh.H"
|
||||||
|
#include "vtkSurfaceWriter.H"
|
||||||
|
#include "cyclicAMIPolyPatch.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Dump patch + weights to vtk file
|
||||||
|
void writeWeights
|
||||||
|
(
|
||||||
|
const scalarField& wghtSum,
|
||||||
|
const primitivePatch& patch,
|
||||||
|
const fileName& folder,
|
||||||
|
const fileName& prefix,
|
||||||
|
const word& timeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkSurfaceWriter writer;
|
||||||
|
|
||||||
|
writer.write
|
||||||
|
(
|
||||||
|
folder,
|
||||||
|
prefix + "_proc" + Foam::name(Pstream::myProcNo()) + "_" + timeName,
|
||||||
|
patch.localPoints(),
|
||||||
|
patch.localFaces(),
|
||||||
|
"weightsSum",
|
||||||
|
wghtSum,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void writeWeights(const polyMesh& mesh)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
const word tmName(mesh.time().timeName());
|
||||||
|
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
if (isA<cyclicAMIPolyPatch>(pbm[patchI]))
|
||||||
|
{
|
||||||
|
const cyclicAMIPolyPatch& cpp =
|
||||||
|
refCast<const cyclicAMIPolyPatch>(pbm[patchI]);
|
||||||
|
|
||||||
|
if (cpp.owner())
|
||||||
|
{
|
||||||
|
const AMIPatchToPatchInterpolation& ami =
|
||||||
|
cpp.AMI();
|
||||||
|
writeWeights
|
||||||
|
(
|
||||||
|
ami.tgtWeightsSum(),
|
||||||
|
cpp.neighbPatch(),
|
||||||
|
"output",
|
||||||
|
"tgt",
|
||||||
|
tmName
|
||||||
|
);
|
||||||
|
writeWeights
|
||||||
|
(
|
||||||
|
ami.srcWeightsSum(),
|
||||||
|
cpp,
|
||||||
|
"output",
|
||||||
|
"src",
|
||||||
|
tmName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"checkAMI",
|
||||||
|
"check AMI weights"
|
||||||
|
);
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createDynamicFvMesh.H"
|
# include "createDynamicFvMesh.H"
|
||||||
|
|
||||||
|
const bool checkAMI = args.optionFound("checkAMI");
|
||||||
|
|
||||||
|
if (checkAMI)
|
||||||
|
{
|
||||||
|
Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
while (runTime.loop())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << endl;
|
Info<< "Time = " << runTime.timeName() << endl;
|
||||||
@ -52,6 +131,11 @@ int main(int argc, char *argv[])
|
|||||||
mesh.update();
|
mesh.update();
|
||||||
mesh.checkMesh(true);
|
mesh.checkMesh(true);
|
||||||
|
|
||||||
|
if (checkAMI)
|
||||||
|
{
|
||||||
|
writeWeights(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
|||||||
Reference in New Issue
Block a user