Public Member Functions | Protected Member Functions | Protected Attributes
canopySource Class Reference

Base class for momentum and turbulence source/sink-terms for tree canopy. More...

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

Public Member Functions

 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< scalar > &eqn, const label fieldI)
 
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< scalar > &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...
 

Protected Member Functions

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)
 
 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 ()
 
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)
 
 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

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...
 

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...
 

Detailed Description

Base class for momentum and turbulence source/sink-terms for tree canopy.

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

Usage
Example usage:
canopy
{
    type                       canopySource;
    active                     on;              // toggle the option
    writeFields                on;              // write to disk
    readFromDisk               off;             // if present, read fields landuse, z0, LAD from disk
    readLanduseFromRaster      off;             // read landuse from raster
    readCanopyHeightFromRaster off;             // 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)
   
    translateRaster            (0 0 0);         // translate raster to mesh coordinate sys.

    LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );  // default LAD profile

    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;
        };

    };
}
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

Usage
Example usage:
canopy
{
    type                       canopySource;
    active                     on;              // toggle the option
    writeFields                on;              // write to disk
    readFromDisk               off;             // if present, read fields landuse, z0, LAD from disk
    readLanduseFromRaster      off;             // read landuse from raster
    readCanopyHeightFromRaster off;             // 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)
   
    translateRaster            (0 0 0);         // translate raster to mesh coordinate sys.

    LADProfile ( 0.05 0.1 0.15 0.35 1.1 0.9 0.5 0.2 0.15 0.05 0.01 );  // default LAD profile

    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;
        };

    };
}
Source files

Definition at line 119 of file canopySource.H.

Constructor & Destructor Documentation

◆ canopySource() [1/4]

canopySource ( const canopySource )
protected

Disallow default bitwise copy construct.

◆ canopySource() [2/4]

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

Construct from components.

Definition at line 53 of file canopySource.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ ~canopySource() [1/2]

virtual ~canopySource ( )
inlinevirtual

Destructor.

Definition at line 208 of file canopySource.H.

◆ canopySource() [3/4]

canopySource ( const canopySource )
protected

Disallow default bitwise copy construct.

◆ canopySource() [4/4]

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

Construct from components.

◆ ~canopySource() [2/2]

virtual ~canopySource ( )
inlinevirtual

Destructor.

Definition at line 208 of file canopySource.H.

Member Function Documentation

◆ addSup() [1/4]

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

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

Reimplemented from option.

Reimplemented in dalpeMassonCanopySource, dalpeMassonCanopySource, svenssonHaggkvistCanopySource, and svenssonHaggkvistCanopySource.

Definition at line 107 of file canopySource.C.

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

Here is the call graph for this function:

◆ addSup() [2/4]

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

Reimplemented from option.

Reimplemented in dalpeMassonCanopySource, dalpeMassonCanopySource, svenssonHaggkvistCanopySource, and svenssonHaggkvistCanopySource.

Definition at line 81 of file canopySource.C.

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

Here is the call graph for this function:

◆ operator=() [1/2]

void operator= ( const canopySource )
protected

Disallow default bitwise assignment.

◆ checkData() [1/2]

void checkData ( ) const
protected

◆ readRaster() [1/2]

Raster readRaster ( fileName  rasterPath)
protected

◆ calculatePatchDistance() [1/2]

void calculatePatchDistance ( label  patch,
volScalarField d 
)
protected

Definition at line 341 of file canopySource.C.

References Foam::endl(), Foam::Info, HashSet< Key, Hash >::insert(), Foam::nl, and groundDist::y().

Here is the call graph for this function:

◆ setPatchLanduse() [1/2]

void setPatchLanduse ( label  patch,
volScalarField landuse,
volScalarField LAD,
volScalarField z0,
volScalarField nut,
volScalarField d 
)
protected

◆ calculateCanopy() [1/2]

void calculateCanopy ( )
protected

◆ readLanduseClasses() [1/2]

void readLanduseClasses ( )
protected

◆ TypeName() [1/2]

TypeName ( "canopySource"  )

Runtime type information.

◆ read() [1/2]

bool read ( const dictionary dict)
virtual

Read dictionary.

Reimplemented from option.

Definition at line 192 of file canopySource.C.

References landuseClass::code(), dict, Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, option::read(), and List::size().

Here is the call graph for this function:

◆ addSup() [3/4]

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

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

Reimplemented from option.

Reimplemented in dalpeMassonCanopySource, and svenssonHaggkvistCanopySource.

◆ addSup() [4/4]

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

Reimplemented from option.

Reimplemented in dalpeMassonCanopySource, and svenssonHaggkvistCanopySource.

◆ operator=() [2/2]

void operator= ( const canopySource )
protected

Disallow default bitwise assignment.

◆ checkData() [2/2]

void checkData ( ) const
protected

◆ readRaster() [2/2]

Raster readRaster ( fileName  rasterPath)
protected

◆ calculatePatchDistance() [2/2]

void calculatePatchDistance ( label  patch,
volScalarField d 
)
protected

◆ setPatchLanduse() [2/2]

void setPatchLanduse ( label  patch,
volScalarField landuse,
volScalarField LAD,
volScalarField z0,
volScalarField nut,
volScalarField d 
)
protected

◆ calculateCanopy() [2/2]

void calculateCanopy ( )
protected

◆ readLanduseClasses() [2/2]

void readLanduseClasses ( )
protected

◆ TypeName() [2/2]

TypeName ( "canopySource"  )

Runtime type information.

◆ read() [2/2]

bool read ( const dictionary dict)
virtual

Read dictionary.

Reimplemented from option.

Field Documentation

◆ sourcePatches_

wordList sourcePatches_
protected

Definition at line 127 of file canopySource.H.

Referenced by canopySource::checkData().

◆ canopy_

autoPtr< volScalarField > canopy_
protected

Definition at line 128 of file canopySource.H.

◆ landuseTable_

HashTable< landuseClass, label > landuseTable_
protected

Definition at line 130 of file canopySource.H.

Referenced by canopySource::checkData().

◆ patchLanduseTable_

HashTable< landuseClass, label > patchLanduseTable_
protected

Definition at line 131 of file canopySource.H.

◆ readFromDisk_

Switch readFromDisk_
protected

Definition at line 134 of file canopySource.H.

◆ readLanduseFromRaster_

Switch readLanduseFromRaster_
protected

Definition at line 137 of file canopySource.H.

Referenced by canopySource::checkData().

◆ landuseRaster_

Raster landuseRaster_
protected

Definition at line 138 of file canopySource.H.

◆ readCanopyHeightFromRaster_

Switch readCanopyHeightFromRaster_
protected

Definition at line 141 of file canopySource.H.

◆ canopyHeightRaster_

Raster canopyHeightRaster_
protected

Definition at line 142 of file canopySource.H.

◆ translateRaster

vector translateRaster
protected

Definition at line 145 of file canopySource.H.

◆ writeFields_

Switch writeFields_
protected

Definition at line 147 of file canopySource.H.

◆ LAD_from_disk_

bool LAD_from_disk_
protected

Definition at line 151 of file canopySource.H.

◆ landuse_from_disk_

bool landuse_from_disk_
protected

Definition at line 152 of file canopySource.H.

◆ z0_from_disk_

bool z0_from_disk_
protected

Definition at line 153 of file canopySource.H.


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