CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   how to output a solved parameter of an equation? (https://www.cfd-online.com/Forums/openfoam/198644-how-output-solved-parameter-equation.html)

mixkats February 13, 2018 12:49

how to output a solved parameter of an equation?
 
hello everyone,

Let's say i want to write each writeInterval the Nusselt number for every cell (or the average Nu number for the whole domain, even better), which is solved in the heatTransferModels/RanzMarshall/RanzMarshall.C let's say, in the twoPhaseEulerFoam solver.

How does somebody do that?
Thank you

eric February 13, 2018 13:19

One option is to modify the solver, look in "createFields.H" and add a new volScalarField here for Nu. With the AUTO_WRITE option this will be written when the other fields are written. Then add the code to calculate the Nusselt number at a suitable place in the solver, and recompile the solver. To get the average number you can then use the normal function object functionality to calculate averages.

It's a bit cumbersome, but should teach you a bit about the inner workings of OpenFOAM for further development later :)

mixkats February 14, 2018 14:17

thanx for the "espresso" reply!

I 've tried your way, but it did not work. What you are saying may seem to work (it's a guess of mine) in cases like the wall heat flux. I'm modeling heat transfer in solid/gas fluidized beds, where the Nusselt number is between particle and gas.

The particle Nusselt number is calculated inside the twoPhaseEulerFoam's code and is used in the enthalpy equation, i think.
I am giving you the location in the solver:
applications/solvers/multiphase/myTwoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C

Code:

Foam::tmp<Foam::volScalarField>
Foam::heatTransferModels::RanzMarshall::K() const
{
    volScalarField Nu(scalar(2) + 0.6*sqrt(pair_.Re())*cbrt(pair_.Pr()));

    return
        6.0
      *max(pair_.dispersed(), residualAlpha_)
      *pair_.continuous().kappa()
      *Nu
      /sqr(pair_.dispersed().d());
}

So i need to extract this "Nu", besides the function does not return it (and the "Re" also).

I have also tried unsuccessfully to extract by modifying my controlDict like that:
Code:

functions {   
name4me    {       
type writeRegisteredObject;       
functionObjectLibs ( "libIOFunctionObjects.so" );       
objectNames ("Nu");       
outputControl outputTime;       
outputInterval      1;    } }

but i can't find why it's not detecting it.

Regards

mixkats February 14, 2018 18:18

thanx for the "espresso" reply!

I 've tried your way, but it did not work. What you are saying may seem to work (it's a guess of mine) in cases like the wall heat flux. I'm modeling heat transfer in solid/gas fluidized beds, where the Nusselt number is between particle and gas.

The particle Nusselt number is calculated inside the twoPhaseEulerFoam's code and is used in the enthalpy equation, i think.
I am giving you the location in the solver:
applications/solvers/multiphase/myTwoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C

Code:

Foam::tmp<Foam::volScalarField>
Foam::heatTransferModels::RanzMarshall::K() const
{
    volScalarField Nu(scalar(2) + 0.6*sqrt(pair_.Re())*cbrt(pair_.Pr()));

    return
        6.0
      *max(pair_.dispersed(), residualAlpha_)
      *pair_.continuous().kappa()
      *Nu
      /sqr(pair_.dispersed().d());
}

So i need to extract this "Nu", besides the function does not return it (and the "Re" also).

I have also tried unsuccessfully to extract by modifying my controlDict like that:
Code:


functions
{
    name4me
    {
        type writeRegisteredObject;
        functionObjectLibs ( "libIOFunctionObjects.so" );
        objectNames ("Nu");
        outputControl outputTime;
        outputInterval      1;
    }
}

but i can't find why it's not detecting it.

Regards

piu58 February 15, 2018 00:29

I din't know whether you really need each cell. Ususally, I work with sample, which is called afterwards.


All times are GMT -4. The time now is 18:04.