|
[Sponsors] |
December 25, 2017, 07:58 |
UDF error
|
#1 |
Senior Member
Arun raj.S
Join Date: Jul 2011
Posts: 210
Rep Power: 16 |
Hello everyone,
I am trying to load this UDF (https://www.cfd online.com/Forums/fluent/88129-vortex-induced-vibration.html) for my problem. But I am getting this error while loading "Copied E:\Arun\Tandem\Tandem fluent\free oscillations\Naturally oscillating cylinder zhang/E:\Arun\Tandem\Tandem fluent\free oscillations\Naturally oscillating cylinder zhang\udf_loc_velo_acc.c to libudf\src udf_names.c and user_nt.udf files in 2ddp are upto date. (system "copy "C:\PROGRA~1\ANSYSI~1\v180\fluent"\fluent18.0.0\sr c\udf\makefile_nt.udf "libudf\win64\2ddp\makefile" ") 1 file(s) copied. (chdir "libudf")(chdir "win64\2ddp")# Generating ud_io1.h udf_loc_velo_acc.c ..\..\src\udf_loc_velo_acc.c(107) : error C2143: syntax error : missing ')' before 'constant' ..\..\src\udf_loc_velo_acc.c(107) : error C2059: syntax error : ')' |
|
December 25, 2017, 07:58 |
UDF is given here
|
#2 |
Senior Member
Arun raj.S
Join Date: Jul 2011
Posts: 210
Rep Power: 16 |
#include <stdio.h>
#include "udf.h" # define UDF_FILENAME "udf_loc_velo_acc" # define Temp_File "mytemp" /* read current location,velocity and accelerator from file */ static void read_loc_vel_acc_file (real *loc1, real *vel1,real *acc1) { FILE *fp = fopen(Temp_File, "r"); if (fp != NULL) { float read_loc1, read_vel1, read_acc1; fscanf (fp, "%e %e %e", &read_loc1, &read_vel1, &read_acc1); fclose (fp); *loc1 = (real) read_loc1; *vel1 = (real) read_vel1; *acc1=(real) read_acc1; Message ("\nUDF read viv: y_vel = %f, acc = %f, loc(m)= %f\n", *vel1, *acc1, *loc1); } else { *loc1 = 0.0; *vel1 = 0.0; *acc1 = 0.0; Message("\nThe first reading of udf_loc_vel_acc_file\n"); } } /* write current location, velocity and acceleration into file */ static void write_loc_vel_acc_file (real loc, real vel, real acc) { FILE *fp = fopen(UDF_FILENAME, "a"); if (fp != NULL) { fprintf (fp, "%e %e %e\n", loc, vel, acc); fclose (fp); } else Message ("\nWarning: cannot write %s file", UDF_FILENAME); } /* write current location,velocity and acceleration into temp_file */ static void write_loc_vel_acc_file2 (real loc, real vel, real acc) { FILE *fp = fopen(Temp_File, "w"); if (fp != NULL) { fprintf (fp, "%e %e %e\n", loc, vel, acc); fclose (fp); } else Message ("\nWarning: cannot write %s file", Temp_File); } DEFINE_CG_MOTION(viv, dt, cg_vel, cg_omega, time, dtime) { #define DELTA 0.5 #define BETA 0.25 #define K_SPRING 22.406 #define MASS 4.864 #define xi 0.0054 real wn=sqrt(K_SPRING/MASS); real CC=2*xi*wn*MASS; /*fn=2.92745*/ /*mass ratio equaul 2.4*/ real loc,vel,acc,loc1,vel1,acc1; real a0,a1,a2,a3,a4,a5,a6,a7,keff,reff; static int id1=5; /* Face ID of the cylinder */ static real f_glob[3]; /* Total forces (global) */ static real m_glob[3]; /* Moment (global) */ static real x_cg[3]; /* CG location */ static real force[3]; int i=0; Thread *tf1; Domain *domain = Get_Domain(1); tf1 = Lookup_Thread(domain, id1); a0=1/(BETA*dtime*dtime); a1=DELTA/(BETA*dtime); a2=1/(BETA*dtime); a3=0.5/BETA-1; a4=DELTA/BETA-1; a5=0.5*dtime*(DELTA/BETA-2); a6=dtime*(1-DELTA); a7=DELTA*dtime; keff=a0*MASS+a1*CC+K_SPRING; /* reset velocities */ NV_S (cg_vel, =, 0.0); NV_S (cg_omega, =, 0.0); if (!Data_Valid_P ()) return; /* Get CG position */ for (i=0; i<ND_ND; i++) x_cg[i] = DT_CG(dt)[i]; /* compute force on cylinder */ force[1] = 0.0; Compute_Force_And_Moment(domain, tf1, x_cg, f_glob, m_glob, TRUE); for (i=0; i<ND_ND; i++) { force[i] = f_glob[i]; } /*read data calculated in the former step*/ read_loc_vel_acc_file (&loc1, &vel1, &acc1); /* compute response of cylinder by newmark method*/ reff=force[1]+MASS*(a0*loc1+a2*vel1+a3*acc1)+CC*(a1*loc1+a4*vel 1+a5*acc1); loc=reff/keff; acc=a0*(loc-loc1)-a2*vel1-a3*acc1; vel=vel1+a6*acc1+a7*acc; Message ("\nUDF of viv: time = %f, y_vel = %f, acc = %f, loc(m)= %f\n", time, vel, acc, loc); write_loc_vel_acc_file (loc, vel, acc); write_loc_vel_acc_file2 (loc, vel, acc); cg_vel[1] = vel; } |
|
December 26, 2017, 16:06 |
|
#3 |
Member
mohamed
Join Date: Apr 2016
Posts: 34
Rep Power: 10 |
hi check this line
reff=force[1]+MASS*(a0*loc1+a2*vel1+a3*acc1)+CC*(a1*loc1+a4*vel 1+a5*acc1); the last part a4*vel 1+a25 their is space between vel and 1 |
|
December 26, 2017, 21:33 |
|
#4 |
Senior Member
Arun raj.S
Join Date: Jul 2011
Posts: 210
Rep Power: 16 |
Thank you guys.. it helped..
|
|
December 21, 2018, 17:48 |
|
#5 |
New Member
Join Date: Mar 2018
Posts: 7
Rep Power: 8 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for DPM particle deposition modelingpa | haghshenasfard | Fluent UDF and Scheme Programming | 10 | September 15, 2019 03:03 |
Undeclared Identifier Errof UDF | SteveGoat | Fluent UDF and Scheme Programming | 7 | October 15, 2014 08:11 |
ParaView for OF-1.6-ext | Chrisi1984 | OpenFOAM Installation | 0 | December 31, 2010 07:42 |
Installation OF1.5-dev | ttdtud | OpenFOAM Installation | 46 | May 5, 2009 03:32 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |