View Issue Details

IDProjectCategoryView StatusLast Update
0003204OpenFOAMBugpublic2019-03-20 11:30
Reporterhandrake0724 Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Summary0003204: model_ member variable of restraint class shows different behaviors in constructor and restrain member function
DescriptionIn the restraint class in rigidBodyDynamics, restraint class has different values for reference to rigidBodyModel.
for example, in linearSpring class, the following two functions gives different values.

//// constructor ////
Foam::RBD::restraints::linearSpring::linearSpring
(
    const word& name,
    const dictionary& dict,
    const rigidBodyModel& model
)
:
    restraint(name, dict, model)
{
    ...
    // Info << refCast<const rigidBodyMotion>(model_).state().t() << endl; // not working
    // Info << refCast<const rigidBodyMotion>(model_).state().deltaT() << endl; // not working
    Info << static_cast<const rigidBodyMotion&>(model_).state().t() << endl;
    Info << static_cast<const rigidBodyMotion&>(model_).state().deltaT() << endl;
}

//// member function ////
void Foam::RBD::restraints::linearSpring::restrain
(
    scalarField& tau,
    Field<spatialVector>& fx
) const
{
  ...
  Info << refCast<const rigidBodyMotion>(model_).state().t() << endl;
  Info << refCast<const rigidBodyMotion>(model_).state().deltaT() << endl;
}

In the constructor, refCast is not working and static_cast looks working but the casted model_ does not give the right values (time step and current time) in rigidBodyModelState.
On the other hand, in the restrain member function, refCast is working and gives right values of curent time and time step defined in system/controlDict.

TagsNo tags attached.

Activities

henry

2019-03-20 08:21

manager   ~0010385

It is not clear what change you are proposing.

handrake0724

2019-03-20 11:12

viewer   ~0010386

In the constructor, there is no way to get time step and current time.
I am not sure if this behavior is intended or not but it would be good to have a way to get time step and current time in constructor as in restraint member function.

I am working on coupling restraint class with mooring library.
the library need initialization with time step and the constructor is a proper place for it in my opinion.
So I tested if the model_ is a rigidBodyMotion class or rigidBodyModel class because if model_ is a rigidBodyMotion object then I can get access to rigidBodyMotionState object.
It turned out that time step and current time is not available in constructor.

henry

2019-03-20 11:30

manager   ~0010387

User support request

Issue History

Date Modified Username Field Change
2019-03-20 04:34 handrake0724 New Issue
2019-03-20 08:21 henry Note Added: 0010385
2019-03-20 11:12 handrake0724 Note Added: 0010386
2019-03-20 11:30 henry Assigned To => henry
2019-03-20 11:30 henry Status new => closed
2019-03-20 11:30 henry Resolution open => no change required
2019-03-20 11:30 henry Note Added: 0010387