|
[Sponsors] |
April 26, 2013, 16:14 |
UDF for inflow
|
#1 |
New Member
Join Date: Jan 2013
Posts: 10
Rep Power: 13 |
Hi everyone,
I am having an issue getting fluent to work with a ramped inflow condition. I have a UDF file for a simple ramp written and I have a journal file written but I get back an error everytime saying: "Primitive Error at Node 1: interpolate_profile_field: thread 24: profile \"\" does not exist." It is running in 2D and uses parrallel processing. Here are the files: ramped_inflow.c Code:
#include "udf.h" DEFINE_PROFILE(inlet_velocity, thread, position) { real ramp = 0.0; real t_ramp = 0.0; real u_target = 0.0; real u_in = 0.0; t_ramp = RP_Get_Real("t_ramp"); u_target = RP_Get_Real("u_target"); #if !RP_HOST /* (serial or compute process, i.e. not host process) */ real x[ND_ND]; face_t f; if (CURRENT_TIME <= t_ramp && t_ramp > 0.0) { ramp = CURRENT_TIME/t_ramp; u_in = ramp * u_target; if (u_in == 0.0) { u_in = 0.02; /* cannot initialise flow if u=0 m/s */ } } else { ramp = 1.0; u_in = ramp * u_target; } begin_f_loop(f,thread) { F_CENTROID(x, f, thread); F_PROFILE(f, thread, position) = u_in; } end_f_loop(f,thread) #endif } Code:
; READ MESH /file rc "F2R2T1a.cas" ; ; COMPILE UDFS /define ud cf c "libudf" y "ramped_inflow.c" , , ; ; set target velocity = 2.0 m/s (rp-var-define 'u_target 1.0 'real #f) ; ; set ramp time = 10 s (rp-var-define 't_ramp 10 'real #f) /define ud cf l "libudf" ; ; BOUNDARY CONDITIONS /define bc vi inlet y y y y "udf" "inlet_velocity::libudf" n 0 y n n 0 y n 1 n 1 ; ; INITIALISE /solve initialize compute-defaults vi inlet y /solve initialize initialize-flow ; ; SOLVE /solve dual-time-iterate 30000 40 ; ; SAVE CASE AND DATA FILES /file write-case-data F2R2T1ax.cas y /file write-case-data F2R2T1ax.dat y ; /exit yes Thanks, Matt Last edited by OMJT; April 26, 2013 at 17:57. |
|
April 29, 2013, 23:34 |
|
#2 |
Senior Member
|
I think that you should attach the running log of fluent while reading the journal file.
I barely know UDF so I am a bit confused when reading your source code. Maybe you could help me with the following two questions? 1. Judge from the macro you used (!RP_HOST), the RP_Get... should be executed by HOST only. So why broadcasting those values to non-host processes is unnecessary? 2. Two floating numbers could be equal (r1 == r2 could be true) but people seldom do this. The more common practice I saw is ( fabs(r1-r2) < some_eps ). So do you have any particular reason for this line of code? if (u_in == 0.0) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |