src/atmosphericModels: New library containing models specific to atmospheric flows

Converted the atmBoundaryLayerInlet boundary conditions to inletOutlet to handle
changes in inflow orientation without the need for re-meshing.
This commit is contained in:
Henry Weller
2018-03-18 14:08:20 +00:00
parent 4b40886496
commit ea4fbd5e83
14 changed files with 103 additions and 41 deletions

View File

@ -33,7 +33,6 @@ $(nutWallFunctions)/nutWallFunction/nutWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C
@ -64,11 +63,5 @@ RASBCs = RAS/derivedFvPatchFields
$(RASBCs)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C $(RASBCs)/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
$(RASBCs)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C $(RASBCs)/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
/* Atmospheric boundary layer BCs */
$(RASBCs)/atmBoundaryLayer/atmBoundaryLayer.C
$(RASBCs)/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
$(RASBCs)/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C
$(RASBCs)/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libturbulenceModels LIB = $(FOAM_LIBBIN)/libturbulenceModels

View File

@ -0,0 +1,7 @@
derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C
derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C
derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libatmosphericModels

View File

@ -0,0 +1,18 @@
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
LIB_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools \
-ltriSurface \
-lfvOptions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(p, iF), inletOutletFvPatchScalarField(p, iF),
atmBoundaryLayer() atmBoundaryLayer()
{} {}
@ -56,10 +56,23 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchScalarField(p, iF, dict, false), inletOutletFvPatchScalarField(p, iF),
atmBoundaryLayer(patch().Cf(), dict) atmBoundaryLayer(patch().Cf(), dict)
{ {
scalarField::operator=(epsilon(patch().Cf())); phiName_ = dict.lookupOrDefault<word>("phi", "phi");
refValue() = epsilon(patch().Cf());
refGrad() = 0;
valueFraction() = 1;
if (dict.found("value"))
{
scalarField::operator=(scalarField("value", dict, p.size()));
}
else
{
scalarField::operator=(refValue());
}
} }
@ -72,7 +85,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchScalarField(psf, p, iF, mapper), inletOutletFvPatchScalarField(psf, p, iF, mapper),
atmBoundaryLayer(psf, mapper) atmBoundaryLayer(psf, mapper)
{} {}
@ -84,7 +97,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(psf, iF), inletOutletFvPatchScalarField(psf, iF),
atmBoundaryLayer(psf) atmBoundaryLayer(psf)
{} {}
@ -96,7 +109,7 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::autoMap
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
{ {
fixedValueFvPatchScalarField::autoMap(m); inletOutletFvPatchScalarField::autoMap(m);
atmBoundaryLayer::autoMap(m); atmBoundaryLayer::autoMap(m);
} }
@ -107,7 +120,7 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap
const labelList& addr const labelList& addr
) )
{ {
fixedValueFvPatchScalarField::rmap(psf, addr); inletOutletFvPatchScalarField::rmap(psf, addr);
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf = const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf =
refCast<const atmBoundaryLayerInletEpsilonFvPatchScalarField>(psf); refCast<const atmBoundaryLayerInletEpsilonFvPatchScalarField>(psf);
@ -120,6 +133,7 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
atmBoundaryLayer::write(os); atmBoundaryLayer::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,7 +60,7 @@ SourceFiles
#define atmBoundaryLayerInletEpsilonFvPatchScalarField_H #define atmBoundaryLayerInletEpsilonFvPatchScalarField_H
#include "fvPatchFields.H" #include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
#include "atmBoundaryLayer.H" #include "atmBoundaryLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,7 +74,7 @@ namespace Foam
class atmBoundaryLayerInletEpsilonFvPatchScalarField class atmBoundaryLayerInletEpsilonFvPatchScalarField
: :
public fixedValueFvPatchScalarField, public inletOutletFvPatchScalarField,
public atmBoundaryLayer public atmBoundaryLayer
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ atmBoundaryLayerInletKFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(p, iF), inletOutletFvPatchScalarField(p, iF),
atmBoundaryLayer() atmBoundaryLayer()
{} {}
@ -56,10 +56,23 @@ atmBoundaryLayerInletKFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchScalarField(p, iF, dict, false), inletOutletFvPatchScalarField(p, iF),
atmBoundaryLayer(patch().Cf(), dict) atmBoundaryLayer(patch().Cf(), dict)
{ {
scalarField::operator=(k(patch().Cf())); phiName_ = dict.lookupOrDefault<word>("phi", "phi");
refValue() = k(patch().Cf());
refGrad() = 0;
valueFraction() = 1;
if (dict.found("value"))
{
scalarField::operator=(scalarField("value", dict, p.size()));
}
else
{
scalarField::operator=(refValue());
}
} }
@ -72,7 +85,7 @@ atmBoundaryLayerInletKFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchScalarField(psf, p, iF, mapper), inletOutletFvPatchScalarField(psf, p, iF, mapper),
atmBoundaryLayer(psf, mapper) atmBoundaryLayer(psf, mapper)
{} {}
@ -84,7 +97,7 @@ atmBoundaryLayerInletKFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchScalarField(psf, iF), inletOutletFvPatchScalarField(psf, iF),
atmBoundaryLayer(psf) atmBoundaryLayer(psf)
{} {}
@ -96,7 +109,7 @@ void atmBoundaryLayerInletKFvPatchScalarField::autoMap
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
{ {
fixedValueFvPatchScalarField::autoMap(m); inletOutletFvPatchScalarField::autoMap(m);
atmBoundaryLayer::autoMap(m); atmBoundaryLayer::autoMap(m);
} }
@ -107,7 +120,7 @@ void atmBoundaryLayerInletKFvPatchScalarField::rmap
const labelList& addr const labelList& addr
) )
{ {
fixedValueFvPatchScalarField::rmap(psf, addr); inletOutletFvPatchScalarField::rmap(psf, addr);
const atmBoundaryLayerInletKFvPatchScalarField& blpsf = const atmBoundaryLayerInletKFvPatchScalarField& blpsf =
refCast<const atmBoundaryLayerInletKFvPatchScalarField>(psf); refCast<const atmBoundaryLayerInletKFvPatchScalarField>(psf);
@ -120,6 +133,7 @@ void atmBoundaryLayerInletKFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
atmBoundaryLayer::write(os); atmBoundaryLayer::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,7 +60,7 @@ SourceFiles
#define atmBoundaryLayerInletKFvPatchScalarField_H #define atmBoundaryLayerInletKFvPatchScalarField_H
#include "fvPatchFields.H" #include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
#include "atmBoundaryLayer.H" #include "atmBoundaryLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,7 +74,7 @@ namespace Foam
class atmBoundaryLayerInletKFvPatchScalarField class atmBoundaryLayerInletKFvPatchScalarField
: :
public fixedValueFvPatchScalarField, public inletOutletFvPatchScalarField,
public atmBoundaryLayer public atmBoundaryLayer
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
fixedValueFvPatchVectorField(p, iF), inletOutletFvPatchVectorField(p, iF),
atmBoundaryLayer() atmBoundaryLayer()
{} {}
@ -56,10 +56,23 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchVectorField(p, iF, dict, false), inletOutletFvPatchVectorField(p, iF),
atmBoundaryLayer(patch().Cf(), dict) atmBoundaryLayer(patch().Cf(), dict)
{ {
vectorField::operator=(U(patch().Cf())); phiName_ = dict.lookupOrDefault<word>("phi", "phi");
refValue() = U(patch().Cf());
refGrad() = Zero;
valueFraction() = 1;
if (dict.found("value"))
{
vectorField::operator=(vectorField("value", dict, p.size()));
}
else
{
vectorField::operator=(refValue());
}
} }
@ -72,7 +85,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchVectorField(pvf, p, iF, mapper), inletOutletFvPatchVectorField(pvf, p, iF, mapper),
atmBoundaryLayer(pvf, mapper) atmBoundaryLayer(pvf, mapper)
{} {}
@ -84,7 +97,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
fixedValueFvPatchVectorField(pvf, iF), inletOutletFvPatchVectorField(pvf, iF),
atmBoundaryLayer(pvf) atmBoundaryLayer(pvf)
{} {}
@ -96,7 +109,7 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::autoMap
const fvPatchFieldMapper& m const fvPatchFieldMapper& m
) )
{ {
fixedValueFvPatchVectorField::autoMap(m); inletOutletFvPatchVectorField::autoMap(m);
atmBoundaryLayer::autoMap(m); atmBoundaryLayer::autoMap(m);
} }
@ -107,7 +120,7 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap
const labelList& addr const labelList& addr
) )
{ {
fixedValueFvPatchVectorField::rmap(pvf, addr); inletOutletFvPatchVectorField::rmap(pvf, addr);
const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf = const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf =
refCast<const atmBoundaryLayerInletVelocityFvPatchVectorField>(pvf); refCast<const atmBoundaryLayerInletVelocityFvPatchVectorField>(pvf);
@ -120,6 +133,7 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
atmBoundaryLayer::write(os); atmBoundaryLayer::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -61,7 +61,7 @@ SourceFiles
#define atmBoundaryLayerInletVelocityFvPatchVectorField_H #define atmBoundaryLayerInletVelocityFvPatchVectorField_H
#include "fvPatchFields.H" #include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
#include "atmBoundaryLayer.H" #include "atmBoundaryLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,7 +75,7 @@ namespace Foam
class atmBoundaryLayerInletVelocityFvPatchVectorField class atmBoundaryLayerInletVelocityFvPatchVectorField
: :
public fixedValueFvPatchVectorField, public inletOutletFvPatchVectorField,
public atmBoundaryLayer public atmBoundaryLayer
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -44,4 +44,6 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
libs ("libatmosphericModels.so");
// ************************************************************************* // // ************************************************************************* //