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/)
-   -   CHTC-based source term (https://www.cfd-online.com/Forums/openfoam-programming-development/222617-chtc-based-source-term.html)

M.E. December 2, 2019 04:21

CHTC-based source term
 
Hello,


I'm trying to implement a convective heat transfer coefficient based source term for the energy equation of an incompressible heat transfer solver.


The equation I wish to implement would be the following :


\frac{\partial T}{\partial t}+u_{j}\frac{\partial T}{\partial x_{j}}=\frac{\partial}{\partial x_{i}}(\alpha_{eff}\frac{\partial T}{\partial x_{j}})+\frac{hS(T_{w}-T)}{\rho_{0}C_{p}V}


To do this, I modified the createFields.H of my solver to implement two volScalarFields, h and Tw.

To avoid taking into account the thermal contribution of the wall twice, alphaEff would be set to zero at the wall, and h and Tw set to zero anywhere but at the wall.


To implement this source term, I looked at fvOptions(T), however I could not find a way of implementing non-constant semi-implicit coefficients for the source term, thus I tried to implement it this way :



Code:



    fvScalarMatrix TEqn
    (
        fvm::ddt(T)
      + fvm::div(phi, T)
      - fvm::laplacian(alphaEff, T)
    ==
      - fvm::Sp(h*Surface/(rho*Cp*Volume),T)+fvc::Sp(
h*Surface /(rho*Cp*Volume),Tw)
    );




with rho and Cp two scalars and Volume = mesh.V() and Surface = mesh.magSf().



My main problem is that the Sp() function allows as arguments a scalar and a volScalarField or volVectorField, and I cannot find a way to fit the surface and volume part into any of these types.


I tried to use a fvc::reconstructMag(mesh.magSf()) to transform the type of mesh.magSf() from a surfaceScalarField into a volScalarField, and also to create a volumeScalarField Volume in the createFields.H with Volume.ref() = mesh.V(), but to no avail.



Does anyone have an idea to get past this problem ?


Thanks in advance,


Matthieu


All times are GMT -4. The time now is 16:43.