From cf56850a5b1f431f3218bde956cc0abcd2847e22 Mon Sep 17 00:00:00 2001 From: ignis Date: Tue, 4 Sep 2018 18:35:41 +0900 Subject: [PATCH] dummy bc for 1-D premixed flame --- flameControllingVelocity/Make/files | 3 + flameControllingVelocity/Make/options | 9 + ...ameControllingVelocityFvPatchVectorField.C | 165 +++++++++++++++ ...ameControllingVelocityFvPatchVectorField.H | 195 ++++++++++++++++++ 4 files changed, 372 insertions(+) create mode 100644 flameControllingVelocity/Make/files create mode 100644 flameControllingVelocity/Make/options create mode 100644 flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C create mode 100644 flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H diff --git a/flameControllingVelocity/Make/files b/flameControllingVelocity/Make/files new file mode 100644 index 0000000..6084663 --- /dev/null +++ b/flameControllingVelocity/Make/files @@ -0,0 +1,3 @@ +flameControllingVelocityFvPatchVectorField.C + +LIB = $(FOAM_USER_LIBBIN)/libFlameBC diff --git a/flameControllingVelocity/Make/options b/flameControllingVelocity/Make/options new file mode 100644 index 0000000..97dc674 --- /dev/null +++ b/flameControllingVelocity/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +LIB_LIBS = \ + -lOpenFOAM \ + -ltriSurface \ + -lmeshTools diff --git a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C new file mode 100644 index 0000000..762ef2f --- /dev/null +++ b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ 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 "flameControllingVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "fvPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::flameControllingVelocityFvPatchVectorField:: +flameControllingVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + refValue_(p.size()) +{} + + +Foam::flameControllingVelocityFvPatchVectorField:: +flameControllingVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + refValue_("refValue", dict, p.size()) +{ + fvPatchVectorField::operator=(refValue_*patch().nf()); +} + + +Foam::flameControllingVelocityFvPatchVectorField:: +flameControllingVelocityFvPatchVectorField +( + const flameControllingVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(p, iF), + refValue_(ptf.refValue_, mapper) +{ + // Note: calculate product only on ptf to avoid multiplication on + // unset values in reconstructPar. + fvPatchVectorField::operator= + ( + vectorField + ( + ptf.refValue_*ptf.patch().nf(), + mapper + ) + ); +} + + +Foam::flameControllingVelocityFvPatchVectorField:: +flameControllingVelocityFvPatchVectorField +( + const flameControllingVelocityFvPatchVectorField& pivpvf +) +: + fixedValueFvPatchVectorField(pivpvf), + refValue_(pivpvf.refValue_) +{} + + +Foam::flameControllingVelocityFvPatchVectorField:: +flameControllingVelocityFvPatchVectorField +( + const flameControllingVelocityFvPatchVectorField& pivpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(pivpvf, iF), + refValue_(pivpvf.refValue_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::flameControllingVelocityFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchVectorField::autoMap(m); + refValue_.autoMap(m); +} + + +void Foam::flameControllingVelocityFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchVectorField::rmap(ptf, addr); + + const flameControllingVelocityFvPatchVectorField& tiptf = + refCast(ptf); + + refValue_.rmap(tiptf.refValue_, addr); +} + + +void Foam::flameControllingVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + fvPatchVectorField::operator=(refValue_*patch().nf()); + fvPatchVectorField::updateCoeffs(); +} + + +void Foam::flameControllingVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + refValue_.writeEntry("refValue", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + flameControllingVelocityFvPatchVectorField + ); +} + +// ************************************************************************* // diff --git a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H new file mode 100644 index 0000000..b0df8d4 --- /dev/null +++ b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ 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::flameControllingVelocityFvPatchVectorField + +Group + grpGenericBoundaryConditions grpInletBoundaryConditions + +Description + This boundary condition provides a surface-normal vector boundary condition + by its magnitude. + +Usage + \table + Property | Description | Required | Default value + refValue | reference value | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + + { + type flameControllingVelocity; + refValue uniform -10; // 10 INTO the domain + } + \endverbatim + +Note + Sign conventions: + - the value is positive for outward-pointing vectors + +See also + Foam::fixedValueFvPatchField + +SourceFiles + flameControllingVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef flameControllingVelocityFvPatchVectorField_H +#define flameControllingVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class flameControllingVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class flameControllingVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + scalarField refValue_; + + +public: + + //- Runtime type information + TypeName("flameControllingVelocity"); + + + // Constructors + + //- Construct from patch and internal field + flameControllingVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + flameControllingVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // flameControllingVelocityFvPatchVectorField + // onto a new patch + flameControllingVelocityFvPatchVectorField + ( + const flameControllingVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + flameControllingVelocityFvPatchVectorField + ( + const flameControllingVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new flameControllingVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + flameControllingVelocityFvPatchVectorField + ( + const flameControllingVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new flameControllingVelocityFvPatchVectorField + ( + *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&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //