CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

from UDF(fluent) to OpenFOAM code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2015, 11:00
Default from UDF(fluent) to OpenFOAM code
  #1
New Member
 
francesco
Join Date: Jun 2015
Posts: 3
Rep Power: 11
fra d'amb is on a distinguished road
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
fra d'amb is offline   Reply With Quote

Old   October 23, 2015, 20:26
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
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
hk318i is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory protection in OpenFOAM / combinig with FORTRAN botp OpenFOAM Programming & Development 2 February 15, 2016 13:25
OpenFOAM Foundation releases OpenFOAM 2.2.2 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 October 14, 2013 08:18
How to code integral of (DU/Dt - 2000 ) in openFoam erncyc OpenFOAM 5 September 13, 2012 07:33
OpenFOAM for subsurface flow, or coupling with a subsurface flow code? chljl OpenFOAM Running, Solving & CFD 0 February 14, 2012 20:38
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 07:55


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