CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF warning C4027- CG motion code (https://www.cfd-online.com/Forums/fluent-udf/227467-udf-warning-c4027-cg-motion-code.html)

Me_1989 May 29, 2020 12:01

UDF warning C4027- CG motion code
 
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

vinerm May 29, 2020 12:07

Bug
 
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.

Me_1989 May 29, 2020 12:16

Quote:

Originally Posted by vinerm (Post 772544)
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)!!

vinerm May 29, 2020 12:25

The bug
 
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.

Me_1989 May 29, 2020 12:38

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!

vinerm May 29, 2020 12:41

The Code
 
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?

Me_1989 May 29, 2020 12:51

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 */

vinerm May 29, 2020 12:58

Bug
 
Now, that's where the problem is. Remove seven lines where you have defined variables that are used as arguments of the function.

Me_1989 May 29, 2020 13:13

Yepppppp that's it. Vinerm many many thanks for your help. Thanks a bunch.

Regards

Me_1989 May 29, 2020 13:24

But, Vinerm would you please tell me how do you know from compile log that the problem is those seven lines?!

vinerm May 29, 2020 13:46

Problem
 
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.

Me_1989 May 29, 2020 14:56

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.


All times are GMT -4. The time now is 21:02.