CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Variable conductivity and van Driest wall functions (https://www.cfd-online.com/Forums/openfoam-programming-development/194987-variable-conductivity-van-driest-wall-functions.html)

andy_pr October 28, 2017 18:20

Variable conductivity and van Driest wall functions
 
Hello,

I have to implement a variable conductivity between 2D parallel plates such as:

k_d = C_t \rho_f C_f d_p u \ell

where there is the van Driest type wall function:

\ell = 1-exp[-y/(w d_p)] \ \ \ \ 0 \le y \le H/2

\ell = 1-exp[-(H-y)/(w d_p)] \ \ \ \ H/2 \le y \le H

So far I have added the code below to TEqn.H to solve a scalar transport equation. It seemed to work ok without the conditional statement, but when I introduce the if statement the error occurs in compilation:

/home/apr207/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/dimensionedType.C:593:6: note: template argument deduction/substitution failed:
In file included from porousSimpleEpsilonSquaredTemperatureConductivityF oam.C:73:0:
TEqn.H:33:32: note: ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ is not derived from ‘const Foam::dimensioned<Type>’
if(mesh.C().component(1) < 0.005)
^
I wondered:
* Is y = mesh.C().component(1)?
* How to set the conditional for y < 0.005?
* Is the x-component of velocity, u = mag(U)?
Code:

volScalarField kd
(
IOobject
(
"kd",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet(1,1,-3,-1,0),0.0)
);
   
volScalarField L
(
IOobject
(
"L",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet(0,0,0,0,0),0.0)
);
   
    if(mesh.C().component(1) < 0.005)
    {
        L=1.0-exp(-mesh.C().component(1)/(1.5*dp));
    }
    else
    {
        L=1.0-exp(-(0.01-mesh.C().component(1))/(1.5*dp));
    }
 
    kd=0.375*rhof*cpf*mag(U)*dp*L;

    fvScalarMatrix TEqn
    (
          fvm::div(phi,T)
        ==
          fvm::laplacian((kfe+kse+kd)/(rhof*cpf*eps),T,"laplacian(DT,T)")
    );
    TEqn.relax();
    TEqn.solve();



All times are GMT -4. The time now is 20:09.