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

UDF warning C4027- CG motion code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2020, 12:01
Default UDF warning C4027- CG motion code
  #1
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
Hello,

I've recently worked on external Gear pump which is demanded a "DEFINE_CG_MOTION" code. I write the code but when I try to build a code from UDF the below warning is shown twice:

warning C4027: function declared without formal parameter list.
warning C4027: function declared without formal parameter list.

I use Fluent V180, SDK 10 ( I use windows 10) and Visual Studio 2017 for compiling. However, when I go to iterate the model regardless of these warning, I see there is no effect by changing the omega of the gears.

So, I will be really grateful if someone have a solution for this. thank you again.

Regards
Me_1989 is offline   Reply With Quote

Old   May 29, 2020, 12:07
Default Bug
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
The error implies that you are using some function without proper arguments (or parameters as those are called in MSVC). But it would not be possible to help without looking at either the code or the full compiler log that it saves in log file in the working directory. Look in that log file or the output within the Fluent's interface. It shows line numbers with the error. That information is more important than C4027, which is just a cryptic code.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 12:16
Default
  #3
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
Quote:
Originally Posted by vinerm View Post
The error implies that you are using some function without proper arguments (or parameters as those are called in MSVC). But it would not be possible to help without looking at either the code or the full compiler log that it saves in log file in the working directory. Look in that log file or the output within the Fluent's interface. It shows line numbers with the error. That information is more important than C4027, which is just a cryptic code.
Thanks you for your immediate reply.
Actually, the code is as below:

DEFINE_CG_MOTION(anticlock_wise, dt, vel, omega, time, dtime)
{ NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
/* Linear Velocity for Driving Gear */
vel[0] = 0.0;
vel[1] = 0.0;
vel[2] = 0.0;
/* Angular Velocity for Driving Gear */
omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 120;
/* Messages for Display */
Message("\nThis is Anti Clockwise Gear\n");
Message("\nCG_Omega for anticlock_wise: %g, %g, %g\n", omega[0], omega[1],
omega[2]);
Message("\nCG Position for anticlock_wise: %g, %g, %g\n", NV_LIST(DT_CG(dt)));
Message("\nCG Orientation for anticl0ck_wise: %g, %g, %g\n",
NV_LIST(DT_THETA(dt)));
}

yes, as you said the problem is in line 2 which is stated: NV_S(vel, =, 0.0)!!
Me_1989 is offline   Reply With Quote

Old   May 29, 2020, 12:25
Default The bug
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
I don't see a problem with the code, except that you don't need it. The omega is fixed. You don't need a UDF for that. You can go to cell zone conditions and use mesh motion with speed of 120 rad/s.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 12:38
Default
  #5
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
Actually, I don't think so that I could use the sliding mesh motion since there are two gears in my external gear pump. So, I think, I have to do it with dynamic mesh. However, for having simplicity I sent only the first part of the code which is for one of the gears. The problem exactly is that when I increase the Omega, I could not see its effect in the mass flow rate. So I think the problem may refer to the codes warning! maybe!
Me_1989 is offline   Reply With Quote

Old   May 29, 2020, 12:41
Default The Code
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
If you are using dynamic mesh with two gears meshed, then yes, you cannot use mesh motion. But the code appears to be alright, except for redundancies. Could you copy whole of the compile log here in the post?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 12:51
Default
  #7
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
This is the whole written code:
#include "udf.h"
#include "dynamesh_tools.h"
/* UDF starts for Rotational Speed of2850 rpm for Driving Gear */
void anticlock_wise(void);
void clock_wise(void);
real dt;
real time;
real dtime;
real vel [];
real omega [];
DEFINE_CG_MOTION(anticlock_wise, dt, vel, omega, time, dtime)
{ NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
/* Linear Velocity for Driving Gear */
vel[0] = 0.0;
vel[1] = 0.0;
vel[2] = 0.0;
/* Angular Velocity for Driving Gear */
omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 3000;
/* Messages for Display */
Message("\nThis is Anti Clockwise Gear\n");
Message("\nCG_Omega for anticlock_wise: %g, %g, %g\n", omega[0], omega[1],
omega[2]);
Message("\nCG Position for anticlock_wise: %g, %g, %g\n", NV_LIST(DT_CG(dt)));
Message("\nCG Orientation for anticl0ck_wise: %g, %g, %g\n",
NV_LIST(DT_THETA(dt)));
}
/* UDF ends for Rotational Speed of2850 rpm for Driving Gear */
/* UDP starts for Rotational Speed of2850 rpm for Driven Gear */
/* Rotational Speed of 2000 rpm for Driven Gear */
DEFINE_CG_MOTION(clock_wise, dt, vel, omega, time, dtime)
{ NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
/* Linear Velocity for Driven Gear */
vel[0] = 0.0;
vel[1] = 0.0;
vel[2] = 0.0;
/* Angular Velocity for Driven Gear */
omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = -3000;
/* Messages for Display */
Message("\nThis is Clockwise Gear\n");
Message("\nCG_Omega for clock_wise: %g, %g, %g\n", omega[0], omega[1],
omega[2]);
Message("\nCG Position for clock_wise: %g, %g, %g\n", NV_LIST(DT_CG(dt)));
Message("\nCG Orientation for clock_wise: %g, %g, %g\n", NV_LIST(DT_THETA(dt)));
}
/* UDP ends for Rotational Speed of2850 rpm for Driven Gear */
/* UDP ends for both the gears */

Last edited by Me_1989; May 29, 2020 at 15:07.
Me_1989 is offline   Reply With Quote

Old   May 29, 2020, 12:58
Default Bug
  #8
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Now, that's where the problem is. Remove seven lines where you have defined variables that are used as arguments of the function.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 13:13
Default
  #9
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
Yepppppp that's it. Vinerm many many thanks for your help. Thanks a bunch.

Regards
Me_1989 is offline   Reply With Quote

Old   May 29, 2020, 13:24
Default
  #10
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
But, Vinerm would you please tell me how do you know from compile log that the problem is those seven lines?!
Me_1989 is offline   Reply With Quote

Old   May 29, 2020, 13:46
Default Problem
  #11
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
I didn't see the compile log; you didn't share it. I looked directly at the code. The arguments used in a function are not supposed to be declared explicitly.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   May 29, 2020, 14:56
Default
  #12
New Member
 
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5
Me_1989 is on a distinguished road
Actually I don't know what do you mean exactly by the compile log. I thought that you mean the messages which are shown in the console. Anyway thank you very much again.
Me_1989 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] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
foamToTecplot360 thomasduerr OpenFOAM Post-Processing 121 June 11, 2021 10:05
UDF code help solve reaction rate equation palm oil zirkov Fluent UDF and Scheme Programming 0 February 13, 2017 10:34
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
[swak4Foam] wmake groovyBC in OpenFOAM 1.7 ? randomid OpenFOAM Community Contributions 1 August 27, 2010 05:15


All times are GMT -4. The time now is 07:23.