CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Add an inverse field into laplacianFoam (http://www.cfd-online.com/Forums/openfoam-programming-development/132992-add-inverse-field-into-laplacianfoam.html)

sharonyue April 8, 2014 21:16

Add an inverse field into laplacianFoam
 
2 Attachment(s)
Hi guys,

This solver is just for validation. I add this into laplacianFoam:

createField:
Code:

volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

    volScalarField TTT
    (
        IOobject
        (
            "TTT",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        scalar(1)/T,
        T.boundaryField().types()
    );

    volScalarField TT
    (
        IOobject
        (
            "TT",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        scalar(1)/TTT,
        T.boundaryField().types()
    );

solver:
Code:

solve
            (
                fvm::ddt(TT) - fvm::laplacian(DT, TT)
            );

I mean, I think TT is the same with T. So I expect that I get the same result of TT with T. But this two is not the same. See the picture:

Actually Im wondering if I can solve this equation(Regard this 1/exp(t) as a volScalarField), and get the field of T

\frac{{\partial \left( {{\rho _d}\frac{1}{{\exp \left( T \right)}}} \right)}}{{\partial t}} + \nabla  \cdot \left( {{\rho _d}{u_d}\frac{1}{{\exp \left( T \right)}}} \right) = .......

sharonyue April 13, 2014 21:23

Any ideas?

sharonyue April 14, 2014 23:26

Solved,

After this equation is solved. I have to rewrite this TT to write. Otherwise the solver will not wirte this TT. Then TT is the real T.

epi_c April 15, 2014 00:36

Quote:

Originally Posted by sharonyue (Post 486153)
Solved,

After this equation is solved. I have to rewrite this TT to write. Otherwise the solver will not wirte this TT. Then TT is the real T.

I can't get what you said.

sharonyue April 15, 2014 03:24

Sorry, check it out:
Code:

    Info<< "Reading field T\n" << endl;

    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

    volScalarField TI
    (
        IOobject
        (
            "TI",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        scalar(1)/T,
        T.boundaryField().types()
    );

Code:

while (simple.correctNonOrthogonal())
        {
            solve
            (
                fvm::ddt(TI) - fvm::laplacian(DT, TI)
            );
        }     

T = scalar(1)/TI;

 runTime.write()



All times are GMT -4. The time now is 13:25.