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/)
-   -   How to calculate Production and Dissipation term (https://www.cfd-online.com/Forums/openfoam-programming-development/238875-how-calculate-production-dissipation-term.html)

ht2017 October 8, 2021 00:14

How to calculate Production and Dissipation term
 
Now I am running channel flow with DNS. I am modifying the "create_field.H" to calculate the production term by the equation.

P_k = - \overline{u\prime_i u\prime_m} \frac{\partial U_i}{\partial x_m}

Code:

Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
    IOobject
    (
        "transportProperties",
        runTime.constant(),
        mesh,
        IOobject::MUST_READ_IF_MODIFIED,
        IOobject::NO_WRITE
    )
);

dimensionedScalar nu
(
    "nu",
    dimViscosity,
    transportProperties.lookup("nu")
);

Info<< "Reading field p\n" << endl;
volScalarField p
(
    IOobject
    (
        "p",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);


Info<< "Reading field U\n" << endl;
volVectorField U
(
    IOobject
    (
        "U",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);
  dimensionedScalar gradP
    (     
        transportProperties.lookup("gradP")
    );

    vector flowDirection(1,0,0);


// calculate production term

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

volVectorField UMean
(
    IOobject
    (
        "UMean",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);

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

volScalarField prod
(
    IOobject
    (
        "prod",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    -(((U-UMean)*(U-UMean))&&fvc::grad(U))
       
);

 // end


#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
mesh.setFluxRequired(p.name());

it appears the error at -(((U-UMean)*(U-UMean))&&fvc::grad(U)). Do you know how to fix it?


All times are GMT -4. The time now is 05:11.