ENH: solidBodyMotion: added pointDisplacement bc
This commit is contained in:
parent
86f0655052
commit
209cc1d538
@ -18,5 +18,6 @@ $(solidBodyMotionFunctions)/axisRotationMotion/axisRotationMotion.C
|
||||
$(solidBodyMotionFunctions)/multiMotion/multiMotion.C
|
||||
$(solidBodyMotionFunctions)/oscillatingLinearMotion/oscillatingLinearMotion.C
|
||||
$(solidBodyMotionFunctions)/oscillatingRotatingMotion/oscillatingRotatingMotion.C
|
||||
solidBodyMotionFvMesh/pointPatchFields/derived/solidBodyMotionDisplacement/solidBodyMotionDisplacementPointPatchVectorField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libdynamicFvMesh
|
||||
|
@ -0,0 +1,197 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "solidBodyMotionDisplacementPointPatchVectorField.H"
|
||||
#include "transformField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "pointPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
solidBodyMotionDisplacementPointPatchVectorField::
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchVectorField(p, iF),
|
||||
SBMFPtr_()
|
||||
{}
|
||||
|
||||
|
||||
solidBodyMotionDisplacementPointPatchVectorField::
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchVectorField(p, iF, dict, false),
|
||||
SBMFPtr_(solidBodyMotionFunction::New(dict, this->db().time()))
|
||||
{
|
||||
if (!dict.found("value"))
|
||||
{
|
||||
// Determine current local points and offset
|
||||
fixedValuePointPatchVectorField::operator==
|
||||
(
|
||||
transform(SBMFPtr_().transformation(), localPoints0())
|
||||
-localPoints0()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
solidBodyMotionDisplacementPointPatchVectorField::
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const solidBodyMotionDisplacementPointPatchVectorField& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchVectorField(ptf, p, iF, mapper),
|
||||
SBMFPtr_(ptf.SBMFPtr_().clone().ptr())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
|
||||
fixedValuePointPatchVectorField::operator==
|
||||
(
|
||||
transform(SBMFPtr_().transformation(), localPoints0())
|
||||
-localPoints0()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
solidBodyMotionDisplacementPointPatchVectorField::
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const solidBodyMotionDisplacementPointPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchVectorField(ptf),
|
||||
SBMFPtr_(ptf.SBMFPtr_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
solidBodyMotionDisplacementPointPatchVectorField::
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const solidBodyMotionDisplacementPointPatchVectorField& ptf,
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchVectorField(ptf, iF),
|
||||
SBMFPtr_(ptf.SBMFPtr_().clone().ptr())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
|
||||
fixedValuePointPatchVectorField::operator==
|
||||
(
|
||||
transform(SBMFPtr_().transformation(), localPoints0())
|
||||
-localPoints0()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const pointField&
|
||||
solidBodyMotionDisplacementPointPatchVectorField::localPoints0() const
|
||||
{
|
||||
if (!localPoints0Ptr_.valid())
|
||||
{
|
||||
pointIOField points0
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
this->db().time().constant(),
|
||||
polyMesh::meshSubDir,
|
||||
this->db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
localPoints0Ptr_.reset(new pointField(points0, patch().meshPoints()));
|
||||
}
|
||||
return localPoints0Ptr_();
|
||||
}
|
||||
|
||||
|
||||
void solidBodyMotionDisplacementPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine current local points and offset
|
||||
fixedValuePointPatchVectorField::operator==
|
||||
(
|
||||
transform(SBMFPtr_().transformation(), localPoints0())
|
||||
-localPoints0()
|
||||
);
|
||||
|
||||
fixedValuePointPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void solidBodyMotionDisplacementPointPatchVectorField::
|
||||
write(Ostream& os) const
|
||||
{
|
||||
// Note: write value
|
||||
fixedValuePointPatchVectorField::write(os);
|
||||
|
||||
os.writeKeyword(solidBodyMotionFunction::typeName) << SBMFPtr_->type()
|
||||
<< token::END_STATEMENT << nl;
|
||||
os << indent << word(SBMFPtr_->type() + "Coeffs");
|
||||
SBMFPtr_->writeData(os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchTypeField
|
||||
(
|
||||
pointPatchVectorField,
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,169 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::solidBodyMotionDisplacementPointPatchVectorField
|
||||
|
||||
Description
|
||||
Enables the specification of a fixed value boundary condition using the
|
||||
solid body motion functions.
|
||||
|
||||
SourceFiles
|
||||
solidBodyMotionDisplacementPointPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidBodyMotionDisplacementPointPatchVectorField_H
|
||||
#define solidBodyMotionDisplacementPointPatchVectorField_H
|
||||
|
||||
#include "solidBodyMotionFunction.H"
|
||||
#include "fixedValuePointPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class solidBodyMotionDisplacementPointPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class solidBodyMotionDisplacementPointPatchVectorField
|
||||
:
|
||||
public fixedValuePointPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The motion control function
|
||||
autoPtr<solidBodyMotionFunction> SBMFPtr_;
|
||||
|
||||
mutable autoPtr<pointField> localPoints0Ptr_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("solidBodyMotionDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<vector> onto a new patch
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const solidBodyMotionDisplacementPointPatchVectorField&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<vector, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const solidBodyMotionDisplacementPointPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
const solidBodyMotionDisplacementPointPatchVectorField&,
|
||||
const DimensionedField<vector, pointMesh>&
|
||||
);
|
||||
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<vector> > clone
|
||||
(
|
||||
const DimensionedField<vector, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<vector> >
|
||||
(
|
||||
new solidBodyMotionDisplacementPointPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the fluctuation scale
|
||||
const solidBodyMotionFunction& motion() const
|
||||
{
|
||||
return SBMFPtr_();
|
||||
}
|
||||
|
||||
const pointField& localPoints0() const;
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -118,6 +118,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new SDA
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~SDA();
|
||||
|
@ -88,6 +88,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new axisRotationMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~axisRotationMotion();
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,6 +84,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new linearMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~linearMotion();
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,6 +84,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new multiMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~multiMotion();
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -87,6 +87,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new oscillatingLinearMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~oscillatingLinearMotion();
|
||||
|
@ -90,6 +90,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new oscillatingRotatingMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~oscillatingRotatingMotion();
|
||||
|
@ -95,6 +95,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new rotatingMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~rotatingMotion();
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -70,4 +70,10 @@ bool Foam::solidBodyMotionFunction::read(const dictionary& SBMFCoeffs)
|
||||
}
|
||||
|
||||
|
||||
void Foam::solidBodyMotionFunction::writeData(Ostream& os) const
|
||||
{
|
||||
os << SBMFCoeffs_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -106,6 +106,9 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const = 0;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
@ -128,6 +131,9 @@ public:
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& SBMFCoeffs) = 0;
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -100,6 +100,19 @@ public:
|
||||
const Time& runTime
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<solidBodyMotionFunction> clone() const
|
||||
{
|
||||
return autoPtr<solidBodyMotionFunction>
|
||||
(
|
||||
new tabulated6DoFMotion
|
||||
(
|
||||
SBMFCoeffs_,
|
||||
time_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~tabulated6DoFMotion();
|
||||
|
Loading…
Reference in New Issue
Block a user