From 99d4b831e6f25f3fba273a1fb517aea65e704acd Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 12 Oct 2009 13:52:36 +0100 Subject: [PATCH] Added Graham's 6DoF solver-based BC for mesh-motion which uses the forces functionObject to compute the motion of e.g. floating objects. interDyMFoam tutorial also supplied. --- src/fvMotionSolver/Make/files | 5 + src/fvMotionSolver/Make/options | 2 + ...DoFRigidBodyDisplacementPointPatchVectorField.C | 192 ++++++++++++++++ ...DoFRigidBodyDisplacementPointPatchVectorField.H | 157 +++++++++++++ .../sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C | 210 +++++++++++++++++ .../sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H | 251 +++++++++++++++++++++ .../sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H | 183 +++++++++++++++ .../sixDoFRigidBodyMotionIO.C | 87 +++++++ .../sixDoFRigidBodyMotionState.C | 95 ++++++++ .../sixDoFRigidBodyMotionState.H | 194 ++++++++++++++++ .../sixDoFRigidBodyMotionStateI.H | 102 +++++++++ .../sixDoFRigidBodyMotionStateIO.C | 98 ++++++++ .../interDyMFoam/ras/floatingObject/Allclean | 10 + .../interDyMFoam/ras/floatingObject/Allrun | 27 +++ .../ras/floatingObject/constant/RASProperties | 25 ++ .../ras/floatingObject/constant/dynamicMeshDict | 26 +++ .../interDyMFoam/ras/floatingObject/constant/g | 22 ++ .../floatingObject/constant/polyMesh/blockMeshDict | 62 +++++ .../ras/floatingObject/constant/polyMesh/boundary | 40 ++++ .../floatingObject/constant/transportProperties | 35 +++ .../floatingObject/constant/turbulenceProperties | 20 ++ .../ras/floatingObject/system/cellSetDict.1 | 30 +++ .../ras/floatingObject/system/cellSetDict.2 | 24 ++ .../ras/floatingObject/system/controlDict | 56 +++++ .../ras/floatingObject/system/decomposeParDict | 50 ++++ .../ras/floatingObject/system/fvSchemes | 61 +++++ .../ras/floatingObject/system/fvSolution | 129 +++++++++++ .../ras/floatingObject/system/setFieldsDict | 39 ++++ 28 files changed, 2232 insertions(+) create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H create mode 100644 src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C create mode 100755 tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean create mode 100755 tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution create mode 100644 tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict diff --git a/src/fvMotionSolver/Make/files b/src/fvMotionSolver/Make/files index f229ae32..fd018a75 100644 --- a/src/fvMotionSolver/Make/files +++ b/src/fvMotionSolver/Make/files @@ -31,5 +31,10 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C LIB = $(FOAM_LIBBIN)/libfvMotionSolvers diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 966b5696..c7f17f18 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -1,10 +1,12 @@ EXE_INC = \ + -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ + -lforces \ -ltriSurface \ -lmeshTools \ -ldynamicMesh \ diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C new file mode 100644 index 00000000..f2a7adb5 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -0,0 +1,192 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyDisplacementPointPatchVectorField.H" +#include "pointPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "Time.H" +#include "fvMesh.H" +#include "volFields.H" +#include "uniformDimensionedFields.H" +#include "forces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const pointPatch& p, + const DimensionedField& iF +) +: + fixedValuePointPatchField(p, iF), + motion_(), + p0_(p.localPoints()), + rhoInf_(1.0) +{} + + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const pointPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValuePointPatchField(p, iF, dict), + motion_(dict), + rhoInf_(readScalar(dict.lookup("rhoInf"))) +{ + if (!dict.found("value")) + { + updateCoeffs(); + } + + if (dict.found("p0")) + { + p0_ = vectorField("p0", dict , p.size()); + } + else + { + p0_ = p.localPoints(); + } +} + + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf, + const pointPatch& p, + const DimensionedField& iF, + const pointPatchFieldMapper& mapper +) +: + fixedValuePointPatchField(ptf, p, iF, mapper), + motion_(ptf.motion_), + p0_(ptf.p0_), + rhoInf_(ptf.rhoInf_) +{} + + +sixDoFRigidBodyDisplacementPointPatchVectorField:: +sixDoFRigidBodyDisplacementPointPatchVectorField +( + const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf, + const DimensionedField& iF +) +: + fixedValuePointPatchField(ptf, iF), + motion_(ptf.motion_), + p0_(ptf.p0_), + rhoInf_(ptf.rhoInf_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const polyMesh& mesh = this->dimensionedInternalField().mesh()(); + const Time& t = mesh.time(); + const pointPatch& ptPatch = this->patch(); + + // Patch force data is valid for the current positions, so + // calculate the forces on the motion object from this data, then + // update the positions + + motion_.updatePosition(t.deltaT().value()); + + dictionary forcesDict; + + forcesDict.add("patches", wordList(1, ptPatch.name())); + forcesDict.add("rhoInf", rhoInf_); + forcesDict.add("CofR", motion_.centreOfMass()); + + forces f("forces", db(), forcesDict); + + forces::forcesMoments fm = f.calcForcesMoment(); + + // Get the forces on the patch faces at the current positions + + vector gravity = vector::zero; + + if (db().foundObject("g")) + { + uniformDimensionedVectorField g = + db().lookupObject("g"); + + gravity = g.value(); + } + + motion_.updateForce + ( + fm.first().first() + fm.first().second() + gravity*motion_.mass(), + fm.second().first() + fm.second().second(), + t.deltaT().value() + ); + + Field::operator=(motion_.generatePositions(p0_) - p0_); + + fixedValuePointPatchField::updateCoeffs(); +} + + +void sixDoFRigidBodyDisplacementPointPatchVectorField::write(Ostream& os) const +{ + pointPatchField::write(os); + motion_.write(os); + os.writeKeyword("rhoInf") + << rhoInf_ << token::END_STATEMENT << nl; + p0_.writeEntry("p0", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePointPatchTypeField +( + pointPatchVectorField, + sixDoFRigidBodyDisplacementPointPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H new file mode 100644 index 00000000..048fa9f1 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sixDoFRigidBodyDisplacementPointPatchVectorField + +Description + Foam::sixDoFRigidBodyDisplacementPointPatchVectorField + +SourceFiles + sixDoFRigidBodyDisplacementPointPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sixDoFRigidBodyDisplacementPointPatchVectorField_H +#define sixDoFRigidBodyDisplacementPointPatchVectorField_H + +#include "fixedValuePointPatchField.H" +#include "sixDoFRigidBodyMotion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class sixDoFRigidBodyDisplacementPointPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class sixDoFRigidBodyDisplacementPointPatchVectorField +: + public fixedValuePointPatchField +{ + // Private data + + //- Six dof motion object + sixDoFRigidBodyMotion motion_; + + //- Reference positions of points on the patch + pointField p0_; + + //- Reference density required by the forces object for + // incompressible calculations + scalar rhoInf_; + + +public: + + //- Runtime type information + TypeName("sixDoFRigidBodyDisplacement"); + + + // Constructors + + //- Construct from patch and internal field + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const pointPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const pointPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given patchField onto a new patch + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const sixDoFRigidBodyDisplacementPointPatchVectorField&, + const pointPatch&, + const DimensionedField&, + const pointPatchFieldMapper& + ); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new sixDoFRigidBodyDisplacementPointPatchVectorField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + sixDoFRigidBodyDisplacementPointPatchVectorField + ( + const sixDoFRigidBodyDisplacementPointPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual autoPtr > clone + ( + const DimensionedField& iF + ) const + { + return autoPtr > + ( + new sixDoFRigidBodyDisplacementPointPatchVectorField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C new file mode 100644 index 00000000..dae1ba9f --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotion.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion() +: + motionState_(), + refCentreOfMass_(vector::zero), + momentOfInertia_(diagTensor::one*VSMALL), + mass_(VSMALL) +{} + + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion +( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau, + scalar mass, + const point& refCentreOfMass, + const diagTensor& momentOfInertia +) +: + motionState_ + ( + centreOfMass, + Q, + v, + a, + pi, + tau + ), + refCentreOfMass_(refCentreOfMass), + momentOfInertia_(momentOfInertia), + mass_(mass) +{} + + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict) +: + motionState_(dict), + refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())), + momentOfInertia_(dict.lookup("momentOfInertia")), + mass_(readScalar(dict.lookup("mass"))) +{} + + +Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion +( + const sixDoFRigidBodyMotion& sDoFRBM +) +: + motionState_(sDoFRBM.motionState()), + refCentreOfMass_(sDoFRBM.refCentreOfMass()), + momentOfInertia_(sDoFRBM.momentOfInertia()), + mass_(sDoFRBM.mass()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotion::~sixDoFRigidBodyMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::sixDoFRigidBodyMotion::updatePosition +( + scalar deltaT +) +{ + // First leapfrog velocity adjust and motion part, required before + // force calculation + + if (Pstream::master()) + { + v() += 0.5*deltaT*a(); + + pi() += 0.5*deltaT*tau(); + + // Leapfrog move part + centreOfMass() += deltaT*v(); + + // Leapfrog orientation adjustment + + tensor R; + + R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorZ(deltaT*pi().z()/momentOfInertia_.zz()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy()); + pi() = pi() & R; + Q() = Q() & R; + + R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx()); + pi() = pi() & R; + Q() = Q() & R; + + } + + Pstream::scatter(motionState_); +} + + +void Foam::sixDoFRigidBodyMotion::updateForce +( + const vector& fGlobal, + const vector& tauGlobal, + scalar deltaT +) +{ + // Second leapfrog velocity adjust part, required after motion and + // force calculation part + + if (Pstream::master()) + { + a() = fGlobal/mass_; + + tau() = (Q().T() & tauGlobal); + + v() += 0.5*deltaT*a(); + + pi() += 0.5*deltaT*tau(); + } + + Pstream::scatter(motionState_); +} + + +void Foam::sixDoFRigidBodyMotion::updateForce +( + const pointField& positions, + const vectorField& forces, + scalar deltaT +) +{ + // Second leapfrog velocity adjust part, required after motion and + // force calculation part + + if (Pstream::master()) + { + a() = vector::zero; + + tau() = vector::zero; + + forAll(positions, i) + { + const vector& f = forces[i]; + + a() += f/mass_; + + tau() += (positions[i] ^ (Q().T() & f)); + } + + v() += 0.5*deltaT*a(); + + pi() += 0.5*deltaT*tau(); + } + + Pstream::scatter(motionState_); +} + + +Foam::tmp +Foam::sixDoFRigidBodyMotion::generatePositions(const pointField& pts) const +{ + return (centreOfMass() + (Q() & (pts - refCentreOfMass_))); +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H new file mode 100644 index 00000000..16ea1d42 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H @@ -0,0 +1,251 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sixDoFRigidBodyMotion + +Description + Six degree of freedom motion for a rigid body. Angular momentum stored in + body fixed reference frame. Reference orientation of the body must align + with the cartesian axes such that the Inertia tensor is in principle + component form. + + Symplectic motion as per: + + title = {Symplectic splitting methods for rigid body molecular dynamics}, + publisher = {AIP}, + year = {1997}, + journal = {The Journal of Chemical Physics}, + volume = {107}, + number = {15}, + pages = {5840-5851}, + url = {http://link.aip.org/link/?JCP/107/5840/1}, + doi = {10.1063/1.474310} + +SourceFiles + sixDoFRigidBodyMotionI.H + sixDoFRigidBodyMotion.C + sixDoFRigidBodyMotionIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sixDoFRigidBodyMotion_H +#define sixDoFRigidBodyMotion_H + +#include "sixDoFRigidBodyMotionState.H" +#include "pointField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class sixDoFRigidBodyMotion; +Istream& operator>>(Istream&, sixDoFRigidBodyMotion&); +Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&); + + +/*---------------------------------------------------------------------------*\ + Class sixDoFRigidBodyMotion Declaration +\*---------------------------------------------------------------------------*/ + +class sixDoFRigidBodyMotion +{ + // Private data + + // state data object + sixDoFRigidBodyMotionState motionState_; + + //- Centre of mass of reference state + point refCentreOfMass_; + + //- Moment of inertia of the body in reference configuration + diagTensor momentOfInertia_; + + //- Mass of the body + scalar mass_; + + + // Private Member Functions + + //- Calculate the rotation tensor around the body reference + // frame x-axis by the given angle + inline tensor rotationTensorX(scalar deltaT) const; + + //- Calculate the rotation tensor around the body reference + // frame y-axis by the given angle + inline tensor rotationTensorY(scalar deltaT) const; + + //- Calculate the rotation tensor around the body reference + // frame z-axis by the given angle + inline tensor rotationTensorZ(scalar deltaT) const; + + +public: + + // Constructors + + //- Construct null + sixDoFRigidBodyMotion(); + + //- Construct from components + sixDoFRigidBodyMotion + ( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau, + scalar mass, + const point& refCentreOfMass, + const diagTensor& momentOfInertia + ); + + //- Construct from dictionary + sixDoFRigidBodyMotion(const dictionary& dict); + + //- Construct as copy + sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&); + + + //- Destructor + ~sixDoFRigidBodyMotion(); + + + // Member Functions + + void updatePosition + ( + scalar deltaT + ); + + void updateForce + ( + const vector& fGlobal, + const vector& tauGlobal, + scalar deltaT + ); + + void updateForce + ( + const pointField& positions, + const vectorField& forces, + scalar deltaT + ); + + tmp generatePositions(const pointField& pts) const; + + // Access + + //- Return access to the motion state + inline const sixDoFRigidBodyMotionState& motionState() const; + + //- Return access to the centre of mass + inline const point& centreOfMass() const; + + //- Return access to the centre of mass + inline const point& refCentreOfMass() const; + + //- Return access to the inertia tensor + inline const diagTensor& momentOfInertia() const; + + //- Return access to the mass + inline scalar mass() const; + + //- Return access to the orientation + inline const tensor& Q() const; + + //- Return access to velocity + inline const vector& v() const; + + //- Return access to acceleration + inline const vector& a() const; + + //- Return access to angular momentum + inline const vector& pi() const; + + //- Return access to torque + inline const vector& tau() const; + + + // Edit + + //- Return non-const access to the centre of mass + inline point& centreOfMass(); + + //- Return access to the centre of mass + inline point& refCentreOfMass(); + + //- Return non-const access to the inertia tensor + inline diagTensor& momentOfInertia(); + + //- Return non-const access to the mass + inline scalar& mass(); + + //- Return non-const access to the orientation + inline tensor& Q(); + + //- Return non-const access to vector + inline vector& v(); + + //- Return non-const access to acceleration + inline vector& a(); + + //- Return non-const access to angular momentum + inline vector& pi(); + + //- Return non-const access to torque + inline vector& tau(); + + + //- Write + void write(Ostream&) const; + + + // IOstream Operators + + friend Istream& operator>>(Istream&, sixDoFRigidBodyMotion&); + friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "sixDoFRigidBodyMotionI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H new file mode 100644 index 00000000..aeb75bde --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H @@ -0,0 +1,183 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +inline Foam::tensor +Foam::sixDoFRigidBodyMotion::rotationTensorX(scalar phi) const +{ + return tensor + ( + 1, 0, 0, + 0, Foam::cos(phi), -Foam::sin(phi), + 0, Foam::sin(phi), Foam::cos(phi) + ); +} + + +inline Foam::tensor +Foam::sixDoFRigidBodyMotion::rotationTensorY(scalar phi) const +{ + return tensor + ( + Foam::cos(phi), 0, Foam::sin(phi), + 0, 1, 0, + -Foam::sin(phi), 0, Foam::cos(phi) + ); +} + + +inline Foam::tensor +Foam::sixDoFRigidBodyMotion::rotationTensorZ(scalar phi) const +{ + return tensor + ( + Foam::cos(phi), -Foam::sin(phi), 0, + Foam::sin(phi), Foam::cos(phi), 0, + 0, 0, 1 + ); +} + + +inline const Foam::sixDoFRigidBodyMotionState& +Foam::sixDoFRigidBodyMotion::motionState() const +{ + return motionState_; +} + + +inline const Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() const +{ + return motionState_.centreOfMass(); +} + + +inline const Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() const +{ + return refCentreOfMass_; +} + + +inline const Foam::diagTensor& +Foam::sixDoFRigidBodyMotion::momentOfInertia() const +{ + return momentOfInertia_; +} + + +inline Foam::scalar Foam::sixDoFRigidBodyMotion::mass() const +{ + return mass_; +} + + +inline const Foam::tensor& Foam::sixDoFRigidBodyMotion::Q() const +{ + return motionState_.Q(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::v() const +{ + return motionState_.v(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::a() const +{ + return motionState_.a(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::pi() const +{ + return motionState_.pi(); +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotion::tau() const +{ + return motionState_.tau(); +} + + +inline Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() +{ + return motionState_.centreOfMass(); +} + + +inline Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() +{ + return refCentreOfMass_; +} + + +inline Foam::diagTensor& Foam::sixDoFRigidBodyMotion::momentOfInertia() +{ + return momentOfInertia_; +} + + +inline Foam::scalar& Foam::sixDoFRigidBodyMotion::mass() +{ + return mass_; +} + + +inline Foam::tensor& Foam::sixDoFRigidBodyMotion::Q() +{ + return motionState_.Q(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::v() +{ + return motionState_.v(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::a() +{ + return motionState_.a(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::pi() +{ + return motionState_.pi(); +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotion::tau() +{ + return motionState_.tau(); +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C new file mode 100644 index 00000000..005cbbe6 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotion.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::sixDoFRigidBodyMotion::write(Ostream& os) const +{ + motionState_.write(os); + + os.writeKeyword("refCentreOfMass") + << refCentreOfMass_ << token::END_STATEMENT << nl; + os.writeKeyword("momentOfInertia") + << momentOfInertia_ << token::END_STATEMENT << nl; + os.writeKeyword("mass") + << mass_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, sixDoFRigidBodyMotion& sDoFRBM) +{ + is >> sDoFRBM.motionState_ + >> sDoFRBM.refCentreOfMass_ + >> sDoFRBM.momentOfInertia_ + >> sDoFRBM.mass_; + + // Check state of Istream + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::sixDoFRigidBodyMotion&)" + ); + + return is; +} + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const sixDoFRigidBodyMotion& sDoFRBM +) +{ + os << sDoFRBM.motionState() + << token::SPACE << sDoFRBM.refCentreOfMass() + << token::SPACE << sDoFRBM.momentOfInertia() + << token::SPACE << sDoFRBM.mass() ; + + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " + "const Foam::sixDoFRigidBodyMotion&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C new file mode 100644 index 00000000..cd52b1d1 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotionState.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState() +: + centreOfMass_(vector::zero), + Q_(I), + v_(vector::zero), + a_(vector::zero), + pi_(vector::zero), + tau_(vector::zero) +{} + + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState +( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau +) +: + centreOfMass_(centreOfMass), + Q_(Q), + v_(v), + a_(a), + pi_(pi), + tau_(tau) +{} + + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState +( + const dictionary& dict +) +: + centreOfMass_(dict.lookup("centreOfMass")), + Q_(dict.lookupOrDefault("Q", tensor(I))), + v_(dict.lookupOrDefault("v", vector::zero)), + a_(dict.lookupOrDefault("a", vector::zero)), + pi_(dict.lookupOrDefault("pi", vector::zero)), + tau_(dict.lookupOrDefault("tau", vector::zero)) +{} + + +Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState +( + const sixDoFRigidBodyMotionState& sDoFRBMS +) +: + centreOfMass_(sDoFRBMS.centreOfMass()), + Q_(sDoFRBMS.Q()), + v_(sDoFRBMS.v()), + a_(sDoFRBMS.a()), + pi_(sDoFRBMS.pi()), + tau_(sDoFRBMS.tau()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::sixDoFRigidBodyMotionState::~sixDoFRigidBodyMotionState() +{} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H new file mode 100644 index 00000000..32cf0be0 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::sixDoFRigidBodyMotionState + +Description + Holds the motion state of sixDoF object. Wrapped up together + to allow rapid scatter to other processors. The processors must all + maintain exactly the same state data to avoid any drift or inconsistency. + +SourceFiles + sixDoFRigidBodyMotionStateI.H + sixDoFRigidBodyMotionState.C + sixDoFRigidBodyMotionStateIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sixDoFRigidBodyMotionState_H +#define sixDoFRigidBodyMotionState_H + +#include "vector.H" +#include "point.H" +#include "diagTensor.H" +#include "tensor.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class sixDoFRigidBodyMotionState; +Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&); +Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&); + + +/*---------------------------------------------------------------------------*\ + Class sixDoFRigidBodyMotionState Declaration +\*---------------------------------------------------------------------------*/ + +class sixDoFRigidBodyMotionState +{ + // Private data + + //- Current position of the centre of mass of the body + point centreOfMass_; + + //- Orientation, stored as the rotation tensor to transform + // from the body to the global reference frame, i.e.: + // globalVector = Q_ & bodyLocalVector + // bodyLocalVector = Q_.T() & globalVector + tensor Q_; + + // Linear velocity of body + vector v_; + + // Total linear acceleration of body + vector a_; + + //- Angular momentum of body, in body local reference frame + vector pi_; + + //- Total torque on body, in body local reference frame + vector tau_; + + +public: + + // Constructors + + //- Construct null + sixDoFRigidBodyMotionState(); + + //- Construct from components + sixDoFRigidBodyMotionState + ( + const point& centreOfMass, + const tensor& Q, + const vector& v, + const vector& a, + const vector& pi, + const vector& tau + ); + + //- Construct from dictionary + sixDoFRigidBodyMotionState(const dictionary& dict); + + //- Construct as copy + sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&); + + + //- Destructor + ~sixDoFRigidBodyMotionState(); + + + // Member Functions + + // Access + + //- Return access to the centre of mass + inline const point& centreOfMass() const; + + //- Return access to the orientation + inline const tensor& Q() const; + + //- Return access to velocity + inline const vector& v() const; + + //- Return access to acceleration + inline const vector& a() const; + + //- Return access to angular momentum + inline const vector& pi() const; + + //- Return access to torque + inline const vector& tau() const; + + + // Edit + + //- Return non-const access to the centre of mass + inline point& centreOfMass(); + + //- Return non-const access to the orientation + inline tensor& Q(); + + //- Return non-const access to vector + inline vector& v(); + + //- Return non-const access to acceleration + inline vector& a(); + + //- Return non-const access to angular momentum + inline vector& pi(); + + //- Return non-const access to torque + inline vector& tau(); + + + //- Write + void write(Ostream&) const; + + + // Friend Functions + + // Friend Operators + + // IOstream Operators + + friend Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&); + friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "sixDoFRigidBodyMotionStateI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H new file mode 100644 index 00000000..dc6659d0 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +inline const Foam::point& Foam::sixDoFRigidBodyMotionState::centreOfMass() const +{ + return centreOfMass_; +} + + +inline const Foam::tensor& Foam::sixDoFRigidBodyMotionState::Q() const +{ + return Q_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::v() const +{ + return v_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::a() const +{ + return a_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::pi() const +{ + return pi_; +} + + +inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::tau() const +{ + return tau_; +} + + +inline Foam::point& Foam::sixDoFRigidBodyMotionState::centreOfMass() +{ + return centreOfMass_; +} + + +inline Foam::tensor& Foam::sixDoFRigidBodyMotionState::Q() +{ + return Q_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::v() +{ + return v_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::a() +{ + return a_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::pi() +{ + return pi_; +} + + +inline Foam::vector& Foam::sixDoFRigidBodyMotionState::tau() +{ + return tau_; +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C new file mode 100644 index 00000000..650a3599 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "sixDoFRigidBodyMotionState.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::sixDoFRigidBodyMotionState::write(Ostream& os) const +{ + os.writeKeyword("centreOfMass") + << centreOfMass_ << token::END_STATEMENT << nl; + os.writeKeyword("Q") + << Q_ << token::END_STATEMENT << nl; + os.writeKeyword("v") + << v_ << token::END_STATEMENT << nl; + os.writeKeyword("a") + << a_ << token::END_STATEMENT << nl; + os.writeKeyword("pi") + << pi_ << token::END_STATEMENT << nl; + os.writeKeyword("tau") + << tau_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>> +( + Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS +) +{ + is >> sDoFRBMS.centreOfMass_ + >> sDoFRBMS.Q_ + >> sDoFRBMS.v_ + >> sDoFRBMS.a_ + >> sDoFRBMS.pi_ + >> sDoFRBMS.tau_; + + // Check state of Istream + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)" + ); + + return is; +} + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const sixDoFRigidBodyMotionState& sDoFRBMS +) +{ + os << token::SPACE << sDoFRBMS.centreOfMass() + << token::SPACE << sDoFRBMS.Q() + << token::SPACE << sDoFRBMS.v() + << token::SPACE << sDoFRBMS.a() + << token::SPACE << sDoFRBMS.pi() + << token::SPACE << sDoFRBMS.tau(); + + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " + "const Foam::sixDoFRigidBodyMotionState&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean new file mode 100755 index 00000000..2cd0673f --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm system/cellSetDict > /dev/null 2>&1 +rm -rf 0 > /dev/null 2>&1 + +cleanCase + diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun new file mode 100755 index 00000000..1bece85b --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun @@ -0,0 +1,27 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Set application name +application="interDyMFoam" + +makeMeshByCellSet() +{ + while [ $# -ge 1 ] + do + echo "Running cellSet operation $1" + cp system/cellSetDict.$1 system/cellSetDict + cellSet > log.cellSet.$1 2>&1 + shift + done +} + +runApplication blockMesh +makeMeshByCellSet 1 2 +runApplication subsetMesh -overwrite c0 -patch floatingObject +cp -r 0.orig 0 > /dev/null 2>&1 +runApplication setFields +runApplication $application + +# ----------------------------------------------------------------------------- diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties new file mode 100644 index 00000000..81b1ec91 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict new file mode 100644 index 00000000..083baf72 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict @@ -0,0 +1,26 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object motionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMotionSolverFvMesh; + +motionSolverLibs ("libfvMotionSolvers.so"); + +solver displacementLaplacian; + +diffusivity inverseDistance (floatingObject); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g new file mode 100644 index 00000000..317bdd50 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict new file mode 100644 index 00000000..611466bb --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 1) + (1 0 1) + (1 1 1) + (0 1 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (40 40 60) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + wall stationaryWalls + ( + (0 3 2 1) + (2 6 5 1) + (1 5 4 0) + (3 7 6 2) + (0 4 7 3) + ) + patch atmosphere + ( + (4 5 6 7) + ) + wall floatingObject + () +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary new file mode 100644 index 00000000..62fd629b --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +3 +( + stationaryWalls + { + type wall; + nFaces 11200; + startFace 277808; + } + atmosphere + { + type patch; + nFaces 1600; + startFace 289008; + } + floatingObject + { + type wall; + nFaces 672; + startFace 290608; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties new file mode 100644 index 00000000..6a2e70e1 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 998.2; +} + +phase2 +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties new file mode 100644 index 00000000..e94c3c74 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 new file mode 100644 index 00000000..90a225e6 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object cellSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name c0; + +action new; + +topoSetSources +( + boxToCell + { + box (0.35 0.35 0.44) (0.65 0.65 0.56); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 new file mode 100644 index 00000000..57cc0658 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object cellSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name c0; + +action invert; + +topoSetSources (); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict new file mode 100644 index 00000000..efcb7627 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 6; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.025; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 12; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.2; + +maxDeltaT 0.025; + +libs ("libincompressibleRASModels.so" "libfvMotionSolvers.so"); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict new file mode 100644 index 00000000..2a513989 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 2 2 1 ); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights ( 1 1 1 1 ); +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes new file mode 100644 index 00000000..aa863122 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rho*phi,U) Gauss vanLeerV; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss vanLeer; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; + pcorr; + alpha; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution new file mode 100644 index 00000000..bbe6b39d --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution @@ -0,0 +1,129 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + cellDisplacement + { + solver GAMG; + tolerance 1e-08; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pcorr + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 1e-05; + relTol 0; + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nBottomSweeps 2; + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 1e-05; + relTol 0; + maxIter 100; + } + + p + { + solver GAMG; + tolerance 1e-08; + relTol 0.01; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pFinal + { + solver PCG; + preconditioner + { + preconditioner GAMG; + tolerance 2e-09; + relTol 0; + nVcycles 2; + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + tolerance 2e-09; + relTol 0; + maxIter 20; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } + + "(k|epsilon|R|nuTilda)" + { + $U; + tolerance 1e-08; + relTol 0; + } + +} + +PISO +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + nAlphaCorr 1; + nAlphaSubCycles 1; + cAlpha 1.5; + correctPhi no; +} + +relaxationFactors +{ + U 1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict new file mode 100644 index 00000000..3565b89d --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha1 0 +); + +regions +( + boxToCell + { + box ( -100 -100 -100 ) ( 100 100 0.5368 ); + fieldValues ( volScalarFieldValue alpha1 1 ); + } + + boxToCell + { + box ( 0.7 0.8 -100 ) ( 100 100 0.65 ); + fieldValues ( volScalarFieldValue alpha1 1 ); + } +); + + +// ************************************************************************* // -- 2.11.4.GIT