CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Velocity UDF error

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 8, 2018, 07:26
Default Velocity UDF error
  #1
Member
 
Kamal Bisht
Join Date: Jun 2015
Location: Germany
Posts: 57
Rep Power: 8
Bisht is on a distinguished road
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?
Bisht is offline   Reply With Quote

Old   January 8, 2018, 09:02
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,860
Rep Power: 23
pakk will become famous soon enough
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...
Bisht likes this.
pakk is offline   Reply With Quote

Old   January 8, 2018, 09:21
Default
  #3
Member
 
Kamal Bisht
Join Date: Jun 2015
Location: Germany
Posts: 57
Rep Power: 8
Bisht is on a distinguished road
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?
Bisht is offline   Reply With Quote

Old   January 11, 2018, 09:29
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 224
Rep Power: 8
obscureed is on a distinguished road
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.
obscureed is offline   Reply With Quote

Old   January 12, 2018, 01:53
Default
  #5
Member
 
Kamal Bisht
Join Date: Jun 2015
Location: Germany
Posts: 57
Rep Power: 8
Bisht is on a distinguished road
I included the start velocity in my UDF as suggested by pakk and it worked without interuppting the simulation.
Bisht is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
Compiling dynamicTopoFvMesh for OpenFOAM 2.1.x Saxwax OpenFOAM Installation 25 November 29, 2013 05:34
[swak4Foam] installing funkySetFields igo OpenFOAM Community Contributions 1 November 20, 2012 20:16
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode! alban Fluent UDF and Scheme Programming 2 June 8, 2010 18:54


All times are GMT -4. The time now is 14:50.