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

Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

parents d709dce7 4bcb0d71
......@@ -42,15 +42,15 @@ export WM_PROJECT_VERSION=plus
#
# Please set to the appropriate path if the default is not correct.
#
[ $BASH_SOURCE ] && \
export FOAM_INST_DIR=$(\cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \
export FOAM_INST_DIR=$HOME/$WM_PROJECT
# export FOAM_INST_DIR=~$WM_PROJECT
# export FOAM_INST_DIR=/opt/$WM_PROJECT
# export FOAM_INST_DIR=/usr/local/$WM_PROJECT
[ $BASH_SOURCE ] && FOAM_INST_DIR=$(\cd ${BASH_SOURCE%/*/*/*} && \pwd -P) || \
FOAM_INST_DIR=$HOME/$WM_PROJECT
# FOAM_INST_DIR=~$WM_PROJECT
# FOAM_INST_DIR=/opt/$WM_PROJECT
# FOAM_INST_DIR=/usr/local/$WM_PROJECT
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
export FOAM_INST_DIR
# The default environment variables below can be overridden in a prefs.sh file
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,
......
......@@ -59,6 +59,7 @@ set cmake_version=cmake-system
#------------------------------------------------------------------------------
# Clean the PATH
if ( ! $?ParaView_DIR ) setenv ParaView_DIR
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) setenv PATH $cleaned
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -83,7 +83,7 @@ readField
// 2. Patch-groups. (using non-wild card entries of dictionaries)
// (patchnames already matched above)
// Note: in reverse order of entries in the dictionary (last
// patchGroups wins). This is so is consistent with dictionary wildcard
// patchGroups wins). This is so it is consistent with dictionary wildcard
// behaviour
if (dict.size())
{
......@@ -570,14 +570,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
writeEntry(const word& keyword, Ostream& os) const
{
os.beginBlock(keyword);
forAll(*this, patchi)
{
os.beginBlock(this->operator[](patchi).patch().name());
os << this->operator[](patchi);
os.endBlock();
}
this->writeEntries(os);
os.endBlock() << flush;
// Check state of IOstream
......@@ -589,6 +582,19 @@ writeEntry(const word& keyword, Ostream& os) const
}
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
writeEntries(Ostream& os) const
{
forAll(*this, patchi)
{
os.beginBlock(this->operator[](patchi).patch().name());
os << this->operator[](patchi);
os.endBlock();
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type, template<class> class PatchField, class GeoMesh>
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -218,6 +218,9 @@ public:
//- Write boundary field as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const;
//- Write dictionary entries of the individual boundary fields.
void writeEntries(Ostream& os) const;
// Member operators
......
......@@ -141,12 +141,24 @@ void Foam::functionObjects::fieldAverage::calcAverages()
prevTimeIndex_ = currentTimeIndex;
}
bool doRestart = false;
if (periodicRestart_ && currentTime > restartPeriod_*periodIndex_)
{
restart();
doRestart = true;
periodIndex_++;
}
if (currentTime >= restartTime_)
{
doRestart = true; // Restart is overdue.
restartTime_ = GREAT; // Avoid triggering again
}
if (doRestart)
{
restart();
}
Log
<< type() << " " << name() << " write:" << nl
<< " Calculating averages" << nl;
......@@ -262,6 +274,7 @@ Foam::functionObjects::fieldAverage::fieldAverage
restartOnOutput_(false),
periodicRestart_(false),
restartPeriod_(GREAT),
restartTime_(GREAT),
initialised_(false),
faItems_(),
totalIter_(),
......@@ -296,6 +309,25 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
if (periodicRestart_)
{
dict.lookup("restartPeriod") >> restartPeriod_;
Log
<< " Restart period " << restartPeriod_
<< nl << endl;
}
restartTime_ = GREAT;
if (dict.readIfPresent("restartTime", restartTime_))
{
if (restartTime_ < obr_.time().value())
{
// The restart time is already in the past - ignore
restartTime_ = GREAT;
}
else
{
Log
<< " Restart scheduled at time " << restartTime_
<< nl << endl;
}
}
readAveragingProperties();
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -106,6 +106,7 @@ Usage
restartOnOutput | Restart the averaging on output | no | no
periodicRestart | Periodically restart the averaging | no | no
restartPeriod | Periodic restart period | conditional |
restartTime | One-shot reset of the averaging | no | great
fields | list of fields and averaging options | yes |
\endtable
......@@ -166,6 +167,9 @@ protected:
//- Restart period
scalar restartPeriod_;
//- Specific restart time
scalar restartTime_;
//- Initialised flag
bool initialised_;
......
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