From b634d14068febe129d5fba18d11e67ccfd62dba8 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 11 Feb 2013 11:13:24 +0000 Subject: [PATCH] setFields: If field is not found in the current time directory look in "constant" --- .../preProcessing/setFields/setFields.C | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 274258ffd2..0dbc03540f 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,6 +54,7 @@ bool setCellFieldType word fieldName(fieldValueStream); + // Check the current time directory IOobject fieldHeader ( fieldName, @@ -62,6 +63,18 @@ bool setCellFieldType IOobject::MUST_READ ); + // Check the "constant" directory + if (!fieldHeader.headerOk()) + { + fieldHeader = IOobject + ( + fieldName, + mesh.time().constant(), + mesh, + IOobject::MUST_READ + ); + } + // Check field exists if (fieldHeader.headerOk()) { @@ -193,6 +206,7 @@ bool setFaceFieldType word fieldName(fieldValueStream); + // Check the current time directory IOobject fieldHeader ( fieldName, @@ -201,6 +215,18 @@ bool setFaceFieldType IOobject::MUST_READ ); + // Check the "constant" directory + if (!fieldHeader.headerOk()) + { + fieldHeader = IOobject + ( + fieldName, + mesh.time().constant(), + mesh, + IOobject::MUST_READ + ); + } + // Check field exists if (fieldHeader.headerOk()) {