Commit bc00be2c authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: forces FO updated following update to use functionObjectState

Properties stored in state dictionary:
- normalForce
- tangentialForce
- porousForce
- normalMoment
- tangentialMoment
- porousMoment
parent 137668ba
......@@ -743,10 +743,9 @@ Foam::forces::forces
const bool readFields
)
:
functionObjectState(obr, name),
functionObjectFile(obr, name),
name_(name),
obr_(obr),
active_(true),
log_(true),
force_(3),
moment_(3),
......@@ -779,29 +778,14 @@ Foam::forces::forces
initialised_(false)
{
// Check if the available mesh is an fvMesh otherise deactivate
if (isA<fvMesh>(obr_))
if (setActive<fvMesh>())
{
if (readFields)
{
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
)
:
functionObjectState(obr, name),
functionObjectFile(obr, name),
obr_(obr),
active_(true),
log_(true),
force_(3),
moment_(3),
......@@ -1040,6 +1024,14 @@ void Foam::forces::execute()
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
Foam::functionObject
Foam::functionObjectFile
Foam::functionObjectState
Foam::OutputFilterFunctionObject
Foam::forceCoeffs
......@@ -129,6 +130,7 @@ SourceFiles
#ifndef forces_H
#define forces_H
#include "functionObjectState.H"
#include "functionObjectFile.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
......@@ -156,21 +158,16 @@ class mapPolyMesh;
class forces
:
public functionObjectState,
public functionObjectFile
{
protected:
// Protected data
//- Name of this set of forces,
// Also used as the name of the probes directory.
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Switch to send output to Info as well as to file
Switch log_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment