mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: run-time control clean-up
This commit is contained in:
@ -205,8 +205,8 @@ Foam::functionObjects::stateFunctionObject::objectResultEntries() const
|
||||
}
|
||||
|
||||
|
||||
Foam::List<Foam::word> Foam::functionObjects::stateFunctionObject::
|
||||
objectResultEntries
|
||||
Foam::List<Foam::word>
|
||||
Foam::functionObjects::stateFunctionObject::objectResultEntries
|
||||
(
|
||||
const word& objectName
|
||||
) const
|
||||
|
||||
@ -78,12 +78,6 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::averageCondition::~averageCondition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::averageCondition::apply()
|
||||
@ -145,9 +139,8 @@ bool Foam::functionObjects::runTimeControls::averageCondition::apply()
|
||||
<< "From function object: " << functionObjectName_ << nl
|
||||
<< "Unprocessed fields:" << nl;
|
||||
|
||||
forAll(unprocessedFields, i)
|
||||
for (const label fieldi : unprocessedFields)
|
||||
{
|
||||
label fieldi = unprocessedFields[i];
|
||||
Info<< " " << fieldNames_[fieldi] << nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~averageCondition();
|
||||
virtual ~averageCondition() = default;
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
@ -95,13 +95,6 @@ equationInitialResidualCondition
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::equationInitialResidualCondition::
|
||||
~equationInitialResidualCondition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::equationInitialResidualCondition::
|
||||
|
||||
@ -99,7 +99,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~equationInitialResidualCondition();
|
||||
virtual ~equationInitialResidualCondition() = default;
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
@ -76,13 +76,6 @@ equationMaxIterCondition
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::equationMaxIterCondition::
|
||||
~equationMaxIterCondition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::equationMaxIterCondition::apply()
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~equationMaxIterCondition();
|
||||
virtual ~equationMaxIterCondition() = default;
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
@ -90,12 +90,6 @@ Foam::functionObjects::runTimeControls::minMaxCondition::minMaxCondition
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::minMaxCondition::~minMaxCondition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::minMaxCondition::apply()
|
||||
@ -107,10 +101,8 @@ bool Foam::functionObjects::runTimeControls::minMaxCondition::apply()
|
||||
return satisfied;
|
||||
}
|
||||
|
||||
forAll(fieldNames_, fieldi)
|
||||
for (const word& fieldName :fieldNames_)
|
||||
{
|
||||
const word& fieldName = fieldNames_[fieldi];
|
||||
|
||||
const word valueType =
|
||||
state_.objectResultType(functionObjectName_, fieldName);
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~minMaxCondition();
|
||||
virtual ~minMaxCondition() = default;
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
@ -63,13 +63,6 @@ minTimeStepCondition
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::minTimeStepCondition::
|
||||
~minTimeStepCondition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::minTimeStepCondition::apply()
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~minTimeStepCondition();
|
||||
virtual ~minTimeStepCondition() = default;
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
@ -89,12 +89,6 @@ Foam::functionObjects::runTimeControls::runTimeCondition::runTimeCondition
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::runTimeCondition::~runTimeCondition()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||
|
||||
const Foam::word&
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
virtual ~runTimeCondition();
|
||||
virtual ~runTimeCondition() = default;
|
||||
|
||||
//- Selector
|
||||
static autoPtr<runTimeCondition> New
|
||||
|
||||
@ -60,18 +60,13 @@ Foam::functionObjects::runTimeControls::runTimeControl::runTimeControl
|
||||
nWriteStep_(0),
|
||||
writeStepI_(0),
|
||||
satisfiedAction_(satisfiedAction::end),
|
||||
triggerIndex_(labelMin)
|
||||
triggerIndex_(labelMin),
|
||||
active_(getObjectProperty(name, "active", true))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::runTimeControls::runTimeControl::~runTimeControl()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
||||
@ -117,17 +112,17 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
||||
else
|
||||
{
|
||||
// Check that at least one condition is active
|
||||
bool active = false;
|
||||
bool check = false;
|
||||
for (const auto& condition : conditions_)
|
||||
{
|
||||
if (condition.active())
|
||||
{
|
||||
active = true;
|
||||
check = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!active)
|
||||
if (!check)
|
||||
{
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " All conditions are inactive" << nl
|
||||
@ -156,6 +151,11 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
||||
{
|
||||
if (!active_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
// IDs of satisfied conditions
|
||||
@ -242,12 +242,17 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
||||
Info<< " Stopping calculation" << nl
|
||||
<< " Writing fields - final step" << nl;
|
||||
time.writeAndEnd();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case satisfiedAction::setTrigger:
|
||||
{
|
||||
Info<< " Setting trigger " << triggerIndex_ << nl;
|
||||
setTrigger(triggerIndex_);
|
||||
|
||||
// Deactivate the model
|
||||
active_ = false;
|
||||
setProperty("active", active_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016- OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,7 @@ Description
|
||||
user-specified conditions.
|
||||
|
||||
Optionally specify a number of write steps before the calculation is
|
||||
terminated. Here, a write is performed each time that all conditons are
|
||||
terminated. Here, a write is performed each time that all conditions are
|
||||
satisfied.
|
||||
|
||||
SourceFiles
|
||||
@ -96,12 +96,16 @@ private:
|
||||
//- Current number of steps written
|
||||
label writeStepI_;
|
||||
|
||||
//- Action to take when conditions are satified
|
||||
//- Action to take when conditions are satisfied
|
||||
satisfiedAction satisfiedAction_;
|
||||
|
||||
//- Trigger index if satisfiedAction is setTrigger
|
||||
label triggerIndex_;
|
||||
|
||||
//- Active flag
|
||||
// Used in the trigger case to bypass any evaluations after the
|
||||
// trigger has been set
|
||||
bool active_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -121,8 +125,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct for given objectRegistry and dictionary
|
||||
runTimeControl
|
||||
(
|
||||
const word& name,
|
||||
@ -132,7 +135,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~runTimeControl();
|
||||
virtual ~runTimeControl() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
Reference in New Issue
Block a user