Commit eebfda5f authored by Andrew Heather's avatar Andrew Heather
Browse files

optimisation for diffusion calc

parent f9e3cf3e
...@@ -47,7 +47,7 @@ namespace Foam ...@@ -47,7 +47,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class APIdiffCoefFunc Declaration Class APIdiffCoefFunc Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class APIdiffCoefFunc class APIdiffCoefFunc
...@@ -59,6 +59,9 @@ class APIdiffCoefFunc ...@@ -59,6 +59,9 @@ class APIdiffCoefFunc
// API vapour mass diffusivity function coefficients // API vapour mass diffusivity function coefficients
scalar a_, b_, wf_, wa_; scalar a_, b_, wf_, wa_;
// Helper variables
scalar alpha_, beta_;
public: public:
...@@ -74,7 +77,9 @@ public: ...@@ -74,7 +77,9 @@ public:
a_(a), a_(a),
b_(b), b_(b),
wf_(wf), wf_(wf),
wa_(wa) wa_(wa),
alpha_(sqrt(1/wf_ + 1/wa_)),
beta_(sqr((cbrt(a_) + cbrt(b_))))
{} {}
//- Construct from Istream //- Construct from Istream
...@@ -83,21 +88,21 @@ public: ...@@ -83,21 +88,21 @@ public:
a_(readScalar(is)), a_(readScalar(is)),
b_(readScalar(is)), b_(readScalar(is)),
wf_(readScalar(is)), wf_(readScalar(is)),
wa_(readScalar(is)) wa_(readScalar(is)),
alpha_(sqrt(1/wf_ + 1/wa_)),
beta_(sqr((cbrt(a_) + cbrt(b_))))
{} {}
// Member Functions // Member Functions
//- API vapour mass diffusivity function //- API vapour mass diffusivity function using properties from
// construction
scalar f(scalar p, scalar T) const scalar f(scalar p, scalar T) const
{ {
return return 3.6059e-3*(pow(1.8*T, 1.75))*alpha_/(p*beta_);
3.6059e-3*(pow(1.8*T, 1.75))*sqrt(1/wf_ + 1/wa_)
/(p*sqr((cbrt(a_) + cbrt(b_))));
} }
//- Write the function coefficients //- Write the function coefficients
void writeData(Ostream& os) const void writeData(Ostream& os) const
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment