From b8bb55507e243ea5c589d4438191aa73a7b453e3 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Wed, 19 Oct 2016 11:52:00 +0100 Subject: [PATCH] ENH: Coded fvOption - updated construction of the redirectFvOption to simplify user input --- src/fvOptions/sources/general/codedSource/CodedSource.C | 3 ++- src/fvOptions/sources/general/codedSource/CodedSource.H | 9 ++------- .../sources/general/codedSource/CodedSourceIO.C | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.C b/src/fvOptions/sources/general/codedSource/CodedSource.C index 267354e313..f29021c94b 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.C +++ b/src/fvOptions/sources/general/codedSource/CodedSource.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -134,6 +134,7 @@ Foam::fv::option& Foam::fv::CodedSource::redirectFvOption() const { dictionary constructDict(dict_); constructDict.set("type", name_); + constructDict.changeKeyword(modelType_ & "Coeffs", name_ & "Coeffs"); redirectFvOptionPtr_ = option::New ( diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.H b/src/fvOptions/sources/general/codedSource/CodedSource.H index 6dce798fd3..6d3466fa3b 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.H +++ b/src/fvOptions/sources/general/codedSource/CodedSource.H @@ -28,7 +28,7 @@ Group grpFvOptionsSources Description - Constructs on-the-fly fvOption source + Constructs on-the-fly fvOption source The hook functions take the following arguments: @@ -50,7 +50,7 @@ Description ) where : - field is the field in fieldNames + field is the name of the field in the fields list eqn is the fvMatrix Usage @@ -99,11 +99,6 @@ Usage $codeSetValue #}; } - - sourceTimeCoeffs - { - // Dummy entry - } } \endverbatim diff --git a/src/fvOptions/sources/general/codedSource/CodedSourceIO.C b/src/fvOptions/sources/general/codedSource/CodedSourceIO.C index af908bf593..0899706841 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSourceIO.C +++ b/src/fvOptions/sources/general/codedSource/CodedSourceIO.C @@ -37,13 +37,13 @@ bool Foam::fv::CodedSource::read(const dictionary& dict) applied_.setSize(fieldNames_.size(), false); // Backward compatibility - if (dict.found("redirectType")) + if (coeffs_.found("redirectType")) { - dict.lookup("redirectType") >> name_; + coeffs_.lookup("redirectType") >> name_; } else { - dict.lookup("name") >> name_; + coeffs_.lookup("name") >> name_; } // Code snippets