mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
The built-in explicit symplectic integrator has been replaced by a
general framework supporting run-time selectable integrators. Currently
the explicit symplectic, implicit Crank-Nicolson and implicit Newmark
methods are provided, all of which are 2nd-order in time:
Symplectic 2nd-order explicit time-integrator for 6DoF solid-body motion:
Reference:
Dullweber, A., Leimkuhler, B., & McLachlan, R. (1997).
Symplectic splitting methods for rigid body molecular dynamics.
The Journal of chemical physics, 107(15), 5840-5851.
Can only be used for explicit integration of the motion of the body,
i.e. may only be called once per time-step, no outer-correctors may be
applied. For implicit integration with outer-correctors choose either
CrankNicolson or Newmark schemes.
Example specification in dynamicMeshDict:
solver
{
type symplectic;
}
Newmark 2nd-order time-integrator for 6DoF solid-body motion:
Reference:
Newmark, N. M. (1959).
A method of computation for structural dynamics.
Journal of the Engineering Mechanics Division, 85(3), 67-94.
Example specification in dynamicMeshDict:
solver
{
type Newmark;
gamma 0.5; // Velocity integration coefficient
beta 0.25; // Position integration coefficient
}
Crank-Nicolson 2nd-order time-integrator for 6DoF solid-body motion:
The off-centering coefficients for acceleration (velocity integration) and
velocity (position/orientation integration) may be specified but default
values of 0.5 for each are used if they are not specified. With the default
off-centering this scheme is equivalent to the Newmark scheme with default
coefficients.
Example specification in dynamicMeshDict:
solver
{
type CrankNicolson;
aoc 0.5; // Acceleration off-centering coefficient
voc 0.5; // Velocity off-centering coefficient
}
Both the Newmark and Crank-Nicolson are proving more robust and reliable
than the symplectic method for solving complex coupled problems and the
tutorial cases have been updated to utilize this.
In this new framework it would be straight forward to add other methods
should the need arise.
Henry G. Weller
CFD Direct
162 lines
4.1 KiB
C
162 lines
4.1 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | Copyright (C) 2011-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/>.
|
|
|
|
Application
|
|
moveDynamicMesh
|
|
|
|
Description
|
|
Mesh motion and topological mesh changes utility.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#include "argList.H"
|
|
#include "Time.H"
|
|
#include "dynamicFvMesh.H"
|
|
#include "vtkSurfaceWriter.H"
|
|
#include "cyclicAMIPolyPatch.H"
|
|
|
|
using namespace Foam;
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
// Dump patch + weights to vtk file
|
|
void writeWeights
|
|
(
|
|
const scalarField& wghtSum,
|
|
const primitivePatch& patch,
|
|
const fileName& directory,
|
|
const fileName& prefix,
|
|
const word& timeName
|
|
)
|
|
{
|
|
vtkSurfaceWriter writer;
|
|
|
|
writer.write
|
|
(
|
|
directory,
|
|
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())
|
|
{
|
|
Info<< "Calculating AMI weights between owner patch: "
|
|
<< cpp.name() << " and neighbour patch: "
|
|
<< cpp.neighbPatch().name() << endl;
|
|
|
|
const AMIPatchToPatchInterpolation& ami =
|
|
cpp.AMI();
|
|
|
|
writeWeights
|
|
(
|
|
ami.tgtWeightsSum(),
|
|
cpp.neighbPatch(),
|
|
"postProcessing",
|
|
"tgt",
|
|
tmName
|
|
);
|
|
writeWeights
|
|
(
|
|
ami.srcWeightsSum(),
|
|
cpp,
|
|
"postProcessing",
|
|
"src",
|
|
tmName
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
#include "addRegionOption.H"
|
|
argList::addBoolOption
|
|
(
|
|
"checkAMI",
|
|
"check AMI weights"
|
|
);
|
|
|
|
#include "setRootCase.H"
|
|
#include "createTime.H"
|
|
#include "createNamedDynamicFvMesh.H"
|
|
|
|
const bool checkAMI = args.optionFound("checkAMI");
|
|
|
|
if (checkAMI)
|
|
{
|
|
Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
|
|
}
|
|
|
|
while (runTime.loop())
|
|
{
|
|
Info<< "Time = " << runTime.timeName() << endl;
|
|
|
|
for (int i = 0; i<2; i++)
|
|
{
|
|
mesh.update();
|
|
}
|
|
|
|
mesh.checkMesh(true);
|
|
|
|
if (checkAMI)
|
|
{
|
|
writeWeights(mesh);
|
|
}
|
|
|
|
runTime.write();
|
|
|
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
|
<< nl << endl;
|
|
}
|
|
|
|
Info<< "End\n" << endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|