|
[Sponsors] |
May 29, 2020, 12:01 |
UDF warning C4027- CG motion code
|
#1 |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
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 |
|
May 29, 2020, 12:07 |
Bug
|
#2 |
Senior Member
|
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. |
|
May 29, 2020, 12:16 |
|
#3 | |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
Quote:
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)!! |
||
May 29, 2020, 12:25 |
The bug
|
#4 |
Senior Member
|
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. |
|
May 29, 2020, 12:38 |
|
#5 |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
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!
|
|
May 29, 2020, 12:41 |
The Code
|
#6 |
Senior Member
|
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. |
|
May 29, 2020, 12:51 |
|
#7 |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
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. |
|
May 29, 2020, 12:58 |
Bug
|
#8 |
Senior Member
|
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. |
|
May 29, 2020, 13:13 |
|
#9 |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
Yepppppp that's it. Vinerm many many thanks for your help. Thanks a bunch.
Regards |
|
May 29, 2020, 13:24 |
|
#10 |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
But, Vinerm would you please tell me how do you know from compile log that the problem is those seven lines?!
|
|
May 29, 2020, 13:46 |
Problem
|
#11 |
Senior Member
|
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. |
|
May 29, 2020, 14:56 |
|
#12 |
New Member
Me_1989
Join Date: May 2020
Posts: 16
Rep Power: 5 |
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.
|
|
|
|
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 |