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

'bad suffix on number' when building udf function

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2020, 10:18
Default 'bad suffix on number' when building udf function
  #1
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Hi everyone,

I am trying to make an UDF function that can change timestep in unsteady simulation with Fluent.
Howeve, when I compile the UDF function with fluent, it show error like that:
..\..\src\timeStep.c(29): error C2059: syntax error: 'bad suffix on number'

The UDF file is as below:
#include "udf.h"
#include "unsteady.h"
DEFINE_DELTAT(myDeltaT, domain)
{
/*time step, flow time parameters*/
real timeStep, flowTime;
real cDeltaT;
real CFL;
real timeCheck;

/*variable to check velocity*/
real Ux, Uy, Uz, velCell;

/*variable to get minimum of volume*/
real volume;

/*common variable */
Domain *d;
Thread *t;
cell_t c;

/*Get domain*/
d = Get_Domain(1); /*Get the domain using ANSYS FLUENT utility*/

/*get timestep and flowtime*/
flowTime = RP_Get_Real("flow-time");
timeStep = RP_Get_Real("physical-time-step");

CFL = 0.1;
if(flowTime < 1.0d-5)
{
timeStep = 1.0d-6;
}
else
{
/*Loop over all cell threads in the domain*/
//minVol = 1.0d+9; /*Assign first value for minVol*/
timeCheck = 10.d0;
thread_loop_c(t,d)
{
/*Compute min cell's volume*/
begin_c_loop(c,t)
{
volume = C_VOLUME(c,t); /*get cell volume*/
Ux = C_U(c,t); /*get x component of velocity of current cell*/
Uy = C_V(c,t); /*get y component of velocity of current cell*/
Uz = C_W(c,t); /*get z component of velocity of current cell*/
velCell = sqrt(pow(Ux,2) + pow(Uy,2) + pow(Uz,2)); /*magnitude of velocity in current cell*/
cDeltaT = CFL * velCell/volume; /*compute timeStep in each cell volume*/
if(cDeltaT < timeCheck)
{
timeCheck = cDeltaT;
}
// cDeltaT = timeCheck;
}
end_c_loop(c,t)
timeStep = timeCheck;
}

Message("timestep %g \n",timeStep);
return timeStep;
/*get minimum of cell volume*/
}

}

It is appreciated if someone could explain to me the way to deal with this stuck.

I thank you very much,
Attached Files
File Type: c timeStep.c (1.6 KB, 2 views)
ndtrong is offline   Reply With Quote

Old   January 9, 2020, 11:42
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Code:
if(flowTime < 1.0d-5)
What is 1.0d-5?
Don't you mean 1.0e-5?
pakk is offline   Reply With Quote

Old   January 9, 2020, 22:45
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
what fluent version do you use?
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 10, 2020, 01:51
Default
  #4
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Quote:
Originally Posted by pakk View Post
Code:
if(flowTime < 1.0d-5)
What is 1.0d-5?
Don't you mean 1.0e-5?
Dear Pakk

I thank you very much for your suggestion. My problem is solved.
ndtrong is offline   Reply With Quote

Old   January 10, 2020, 01:54
Default
  #5
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
what fluent version do you use?
Dear AlexanderZ

I am using Fluent v19.2

Do you have any comments or suggestions for this?

Thanks
ndtrong is offline   Reply With Quote

Old   January 10, 2020, 06:59
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
v19.2 is parallel by default

you should organize your UDF to work in parallel
Code:
flowTime = RP_Get_Real("flow-time");
timeStep = RP_Get_Real("physical-time-step");
must be read on host, than transfer to nodes

Ansys Fluent Customization manual | Parallel Considerations
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
parallel run OpenFoam Srinath Reddy OpenFOAM Running, Solving & CFD 13 February 27, 2019 10:15
[foam-extend.org] Error compiling OpenFOAM-1.6-ext Canesin OpenFOAM Installation 137 January 20, 2016 15:56
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 14:41
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42


All times are GMT -4. The time now is 20:54.