Implementation of constraints, part 4
Version that works (compiles and runs properly). To do: 1. Writing out constraints to dictionary for proper restart, 2. Stabilisation of round-off errors when using constraints.
This commit is contained in:
parent
041fddd197
commit
bd820ac31b
9 changed files with 14 additions and 94 deletions
|
@ -44,11 +44,10 @@ namespace Foam
|
||||||
Foam::constantAngularAcceleration::constantAngularAcceleration
|
Foam::constantAngularAcceleration::constantAngularAcceleration
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
rotationalConstraint(name, sixDOFODE, dict),
|
rotationalConstraint(name, dict),
|
||||||
dir_(dict.lookup("constraintDirection")),
|
dir_(dict.lookup("constraintDirection")),
|
||||||
alpha_(readScalar(dict.lookup("angularAcceleration"))),
|
alpha_(readScalar(dict.lookup("angularAcceleration"))),
|
||||||
inGlobal_(dict.lookup("inGlobalCoordinateSystem"))
|
inGlobal_(dict.lookup("inGlobalCoordinateSystem"))
|
||||||
|
|
|
@ -81,7 +81,6 @@ public:
|
||||||
constantAngularAcceleration
|
constantAngularAcceleration
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,8 @@ namespace Foam
|
||||||
Foam::rotationalConstraint::rotationalConstraint
|
Foam::rotationalConstraint::rotationalConstraint
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
sixDOFODE_(sixDOFODE)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +54,6 @@ Foam::rotationalConstraint::~rotationalConstraint()
|
||||||
Foam::autoPtr<Foam::rotationalConstraint> Foam::rotationalConstraint::New
|
Foam::autoPtr<Foam::rotationalConstraint> Foam::rotationalConstraint::New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +69,6 @@ Foam::autoPtr<Foam::rotationalConstraint> Foam::rotationalConstraint::New
|
||||||
"rotationalConstraint::New"
|
"rotationalConstraint::New"
|
||||||
"\n("
|
"\n("
|
||||||
"\n const word& name,"
|
"\n const word& name,"
|
||||||
"\n const sixDOFODE& sixDOFODE,"
|
|
||||||
"\n const dictionary& dict,"
|
"\n const dictionary& dict,"
|
||||||
"\n)"
|
"\n)"
|
||||||
) << "Unknown rotation constraint type: " << constraintType
|
) << "Unknown rotation constraint type: " << constraintType
|
||||||
|
@ -89,7 +83,6 @@ Foam::autoPtr<Foam::rotationalConstraint> Foam::rotationalConstraint::New
|
||||||
cstrIter()
|
cstrIter()
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
sixDOFODE,
|
|
||||||
dict
|
dict
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -69,15 +69,6 @@ namespace Foam
|
||||||
|
|
||||||
class rotationalConstraint
|
class rotationalConstraint
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of the constraint
|
|
||||||
const word name_;
|
|
||||||
|
|
||||||
//- Reference to underlying sixDOFODE
|
|
||||||
const sixDOFODE& sixDOFODE_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
@ -93,10 +84,9 @@ public:
|
||||||
word,
|
word,
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
),
|
),
|
||||||
(name, sixDOFODE, dict)
|
(name, dict)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,20 +94,16 @@ public:
|
||||||
// PtrLists of rotationalConstraint
|
// PtrLists of rotationalConstraint
|
||||||
class iNew
|
class iNew
|
||||||
{
|
{
|
||||||
const sixDOFODE& sixDOFODE_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
iNew(const sixDOFODE& sixDOFODE)
|
iNew()
|
||||||
:
|
|
||||||
sixDOFODE_(sixDOFODE)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
autoPtr<rotationalConstraint> operator()(Istream& is) const
|
autoPtr<rotationalConstraint> operator()(Istream& is) const
|
||||||
{
|
{
|
||||||
word name(is);
|
word name(is);
|
||||||
dictionary dict(is);
|
dictionary dict(is);
|
||||||
return rotationalConstraint::New(name, sixDOFODE_, dict);
|
return rotationalConstraint::New(name, dict);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +114,6 @@ public:
|
||||||
rotationalConstraint
|
rotationalConstraint
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,7 +127,6 @@ public:
|
||||||
static autoPtr<rotationalConstraint> New
|
static autoPtr<rotationalConstraint> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -154,21 +138,6 @@ public:
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access functions
|
|
||||||
|
|
||||||
//- Return const reference to name of the constraint
|
|
||||||
const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return const reference to underlying sixDOFODE object
|
|
||||||
const sixDOFODE& sixDOF() const
|
|
||||||
{
|
|
||||||
return sixDOFODE_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Constraint specific functions
|
// Constraint specific functions
|
||||||
|
|
||||||
//- Return matrix contribution defined by constraint, f(t)
|
//- Return matrix contribution defined by constraint, f(t)
|
||||||
|
|
|
@ -44,11 +44,10 @@ namespace Foam
|
||||||
Foam::constantTranslationalAcceleration::constantTranslationalAcceleration
|
Foam::constantTranslationalAcceleration::constantTranslationalAcceleration
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
translationalConstraint(name, sixDOFODE, dict),
|
translationalConstraint(name, dict),
|
||||||
dir_(dict.lookup("constraintDirection")),
|
dir_(dict.lookup("constraintDirection")),
|
||||||
a_(readScalar(dict.lookup("translationalAcceleration")))
|
a_(readScalar(dict.lookup("translationalAcceleration")))
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -77,7 +77,6 @@ public:
|
||||||
constantTranslationalAcceleration
|
constantTranslationalAcceleration
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,8 @@ namespace Foam
|
||||||
Foam::translationalConstraint::translationalConstraint
|
Foam::translationalConstraint::translationalConstraint
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
sixDOFODE_(sixDOFODE)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +54,6 @@ Foam::translationalConstraint::~translationalConstraint()
|
||||||
Foam::autoPtr<Foam::translationalConstraint> Foam::translationalConstraint::New
|
Foam::autoPtr<Foam::translationalConstraint> Foam::translationalConstraint::New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +69,6 @@ Foam::autoPtr<Foam::translationalConstraint> Foam::translationalConstraint::New
|
||||||
"translationalConstraint::New"
|
"translationalConstraint::New"
|
||||||
"\n("
|
"\n("
|
||||||
"\n const word& name,"
|
"\n const word& name,"
|
||||||
"\n const sixDOFODE& sixDOFODE,"
|
|
||||||
"\n const dictionary& dict,"
|
"\n const dictionary& dict,"
|
||||||
"\n)"
|
"\n)"
|
||||||
) << "Unknown translation constraint type: " << constraintType
|
) << "Unknown translation constraint type: " << constraintType
|
||||||
|
@ -89,7 +83,6 @@ Foam::autoPtr<Foam::translationalConstraint> Foam::translationalConstraint::New
|
||||||
cstrIter()
|
cstrIter()
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
sixDOFODE,
|
|
||||||
dict
|
dict
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -69,15 +69,6 @@ namespace Foam
|
||||||
|
|
||||||
class translationalConstraint
|
class translationalConstraint
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of the constraint
|
|
||||||
const word name_;
|
|
||||||
|
|
||||||
//- Reference to underlying sixDOFODE
|
|
||||||
const sixDOFODE& sixDOFODE_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
@ -93,10 +84,9 @@ public:
|
||||||
word,
|
word,
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
),
|
),
|
||||||
(name, sixDOFODE, dict)
|
(name, dict)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,20 +94,16 @@ public:
|
||||||
// PtrLists of translationalConstraint
|
// PtrLists of translationalConstraint
|
||||||
class iNew
|
class iNew
|
||||||
{
|
{
|
||||||
const sixDOFODE& sixDOFODE_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
iNew(const sixDOFODE& sixDOFODE)
|
iNew()
|
||||||
:
|
|
||||||
sixDOFODE_(sixDOFODE)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
autoPtr<translationalConstraint> operator()(Istream& is) const
|
autoPtr<translationalConstraint> operator()(Istream& is) const
|
||||||
{
|
{
|
||||||
word name(is);
|
word name(is);
|
||||||
dictionary dict(is);
|
dictionary dict(is);
|
||||||
return translationalConstraint::New(name, sixDOFODE_, dict);
|
return translationalConstraint::New(name, dict);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +114,6 @@ public:
|
||||||
translationalConstraint
|
translationalConstraint
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,7 +127,6 @@ public:
|
||||||
static autoPtr<translationalConstraint> New
|
static autoPtr<translationalConstraint> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const sixDOFODE& sixDOFODE,
|
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -154,21 +138,6 @@ public:
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access functions
|
|
||||||
|
|
||||||
//- Return const reference to name of the constraint
|
|
||||||
const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return const reference to underlying sixDOFODE object
|
|
||||||
const sixDOFODE& sixDOF() const
|
|
||||||
{
|
|
||||||
return sixDOFODE_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Constraint specific functions
|
// Constraint specific functions
|
||||||
|
|
||||||
//- Return matrix contribution defined by constraint, f(t)
|
//- Return matrix contribution defined by constraint, f(t)
|
||||||
|
|
|
@ -374,7 +374,7 @@ Foam::geometricSixDOF::geometricSixDOF(const IOobject& io)
|
||||||
PtrList<translationalConstraint> tcList
|
PtrList<translationalConstraint> tcList
|
||||||
(
|
(
|
||||||
dict().lookup("translationalConstraints"),
|
dict().lookup("translationalConstraints"),
|
||||||
translationalConstraint::iNew(*this)
|
translationalConstraint::iNew()
|
||||||
);
|
);
|
||||||
translationalConstraints_.transfer(tcList);
|
translationalConstraints_.transfer(tcList);
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ Foam::geometricSixDOF::geometricSixDOF(const IOobject& io)
|
||||||
PtrList<rotationalConstraint> tcList
|
PtrList<rotationalConstraint> tcList
|
||||||
(
|
(
|
||||||
dict().lookup("rotationalConstraints"),
|
dict().lookup("rotationalConstraints"),
|
||||||
rotationalConstraint::iNew(*this)
|
rotationalConstraint::iNew()
|
||||||
);
|
);
|
||||||
rotationalConstraints_.transfer(tcList);
|
rotationalConstraints_.transfer(tcList);
|
||||||
}
|
}
|
||||||
|
@ -626,10 +626,10 @@ bool Foam::geometricSixDOF::writeData(Ostream& os) const
|
||||||
os.writeKeyword("omega") << tab << omega_
|
os.writeKeyword("omega") << tab << omega_
|
||||||
<< token::END_STATEMENT << nl << nl;
|
<< token::END_STATEMENT << nl << nl;
|
||||||
|
|
||||||
os.writeKeyword("translationalConstraints") << tab
|
// os.writeKeyword("translationalConstraints") << tab
|
||||||
<< translationalConstraints_ << token::END_STATEMENT << nl;
|
// << translationalConstraints_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("rotationalConstraints") << tab
|
// os.writeKeyword("rotationalConstraints") << tab
|
||||||
<< rotationalConstraints_ << token::END_STATEMENT << nl << endl;
|
// << rotationalConstraints_ << token::END_STATEMENT << nl << endl;
|
||||||
|
|
||||||
return os.good();
|
return os.good();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue