mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'olesenm'
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.6 |
|
||||
| \\ / A nd | Web: http://www.OpenFOAM.org |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
|
||||
@ -76,11 +76,9 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
rhoInf_ = readScalar(dict.lookup("rhoInf"));
|
||||
}
|
||||
|
||||
if (dict.found("g"))
|
||||
if (dict.readIfPresent("g", g_))
|
||||
{
|
||||
lookupGravity_ = -2;
|
||||
|
||||
g_ = dict.lookup("g");
|
||||
}
|
||||
|
||||
if (!dict.found("value"))
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "error.H"
|
||||
#include "Time.H"
|
||||
#include "OSspecific.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,8 +53,12 @@ const Foam::NamedEnum<Foam::abortCalculation::actionType, 3>
|
||||
|
||||
void Foam::abortCalculation::removeFile() const
|
||||
{
|
||||
if (isFile(abortFile_))
|
||||
bool hasAbort = isFile(abortFile_);
|
||||
reduce(hasAbort, orOp<bool>());
|
||||
|
||||
if (hasAbort && Pstream::master())
|
||||
{
|
||||
// cleanup ABORT file (on master only)
|
||||
rm(abortFile_);
|
||||
}
|
||||
}
|
||||
@ -92,14 +97,9 @@ Foam::abortCalculation::~abortCalculation()
|
||||
|
||||
void Foam::abortCalculation::read(const dictionary& dict)
|
||||
{
|
||||
word actionName;
|
||||
|
||||
if (dict.found("action"))
|
||||
{
|
||||
action_ = actionTypeNames_.read
|
||||
(
|
||||
dict.lookup("action")
|
||||
);
|
||||
action_ = actionTypeNames_.read(dict.lookup("action"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -115,27 +115,48 @@ void Foam::abortCalculation::read(const dictionary& dict)
|
||||
|
||||
void Foam::abortCalculation::execute()
|
||||
{
|
||||
if (isFile(abortFile_))
|
||||
bool hasAbort = isFile(abortFile_);
|
||||
reduce(hasAbort, orOp<bool>());
|
||||
|
||||
if (hasAbort)
|
||||
{
|
||||
switch (action_)
|
||||
{
|
||||
case noWriteNow :
|
||||
obr_.time().stopAt(Time::saNoWriteNow);
|
||||
Info<< "user requested abort - "
|
||||
"stop immediately without writing data" << endl;
|
||||
{
|
||||
if (obr_.time().stopAt(Time::saNoWriteNow))
|
||||
{
|
||||
Info<< "USER REQUESTED ABORT (timeIndex="
|
||||
<< obr_.time().timeIndex()
|
||||
<< "): stop without writing data"
|
||||
<< endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case writeNow :
|
||||
obr_.time().stopAt(Time::saWriteNow);
|
||||
Info<< "user requested abort - "
|
||||
"stop immediately with writing data" << endl;
|
||||
{
|
||||
if (obr_.time().stopAt(Time::saWriteNow))
|
||||
{
|
||||
Info<< "USER REQUESTED ABORT (timeIndex="
|
||||
<< obr_.time().timeIndex()
|
||||
<< "): stop+write data"
|
||||
<< endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case nextWrite :
|
||||
obr_.time().stopAt(Time::saNextWrite);
|
||||
Info<< "user requested abort - "
|
||||
"stop after next data write" << endl;
|
||||
{
|
||||
if (obr_.time().stopAt(Time::saNextWrite))
|
||||
{
|
||||
Info<< "USER REQUESTED ABORT (timeIndex="
|
||||
<< obr_.time().timeIndex()
|
||||
<< "): stop after next data write"
|
||||
<< endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,7 +170,7 @@ void Foam::abortCalculation::end()
|
||||
|
||||
void Foam::abortCalculation::write()
|
||||
{
|
||||
execute();
|
||||
// Do nothing - only valid on execute
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,8 +47,12 @@ bool Foam::residualControl::checkCriteria(const bool verbose) const
|
||||
|
||||
if (maxResiduals_.readIfPresent(variableName, maxResidual))
|
||||
{
|
||||
// use the residual from the first solution
|
||||
const scalar eqnResidual =
|
||||
lduMatrix::solverPerformance(iter().stream()).initialResidual();
|
||||
List<lduMatrix::solverPerformance>
|
||||
(
|
||||
iter().stream()
|
||||
).first().initialResidual();
|
||||
|
||||
achieved = achieved && (eqnResidual < maxResidual);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user