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/)
-   -   from UDF(fluent) to OpenFOAM code (https://www.cfd-online.com/Forums/openfoam-programming-development/161362-udf-fluent-openfoam-code.html)

fra d'amb October 22, 2015 10:00

from UDF(fluent) to OpenFOAM code
 
Hi everybody,
i've to use the following UDF in an OpenFOAM case. I know that OF doesn't use UDF but I don't know how implement the code in OF.
The UDF is used to evaluate the source term of a heat exchange.

Code:

#include "udf.h"
#include "mem.h"

#define TimeCoeff 50.0
#define WGTemp 600.0
DEFINE_SOURCE(sink,c,t,dS,eqn)
{
    real con, source, rho, spheat, temp;
    int tstep;
    tstep = RP_Get_Integer("time-step");
    rho = C_R(c,t);
    spheat = C_CP(c,t);
    temp = C_T(c,t);
       
    if (tstep > 1000)
    {
        source = TimeCoeff*rho*spheat*(WGTemp-temp);
        dS[eqn] = 0.;
    }
    else
    {
        source = dS[eqn] = 0.;       
    }   
return source;
}

Someone can give me some advice or show some example.

Regards

Francesco

hk318i October 23, 2015 19:26

Hello Francesc,

In OpenFOAM terms, you can check fvOptions. It allows you to add a source term to the solver governing equations as a part of case setup.

Search here in the forum for fvOptions. Check this [LINK] as an example but I believe it is not the only one.

Best wishes,
Hassan


All times are GMT -4. The time now is 06:16.