Extended interface for motion constraints

This commit is contained in:
Vuko Vukcevic 2017-03-08 15:59:13 +01:00 committed by Hrvoje Jasak
parent b5892ea8f8
commit ca5c3600fe
8 changed files with 90 additions and 20 deletions

View file

@ -75,7 +75,8 @@ Foam::constantAngularAcceleration::~constantAngularAcceleration()
Foam::vector Foam::constantAngularAcceleration::matrixContribution Foam::vector Foam::constantAngularAcceleration::matrixContribution
( (
const scalar, const scalar,
const tensor& toRelative const tensor& toRelative,
const vector&
) const ) const
{ {
vector mc; vector mc;
@ -98,7 +99,9 @@ Foam::vector Foam::constantAngularAcceleration::matrixContribution
Foam::scalar Foam::constantAngularAcceleration::sourceContribution Foam::scalar Foam::constantAngularAcceleration::sourceContribution
( (
const scalar const scalar,
const tensor& toRelative,
const vector&
) const ) const
{ {
return alpha_; return alpha_;

View file

@ -101,11 +101,17 @@ public:
virtual vector matrixContribution virtual vector matrixContribution
( (
const scalar, const scalar,
const tensor& toRelative const tensor& toRelative,
const vector&
) const; ) const;
//- Return source contribution defined by constraint, a(t) //- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar) const; virtual scalar sourceContribution
(
const scalar,
const tensor&,
const vector&
) const;
// I-O Functions // I-O Functions

View file

@ -153,11 +153,17 @@ public:
virtual vector matrixContribution virtual vector matrixContribution
( (
const scalar t, const scalar t,
const tensor& toRelative const tensor& toRelative,
const vector& omega
) const = 0; ) const = 0;
//- Return source contribution defined by constraint, a(t) //- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar t) const = 0; virtual scalar sourceContribution
(
const scalar t,
const tensor& toRelative,
const vector& omega
) const = 0;
// I-O Functions and Operators // I-O Functions and Operators

View file

@ -74,7 +74,9 @@ Foam::constantTranslationalAcceleration::~constantTranslationalAcceleration()
Foam::vector Foam::constantTranslationalAcceleration::matrixContribution Foam::vector Foam::constantTranslationalAcceleration::matrixContribution
( (
const scalar, const scalar,
const tensor& const tensor&,
const vector&,
const vector&
) const ) const
{ {
return dir_; return dir_;
@ -83,7 +85,10 @@ Foam::vector Foam::constantTranslationalAcceleration::matrixContribution
Foam::scalar Foam::constantTranslationalAcceleration::sourceContribution Foam::scalar Foam::constantTranslationalAcceleration::sourceContribution
( (
const scalar const scalar,
const tensor&,
const vector&,
const vector&
) const ) const
{ {
return a_; return a_;

View file

@ -97,11 +97,20 @@ public:
virtual vector matrixContribution virtual vector matrixContribution
( (
const scalar, const scalar,
const tensor& const tensor&,
const vector&,
const vector&
) const; ) const;
//- Return source contribution defined by constraint, a(t) //- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar) const; virtual scalar sourceContribution
(
const scalar,
const tensor&,
const vector&,
const vector&
) const;
// I-O Functions // I-O Functions

View file

@ -153,11 +153,19 @@ public:
virtual vector matrixContribution virtual vector matrixContribution
( (
const scalar t, const scalar t,
const tensor& toRelative const tensor& toRelative,
const vector& x,
const vector& u
) const = 0; ) const = 0;
//- Return source contribution defined by constraint, a(t) //- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar t) const = 0; virtual scalar sourceContribution
(
const scalar t,
const tensor& toRelative,
const vector& x,
const vector& u
) const = 0;
// I-O Functions and Operators // I-O Functions and Operators

View file

@ -104,7 +104,14 @@ Foam::dimensionedVector Foam::geometricSixDOF::A
const translationalConstraint& curTc = translationalConstraints_[tcI]; const translationalConstraint& curTc = translationalConstraints_[tcI];
// Get matrix contribution from constraint // Get matrix contribution from constraint
const vector mc = curTc.matrixContribution(t, R.T()); const vector mc =
curTc.matrixContribution
(
t,
R.T(),
xR.value(),
uR.value()
);
// Get matrix index // Get matrix index
const label index = tcI + 3; const label index = tcI + 3;
@ -117,7 +124,7 @@ Foam::dimensionedVector Foam::geometricSixDOF::A
} }
// Insert source contribution (remainder of the constraint function) // Insert source contribution (remainder of the constraint function)
rhs[index] = curTc.sourceContribution(t); rhs[index] = curTc.sourceContribution(t, R.T(), xR.value(), uR.value());
} }
// Solve the matrix using LU decomposition. Note: solution is in the rhs and // Solve the matrix using LU decomposition. Note: solution is in the rhs and
@ -174,7 +181,13 @@ Foam::dimensionedVector Foam::geometricSixDOF::OmegaDot
const rotationalConstraint& curRc = rotationalConstraints_[rcI]; const rotationalConstraint& curRc = rotationalConstraints_[rcI];
// Get matrix contribution from the constraint // Get matrix contribution from the constraint
const vector mc = curRc.matrixContribution(t, RT.value()); const vector mc =
curRc.matrixContribution
(
t,
RT.value(),
omega.value()
);
// Get matrix index // Get matrix index
const label index = rcI + 3; const label index = rcI + 3;
@ -187,7 +200,7 @@ Foam::dimensionedVector Foam::geometricSixDOF::OmegaDot
} }
// Insert source contribution (remainder of the constraint function) // Insert source contribution (remainder of the constraint function)
rhs[index] = curRc.sourceContribution(t); rhs[index] = curRc.sourceContribution(t, RT.value(), omega.value());
} }
// Solve the matrix using LU decomposition. Note: solution is in the rhs and // Solve the matrix using LU decomposition. Note: solution is in the rhs and

View file

@ -89,7 +89,14 @@ Foam::dimensionedVector Foam::quaternionSixDOF::A
const translationalConstraint& curTc = translationalConstraints_[tcI]; const translationalConstraint& curTc = translationalConstraints_[tcI];
// Get matrix contribution from constraint // Get matrix contribution from constraint
const vector mc = curTc.matrixContribution(t, rotation.R()); const vector mc =
curTc.matrixContribution
(
t,
rotation.R(),
xR.value(),
uR.value()
);
// Get matrix index // Get matrix index
const label index = tcI + 3; const label index = tcI + 3;
@ -102,7 +109,14 @@ Foam::dimensionedVector Foam::quaternionSixDOF::A
} }
// Insert source contribution (remainder of the constraint function) // Insert source contribution (remainder of the constraint function)
rhs[index] = curTc.sourceContribution(t); rhs[index] =
curTc.sourceContribution
(
t,
rotation.R(),
xR.value(),
uR.value()
);
} }
// Solve the matrix using LU decomposition. Note: solution is in the rhs and // Solve the matrix using LU decomposition. Note: solution is in the rhs and
@ -160,7 +174,13 @@ Foam::dimensionedVector Foam::quaternionSixDOF::OmegaDot
const rotationalConstraint& curRc = rotationalConstraints_[rcI]; const rotationalConstraint& curRc = rotationalConstraints_[rcI];
// Get matrix contribution from the constraint // Get matrix contribution from the constraint
const vector mc = curRc.matrixContribution(t, R.value()); const vector mc =
curRc.matrixContribution
(
t,
R.value(),
omega.value()
);
// Get matrix index // Get matrix index
const label index = rcI + 3; const label index = rcI + 3;
@ -173,7 +193,7 @@ Foam::dimensionedVector Foam::quaternionSixDOF::OmegaDot
} }
// Insert source contribution (remainder of the constraint function) // Insert source contribution (remainder of the constraint function)
rhs[index] = curRc.sourceContribution(t); rhs[index] = curRc.sourceContribution(t, R.value(), omega.value());
} }
// Solve the matrix using LU decomposition. Note: solution is in the rhs and // Solve the matrix using LU decomposition. Note: solution is in the rhs and