diff --git a/etc/bashrc b/etc/bashrc index 01115f2600..c65f5fab04 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -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, diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index ba718b0c0c..ef697365a1 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -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 diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index 7e273aa9fd..5eb896084a 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -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::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 PatchField, class GeoMesh> +void Foam::GeometricField::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 PatchField, class GeoMesh> diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 01337ebe66..c56bcd9a59 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -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 diff --git a/src/functionObjects/field/fieldAverage/fieldAverage.C b/src/functionObjects/field/fieldAverage/fieldAverage.C index cf076159c4..d7cd691bf2 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverage.C +++ b/src/functionObjects/field/fieldAverage/fieldAverage.C @@ -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(); diff --git a/src/functionObjects/field/fieldAverage/fieldAverage.H b/src/functionObjects/field/fieldAverage/fieldAverage.H index 0fd49c9bd6..31a4763bfa 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverage.H +++ b/src/functionObjects/field/fieldAverage/fieldAverage.H @@ -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_;