Public Member Functions | Private Member Functions | Private Attributes
dalpeMassonCanopySource Class Reference

Momentum source term is expressed as: More...

Inheritance diagram for dalpeMassonCanopySource:
Inheritance graph
[legend]
Collaboration diagram for dalpeMassonCanopySource:
Collaboration graph
[legend]

Public Member Functions

 TypeName ("dalpeMassonCanopySource")
 Runtime type information. More...
 
 dalpeMassonCanopySource (const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
 Construct from components. More...
 
virtual ~dalpeMassonCanopySource ()
 Destructor. More...
 
dimensionedScalar betaP () const
 
dimensionedScalar betaD () const
 
dimensionedScalar C4 () const
 
dimensionedScalar C5 () const
 
void addSup (const volScalarField &rho, fvMatrix< vector > &eqn, const label fieldi)
 Source terms to momentum equation (for solvers with and without explicit density) More...
 
void addSup (fvMatrix< vector > &eqn, const label fieldi)
 
void addSup (fvMatrix< scalar > &eqn, const label fieldi)
 Source term to scalar equations (k & epsilon) More...
 
void addSup (const volScalarField &rho, fvMatrix< scalar > &eqn, const label fieldi)
 Source term to compressible scalar equation (k & epsilon) More...
 
 TypeName ("dalpeMassonCanopySource")
 Runtime type information. More...
 
 dalpeMassonCanopySource (const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
 Construct from components. More...
 
virtual ~dalpeMassonCanopySource ()
 Destructor. More...
 
dimensionedScalar betaP () const
 
dimensionedScalar betaD () const
 
dimensionedScalar C4 () const
 
dimensionedScalar C5 () const
 
void addSup (const volScalarField &rho, fvMatrix< vector > &eqn, const label fieldi)
 Source terms to momentum equation (for solvers with and without explicit density) More...
 
void addSup (fvMatrix< vector > &eqn, const label fieldi)
 
void addSup (fvMatrix< scalar > &eqn, const label fieldi)
 Source term to scalar equations (k & epsilon) More...
 
void addSup (const volScalarField &rho, fvMatrix< scalar > &eqn, const label fieldi)
 Source term to compressible scalar equation (k & epsilon) More...
 
- Public Member Functions inherited from canopySource
 TypeName ("canopySource")
 Runtime type information. More...
 
 canopySource (const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
 Construct from components. More...
 
virtual ~canopySource ()
 Destructor. More...
 
bool read (const dictionary &dict)
 Read dictionary. More...
 
 TypeName ("canopySource")
 Runtime type information. More...
 
 canopySource (const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
 Construct from components. More...
 
virtual ~canopySource ()
 Destructor. More...
 
bool read (const dictionary &dict)
 Read dictionary. More...
 
- Public Member Functions inherited from option
 TypeName ("option")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, option, dictionary,(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh),(name, modelType, dict, mesh))
 
 option (const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
 Construct from components. More...
 
autoPtr< optionclone () const
 Return clone. More...
 
virtual ~option ()
 Destructor. More...
 
const wordname () const
 Return const access to the source name. More...
 
const fvMeshmesh () const
 Return const access to the mesh database. More...
 
const dictionarycoeffs () const
 Return dictionary. More...
 
bool active () const
 Return const access to the source active flag. More...
 
void setApplied (const label fieldI)
 Set the applied flag to true for field index fieldI. More...
 
Switchactive ()
 Return access to the source active flag. More...
 
virtual bool isActive ()
 Is the source active? More...
 
virtual label applyToField (const word &fieldName) const
 Return index of field name if found in fieldNames list. More...
 
virtual void checkApplied () const
 Check that the source has been applied. More...
 
virtual void addSup (fvMatrix< symmTensor > &eqn, const label fieldI)
 
virtual void addSup (fvMatrix< sphericalTensor > &eqn, const label fieldI)
 
virtual void addSup (fvMatrix< tensor > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &rho, fvMatrix< symmTensor > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &rho, fvMatrix< sphericalTensor > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &rho, fvMatrix< tensor > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &alpha, const volScalarField &rho, fvMatrix< scalar > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &alpha, const volScalarField &rho, fvMatrix< vector > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &alpha, const volScalarField &rho, fvMatrix< symmTensor > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &alpha, const volScalarField &rho, fvMatrix< sphericalTensor > &eqn, const label fieldI)
 
virtual void addSup (const volScalarField &alpha, const volScalarField &rho, fvMatrix< tensor > &eqn, const label fieldI)
 
virtual void constrain (fvMatrix< scalar > &eqn, const label fieldI)
 
virtual void constrain (fvMatrix< vector > &eqn, const label fieldI)
 
virtual void constrain (fvMatrix< sphericalTensor > &eqn, const label fieldI)
 
virtual void constrain (fvMatrix< symmTensor > &eqn, const label fieldI)
 
virtual void constrain (fvMatrix< tensor > &eqn, const label fieldI)
 
virtual void correct (volScalarField &field)
 
virtual void correct (volVectorField &field)
 
virtual void correct (volSphericalTensorField &field)
 
virtual void correct (volSymmTensorField &field)
 
virtual void correct (volTensorField &field)
 
virtual void writeHeader (Ostream &) const
 Write the source header information. More...
 
virtual void writeFooter (Ostream &) const
 Write the source footer information. More...
 
virtual void writeData (Ostream &) const
 Write the source properties. More...
 

Private Member Functions

 dalpeMassonCanopySource (const dalpeMassonCanopySource &)
 Disallow default bitwise copy construct. More...
 
void operator= (const dalpeMassonCanopySource &)
 Disallow default bitwise assignment. More...
 
template<class RhoFieldType >
void addSup (const RhoFieldType &rho, fvMatrix< vector > &eqn, const label fieldi)
 Source term to momentum equation. More...
 
template<class RhoFieldType >
void addSup (const RhoFieldType &rho, fvMatrix< scalar > &eqn, const label fieldi)
 
 dalpeMassonCanopySource (const dalpeMassonCanopySource &)
 Disallow default bitwise copy construct. More...
 
void operator= (const dalpeMassonCanopySource &)
 Disallow default bitwise assignment. More...
 
template<class RhoFieldType >
void addSup (const RhoFieldType &rho, fvMatrix< vector > &eqn, const label fieldi)
 Source term to momentum equation. More...
 
template<class RhoFieldType >
void addSup (const RhoFieldType &rho, fvMatrix< scalar > &eqn, const label fieldi)
 

Private Attributes

dimensionedScalar betaP_
 
dimensionedScalar betaD_
 
dimensionedScalar C4_
 
dimensionedScalar C5_
 

Additional Inherited Members

- Static Public Member Functions inherited from option
static autoPtr< optionNew (const word &name, const dictionary &dict, const fvMesh &mesh)
 Return a reference to the selected fvOption model. More...
 
- Protected Member Functions inherited from canopySource
 canopySource (const canopySource &)
 Disallow default bitwise copy construct. More...
 
void operator= (const canopySource &)
 Disallow default bitwise assignment. More...
 
void checkData () const
 
Raster readRaster (fileName rasterPath)
 
void calculatePatchDistance (label patch, volScalarField &d)
 
void setPatchLanduse (label patch, volScalarField &landuse, volScalarField &LAD, volScalarField &z0, volScalarField &nut, volScalarField &d)
 
void calculateCanopy ()
 
void readLanduseClasses ()
 
 canopySource (const canopySource &)
 Disallow default bitwise copy construct. More...
 
void operator= (const canopySource &)
 Disallow default bitwise assignment. More...
 
void checkData () const
 
Raster readRaster (fileName rasterPath)
 
void calculatePatchDistance (label patch, volScalarField &d)
 
void setPatchLanduse (label patch, volScalarField &landuse, volScalarField &LAD, volScalarField &z0, volScalarField &nut, volScalarField &d)
 
void calculateCanopy ()
 
void readLanduseClasses ()
 
- Protected Attributes inherited from canopySource
wordList sourcePatches_
 
autoPtr< volScalarFieldcanopy_
 
HashTable< landuseClass, labellanduseTable_
 
HashTable< landuseClass, labelpatchLanduseTable_
 
Switch readFromDisk_
 
Switch readLanduseFromRaster_
 
Raster landuseRaster_
 
Switch readCanopyHeightFromRaster_
 
Raster canopyHeightRaster_
 
vector translateRaster
 
Switch writeFields_
 
bool LAD_from_disk_
 
bool landuse_from_disk_
 
bool z0_from_disk_
 
- Protected Attributes inherited from option
const word name_
 Source name. More...
 
const word modelType_
 Model type. More...
 
const fvMeshmesh_
 Reference to the mesh database. More...
 
dictionary dict_
 Top level source dictionary. More...
 
dictionary coeffs_
 Dictionary containing source coefficients. More...
 
Switch active_
 Source active flag. More...
 
wordList fieldNames_
 Field names to apply source to - populated by derived models. More...
 
List< bool > applied_
 Applied flag list - corresponds to each fieldNames_ entry. More...
 

Detailed Description

Momentum source term is expressed as:

Author David Segersson, Swedish Meteorological and Hydrological Institute, david.nosp@m..seg.nosp@m.ersso.nosp@m.n@sm.nosp@m.hi.se

\[ S_u = -\rho C_d \alpha u^2 \]

Source term for k is expressed as:

\[ S_k = \rho C_d \alpha \left(\beta_p u^3 - \beta_d k u \right) \]

Source term for epsilon is expressed as:

\[ S_{\epsilon}=\rho C_d \alpha \frac{\epsilon}{k} \left(C_{\epsilon 4} \beta_p u^3 - C_{\epsilon 5} \beta_d k u \right) \]

where \beta_p (1.0), \betad_d (5.03), C_{\epsilon 4} (0.78) and C_{epsilon 5} (0.78) are dimensionless coefficients

$ \rho $ = density
$ u $ = magnitude of velocity
$ k $ = turbulent kinetic energy
$ \alpha $ = leaf area density [m]
$ C_d $ = tree canopy drag coefficient

Use with any variant of the k-\epsilon turbulence model.

Reference: Momentum and turbulence source/sink-terms for tree canopy according to B. Dalpé and C. Masson. Numerical simulation of wind flow near a forest edge. J. of Wind Eng. and Ind. Aerodyn, 2006

Usage
Example usage:
canopy
{
    type                       dalpeMassonCanopySource;
    active                     on;              // toggle the option
    writeFields                on;              // write to disk
    readLanduseFromRaster      on;              // read landuse from raster
    readCanopyHeightFromRaster on;              // read canopy height from raster
    sourcePatches              (ground forest); // for which patches to set landuse
    patchLanduse               (0 1);           // landuse code per patch (if not read from raster)

    landuse
    {

        low_birch                               // name of landuse class
        {
            code 1;                             // code of landuse class
            Cd 0.2;                             // drag coefficient of trees
            LAI 2.15;                           // Leaf Area Index (used if LADmax is not specified)
            LADmax 1.2;                         // Maximum Leaf Area Density [m ^-1]
            z0 0.06;                            // roughness length [m]
            height 7.5;                         // tree canopy height (if not read from raster)
            
            // Vertical profile of Leaf Area Density
            // first value is closest to ground
            // each value represents an equal share of the tree height
            // e.g. for a 4 m tree and 4 values, each value will represent 1 m
            // values are scaled so that the highest will correspond to LADMax                

            LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );
        };

        grass
        {
            code 0;
            Cd 0.2;
            LAI 0;
            z0 0.06;
            height 0;
            LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );
        };

    };
}
Source files

Author David Segersson, Swedish Meteorological and Hydrological Institute, david.nosp@m..seg.nosp@m.ersso.nosp@m.n@sm.nosp@m.hi.se

\[ S_u = -\rho C_d \alpha u^2 \]

Source term for k is expressed as:

\[ S_k = \rho C_d \alpha \left(\beta_p u^3 - \beta_d k u \right) \]

Source term for epsilon is expressed as:

\[ S_{\epsilon}=\rho C_d \alpha \frac{\epsilon}{k} \left(C_{\epsilon 4} \beta_p u^3 - C_{\epsilon 5} \beta_d k u \right) \]

where \beta_p (1.0), \betad_d (5.03), C_{\epsilon 4} (0.78) and C_{epsilon 5} (0.78) are dimensionless coefficients

$ \rho $ = density
$ u $ = magnitude of velocity
$ k $ = turbulent kinetic energy
$ \alpha $ = leaf area density [m]
$ C_d $ = tree canopy drag coefficient

Use with any variant of the k-\epsilon turbulence model.

Reference: Momentum and turbulence source/sink-terms for tree canopy according to B. Dalpé and C. Masson. Numerical simulation of wind flow near a forest edge. J. of Wind Eng. and Ind. Aerodyn, 2006

Usage
Example usage:
canopy
{
    type                       dalpeMassonCanopySource;
    active                     on;              // toggle the option
    writeFields                on;              // write to disk
    readLanduseFromRaster      on;              // read landuse from raster
    readCanopyHeightFromRaster on;              // read canopy height from raster
    sourcePatches              (ground forest); // for which patches to set landuse
    patchLanduse               (0 1);           // landuse code per patch (if not read from raster)

    landuse
    {

        low_birch                               // name of landuse class
        {
            code 1;                             // code of landuse class
            Cd 0.2;                             // drag coefficient of trees
            LAI 2.15;                           // Leaf Area Index (used if LADmax is not specified)
            LADmax 1.2;                         // Maximum Leaf Area Density [m ^-1]
            z0 0.06;                            // roughness length [m]
            height 7.5;                         // tree canopy height (if not read from raster)
            
            // Vertical profile of Leaf Area Density
            // first value is closest to ground
            // each value represents an equal share of the tree height
            // e.g. for a 4 m tree and 4 values, each value will represent 1 m
            // values are scaled so that the highest will correspond to LADMax                

            LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );
        };

        grass
        {
            code 0;
            Cd 0.2;
            LAI 0;
            z0 0.06;
            height 0;
            LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );
        };

    };
}
Source files

Definition at line 163 of file dalpeMassonCanopySource.H.

Constructor & Destructor Documentation

◆ dalpeMassonCanopySource() [1/4]

Disallow default bitwise copy construct.

◆ dalpeMassonCanopySource() [2/4]

dalpeMassonCanopySource ( const word name,
const word modelType,
const dictionary dict,
const fvMesh mesh 
)

Construct from components.

Definition at line 52 of file dalpeMassonCanopySource.C.

◆ ~dalpeMassonCanopySource() [1/2]

virtual ~dalpeMassonCanopySource ( )
inlinevirtual

Destructor.

Definition at line 223 of file dalpeMassonCanopySource.H.

◆ dalpeMassonCanopySource() [3/4]

Disallow default bitwise copy construct.

◆ dalpeMassonCanopySource() [4/4]

dalpeMassonCanopySource ( const word name,
const word modelType,
const dictionary dict,
const fvMesh mesh 
)

Construct from components.

◆ ~dalpeMassonCanopySource() [2/2]

virtual ~dalpeMassonCanopySource ( )
inlinevirtual

Destructor.

Definition at line 223 of file dalpeMassonCanopySource.H.

Member Function Documentation

◆ operator=() [1/2]

void operator= ( const dalpeMassonCanopySource )
private

Disallow default bitwise assignment.

◆ addSup() [1/12]

void addSup ( const RhoFieldType &  rho,
fvMatrix< vector > &  eqn,
const label  fieldi 
)
private

Source term to momentum equation.

◆ addSup() [2/12]

void addSup ( const RhoFieldType &  rho,
fvMatrix< scalar > &  eqn,
const label  fieldi 
)
private

◆ TypeName() [1/2]

TypeName ( "dalpeMassonCanopySource"  )

Runtime type information.

◆ betaP() [1/2]

dimensionedScalar betaP ( ) const
inline

Definition at line 230 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::betaP_.

◆ betaD() [1/2]

dimensionedScalar betaD ( ) const
inline

Definition at line 235 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::betaD_.

◆ C4() [1/2]

dimensionedScalar C4 ( ) const
inline

Definition at line 240 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::C4_.

◆ C5() [1/2]

dimensionedScalar C5 ( ) const
inline

Definition at line 245 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::C5_.

◆ addSup() [3/12]

void addSup ( const volScalarField rho,
fvMatrix< vector > &  eqn,
const label  fieldi 
)
virtual

Source terms to momentum equation (for solvers with and without explicit density)

Reimplemented from canopySource.

Definition at line 126 of file dalpeMassonCanopySource.C.

References Foam::mag(), fvMatrix::psi(), rho, Foam::fvc::Sp(), and U.

Here is the call graph for this function:

◆ addSup() [4/12]

void addSup ( fvMatrix< vector > &  eqn,
const label  fieldi 
)
virtual

Reimplemented from canopySource.

Definition at line 104 of file dalpeMassonCanopySource.C.

References Foam::mag(), fvMatrix::psi(), Foam::fvc::Sp(), and U.

Here is the call graph for this function:

◆ addSup() [5/12]

void addSup ( fvMatrix< scalar > &  eqn,
const label  fieldi 
)
virtual

Source term to scalar equations (k & epsilon)

Reimplemented from option.

Definition at line 149 of file dalpeMassonCanopySource.C.

References epsilon, k, Foam::mag(), Foam::pow(), fvMatrix::psi(), Foam::fvc::Sp(), and U.

Here is the call graph for this function:

◆ addSup() [6/12]

void addSup ( const volScalarField rho,
fvMatrix< scalar > &  eqn,
const label  fieldi 
)
virtual

Source term to compressible scalar equation (k & epsilon)

Reimplemented from option.

Definition at line 187 of file dalpeMassonCanopySource.C.

References epsilon, k, Foam::mag(), Foam::pow(), fvMatrix::psi(), rho, Foam::fvc::Sp(), and U.

Here is the call graph for this function:

◆ operator=() [2/2]

void operator= ( const dalpeMassonCanopySource )
private

Disallow default bitwise assignment.

◆ addSup() [7/12]

void addSup ( const RhoFieldType &  rho,
fvMatrix< vector > &  eqn,
const label  fieldi 
)
private

Source term to momentum equation.

◆ addSup() [8/12]

void addSup ( const RhoFieldType &  rho,
fvMatrix< scalar > &  eqn,
const label  fieldi 
)
private

◆ TypeName() [2/2]

TypeName ( "dalpeMassonCanopySource"  )

Runtime type information.

◆ betaP() [2/2]

dimensionedScalar betaP ( ) const
inline

Definition at line 230 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::betaP_.

◆ betaD() [2/2]

dimensionedScalar betaD ( ) const
inline

Definition at line 235 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::betaD_.

◆ C4() [2/2]

dimensionedScalar C4 ( ) const
inline

Definition at line 240 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::C4_.

◆ C5() [2/2]

dimensionedScalar C5 ( ) const
inline

Definition at line 245 of file dalpeMassonCanopySource.H.

References dalpeMassonCanopySource::C5_.

◆ addSup() [9/12]

void addSup ( const volScalarField rho,
fvMatrix< vector > &  eqn,
const label  fieldi 
)
virtual

Source terms to momentum equation (for solvers with and without explicit density)

Reimplemented from canopySource.

◆ addSup() [10/12]

void addSup ( fvMatrix< vector > &  eqn,
const label  fieldi 
)
virtual

Reimplemented from canopySource.

◆ addSup() [11/12]

void addSup ( fvMatrix< scalar > &  eqn,
const label  fieldi 
)
virtual

Source term to scalar equations (k & epsilon)

Reimplemented from option.

◆ addSup() [12/12]

void addSup ( const volScalarField rho,
fvMatrix< scalar > &  eqn,
const label  fieldi 
)
virtual

Source term to compressible scalar equation (k & epsilon)

Reimplemented from option.

Field Documentation

◆ betaP_

dimensionedScalar betaP_
private

Definition at line 170 of file dalpeMassonCanopySource.H.

Referenced by dalpeMassonCanopySource::betaP().

◆ betaD_

dimensionedScalar betaD_
private

Definition at line 171 of file dalpeMassonCanopySource.H.

Referenced by dalpeMassonCanopySource::betaD().

◆ C4_

dimensionedScalar C4_
private

Definition at line 172 of file dalpeMassonCanopySource.H.

Referenced by dalpeMassonCanopySource::C4().

◆ C5_

dimensionedScalar C5_
private

Definition at line 173 of file dalpeMassonCanopySource.H.

Referenced by dalpeMassonCanopySource::C5().


The documentation for this class was generated from the following files: