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 output the turbulent model's coefficient (https://www.cfd-online.com/Forums/openfoam-programming-development/224151-how-output-turbulent-models-coefficient.html)

wangziyang February 9, 2020 07:03

How to output the turbulent model's coefficient
 
i recently use the dynamic Smagorisky model to simulate the cavitation, i want to output the turbulent models coefficent "cD" to a file, what code should i make ?
the the dynamic Smagorisky model.C program of cD is as follows
[/{
// The SGS viscosity is bounded so that nuEff cannot become negative.
// Values are limited here, and not in nuEff, for consistency in stored
// data and in submodels using nuSgs().
// No warning message is printed when this limitation is applied.
nuSgs_ = max(cD(D)*sqr(delta())*sqrt(magSqr(D)), -nu());
nuSgs_.correctBoundaryConditions();
}

volScalarField dynamicSmagorinsky::cD
(
const volSymmTensorField& D
) const
{
tmp<volSymmTensorField> LL =
dev(filter_(sqr(U())) - (sqr(filter_(U()))));//sqr returns the outer product of U, the deviatoric part is explicitly expressed, while the isotropic part is in the pressure term

const volSymmTensorField MM
(
sqr(delta())*(filter_(mag(D)*(D)) - 4*mag(filter_(D))*filter_(D))
);

// Locally averaging MMMM on cell faces
volScalarField MMMM = fvc::average(magSqr(MM));

MMMM.max(VSMALL);

// Performing local avera[/CODE]ge on cell faces on return
return 0.5*fvc::average(LL && MM)/MMMM; // cD expression
}]

HPE February 9, 2020 12:53

Since `cD` seems to be registered to the mesh, I think adding:

cD.write();

somewhere in your code? Then `cD` could be written out like `U`?

Or if you execute in a single processor:

Info<< cD << endl; // I wouldn't use this though.


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