ENH: forces FO updated following update to use functionObjectState
Properties stored in state dictionary: - normalForce - tangentialForce - porousForce - normalMoment - tangentialMoment - porousMoment
This commit is contained in:
parent
137668ba81
commit
bc00be2c9a
@ -743,10 +743,9 @@ Foam::forces::forces
|
|||||||
const bool readFields
|
const bool readFields
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
functionObjectState(obr, name),
|
||||||
functionObjectFile(obr, name),
|
functionObjectFile(obr, name),
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
|
||||||
log_(true),
|
log_(true),
|
||||||
force_(3),
|
force_(3),
|
||||||
moment_(3),
|
moment_(3),
|
||||||
@ -779,29 +778,14 @@ Foam::forces::forces
|
|||||||
initialised_(false)
|
initialised_(false)
|
||||||
{
|
{
|
||||||
// Check if the available mesh is an fvMesh otherise deactivate
|
// Check if the available mesh is an fvMesh otherise deactivate
|
||||||
if (isA<fvMesh>(obr_))
|
if (setActive<fvMesh>())
|
||||||
{
|
{
|
||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
Info<< endl;
|
if (log_) Info << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
active_ = false;
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"Foam::forces::forces"
|
|
||||||
"("
|
|
||||||
"const word&, "
|
|
||||||
"const objectRegistry&, "
|
|
||||||
"const dictionary&, "
|
|
||||||
"const bool"
|
|
||||||
")"
|
|
||||||
) << "No fvMesh available, deactivating " << name_
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -818,9 +802,9 @@ Foam::forces::forces
|
|||||||
const coordinateSystem& coordSys
|
const coordinateSystem& coordSys
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
functionObjectState(obr, name),
|
||||||
functionObjectFile(obr, name),
|
functionObjectFile(obr, name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
|
||||||
log_(true),
|
log_(true),
|
||||||
force_(3),
|
force_(3),
|
||||||
moment_(3),
|
moment_(3),
|
||||||
@ -1040,6 +1024,14 @@ void Foam::forces::execute()
|
|||||||
if (log_) Info << endl;
|
if (log_) Info << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write state/results information
|
||||||
|
setResult("normalForce", sum(force_[0]));
|
||||||
|
setResult("tangentialForce", sum(force_[1]));
|
||||||
|
setResult("porousForce", sum(force_[2]));
|
||||||
|
|
||||||
|
setResult("normalMoment", sum(moment_[0]));
|
||||||
|
setResult("tangentialMoment", sum(moment_[1]));
|
||||||
|
setResult("porousMoment", sum(moment_[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ Note
|
|||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::functionObjectFile
|
Foam::functionObjectFile
|
||||||
|
Foam::functionObjectState
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::OutputFilterFunctionObject
|
||||||
Foam::forceCoeffs
|
Foam::forceCoeffs
|
||||||
|
|
||||||
@ -129,6 +130,7 @@ SourceFiles
|
|||||||
#ifndef forces_H
|
#ifndef forces_H
|
||||||
#define forces_H
|
#define forces_H
|
||||||
|
|
||||||
|
#include "functionObjectState.H"
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFile.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
#include "coordinateSystems.H"
|
#include "coordinateSystems.H"
|
||||||
@ -156,21 +158,16 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class forces
|
class forces
|
||||||
:
|
:
|
||||||
|
public functionObjectState,
|
||||||
public functionObjectFile
|
public functionObjectFile
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of forces,
|
//- Reference to the database
|
||||||
// Also used as the name of the probes directory.
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- On/off switch
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
//- Switch to send output to Info as well as to file
|
//- Switch to send output to Info as well as to file
|
||||||
Switch log_;
|
Switch log_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user