mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
pointConstraint: Added constrainDisplacement
which directly applies the constraint to the displacement without external tensor ops. Patch contributed by Mattijs Janssens
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -87,6 +87,9 @@ public:
|
|||||||
//- Return the accumulated unconstrained directions. Directions
|
//- Return the accumulated unconstrained directions. Directions
|
||||||
// coded as first n rows of tensor.
|
// coded as first n rows of tensor.
|
||||||
inline void unconstrainedDirections(label& n, tensor& vecs) const;
|
inline void unconstrainedDirections(label& n, tensor& vecs) const;
|
||||||
|
|
||||||
|
//- Constrain a displacement
|
||||||
|
inline vector constrainDisplacement(const vector& disp) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +106,7 @@ inline pointConstraint transform(const tensor& tt, const pointConstraint& v);
|
|||||||
//- contiguous
|
//- contiguous
|
||||||
template<class T> bool contiguous();
|
template<class T> bool contiguous();
|
||||||
template<>
|
template<>
|
||||||
inline bool contiguous<pointConstraint>() {return true;}
|
inline bool contiguous<pointConstraint>() {return true;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ inline Foam::pointConstraint::pointConstraint(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::pointConstraint::applyConstraint(const vector& cd)
|
inline void Foam::pointConstraint::applyConstraint(const vector& cd)
|
||||||
{
|
{
|
||||||
if (first() == 0)
|
if (first() == 0)
|
||||||
{
|
{
|
||||||
@ -74,7 +74,7 @@ void Foam::pointConstraint::applyConstraint(const vector& cd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointConstraint::combine(const pointConstraint& pc)
|
inline void Foam::pointConstraint::combine(const pointConstraint& pc)
|
||||||
{
|
{
|
||||||
if (first() == 0)
|
if (first() == 0)
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ void Foam::pointConstraint::combine(const pointConstraint& pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tensor Foam::pointConstraint::constraintTransformation() const
|
inline Foam::tensor Foam::pointConstraint::constraintTransformation() const
|
||||||
{
|
{
|
||||||
if (first() == 0)
|
if (first() == 0)
|
||||||
{
|
{
|
||||||
@ -136,8 +136,11 @@ Foam::tensor Foam::pointConstraint::constraintTransformation() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pointConstraint::unconstrainedDirections(label& n, tensor& tt)
|
inline void Foam::pointConstraint::unconstrainedDirections
|
||||||
const
|
(
|
||||||
|
label& n,
|
||||||
|
tensor& tt
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
n = 3-first();
|
n = 3-first();
|
||||||
|
|
||||||
@ -179,7 +182,36 @@ const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::combineConstraintsEqOp::operator()
|
inline Foam::vector Foam::pointConstraint::constrainDisplacement
|
||||||
|
(
|
||||||
|
const vector& d
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
vector cd;
|
||||||
|
|
||||||
|
if (first() == 0)
|
||||||
|
{
|
||||||
|
cd = d;
|
||||||
|
}
|
||||||
|
else if (first() == 1)
|
||||||
|
{
|
||||||
|
// Remove plane normal
|
||||||
|
cd = d-(d&second())*second();
|
||||||
|
}
|
||||||
|
else if (first() == 2)
|
||||||
|
{
|
||||||
|
// Keep line direction only
|
||||||
|
cd = (d&second())*second();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cd = Zero;
|
||||||
|
}
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::combineConstraintsEqOp::operator()
|
||||||
(
|
(
|
||||||
pointConstraint& x,
|
pointConstraint& x,
|
||||||
const pointConstraint& y
|
const pointConstraint& y
|
||||||
@ -189,7 +221,7 @@ void Foam::combineConstraintsEqOp::operator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::pointConstraint Foam::transform
|
inline Foam::pointConstraint Foam::transform
|
||||||
(
|
(
|
||||||
const tensor& tt,
|
const tensor& tt,
|
||||||
const pointConstraint& v
|
const pointConstraint& v
|
||||||
|
|||||||
Reference in New Issue
Block a user