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

UDF comilation error. urgent help please

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2019, 16:41
Default UDF compilation error. urgent help please
  #1
New Member
 
m zubair
Join Date: Feb 2019
Posts: 12
Rep Power: 7
m zubair is on a distinguished road
i have window 8.1 and microsoft visual studio 2013 and Ansys 16.1 when i try to compile my UDF file there is following error..
please help. i will be very thankful

opied E:\Ansyss\missile\silo.c.c to libudf\src
Creating user_nt.udf file for 2ddp ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v161\fluent"\fluent16.1.0\sr c\udf\makefile_nt.udf "libudf\win64\2ddp\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\2ddp")# Generating ud_io1.h
silo.c.c
..\..\src\silo.c.c(147) : error C2440: '=' : cannot convert from 'Profile' to 'float'

Done.

Opening library "C:\Users\Zubair\AppData\Local\Temp\WB_DESKTOP-P1HIMJQ_Zubair_996_2\unsaved_project_files\dp0\FFF-1\Fluent\C:\Users\Zubair\AppData\Local\Temp\WB_DES KTOP-P1HIMJQ_Zubair_996_2\unsaved_project_files\dp0\FFF-1\Fluent\libudf"...RPC RCX_SC_SET
ERR_MSG failed: RPC: Can't encode arguments


Error: The UDF library you are trying to load (C:\Users\Zubair\AppData\Local\Temp\WB_DESKTOP-P1HIMJQ_Zubair_996_2\unsaved_project_files\dp0\FFF-1\Fluent\libudf) is not compiled for 2ddp on the current platform (win64).

The system cannot find the file specified.

Last edited by m zubair; February 6, 2019 at 00:33.
m zubair is offline   Reply With Quote

Old   February 6, 2019, 20:36
Default
  #2
New Member
 
GenD
Join Date: Nov 2017
Posts: 23
Rep Power: 9
GenD is on a distinguished road
There seems to be a mistake at 147. line.

I recommend to use the newest version of ansys and VS, cause there always can be occured errors for unknown reasons (I had many.), so you won't go anywhere without troubleshooting.
GenD is offline   Reply With Quote

Old   February 7, 2019, 02:07
Default
  #3
New Member
 
m zubair
Join Date: Feb 2019
Posts: 12
Rep Power: 7
m zubair is on a distinguished road
When I edited the line number 147..as I turned into comment. Compilation succeeded but when I do simulation I got following error. What should I do. Either this error is due to UDF changes which I have made? Or something else related to setup.

time step reduced in 4 cells due to excessive temperature change

absolute pressure limited to 1.000000e+04 in 4 cells on zone 2

absolute pressure limited to 2.500000e+06 in 5 cells on zone 2

temperature limited to 5.000000e+01 in 4 cells on zone 2

temperature limited to 2.800000e+03 in 20 cells on zone 2

# Divergence detected in AMG solver: nut -> Increasing relaxation sweeps!
# You may try the enhanced divergence recovery with (rpsetvar 'amg/protective-enhanced? #t)

Error: Divergence detected in AMG solver: nut
m zubair is offline   Reply With Quote

Old   February 7, 2019, 18:03
Default
  #4
New Member
 
GenD
Join Date: Nov 2017
Posts: 23
Rep Power: 9
GenD is on a distinguished road
Does your simulation work without UDF?
GenD is offline   Reply With Quote

Old   February 10, 2019, 12:19
Default please look into this udf .. i have error at line number 148..
  #5
New Member
 
m zubair
Join Date: Feb 2019
Posts: 12
Rep Power: 7
m zubair is on a distinguished road
#include "udf.h"
#include "dynamesh_tools.h"

#define nozzle_tid 12 /* Zone ID of nozzle exit */
#define missile_tid 14 /* Zone ID of missile wall */
#define moving_fluid_id 2 /* Zone ID of fluid surrounding the missile */

#define t_liftoff 0.1 /* Time at which to allow lift-off (sec) */
#define g_c 9.81 /* Gravity acceleration */
#define initial_mass 200.0 /* Initial mass of the rocket (kg) */
#define burn_rate 0.0 /* Fuel burn rate (kg/sec) */
#define pi 4.0*atan(1.0)

float U_sum; /* Sum of inlet U velocity */
float V_sum; /* Sum of inlet V velocity */
float W_sum; /* Sum of inlet W velocity */
float A_sum; /* Sum of facet areas */
float P_sum; /* Sum of face pressure */
float P_i; /* Pressure on face i */
float A_i; /* Area of face i */
float U_i; /* U velocity on face i */
float V_i; /* V velocity on face i */
float W_i; /* W velocity on face i */
float A[3]; /* Area vector of face i */
float VA_sum; /* Sum of velocity times area */
float VEL_i; /* Velocity magnitude on face i */
float V_avg; /* Average velocity */
float V_e; /* Nozzle exit velocity relative to missile */
float Pthrust; /* Thrust due to pressure */
float Mthrust; /* Thrust due to momentum */
float MDOT; /* Mass flow rate from the missile */
float Vmiss[3]; /* Missile velocity vector */
/*float Umiss;*/ /* Missile x velocity */
/*float Vmiss;*/ /* Missile y or r velocity */
/*float Wmiss;*/ /* Missile z velocity (zero for 2-D) */


Domain *domain;
face_t f; /* Nozzle faces */
Thread *t; /* Nozzle thread */
Dynamic_Thread *tmiss; /* Missile wall thread */

DEFINE_SDOF_PROPERTIES(launch, prop, dt, time, dtime)
{

/* Define the mass and moments of inertia */
prop[SDOF_MASS] = initial_mass - (burn_rate * time);
prop[SDOF_IXX] = 0.0;
prop[SDOF_IYY] = 0.0;
prop[SDOF_IZZ] = 0.0;

/* Define ejector moments */
prop[SDOF_LOAD_M_X] = 0.;
prop[SDOF_LOAD_M_Y] = 0.;
prop[SDOF_LOAD_M_Z] = 0.;

/* Calculate rocket thrust and assign to X ejector force.*/
U_sum = 0.0;
V_sum = 0.0;
W_sum = 0.0;
A_sum = 0.0;
P_sum = 0.0;
Pthrust = 0.0;

A_sum = 0.0;
VA_sum = 0.0;
Pthrust = 0.0;
Mthrust = 0.0;

/* Lookup thread values */
domain = Get_Domain(1);
t = Lookup_Thread(domain, nozzle_tid);
tmiss = THREAD_DT(Lookup_Thread(domain, missile_tid)); /* Missile wall */

/* Compute area-weighted average exit velocity */

Message("\n ****************************************");
Message("\n ******* Nozzle Exit Conditions *******");
Message("\n ****************************************");


/* Visit each face on the inlet and add up Vx, Vr, Area, and Pressure */
begin_f_loop (f, t)
{
/* Retrieve the area vector of the current face */
F_AREA(A, f, t);

/* Message("\n check 1");*/

/* Calculate the area of current face */
A_i = NV_MAG(A);

/*Message("\n check 2");*/

/* Retrieve the pressure on the current face */
P_i = F_P(f,t);

/*Message("\n check 3");*/

U_i = F_U(f,t); /* U Velocity on the current face */
V_i = F_V(f,t); /* V velocity on the current face */

#if RP_2D
W_i = 0.0; /* W Velocity (2D) */
#else
W_i = F_W(f, t); /* W Velocity (3D) */
#endif

VEL_i = sqrt(U_i*U_i+V_i*V_i+W_i*W_i); /* Velocity magnitude */


A_sum += A_i; /* Increment the face area */
VA_sum += VEL_i * A_i; /* Increment the VxA */
Pthrust += P_i * A_i; /* Increment the pressure force */

}

end_f_loop (f, t)

#if RP_2D
if(rp_axi)
{A_sum *= 2*pi;
VA_sum *= 2*pi;
Pthrust *= 2*pi;}
#endif

V_avg = VA_sum / A_sum;

Message("\n -> Current Time = %f sec", time);
Message("\n -> Liftoff time = %f sec", t_liftoff);
Message("\n -> Total inlet area = %f m2", A_sum);
Message("\n -> = %f ft2", A_sum / (0.3048 * 0.3048));
Message("\n");
Message("\n -> Average Velocity = %f m/sec", V_avg);
Message("\n = %f ft/sec", V_avg / 0.3048);
Message("\n");
Message("\n -> Average Inlet Pressure = %f Pa", Pthrust / A_sum);
Message("\n = %f psi", Pthrust / A_sum * (14.7/101325.));

/* OBTAIN THE MASS FLOW RATE ACROSS THE INLET */

MDOT = 0.0;

/* Obtain the mass flow rate if inlet is mass flow type */
if (THREAD_VAR(t).mfi.flow_spec == MASS_FLOW_TYPE)
{
MDOT = THREAD_VAR(t).mfi.mass_flow;

Message("\n -> Mass Flow Rate = %f kg/sec", MDOT);
Message("\n -> = %f lbm/sec", MDOT / 2.205);
}

else
{

Message("\n NOW INSIDE UNTESTED PORTION OF THE UDF");


/*
THE FOLLOWING HAS NOT BEEN TESTED YET!!
*/

/* if (IS_PROFILE (THREAD_VAR (t).mfi.mass_flux))
{
Message("\n====================================");
Message("\n MDOT HAS BEEN SPECIFIED AS PROFILE");
Message("\n Beginning face loop.");

begin_f_loop (f, t)
{
mass_flux = NV_MAG (F_AREA_CACHE (f, t))
* F_VAR (f, t, THREAD_VAR (t).mfi.mass_flux);

Message("\n MASS FLOW RATE FOUND.\n");

}
end_f_loop (f, t)

Message("\n VALUE OF MDOT = %f", MDOT);
Message("\n====================================");
}
else
{

Message("\n LOOKING UP MASS FLOW RATE (NOT PROFILE)\n");

mass_flux = THREAD_VAR(t).mfi.mass_flux.constant * A_sum;
MDOT = A_sum * mass_flux;

Message("\n Finished calculating for non profile case. Results:");
Message("\n mass_flux = %f", THREAD_VAR(t).mfi.mass_flux.constant);
Message("\n A_sum = %f", A_sum);
Message("\n MDOT = %f", MDOT);


}
*/


/* END OF UNTESTED SECTION */


/*
#if RP_2D
if (rp_axi) MDOT *= 2.0 * pi;
#endif
*/
}


/* COMPUTE ROCKET THRUST AS (Avg Velocity) * (mass flow rate)

force = V_avg * F_VAR (0, t, THREAD_VAR(t).mfi.mass_flux) / total_;
*/



/* OBTAIN THE CURRENT MISSILE VELOCITY */
if(time < t_liftoff)
{DT_VEL_CG(tmiss)[0] = 0.0;}
/* {Umiss = DT_VEL_CG(tmiss)[0];} */
/* Vmiss[0]=DT_VEL_CG(tmiss)[0];
else
{DT_VEL_CG(tmiss)[0] = 0.0;}

Umiss = DT_VEL_CG(tmiss)[0]; */


Message("\n ***************************************");
Message("\n ******** Thrust / Velocity *********");
Message("\n ***************************************");


Message("\n -> Missile Velocity = %f m/sec", Vmiss[0]);
Message("\n -> = %f ft/sec", Vmiss[0]/0.3048);

#if RP_2D
if (rp_axi)
{
Message("\n -> Missile Velocity Axial = %f m/sec", DT_VEL_CG(tmiss)[0]);
Message("\n -> = %f ft/sec", DT_VEL_CG(tmiss)[0]/0.3048);

Message("\n -> Missile Velocity Radial = %f m/sec", DT_VEL_CG(tmiss)[1]);
Message("\n -> = %f ft/sec", DT_VEL_CG(tmiss)[1]/0.3048);
}
else
{
Message("\n -> Missile Velocity (X) = %f m/sec", DT_VEL_CG(tmiss)[0]);
Message("\n -> = %f ft/sec", DT_VEL_CG(tmiss)[0]/0.3048);
Message("\n -> Missile Velocity (Y) = %f m/sec", DT_VEL_CG(tmiss)[1]);
Message("\n -> = %f ft/sec", DT_VEL_CG(tmiss)[1]/0.3048);
}
#endif

#if RP_3D
Message("\n -> Missile Velocity (Z) = %f m/sec", DT_VEL_CG(tmiss)[2]);
Message("\n -> = %f ft/sec", DT_VEL_CG(tmiss)[2] / 0.3048);
#endif

V_e = V_avg - Vmiss[0];
Mthrust = V_e * MDOT;

Message("\n -> Relative Velocity = %f m/sec", V_e);
Message("\n -> = %f ft/sec", V_e / 0.3048);
Message("\n");
Message("\n -> Momentum Thrust = %f N", V_e*MDOT);
Message("\n -> = %f lbf", V_e*MDOT / 4.448);
Message("\n");
Message("\n -> Pressure Thrust = %f N", Pthrust);
Message("\n -> = %f lbf", Pthrust / 4.448);
Message("\n");
Message("\n -> TOTAL THRUST = %f N", Pthrust+Mthrust);
Message("\n -> = %f lbf", (Pthrust+Mthrust)/4.448);
Message("\n ****************************************");
Message("\n");
Message("\n");

/* Set calculated thrust as a body force (ejector force) */
prop[SDOF_LOAD_F_X] = Pthrust + Mthrust;
prop[SDOF_LOAD_F_Y] = 0.0;
prop[SDOF_LOAD_F_Z] = 0.0;

/* Dummy Override */
#if RP_2D
prop[SDOF_LOAD_F_Z] = 0.;
if (rp_axi)
prop[SDOF_LOAD_F_Y] = 0.;
#endif

}
m zubair 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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 09:52.