diff --git a/src/functionObjects/field/readFields/readFields.C b/src/functionObjects/field/readFields/readFields.C index 2ac396999f2f31e8550cbe5960eedcde8b025bf0..04fb569728e74ba79afea4c865793990db0e123d 100644 --- a/src/functionObjects/field/readFields/readFields.C +++ b/src/functionObjects/field/readFields/readFields.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) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,9 +50,15 @@ Foam::functionObjects::readFields::readFields ) : fvMeshFunctionObject(name, runTime, dict), - fieldSet_() + fieldSet_(), + readOnStart_(true) { read(dict); + + if (readOnStart_) + { + execute(); + } } @@ -69,6 +75,7 @@ bool Foam::functionObjects::readFields::read(const dictionary& dict) fvMeshFunctionObject::read(dict); dict.lookup("fields") >> fieldSet_; + dict.readIfPresent("readOnStart", readOnStart_); return true; } diff --git a/src/functionObjects/field/readFields/readFields.H b/src/functionObjects/field/readFields/readFields.H index f026063e9f9eb81a180e8100c8c87a032ad2b13a..1dfb662d5d75dffc3b56cb10fa0c70933b232904 100644 --- a/src/functionObjects/field/readFields/readFields.H +++ b/src/functionObjects/field/readFields/readFields.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-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,6 +48,7 @@ Usage Property | Description | Required | Default value type | type name: readFields | yes | fields | list of fields to read | no | + readOnStart | flag to start reading on start-up | no | yes log | Log to standard output | no | yes \endtable @@ -88,6 +89,9 @@ protected: //- Fields to load wordList fieldSet_; + //- Flag to read on construction + bool readOnStart_; + // Protected Member Functions