From 8d7b8043a49706fcfdfaf29daf612377ce5c34ab Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 22 Aug 2019 12:28:30 +0200 Subject: [PATCH] ENH: add time ramping to surfaceNormalFixedValue (#1407) - alternatively can use uniformNormalFixedValue with PatchFunction1 specification and temporal ramping. TUT: add ramped example for simpleCar --- src/finiteVolume/Make/files | 1 + ...urfaceNormalFixedValueFvPatchVectorField.C | 68 ++++-- ...urfaceNormalFixedValueFvPatchVectorField.H | 13 +- ...niformNormalFixedValueFvPatchVectorField.C | 205 ++++++++++++++++++ ...niformNormalFixedValueFvPatchVectorField.H | 203 +++++++++++++++++ .../incompressible/simpleFoam/simpleCar/0/U | 36 ++- .../simpleFoam/simpleCar/0/epsilon | 33 +-- .../incompressible/simpleFoam/simpleCar/0/k | 24 +- .../incompressible/simpleFoam/simpleCar/0/nut | 37 +--- .../incompressible/simpleFoam/simpleCar/0/p | 18 +- .../simpleFoam/simpleCar/Allrun | 1 + .../simpleCar/system/createPatchDict | 43 ++++ .../simpleFoam/simpleCar/system/topoSetDict | 17 ++ 13 files changed, 599 insertions(+), 100 deletions(-) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.H create mode 100644 tutorials/incompressible/simpleFoam/simpleCar/system/createPatchDict diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 81500b3e13..ede7556c61 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -209,6 +209,7 @@ $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/uniformInletOutlet/uniformInletOutletFvPatchFields.C $(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C $(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C +$(derivedFvPatchFields)/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C $(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C $(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C index d082e584ed..4a2257d1d0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -40,7 +40,8 @@ surfaceNormalFixedValueFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - refValue_(p.size()) + refValue_(p.size()), + ramp_(nullptr) {} @@ -53,9 +54,22 @@ surfaceNormalFixedValueFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF, dict, false), - refValue_("refValue", dict, p.size()) + refValue_("refValue", dict, p.size()), + ramp_(nullptr) { - fvPatchVectorField::operator=(refValue_*patch().nf()); + if (dict.found("ramp")) + { + ramp_ = Function1::New("ramp", dict); + } + + tmp tvalues(refValue_*patch().nf()); + + if (ramp_) + { + tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue()); + } + + fvPatchVectorField::operator=(tvalues); } @@ -69,36 +83,47 @@ surfaceNormalFixedValueFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - refValue_(ptf.refValue_, mapper, pTraits::zero) + refValue_(ptf.refValue_, mapper, pTraits::zero), + ramp_(ptf.ramp_.clone()) { // Note: refValue_ will have default value of 0 for unmapped faces. This // can temporarily happen during e.g. redistributePar. We should not // access ptf.patch() instead since redistributePar has destroyed this // at the time of mapping. - fvPatchVectorField::operator=(refValue_*patch().nf()); + + tmp tvalues(refValue_*patch().nf()); + + if (ramp_) + { + tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue()); + } + + fvPatchVectorField::operator=(tvalues); } Foam::surfaceNormalFixedValueFvPatchVectorField:: surfaceNormalFixedValueFvPatchVectorField ( - const surfaceNormalFixedValueFvPatchVectorField& pivpvf + const surfaceNormalFixedValueFvPatchVectorField& ptf ) : - fixedValueFvPatchVectorField(pivpvf), - refValue_(pivpvf.refValue_) + fixedValueFvPatchVectorField(ptf), + refValue_(ptf.refValue_), + ramp_(ptf.ramp_.clone()) {} Foam::surfaceNormalFixedValueFvPatchVectorField:: surfaceNormalFixedValueFvPatchVectorField ( - const surfaceNormalFixedValueFvPatchVectorField& pivpvf, + const surfaceNormalFixedValueFvPatchVectorField& ptf, const DimensionedField& iF ) : - fixedValueFvPatchVectorField(pivpvf, iF), - refValue_(pivpvf.refValue_) + fixedValueFvPatchVectorField(ptf, iF), + refValue_(ptf.refValue_), + ramp_(ptf.ramp_.clone()) {} @@ -106,11 +131,11 @@ surfaceNormalFixedValueFvPatchVectorField void Foam::surfaceNormalFixedValueFvPatchVectorField::autoMap ( - const fvPatchFieldMapper& m + const fvPatchFieldMapper& mapper ) { - fixedValueFvPatchVectorField::autoMap(m); - refValue_.autoMap(m); + fixedValueFvPatchVectorField::autoMap(mapper); + refValue_.autoMap(mapper); } @@ -136,7 +161,14 @@ void Foam::surfaceNormalFixedValueFvPatchVectorField::updateCoeffs() return; } - fvPatchVectorField::operator=(refValue_*patch().nf()); + tmp tvalues(refValue_*patch().nf()); + + if (ramp_) + { + tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue()); + } + + fvPatchVectorField::operator=(tvalues); fvPatchVectorField::updateCoeffs(); } @@ -145,6 +177,10 @@ void Foam::surfaceNormalFixedValueFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); refValue_.writeEntry("refValue", os); + if (ramp_) + { + ramp_->writeData(os); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H index 3515e7809a..60c0410330 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -35,8 +35,9 @@ Description Usage \table - Property | Description | Required | Default value - refValue | reference value | yes | + Property | Description | Required | Default + refValue | reference value | yes | + ramp | time-based ramping | no | \endtable Example of the boundary condition specification: @@ -65,6 +66,7 @@ SourceFiles #include "fvPatchFields.H" #include "fixedValueFvPatchFields.H" +#include "Function1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -79,10 +81,13 @@ class surfaceNormalFixedValueFvPatchVectorField : public fixedValueFvPatchVectorField { - // Private data + // Private Data scalarField refValue_; + //- Optional time ramping + autoPtr> ramp_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C new file mode 100644 index 0000000000..2505187a12 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.C @@ -0,0 +1,205 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "uniformNormalFixedValueFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "fvPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::uniformNormalFixedValueFvPatchVectorField:: +uniformNormalFixedValueFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + uniformValue_(nullptr), + ramp_(nullptr) +{} + + +Foam::uniformNormalFixedValueFvPatchVectorField:: +uniformNormalFixedValueFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF, dict, false), + uniformValue_(PatchFunction1::New(p.patch(), "uniformValue", dict)), + ramp_(nullptr) +{ + if (dict.found("ramp")) + { + ramp_ = Function1::New("ramp", dict); + } + + if (dict.found("value")) + { + fvPatchVectorField::operator= + ( + vectorField("value", dict, p.size()) + ); + } + else + { + this->evaluate(); + } +} + + +Foam::uniformNormalFixedValueFvPatchVectorField:: +uniformNormalFixedValueFvPatchVectorField +( + const uniformNormalFixedValueFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(p, iF), // Don't map + uniformValue_(ptf.uniformValue_.clone(p.patch())), + ramp_(ptf.ramp_.clone()) +{ + if (mapper.direct() && !mapper.hasUnmapped()) + { + // Use mapping instead of re-evaluation + this->map(ptf, mapper); + } + else + { + // Evaluate since value not mapped + this->evaluate(); + } +} + + +Foam::uniformNormalFixedValueFvPatchVectorField:: +uniformNormalFixedValueFvPatchVectorField +( + const uniformNormalFixedValueFvPatchVectorField& ptf +) +: + fixedValueFvPatchVectorField(ptf), + uniformValue_(ptf.uniformValue_.clone(this->patch().patch())), + ramp_(ptf.ramp_.clone()) +{} + + +Foam::uniformNormalFixedValueFvPatchVectorField:: +uniformNormalFixedValueFvPatchVectorField +( + const uniformNormalFixedValueFvPatchVectorField& ptf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(ptf, iF), + uniformValue_(ptf.uniformValue_.clone(this->patch().patch())), + ramp_(ptf.ramp_.clone()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::uniformNormalFixedValueFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& mapper +) +{ + fixedValueFvPatchVectorField::autoMap(mapper); + uniformValue_().autoMap(mapper); + + if (uniformValue_().constant()) + { + // If mapper is not dependent on time we're ok to evaluate + this->evaluate(); + } +} + + +void Foam::uniformNormalFixedValueFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchVectorField::rmap(ptf, addr); + + const uniformNormalFixedValueFvPatchVectorField& tiptf = + refCast(ptf); + + uniformValue_().rmap(tiptf.uniformValue_(), addr); +} + + +void Foam::uniformNormalFixedValueFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalar t = this->db().time().timeOutputValue(); + + tmp tvalues(uniformValue_->value(t)*patch().nf()); + + if (ramp_) + { + tvalues.ref() *= ramp_->value(t); + } + + fvPatchVectorField::operator=(tvalues); + fvPatchVectorField::updateCoeffs(); +} + + +void Foam::uniformNormalFixedValueFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + uniformValue_->writeData(os); + if (ramp_) + { + ramp_->writeData(os); + } + this->writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + uniformNormalFixedValueFvPatchVectorField + ); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.H new file mode 100644 index 0000000000..4fb32a9734 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformNormalFixedValue/uniformNormalFixedValueFvPatchVectorField.H @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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::uniformNormalFixedValueFvPatchVectorField + +Group + grpGenericBoundaryConditions grpInletBoundaryConditions + +Description + This boundary condition provides a uniform surface-normal + vector boundary condition by its magnitude. + +Usage + \table + Property | Description | Required | Default + uniformValue | uniform value | yes | + ramp | time-based ramping | no | + \endtable + + Example of the boundary condition specification: + \verbatim + + { + type uniformNormalFixedValue; + uniformValue constant -10; // 10 INTO the domain + } + \endverbatim + +Note + Sign conventions: + - the value is positive for outward-pointing vectors + +See also + Foam::Function1Types + Foam::fixedValueFvPatchField + Foam::surfaceNormalFixedValueFvPatchVectorField + Foam::uniformFixedValueFvPatchVectorField + +SourceFiles + uniformNormalFixedValueFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformNormalFixedValueFvPatchVectorField_H +#define uniformNormalFixedValueFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class uniformNormalFixedValueFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class uniformNormalFixedValueFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private Data + + autoPtr> uniformValue_; + + //- Optional time ramping + autoPtr> ramp_; + + +public: + + //- Runtime type information + TypeName("uniformNormalFixedValue"); + + + // Constructors + + //- Construct from patch and internal field + uniformNormalFixedValueFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + uniformNormalFixedValueFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // uniformNormalFixedValueFvPatchVectorField + // onto a new patch + uniformNormalFixedValueFvPatchVectorField + ( + const uniformNormalFixedValueFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + uniformNormalFixedValueFvPatchVectorField + ( + const uniformNormalFixedValueFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new uniformNormalFixedValueFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + uniformNormalFixedValueFvPatchVectorField + ( + const uniformNormalFixedValueFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new uniformNormalFixedValueFvPatchVectorField + ( + *this, + iF + ) + ); + } + + + // Member Functions + + // Mapping Functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchVectorField&, + const labelList& + ); + + + // Evaluation Functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/simpleCar/0/U b/tutorials/incompressible/simpleFoam/simpleCar/0/U index 07fa8f624c..3c0c4d5ef4 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/0/U +++ b/tutorials/incompressible/simpleFoam/simpleCar/0/U @@ -18,12 +18,42 @@ dimensions [0 1 -1 0 0 0 0]; internalField uniform (10 0 0); +// Surface normal with time ramping +intakeType1 +{ + type surfaceNormalFixedValue; + refValue uniform 1.2; + ramp table ((0 0) (10 1)); +} + +// Uniform surface normal with Function1 for ramping +intakeType2 +{ + type uniformNormalFixedValue; + uniformValue table ((0 0) (10 1.2)); +} + +// Uniform surface normal with time ramping +intakeType3 +{ + // Or directly with uniform value (ramping also possible) + type uniformNormalFixedValue; + uniformValue constant 1.2; + ramp table ((0 0) (10 1)); +} + + boundaryField { inlet { type fixedValue; - value uniform (10 0 0); + value $internalField; + } + + airIntake + { + $intakeType1; } outlet @@ -44,4 +74,8 @@ boundaryField } } + +#remove "intakeType.*" + + // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/simpleCar/0/epsilon b/tutorials/incompressible/simpleFoam/simpleCar/0/epsilon index c7857d58c4..2108810f12 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/0/epsilon +++ b/tutorials/incompressible/simpleFoam/simpleCar/0/epsilon @@ -24,40 +24,27 @@ boundaryField inlet { type fixedValue; - value uniform 0.125; + value $internalField; } - outlet - { - type zeroGradient; - } - upperWall + + "(body|upperWall|lowerWall)" { type epsilonWallFunction; - value uniform 0.125; - Cmu 0.09; - kappa 0.41; - E 9.8; - } - lowerWall - { - type epsilonWallFunction; - value uniform 0.125; - Cmu 0.09; - kappa 0.41; - E 9.8; - } - body - { - type epsilonWallFunction; - value uniform 0.125; + value $internalField; Cmu 0.09; kappa 0.41; E 9.8; } + frontAndBack { type empty; } + + ".*" + { + type zeroGradient; + } } diff --git a/tutorials/incompressible/simpleFoam/simpleCar/0/k b/tutorials/incompressible/simpleFoam/simpleCar/0/k index b63c254402..f628262584 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/0/k +++ b/tutorials/incompressible/simpleFoam/simpleCar/0/k @@ -24,31 +24,21 @@ boundaryField inlet { type fixedValue; - value uniform 0.375; + value $internalField; } - outlet - { - type zeroGradient; - } - upperWall + "(body|upperWall|lowerWall)" { type kqRWallFunction; - value uniform 0.375; - } - lowerWall - { - type kqRWallFunction; - value uniform 0.375; - } - body - { - type kqRWallFunction; - value uniform 0.375; + value $internalField; } frontAndBack { type empty; } + ".*" + { + type zeroGradient; + } } diff --git a/tutorials/incompressible/simpleFoam/simpleCar/0/nut b/tutorials/incompressible/simpleFoam/simpleCar/0/nut index cd1a384ea6..46c4e07d1b 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/0/nut +++ b/tutorials/incompressible/simpleFoam/simpleCar/0/nut @@ -21,44 +21,25 @@ internalField uniform 0; boundaryField { - inlet - { - type calculated; - value uniform 0; - } - outlet - { - type calculated; - value uniform 0; - } - upperWall + "(body|upperWall|lowerWall)" { type nutkWallFunction; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0; - } - lowerWall - { - type nutkWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 0; - } - body - { - type nutkWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 0; + value $internalField; } + frontAndBack { type empty; } + + ".*" + { + type calculated; + value $internalField; + } } diff --git a/tutorials/incompressible/simpleFoam/simpleCar/0/p b/tutorials/incompressible/simpleFoam/simpleCar/0/p index fdf977650d..21506b2714 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/0/p +++ b/tutorials/incompressible/simpleFoam/simpleCar/0/p @@ -20,26 +20,22 @@ internalField uniform 0; boundaryField { - inlet - { - type zeroGradient; - } - outlet { type fixedValue; - value uniform 0; - } - - "(body|upperWall|lowerWall)" - { - type zeroGradient; + value $internalField; } frontAndBack { type empty; } + + ".*" + { + type zeroGradient; + } + } // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/simpleCar/Allrun b/tutorials/incompressible/simpleFoam/simpleCar/Allrun index f88fe7fd92..2a7ff56032 100755 --- a/tutorials/incompressible/simpleFoam/simpleCar/Allrun +++ b/tutorials/incompressible/simpleFoam/simpleCar/Allrun @@ -4,6 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory runApplication blockMesh runApplication topoSet +runApplication createPatch -overwrite runApplication $(getApplication) #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/simpleFoam/simpleCar/system/createPatchDict b/tutorials/incompressible/simpleFoam/simpleCar/system/createPatchDict new file mode 100644 index 0000000000..2770eaeb3a --- /dev/null +++ b/tutorials/incompressible/simpleFoam/simpleCar/system/createPatchDict @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1906 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +pointSync false; + +// Patches to create +patches +( + { + // Name of new patch + name airIntake; + + // Dictionary to construct new patch from + patchInfo + { + type patch; + } + + // How to construct: either from 'patches' or 'set' + constructFrom set; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (); + + // If constructFrom = set : name of faceSet + set airIntake; + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/simpleCar/system/topoSetDict b/tutorials/incompressible/simpleFoam/simpleCar/system/topoSetDict index 59c8bdda88..7da8fad168 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/system/topoSetDict +++ b/tutorials/incompressible/simpleFoam/simpleCar/system/topoSetDict @@ -31,6 +31,23 @@ actions source setToCellZone; set porousCells; } + + { + name airIntake; + type faceSet; + action new; + source patchToFace; + patch body; + } + { + name airIntake; + type faceSet; + action subset; + source boxToFace; + box (2.6 0.75 0)(2.64 0.8 0.1); + } + + ); // ************************************************************************* //