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/)
-   -   Pyrolysis Model - Thermal Conductivity (https://www.cfd-online.com/Forums/openfoam-programming-development/234851-pyrolysis-model-thermal-conductivity.html)

charles4allme March 21, 2021 10:52

Pyrolysis Model - Thermal Conductivity
 
2 Attachment(s)
Hello,

I have this new conduction equation and I was wondering how to insert it into OpenFOAM

Code:

pcdT/dt = d/dx(kdT/dx) with k = keff if x< du or k = k if x> du
I have also attached the equation with the diagram of the problem. I do not know how to create the condition in my pyrolysis model with the new thermal conductivity.

I appreciate the assistance.

SHUBHAM9595 April 15, 2021 17:10

The Equation can be written as follow in a new file TEqn.H....This file can be created in solver directory using touch TEqn.H

Code:

        fvScalarMatrix TEqn
    (
        fvm::ddt(T) == fvm::laplacian(alphat, T)
    );

TEqn.solve();

But before this we have to define alphat as
Code:

tmp <volScalarField> alphat = K/(rho*cp);
Now as k is dependent on vertical length, we need to access that coordinate using
Code:

const fvMesh& mesh = U.mesh();
volScalarField Ycord = mesh.C().component(vector::Y);// assuming Y is the vertical

        forAll(K,celli)
{
                if (Ycord[celli] <= DU.value())
       
                {
                        K[celli] = Keff.value()/(rho.value()*cp.value());
                }
                else
                {
                        K[celli] = K2.value()/(rho.value()*cp.value());;
                }

}

And finally we have to intialise all the additional variables in createFields.H as
Code:

    // Density
    dimensionedScalar rho(transportProperties.lookup("rho"));
   
    // sPECIFIC HEAT
    dimensionedScalar cp(transportProperties.lookup("cp"));

    // Threshold vertical length
    dimensionedScalar DU(transportProperties.lookup("DU"));
   
      // Keff
    dimensionedScalar Keff(transportProperties.lookup("Keff"));
   
      // K2
    dimensionedScalar K2(transportProperties.lookup("K2"));

 Info<< "Reading field Thermal Conductivity \n" << endl;
volScalarField K
(
    IOobject
    (
        "K",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);

Finally, include "TEqn.H" in your "customFoam.C" file within runtime loop

charles4allme May 24, 2021 09:05

Hi SHUBHAM9595,

Thanks a lot for your reply. It has truly been helpful


All times are GMT -4. The time now is 03:56.