|
[Sponsors] |
January 8, 2018, 08:26 |
Velocity UDF error
|
#1 |
Member
Kamal Bisht
Join Date: Jun 2015
Location: Germany
Posts: 57
Rep Power: 11 |
Hi,
I am using a linearly increasing velocity profile with time at the inlet. Here is UDf. #include "udf.h" DEFINE_PROFILE(velocity_magnitude, t, i) { real default_early_velocity_mag,default_late_velocity_m ag,velocity_mag; real start_velocity,end_velocity; real ramp_start,ramp_end; real line_slope,the_current_time; face_t f; default_early_velocity_mag=0.01; default_late_velocity_mag=0.1; start_velocity=0.01; end_velocity=0.1; ramp_start=0.0; ramp_end=45.0; velocity_mag=default_early_velocity_mag; the_current_time = CURRENT_TIME; line_slope=(end_velocity-start_velocity)/(ramp_end-ramp_start); if ((the_current_time>=ramp_start) && (the_current_time<=ramp_end)) { velocity_mag=line_slope*the_current_time; } if ((the_current_time>ramp_end)) { velocity_mag=default_late_velocity_mag; } begin_f_loop(f,t) { F_PROFILE(f,t,i) = velocity_mag; } end_f_loop(f,t) } The simulation is running okay for the first 35 seconds after that I got the error message. Unable to parse: [free Error: undefined read macro Error Object: () Error: > (greater-than): invalid argument [2]: wrong type [not a number] Error Object: #f Halting due to end of file on input. Ending computation Any idea why is it happening? |
|
January 8, 2018, 10:02 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
No.
However, I suspect that you forgot one term: velocity_mag = start_velocity + line_slope*the_current_time; This causes a discontinuity in your boundary condition (it jumps at 45 s from 0.09 m/s to 0.10 m/s), but I don't expect that this causes the error that you see. Still good to fix it, though... |
|
January 8, 2018, 10:21 |
|
#3 |
Member
Kamal Bisht
Join Date: Jun 2015
Location: Germany
Posts: 57
Rep Power: 11 |
Thanks for the highlighting the improvement.
Yeah it shouldn't create a problem at 35 seconds of physical time. I am using a journal file to run my simulation on cluster. Could it be due to it? |
|
January 11, 2018, 10:29 |
|
#4 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
As pakk says, there isn't much wrong with the UDF (apart from the discontinuity -- well spotted!), so I would go looking at the journal. (Does the journal contain the word "free", as mentioned in the error message?)
There is one error in the UDF as listed: a space in the fourth line "default_late_velocity_m ag". But I would be surprised if the libudf compiled with that space there, so perhaps it just crept in during transfer to this forum. |
|
January 12, 2018, 02:53 |
|
#5 |
Member
Kamal Bisht
Join Date: Jun 2015
Location: Germany
Posts: 57
Rep Power: 11 |
I included the start velocity in my UDF as suggested by pakk and it worked without interuppting the simulation.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 20:43 |
Compiling dynamicTopoFvMesh for OpenFOAM 2.1.x | Saxwax | OpenFOAM Installation | 25 | November 29, 2013 06:34 |
[swak4Foam] installing funkySetFields | igo | OpenFOAM Community Contributions | 1 | November 20, 2012 21:16 |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 10:31 |
UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode! | alban | Fluent UDF and Scheme Programming | 2 | June 8, 2010 19:54 |