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

UDF not compiling

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2023, 06:53
Default UDF not compiling
  #1
New Member
 
Amir Khan
Join Date: Jan 2023
Posts: 5
Rep Power: 3
amirkhan5997 is on a distinguished road
Hi everyone,
I am trying to compile the following UDF and it runs without the data saving part but as soon as I add this
Code:
#if RP_HOST
fp = fopen("data.txt", "a");
fprintf(fp,"%g %g %g %g %g \n",time,cg[1],vel[1],cg[2],omega[1])
fclose(fp);
#endif
it doesnt work. Any help will highly appriciated

Code:
#include "udf.h"
#include "math.h"
#include <stdio.h>

static real v_prev_y = 0.0;
static real v_prev_theta = 0.0;

DEFINE_CG_MOTION(flapping,dt,vel,omega,time,dtime)
{
Thread *t;
Domain *d;
FILE *fp;


real cg[3]; real force[3]; real moment[3];

real accl_y;
real dv_y;
real accl_theta;
real dv_theta;

real ured = 10;

real mass_y = 63.9;
real eta = 0.01;
real ro = 1.0;

real c_y = 0;
real k_y = 289.5;

real c_theta = 0.501;
real k_theta = 0;

real lambda = -0.0033;
real l_theta = 0.067;

real I_theta = 0.146 ;

int i;
NV_S(vel,=,0.0);
NV_S(omega,=,0.0);

t = DT_THREAD(dt);
d = Get_Domain(1);


cg[1]=DT_CG(dt)[1];
cg[2]=DT_THETA(dt)[2];

Compute_Force_And_Moment(d,t,cg,force,moment,TRUE);

force[1] += -k_y * cg[1] - c_y * vel[1];
moment[2] += -k_theta * cg[2] - c_theta * omega[2];

accl_y = force[1]/mass_y;
accl_theta = moment[2]/I_theta;

dv_y = accl_y * dtime;
dv_theta = accl_theta * dtime;

v_prev_y += dv_y;
v_prev_theta += dv_theta;

vel[1] = v_prev_y;
omega[2] = v_prev_theta;

#if RP_HOST
fp = fopen("data.txt", "a");
fprintf(fp,"%g %g %g %g %g \n",time,cg[1],vel[1],cg[2],omega[1])
fclose(fp);
#endif
}
amirkhan5997 is offline   Reply With Quote

Old   March 9, 2023, 02:14
Default
  #2
Member
 
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6
Siba11 is on a distinguished road
Hi. You should try this instead:

Code:
#if !RP_HOST
.
.
.
#endif
Also, place the #if !RP_HOST line as soon as you enter the DEFINE_CG_MOTION block.
Siba11 is offline   Reply With Quote

Old   March 13, 2023, 05:06
Default
  #3
New Member
 
Amir Khan
Join Date: Jan 2023
Posts: 5
Rep Power: 3
amirkhan5997 is on a distinguished road
I get the following after building.

Code:
Copied C:\Users\engra\OneDrive - National University of Sciences & Technology\UDFs\UDF_Passive_Flapping - Copy.c to libudf\src
Creating user_nt.udf file for 2ddp_host ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v201\fluent"\fluent20.1.0\src\udf\makefile_nt.udf "libudf\win64\2ddp_host\makefile" ")
        1 file(s) copied.
(chdir "libudf")(chdir "win64\2ddp_host")Creating user_nt.udf file for 2ddp_node ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v201\fluent"\fluent20.1.0\src\udf\makefile_nt.udf "libudf\win64\2ddp_node\makefile" ")
        1 file(s) copied.
(chdir "libudf")(chdir "win64\2ddp_node")
Done.
But when I load is says

Code:
Error at Node 23: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.
amirkhan5997 is offline   Reply With Quote

Reply

Tags
udf, udf compilation, udf compile


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 compiling error Weiqiang Liu FLUENT 2 November 21, 2018 09:36
UDF Compiling / Parallel mode MV78 Fluent UDF and Scheme Programming 6 May 29, 2018 05:02
ERROR in compiling UDF stefanos Fluent UDF and Scheme Programming 1 April 25, 2012 07:37
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
On Compiling a UDF David Chabot FLUENT 5 May 20, 2005 09:13


All times are GMT -4. The time now is 04:12.