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

This commit is contained in:
Andrew Heather
2016-11-01 14:46:56 +00:00
6 changed files with 65 additions and 19 deletions

View File

@ -42,15 +42,15 @@ export WM_PROJECT_VERSION=plus
# #
# Please set to the appropriate path if the default is not correct. # Please set to the appropriate path if the default is not correct.
# #
[ $BASH_SOURCE ] && \ [ $BASH_SOURCE ] && FOAM_INST_DIR=$(\cd ${BASH_SOURCE%/*/*/*} && \pwd -P) || \
export FOAM_INST_DIR=$(\cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \ FOAM_INST_DIR=$HOME/$WM_PROJECT
export FOAM_INST_DIR=$HOME/$WM_PROJECT # FOAM_INST_DIR=~$WM_PROJECT
# export FOAM_INST_DIR=~$WM_PROJECT # FOAM_INST_DIR=/opt/$WM_PROJECT
# export FOAM_INST_DIR=/opt/$WM_PROJECT # FOAM_INST_DIR=/usr/local/$WM_PROJECT
# export FOAM_INST_DIR=/usr/local/$WM_PROJECT
# #
# END OF (NORMAL) USER EDITABLE PART # END OF (NORMAL) USER EDITABLE PART
################################################################################ ################################################################################
export FOAM_INST_DIR
# The default environment variables below can be overridden in a prefs.sh file # The default environment variables below can be overridden in a prefs.sh file
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM, # located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,

View File

@ -59,6 +59,7 @@ set cmake_version=cmake-system
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Clean the PATH # 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-"` 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 if ( $status == 0 ) setenv PATH $cleaned

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -83,7 +83,7 @@ readField
// 2. Patch-groups. (using non-wild card entries of dictionaries) // 2. Patch-groups. (using non-wild card entries of dictionaries)
// (patchnames already matched above) // (patchnames already matched above)
// Note: in reverse order of entries in the dictionary (last // 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 // behaviour
if (dict.size()) if (dict.size())
{ {
@ -570,14 +570,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
writeEntry(const word& keyword, Ostream& os) const writeEntry(const word& keyword, Ostream& os) const
{ {
os.beginBlock(keyword); os.beginBlock(keyword);
this->writeEntries(os);
forAll(*this, patchi)
{
os.beginBlock(this->operator[](patchi).patch().name());
os << this->operator[](patchi);
os.endBlock();
}
os.endBlock() << flush; os.endBlock() << flush;
// Check state of IOstream // 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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -218,6 +218,9 @@ public:
//- Write boundary field as dictionary entry //- Write boundary field as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const; void writeEntry(const word& keyword, Ostream& os) const;
//- Write dictionary entries of the individual boundary fields.
void writeEntries(Ostream& os) const;
// Member operators // Member operators

View File

@ -141,12 +141,24 @@ void Foam::functionObjects::fieldAverage::calcAverages()
prevTimeIndex_ = currentTimeIndex; prevTimeIndex_ = currentTimeIndex;
} }
bool doRestart = false;
if (periodicRestart_ && currentTime > restartPeriod_*periodIndex_) if (periodicRestart_ && currentTime > restartPeriod_*periodIndex_)
{ {
restart(); doRestart = true;
periodIndex_++; periodIndex_++;
} }
if (currentTime >= restartTime_)
{
doRestart = true; // Restart is overdue.
restartTime_ = GREAT; // Avoid triggering again
}
if (doRestart)
{
restart();
}
Log Log
<< type() << " " << name() << " write:" << nl << type() << " " << name() << " write:" << nl
<< " Calculating averages" << nl; << " Calculating averages" << nl;
@ -262,6 +274,7 @@ Foam::functionObjects::fieldAverage::fieldAverage
restartOnOutput_(false), restartOnOutput_(false),
periodicRestart_(false), periodicRestart_(false),
restartPeriod_(GREAT), restartPeriod_(GREAT),
restartTime_(GREAT),
initialised_(false), initialised_(false),
faItems_(), faItems_(),
totalIter_(), totalIter_(),
@ -296,6 +309,25 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
if (periodicRestart_) if (periodicRestart_)
{ {
dict.lookup("restartPeriod") >> restartPeriod_; 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(); readAveragingProperties();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -106,6 +106,7 @@ Usage
restartOnOutput | Restart the averaging on output | no | no restartOnOutput | Restart the averaging on output | no | no
periodicRestart | Periodically restart the averaging | no | no periodicRestart | Periodically restart the averaging | no | no
restartPeriod | Periodic restart period | conditional | restartPeriod | Periodic restart period | conditional |
restartTime | One-shot reset of the averaging | no | great
fields | list of fields and averaging options | yes | fields | list of fields and averaging options | yes |
\endtable \endtable
@ -166,6 +167,9 @@ protected:
//- Restart period //- Restart period
scalar restartPeriod_; scalar restartPeriod_;
//- Specific restart time
scalar restartTime_;
//- Initialised flag //- Initialised flag
bool initialised_; bool initialised_;