diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files
index 8476427b52..8ad81a5a04 100644
--- a/src/finiteVolume/Make/files
+++ b/src/finiteVolume/Make/files
@@ -272,6 +272,12 @@ $(volumeExpr)/volumeExprDriverFields.C
$(volumeExpr)/volumeExprLemonParser.lyy-m4
$(volumeExpr)/volumeExprScanner.cc
+fieldExpr = $(expr)/fields
+$(fieldExpr)/base/patchExprFieldBase.C
+$(fieldExpr)/fvPatchFields/exprFixedValueFvPatchFields.C
+$(fieldExpr)/fvPatchFields/exprMixedFvPatchFields.C
+$(fieldExpr)/pointPatchFields/exprValuePointPatchFields.C
+
fvMatrices/fvMatrices.C
fvMatrices/fvScalarMatrix/fvScalarMatrix.C
diff --git a/src/finiteVolume/expressions/fields/base/patchExprFieldBase.C b/src/finiteVolume/expressions/fields/base/patchExprFieldBase.C
new file mode 100644
index 0000000000..a00d9b115d
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/base/patchExprFieldBase.C
@@ -0,0 +1,186 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2011-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "patchExprFieldBase.H"
+#include "facePointPatch.H"
+#include "fvMesh.H"
+#include "fvPatch.H"
+#include "pointMesh.H"
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+const Foam::fvPatch&
+Foam::expressions::patchExprFieldBase::getFvPatch(const facePointPatch& pp)
+{
+ const polyMesh& pmesh = pp.boundaryMesh().mesh().mesh();
+
+ const fvMesh* meshptr = isA(pmesh);
+
+ if (!meshptr)
+ {
+ FatalErrorInFunction
+ << "Point patch not attached to a base fvMesh, "
+ << "cannot use patch expressions" << nl << endl
+ << exit(FatalError);
+ }
+
+ return meshptr->boundary()[pp.index()];
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::expressions::patchExprFieldBase::patchExprFieldBase()
+:
+ patchExprFieldBase(false)
+{}
+
+
+Foam::expressions::patchExprFieldBase::patchExprFieldBase
+(
+ bool allowGradient
+)
+:
+ debug_(false),
+ allowGradient_(allowGradient),
+ evalOnConstruct_(false),
+ valueExpr_(),
+ gradExpr_(),
+ fracExpr_()
+{}
+
+
+Foam::expressions::patchExprFieldBase::patchExprFieldBase
+(
+ const dictionary& dict,
+ bool allowGradient,
+ bool isPointVal
+)
+:
+ debug_(dict.lookupOrDefault("debug", false)),
+ allowGradient_(allowGradient),
+ evalOnConstruct_(dict.lookupOrDefault("evalOnConstruct", false)),
+ valueExpr_(),
+ gradExpr_(),
+ fracExpr_()
+{
+ if (debug_)
+ {
+ Info<< "Expression BC with " << dict << nl;
+ }
+
+ string expr;
+
+ if (dict.readIfPresent("valueExpr", expr))
+ {
+ valueExpr_ = expressions::exprString(expr, dict);
+ }
+ else
+ {
+ // No value expression - same as Zero
+ if (debug_)
+ {
+ Info<< "No valueExpr" << nl;
+ }
+ }
+
+ if (allowGradient)
+ {
+ if (dict.readIfPresent("gradientExpr", expr))
+ {
+ gradExpr_ = expressions::exprString(expr, dict);
+ }
+ else
+ {
+ // No gradient expression - same as Zero
+
+ if (debug_)
+ {
+ Info<< "No gradientExpr" << nl;
+ }
+ }
+
+ if (dict.readIfPresent("fractionExpr", expr))
+ {
+ if (!expr.empty() && expr != "0")
+ {
+ if (isPointVal)
+ {
+ expr = "toPoint(" + expr + ")";
+ }
+
+ fracExpr_ = expressions::exprString(expr, dict);
+ }
+ }
+ else
+ {
+ // No fraction expression - same as 1 (one)
+ // Mixed BC may elect to simply ignore gradient expression
+ }
+ }
+}
+
+
+Foam::expressions::patchExprFieldBase::patchExprFieldBase
+(
+ const patchExprFieldBase& rhs
+)
+:
+ debug_(rhs.debug_),
+ allowGradient_(rhs.allowGradient_),
+ evalOnConstruct_(rhs.evalOnConstruct_),
+ valueExpr_(rhs.valueExpr_),
+ gradExpr_(rhs.gradExpr_),
+ fracExpr_(rhs.fracExpr_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::expressions::patchExprFieldBase::write(Ostream& os) const
+{
+ os.writeEntryIfDifferent("evalOnConstruct", false, evalOnConstruct_);
+
+ // Do not emit debug_ value
+
+ if (!valueExpr_.empty())
+ {
+ os.writeEntry("valueExpr", valueExpr_);
+ }
+ if (!gradExpr_.empty())
+ {
+ os.writeEntry("gradientExpr", gradExpr_);
+ }
+ if (!fracExpr_.empty())
+ {
+ os.writeEntry("fractionExpr", fracExpr_);
+ }
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/base/patchExprFieldBase.H b/src/finiteVolume/expressions/fields/base/patchExprFieldBase.H
new file mode 100644
index 0000000000..5c802b10aa
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/base/patchExprFieldBase.H
@@ -0,0 +1,131 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2011-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::expressions::patchExprFieldBase
+
+Description
+ Base class for managing patches with expressions.
+ The expected input supports values, gradients and mixed conditions
+
+Usage
+ \table
+ Property | Description | Required | Default
+ valueExpr | expression for fixed value | no | 0
+ gradientExpr | expression for patch normal gradient | no | 0
+ fractionExpr | expression for value fraction weight | no | 1
+ \endtable
+
+SourceFiles
+ patchExprFieldBase.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef expressions_patchExprFieldBase_H
+#define expressions_patchExprFieldBase_H
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "dictionary.H"
+#include "exprString.H"
+
+namespace Foam
+{
+
+// Forward Declarations
+class facePointPatch;
+class fvPatch;
+
+namespace expressions
+{
+
+/*---------------------------------------------------------------------------*\
+ Class patchExprFieldBase Declaration
+\*---------------------------------------------------------------------------*/
+
+class patchExprFieldBase
+{
+protected:
+
+ // Protected Data
+
+ bool debug_;
+ bool allowGradient_;
+
+ //- Slightly dodgy concept here
+ bool evalOnConstruct_;
+
+ // The expressions
+ expressions::exprString valueExpr_;
+ expressions::exprString gradExpr_;
+ expressions::exprString fracExpr_;
+
+
+public:
+
+ // Static Methods
+
+ //- Find (guess) fvPatch from a pointPatch
+ static const fvPatch& getFvPatch(const facePointPatch& fp);
+
+
+ // Constructors
+
+ //- Null constructor
+ patchExprFieldBase();
+
+ //- Construct with specified gradient handling
+ explicit patchExprFieldBase(bool allowGradient);
+
+ //- Construct from dictionary
+ explicit patchExprFieldBase
+ (
+ const dictionary& dict,
+ bool allowGradient = false,
+ bool isPointVal = false
+ );
+
+ //- Copy constructor
+ patchExprFieldBase(const patchExprFieldBase& rhs);
+
+
+ // Member Functions
+
+ //- Write
+ void write(Ostream& os) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace expressions
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C
new file mode 100644
index 0000000000..35eab824d2
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.C
@@ -0,0 +1,215 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2009-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "exprFixedValueFvPatchField.H"
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+template
+void Foam::exprFixedValueFvPatchField::setDebug()
+{
+ if (expressions::patchExprFieldBase::debug_ && !debug)
+ {
+ debug = 1;
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::exprFixedValueFvPatchField::exprFixedValueFvPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ fixedValueFvPatchField(p, iF),
+ expressions::patchExprFieldBase(false),
+ driver_(this->patch())
+{}
+
+
+template
+Foam::exprFixedValueFvPatchField::exprFixedValueFvPatchField
+(
+ const exprFixedValueFvPatchField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ fixedValueFvPatchField(ptf, p, iF, mapper),
+ expressions::patchExprFieldBase(ptf),
+ driver_(this->patch(), ptf.driver_)
+{
+ setDebug();
+ DebugInFunction << nl;
+}
+
+
+template
+Foam::exprFixedValueFvPatchField::exprFixedValueFvPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict,
+ const bool valueRequired
+)
+:
+ fixedValueFvPatchField(p, iF),
+ expressions::patchExprFieldBase(dict),
+ driver_(this->patch(), dict)
+{
+ setDebug();
+ DebugInFunction << nl;
+
+ // Basic sanity
+ if (this->valueExpr_.empty())
+ {
+ FatalIOErrorInFunction(dict)
+ << "The valueExpr was not defined!" << nl
+ << exit(FatalIOError);
+ }
+
+ driver_.readDict(dict);
+
+ if (dict.found("value"))
+ {
+ fvPatchField::operator=
+ (
+ Field("value", dict, p.size())
+ );
+ }
+ else
+ {
+ (*this) == this->patchInternalField();
+
+ WarningInFunction
+ << "No value defined for "
+ << this->internalField().name() << " on "
+ << this->patch().name() << " - setting to internalField value "
+ << nl;
+ }
+
+ if (this->evalOnConstruct_)
+ {
+ // For potentialFoam or other solvers that don't evaluate
+ this->evaluate();
+ }
+}
+
+
+template
+Foam::exprFixedValueFvPatchField::exprFixedValueFvPatchField
+(
+ const exprFixedValueFvPatchField& ptf
+)
+:
+ fixedValueFvPatchField(ptf),
+ expressions::patchExprFieldBase(ptf),
+ driver_(this->patch(), ptf.driver_)
+{
+ setDebug();
+ DebugInFunction << nl;
+}
+
+
+template
+Foam::exprFixedValueFvPatchField::exprFixedValueFvPatchField
+(
+ const exprFixedValueFvPatchField& ptf,
+ const DimensionedField& iF
+)
+:
+ fixedValueFvPatchField(ptf, iF),
+ expressions::patchExprFieldBase(ptf),
+ driver_(this->patch(), ptf.driver_)
+{
+ setDebug();
+ DebugInFunction << nl;
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+void Foam::exprFixedValueFvPatchField::updateCoeffs()
+{
+ if (debug)
+ {
+ InfoInFunction
+ << "Value: " << this->valueExpr_ << nl
+ << "Variables: ";
+ driver_.writeVariableStrings(Info) << endl;
+ }
+
+ if (this->updated())
+ {
+ return;
+ }
+
+ DebugInFunction
+ << "updating" << nl;
+
+ // Expression evaluation
+ {
+ driver_.clearVariables();
+
+ if (this->valueExpr_.empty())
+ {
+ (*this) == Zero;
+ }
+ else
+ {
+ tmp> tresult(driver_.evaluate(this->valueExpr_));
+
+ if (debug)
+ {
+ Info<< "Evaluated: " << tresult();
+ }
+
+ (*this) == tresult;
+ }
+ }
+
+ fixedValueFvPatchField::updateCoeffs();
+}
+
+
+template
+void Foam::exprFixedValueFvPatchField::write(Ostream& os) const
+{
+ fixedValueFvPatchField::write(os);
+ expressions::patchExprFieldBase::write(os);
+
+ // driver_.writeCommon(os, this->debug_ || debug);
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H
new file mode 100644
index 0000000000..a1282f9542
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchField.H
@@ -0,0 +1,175 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2009-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::exprFixedValueFvPatchField
+
+Description
+ A fixed value boundary condition with expressions.
+
+Usage
+ \table
+ Property | Description | Required | Default
+ value | fixed value | yes |
+ valueExpr | expression for fixed value | yes |
+ \endtable
+
+SourceFiles
+ exprFixedValueFvPatchField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprFixedValueFvPatchField_H
+#define exprFixedValueFvPatchField_H
+
+#include "fixedValueFvPatchField.H"
+#include "patchExprFieldBase.H"
+#include "patchExprDriver.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class exprFixedValueFvPatchField Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class exprFixedValueFvPatchField
+:
+ public fixedValueFvPatchField,
+ public expressions::patchExprFieldBase
+{
+protected:
+
+ // Protected Data
+
+ //- The expression driver
+ expressions::patchExpr::parseDriver driver_;
+
+
+ // Protected Member Functions
+
+ //- Set debug ON if "debug" is enabled
+ void setDebug();
+
+
+public:
+
+ //- Runtime type information
+ TypeName("exprFixedValue");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ exprFixedValueFvPatchField
+ (
+ const fvPatch& p,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ exprFixedValueFvPatchField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary& dict,
+ const bool valueRequired=true
+ );
+
+ //- Construct by mapping given exprFixedValueFvPatchField
+ //- onto a new patch
+ exprFixedValueFvPatchField
+ (
+ const exprFixedValueFvPatchField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ exprFixedValueFvPatchField
+ (
+ const exprFixedValueFvPatchField&
+ );
+
+
+ //- Construct and return a clone
+ virtual tmp> clone() const
+ {
+ return tmp>
+ (
+ new exprFixedValueFvPatchField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ exprFixedValueFvPatchField
+ (
+ const exprFixedValueFvPatchField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp> clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp>
+ (
+ new exprFixedValueFvPatchField(*this, iF)
+ );
+ }
+
+
+ // Member Functions
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+ //- Write
+ virtual void write(Ostream& os) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+ #include "exprFixedValueFvPatchField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFields.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFields.C
new file mode 100644
index 0000000000..5695a23af9
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFields.C
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "exprFixedValueFvPatchFields.H"
+#include "volFields.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+makePatchFields(exprFixedValue);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFields.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFields.H
new file mode 100644
index 0000000000..cab541738e
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFields.H
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprFixedValueFvPatchFields_H
+#define exprFixedValueFvPatchFields_H
+
+#include "exprFixedValueFvPatchField.H"
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePatchTypeFieldTypedefs(exprFixedValue);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFieldsFwd.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFieldsFwd.H
new file mode 100644
index 0000000000..375adc50be
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprFixedValueFvPatchFieldsFwd.H
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprFixedValueFvPatchFieldsFwd_H
+#define exprFixedValueFvPatchFieldsFwd_H
+
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template class exprFixedValueFvPatchField;
+
+makePatchTypeFieldTypedefs(exprFixedValue);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C
new file mode 100644
index 0000000000..c145744333
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.C
@@ -0,0 +1,309 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2009-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+\*---------------------------------------------------------------------------*/
+
+#include "exprMixedFvPatchField.H"
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+template
+void Foam::exprMixedFvPatchField::setDebug()
+{
+ if (expressions::patchExprFieldBase::debug_ && !debug)
+ {
+ debug = 1;
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::exprMixedFvPatchField::exprMixedFvPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchField(p, iF),
+ expressions::patchExprFieldBase(true), // allowGradient
+ driver_(this->patch())
+{
+ this->refValue() = Zero;
+ this->refGrad() = Zero;
+ this->valueFraction() = scalar(1);
+}
+
+
+template
+Foam::exprMixedFvPatchField::exprMixedFvPatchField
+(
+ const exprMixedFvPatchField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mixedFvPatchField(ptf, p, iF, mapper),
+ expressions::patchExprFieldBase(ptf),
+ driver_(this->patch(), ptf.driver_)
+{
+ setDebug();
+ DebugInFunction << nl;
+}
+
+
+template
+Foam::exprMixedFvPatchField::exprMixedFvPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ mixedFvPatchField(p, iF),
+ expressions::patchExprFieldBase(dict, true),
+ driver_(this->patch(), dict)
+{
+ setDebug();
+ DebugInFunction << nl;
+
+ // Basic sanity checks
+ if (this->valueExpr_.empty() && this->gradExpr_.empty())
+ {
+ if (this->valueExpr_.empty())
+ {
+ FatalIOErrorInFunction(dict)
+ << "The valueExpr was not defined!" << nl
+ << exit(FatalIOError);
+ }
+ if (this->gradExpr_.empty())
+ {
+ FatalIOErrorInFunction(dict)
+ << "The gradientExpr was not defined!" << nl
+ << exit(FatalIOError);
+ }
+ }
+
+
+ driver_.readDict(dict);
+
+ // Similar to fvPatchField constructor, which we have bypassed
+ dict.readIfPresent("patchType", this->patchType());
+
+ if (dict.found("refValue"))
+ {
+ this->refValue() = Field("refValue", dict, p.size());
+ }
+ else
+ {
+ this->refValue() = this->patchInternalField();
+ }
+
+ if (dict.found("value"))
+ {
+ fvPatchField::operator=
+ (
+ Field("value", dict, p.size())
+ );
+
+ if (!dict.found("refValue"))
+ {
+ // Ensure refValue has a sensible value for the "update" below
+ this->refValue() = Field("value", dict, p.size());
+ }
+ }
+ else
+ {
+ fvPatchField::operator=(this->refValue());
+
+ WarningInFunction
+ << "No value defined for "
+ << this->internalField().name()
+ << " on " << this->patch().name() << " therefore using "
+ << "the internal field next to the patch"
+ << endl;
+ }
+
+
+ if (dict.found("refGradient"))
+ {
+ this->refGrad() = Field("refGradient", dict, p.size());
+ }
+ else
+ {
+ this->refGrad() = Zero;
+ }
+
+ if (dict.found("valueFraction"))
+ {
+ this->valueFraction() = Field("valueFraction", dict, p.size());
+ }
+ else
+ {
+ this->valueFraction() = 1;
+ }
+
+
+ if (this->evalOnConstruct_)
+ {
+ // For potentialFoam or other solvers that don't evaluate
+ this->evaluate();
+ }
+ else
+ {
+ // Emulate mixedFvPatchField::evaluate,
+ // but avoid our own updateCoeffs
+ if (!this->updated())
+ {
+ this->mixedFvPatchField::updateCoeffs();
+ }
+
+ Field::operator=
+ (
+ this->valueFraction()*this->refValue()
+ +
+ (1.0 - this->valueFraction())*
+ (
+ this->patchInternalField()
+ + this->refGrad()/this->patch().deltaCoeffs()
+ )
+ );
+
+ fvPatchField::evaluate();
+ }
+}
+
+
+template
+Foam::exprMixedFvPatchField::exprMixedFvPatchField
+(
+ const exprMixedFvPatchField& ptf
+)
+:
+ mixedFvPatchField(ptf),
+ expressions::patchExprFieldBase(ptf),
+ driver_(this->patch(), ptf.driver_)
+{
+ setDebug();
+ DebugInFunction << nl;
+}
+
+
+template
+Foam::exprMixedFvPatchField::exprMixedFvPatchField
+(
+ const exprMixedFvPatchField& ptf,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchField(ptf, iF),
+ expressions::patchExprFieldBase(ptf),
+ driver_(this->patch(), ptf.driver_)
+{
+ setDebug();
+ DebugInFunction << nl;
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+void Foam::exprMixedFvPatchField::updateCoeffs()
+{
+ if (debug)
+ {
+ InfoInFunction
+ << "Value: " << this->valueExpr_ << nl
+ << "Gradient: " << this->gradExpr_ << nl
+ << "Fraction: " << this->fracExpr_ << nl
+ << "Variables: ";
+
+ driver_.writeVariableStrings(Info) << endl;
+ }
+
+ if (this->updated())
+ {
+ return;
+ }
+
+ DebugInFunction << " - updating" << nl;
+
+
+ // Expression evaluation
+ {
+ driver_.clearVariables();
+
+ if (this->valueExpr_.empty())
+ {
+ this->refValue() = Zero;
+ }
+ else
+ {
+ this->refValue() = driver_.evaluate(this->valueExpr_);
+ }
+
+ bool evalGrad = !this->gradExpr_.empty();
+
+ if (this->fracExpr_.empty() || this->fracExpr_ == "1")
+ {
+ evalGrad = false;
+ this->valueFraction() = scalar(1);
+ }
+ else if (this->fracExpr_ == "0")
+ {
+ this->valueFraction() = Zero;
+ }
+ else
+ {
+ this->valueFraction() = driver_.evaluate(this->fracExpr_);
+ }
+
+ if (evalGrad)
+ {
+ this->refGrad() = driver_.evaluate(this->gradExpr_);
+ }
+ else
+ {
+ this->refGrad() = Zero;
+ }
+ }
+
+ mixedFvPatchField::updateCoeffs();
+}
+
+
+template
+void Foam::exprMixedFvPatchField::write(Ostream& os) const
+{
+ mixedFvPatchField::write(os);
+ expressions::patchExprFieldBase::write(os);
+
+ // driver_.writeCommon(os, this->debug_ || debug);
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H
new file mode 100644
index 0000000000..7ac843cacb
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchField.H
@@ -0,0 +1,172 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2009-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::exprMixedFvPatchField
+
+Description
+ Foam::exprMixedFvPatchField
+
+Usage
+ \table
+ Property | Description | Required | Default
+ valueExpr | expression for fixed value | no | 0
+ gradientExpr | expression for patch normal gradient | no | 0
+ fractionExpr | expression for value weighting | no | 1
+ \endtable
+
+SourceFiles
+ exprMixedFvPatchField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprMixedFvPatchField_H
+#define exprMixedFvPatchField_H
+
+#include "mixedFvPatchField.H"
+#include "patchExprFieldBase.H"
+#include "patchExprDriver.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class exprMixedFvPatchField Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class exprMixedFvPatchField
+:
+ public mixedFvPatchField,
+ public expressions::patchExprFieldBase
+{
+protected:
+
+ // Protected Data
+
+ //- The expression driver
+ expressions::patchExpr::parseDriver driver_;
+
+
+ // Protected Member Functions
+
+ //- Set debug ON if "debug" is enabled
+ void setDebug();
+
+
+public:
+
+ //- Runtime type information
+ TypeName("exprMixed");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ exprMixedFvPatchField
+ (
+ const fvPatch& p,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ exprMixedFvPatchField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary& dict
+ );
+
+ //- Construct by mapping given exprMixedFvPatchField onto a new patch
+ exprMixedFvPatchField
+ (
+ const exprMixedFvPatchField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ exprMixedFvPatchField
+ (
+ const exprMixedFvPatchField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp> clone() const
+ {
+ return tmp>
+ (
+ new exprMixedFvPatchField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ exprMixedFvPatchField
+ (
+ const exprMixedFvPatchField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp > clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp>
+ (
+ new exprMixedFvPatchField(*this, iF)
+ );
+ }
+
+
+ // Member Functions
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+ //- Write
+ virtual void write(Ostream& os) const;
+};
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+ #include "exprMixedFvPatchField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFields.C b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFields.C
new file mode 100644
index 0000000000..730fee6baa
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFields.C
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "exprMixedFvPatchFields.H"
+#include "volFields.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+makePatchFields(exprMixed);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFields.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFields.H
new file mode 100644
index 0000000000..40531f0295
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFields.H
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprMixedFvPatchFields_H
+#define exprMixedFvPatchFields_H
+
+#include "exprMixedFvPatchField.H"
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePatchTypeFieldTypedefs(exprMixed);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFieldsFwd.H b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFieldsFwd.H
new file mode 100644
index 0000000000..2db491b761
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/fvPatchFields/exprMixedFvPatchFieldsFwd.H
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprMixedFvPatchFieldsFwd_H
+#define exprMixedFvPatchFieldsFwd_H
+
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template class exprMixedFvPatchField;
+
+makePatchTypeFieldTypedefs(exprMixed);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C
new file mode 100644
index 0000000000..34585032cf
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.C
@@ -0,0 +1,219 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2010-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "exprValuePointPatchField.H"
+#include "pointPatchFieldMapper.H"
+#include "typeInfo.H"
+#include "facePointPatch.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::exprValuePointPatchField::exprValuePointPatchField
+(
+ const pointPatch& p,
+ const DimensionedField& iF
+)
+:
+ valuePointPatchField(p, iF),
+ expressions::patchExprFieldBase(false),
+ driver_
+ (
+ expressions::patchExprFieldBase::getFvPatch
+ (
+ dynamicCast(this->patch())
+ )
+ )
+{}
+
+
+template
+Foam::exprValuePointPatchField::exprValuePointPatchField
+(
+ const exprValuePointPatchField& ptf,
+ const pointPatch& p,
+ const DimensionedField& iF,
+ const pointPatchFieldMapper& mapper
+)
+:
+ valuePointPatchField(ptf, p, iF, mapper),
+ expressions::patchExprFieldBase(ptf),
+ driver_
+ (
+ expressions::patchExprFieldBase::getFvPatch
+ (
+ dynamicCast(this->patch())
+ ),
+ ptf.driver_
+ )
+{}
+
+
+template
+Foam::exprValuePointPatchField::exprValuePointPatchField
+(
+ const pointPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ valuePointPatchField(p, iF),
+ expressions::patchExprFieldBase(dict, false, true),
+ driver_
+ (
+ expressions::patchExprFieldBase::getFvPatch
+ (
+ dynamicCast(this->patch())
+ ),
+ dict
+ )
+{
+ // Basic sanity
+ if (this->valueExpr_.empty())
+ {
+ FatalIOErrorInFunction(dict)
+ << "The valueExpr was not defined!" << nl
+ << exit(FatalIOError);
+ }
+
+ driver_.readDict(dict);
+
+ if (dict.found("value"))
+ {
+ Field::operator=
+ (
+ Field("value", dict, p.size())
+ );
+ }
+ else
+ {
+ WarningInFunction
+ << "No value defined for "
+ << this->internalField().name()
+ << " on " << this->patch().name()
+ << endl;
+ }
+
+ if (this->evalOnConstruct_)
+ {
+ // For potentialFoam or other solvers that don't evaluate
+ this->evaluate();
+ }
+}
+
+
+template
+Foam::exprValuePointPatchField::exprValuePointPatchField
+(
+ const exprValuePointPatchField& ptf,
+ const DimensionedField& iF
+)
+:
+ valuePointPatchField(ptf, iF),
+ expressions::patchExprFieldBase(ptf),
+ driver_
+ (
+ expressions::patchExprFieldBase::getFvPatch
+ (
+ dynamicCast(this->patch())
+ ),
+ ptf.driver_
+ )
+{}
+
+
+template
+Foam::exprValuePointPatchField::exprValuePointPatchField
+(
+ const exprValuePointPatchField& ptf
+)
+:
+ valuePointPatchField(ptf),
+ expressions::patchExprFieldBase(ptf),
+ driver_
+ (
+ expressions::patchExprFieldBase::getFvPatch
+ (
+ dynamicCast(this->patch())
+ ),
+ ptf.driver_
+ )
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+void Foam::exprValuePointPatchField::updateCoeffs()
+{
+ if (debug)
+ {
+ InfoInFunction
+ << "Value: " << this->valueExpr_ << nl
+ << "Variables: ";
+ driver_.writeVariableStrings(Info) << endl;
+ }
+
+ if (this->updated())
+ {
+ return;
+ }
+
+ // Expression evaluation
+ {
+ driver_.clearVariables();
+
+ if (this->valueExpr_.empty())
+ {
+ (*this) == Zero;
+ }
+ else
+ {
+ Field::operator=
+ (
+ driver_.evaluate(this->valueExpr_, true)
+ );
+ }
+ }
+
+ valuePointPatchField::updateCoeffs();
+}
+
+
+template
+void Foam::exprValuePointPatchField::write(Ostream& os) const
+{
+ valuePointPatchField::write(os);
+ expressions::patchExprFieldBase::write(os);
+
+ this->writeEntry("value",os);
+
+ // driver_.writeCommon(os,this->debug_ || debug);
+}
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H
new file mode 100644
index 0000000000..b051134bf6
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchField.H
@@ -0,0 +1,175 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Original code Copyright (C) 2010-2018 Bernhard Gschaider
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::exprValuePointPatchField
+
+Description
+ A fixed value boundary condition with expressions.
+
+Usage
+ \table
+ Property | Description | Required | Default
+ value | fixed value | yes |
+ valueExpr | expression for fixed value | yes |
+ \endtable
+
+SourceFiles
+ exprValuePointPatchField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprValuePointPatchField_H
+#define exprValuePointPatchField_H
+
+#include "valuePointPatchField.H"
+#include "patchExprFieldBase.H"
+#include "patchExprDriver.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class exprValuePointPatchField Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class exprValuePointPatchField
+:
+ public valuePointPatchField,
+ public expressions::patchExprFieldBase
+{
+protected:
+
+ // Protected Data
+
+ //- The expression driver
+ expressions::patchExpr::parseDriver driver_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("exprValue");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ exprValuePointPatchField
+ (
+ const pointPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ exprValuePointPatchField
+ (
+ const pointPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given patchField onto a new patch
+ exprValuePointPatchField
+ (
+ const exprValuePointPatchField&,
+ const pointPatch&,
+ const DimensionedField&,
+ const pointPatchFieldMapper&
+ );
+
+ //- Construct as copy setting internal field reference
+ exprValuePointPatchField
+ (
+ const exprValuePointPatchField&,
+ const DimensionedField&
+ );
+
+ //- Construct as copy
+ exprValuePointPatchField
+ (
+ const exprValuePointPatchField&
+ );
+
+
+ //- Construct and return a clone
+ virtual autoPtr > clone() const
+ {
+ return autoPtr>
+ (
+ new exprValuePointPatchField
+ (
+ *this
+ )
+ );
+ }
+
+
+ //- Construct and return a clone setting internal field reference
+ virtual autoPtr> clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return autoPtr>
+ (
+ new exprValuePointPatchField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member Functions
+
+ //- Update the patch field
+ virtual void updateCoeffs();
+
+ //- Write
+ virtual void write(Ostream& os) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+# include "exprValuePointPatchField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C
new file mode 100644
index 0000000000..e9cca570dd
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.C
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "exprValuePointPatchFields.H"
+#include "pointPatchFields.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+makePointPatchFields(exprValue);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.H b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.H
new file mode 100644
index 0000000000..b0035fcac8
--- /dev/null
+++ b/src/finiteVolume/expressions/fields/pointPatchFields/exprValuePointPatchFields.H
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2019 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef exprValuePointPatchFields_H
+#define exprValuePointPatchFields_H
+
+#include "exprValuePointPatchField.H"
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePointPatchFieldTypedefs(exprValue);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //