ENH: radiation - temperature dependent absorption, emissivity, transmissivity

- constantAbsorption - updated a_ and e_ (Function1)
- constantTransmissivity - updated tau_  (Function1)
This commit is contained in:
Andrew Heather 2024-06-03 20:29:14 +01:00 committed by Mark OLESEN
parent 274fee92dd
commit de39878b9b
4 changed files with 67 additions and 18 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2018, 2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,8 +56,8 @@ Foam::radiation::constantAbsorption::constantAbsorption
:
wallAbsorptionEmissionModel(dict, pp),
coeffsDict_(dict),
a_(coeffsDict_.get<scalar>("absorptivity")),
e_(coeffsDict_.get<scalar>("emissivity"))
a_(Function1<scalar>::New("absorptivity", coeffsDict_)),
e_(Function1<scalar>::New("emissivity", coeffsDict_))
{}
@ -70,7 +70,23 @@ Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::a
const scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), a_);
if (a_->constant())
{
// Use arbitrary argument for a_
return tmp<scalarField>::New(pp_.size(), a_->value(0));
}
if (T)
{
return a_->value(*T);
}
FatalErrorInFunction
<< "Attempted to set 'a' using a non-uniform function of Temperature, "
<< "but temperature field is unavailable"
<< abort(FatalError);
return nullptr;
}
@ -82,7 +98,7 @@ Foam::scalar Foam::radiation::constantAbsorption::a
const scalar T
) const
{
return a_;
return a_->value(T);
}
@ -93,7 +109,23 @@ Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::e
const scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), e_);
if (e_->constant())
{
// Use arbitrary argument for e_
return tmp<scalarField>::New(pp_.size(), e_->value(0));
}
if (T)
{
return e_->value(*T);
}
FatalErrorInFunction
<< "Attempted to set 'e' using a non-uniform function of Temperature, "
<< "but temperature field is unavailable"
<< abort(FatalError);
return nullptr;
}
@ -105,7 +137,7 @@ Foam::scalar Foam::radiation::constantAbsorption::e
const scalar T
) const
{
return e_;
return e_->value(T);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018, 2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,6 +41,7 @@ SourceFiles
#define Foam_radiation_constantAbsorption_H
#include "wallAbsorptionEmissionModel.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,10 +65,10 @@ class constantAbsorption
dictionary coeffsDict_;
//- Absorptivity coefficient
scalar a_;
autoPtr<Function1<scalar>> a_;
//- Emissivity coefficient
scalar e_;
autoPtr<Function1<scalar>> e_;
public:

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2018, 2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,21 +56,36 @@ Foam::radiation::constantTransmissivity::constantTransmissivity
:
wallTransmissivityModel(dict, pp),
coeffsDict_(dict),
tau_(coeffsDict_.get<scalar>("transmissivity"))
tau_(Function1<scalar>::New("transmissivity", coeffsDict_))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::radiation::constantTransmissivity::t
Foam::tmp<Foam::scalarField> Foam::radiation::constantTransmissivity::t
(
const label bandI,
const vectorField* incomingDirection,
const scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), tau_);
if (tau_->constant())
{
// Use arbitrary argument for a_
return tmp<scalarField>::New(pp_.size(), tau_->value(0));
}
if (T)
{
return tau_->value(*T);
}
FatalErrorInFunction
<< "Attempted to set 't' using a non-uniform function of Temperature, "
<< "but temperature field is unavailable"
<< abort(FatalError);
return nullptr;
}
@ -82,7 +97,7 @@ Foam::scalar Foam::radiation::constantTransmissivity::t
const scalar T
) const
{
return tau_;
return tau_->value(T);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2018, 2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,6 +41,7 @@ SourceFiles
#define Foam_radiation_constantTransmissivity_H
#include "wallTransmissivityModel.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +65,7 @@ class constantTransmissivity
dictionary coeffsDict_;
//- Transmissivity coefficient
scalar tau_;
autoPtr<Function1<scalar>> tau_;
public: