|
[Sponsors] |
August 26, 2018, 04:28 |
Parsing error while using the following loop
|
#1 |
Member
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 8 |
Hello, I have recently stepped into the realms of udf. After a few successive tries, I was told to model pulsed laser.
Code:
#include "udf.h" #define PI 3.1415926 //Pi, a constant #define sigma_q 0.35 //Absorptivity #define I 1.05e9 //Laser power #define R 5.250e-3 //Radius of laser beam #define v 3.000e-3 //Scanning velocity #define tr 1e-6 #define tc 50e-6 #define tf 1e-6 #define tp = 100e-6 DEFINE_PROFILE(heat_flux_momin1,thread,position) { face_t f; double x[ND_ND], ft, time, vol, r, t, tempp; double a = 2*R/3; time = RP_Get_Real("flow-time"); t = RP_Get_Real("laser-pulse-time"); begin_f_loop(f,thread) { tempp = F_T(f,thread); F_CENTROID(x,f,thread); r=sqrt(pow((x[0]),2.0)+pow((x[1]),2.0)); while (t <tp) { if (t =0) {ft = 0;} else if (t < tr) { ft = time/tr;} else if (t <= (tr + tc) && time >= tr) {ft = 1;} else if (t < (tr + tc + tf) && time > tr + tc) {ft = (tr+tc+tf-t)/tf;} else {ft = 0}; } t = time -tp ; r=sqrt(pow((x[0]),2.0)+pow((x[1]),2.0)); vol=2.0*r*r/(a*a); F_PROFILE(f,thread,position)=(2.0*I*sigma_q*exp(-vol)*ft; //Set face flux end_f_loop(f,thread) } } Error: C:/Users/NEWU~1/AppData/Local/Temp/MominHeatFlux3.c.8748.0.c: line 25: parse error. Error: C:/Users/NEWU~1/AppData/Local/Temp/MominHeatFlux3.c.8748.0.c: line 28: parse error. Error: C:/Users/NEWU~1/AppData/Local/Temp/MominHeatFlux3.c.8748.0.c: line 29: parse error. Error: C:/Users/NEWU~1/AppData/Local/Temp/MominHeatFlux3.c.8748.0.c: line 30: parse error. Error: C:/Users/NEWU~1/AppData/Local/Temp/MominHeatFlux3.c.8748.0.c: line 31: parse error. Can anyone please help me out with this? Thank you. |
|
August 26, 2018, 21:53 |
|
#2 |
Senior Member
|
I have corrected the syntax error for you.
Code:
#include "udf.h" #define PI 3.1415926 //Pi, a constant #define sigma_q 0.35 //Absorptivity #define I 1.05e9 //Laser power #define R 5.250e-3 //Radius of laser beam #define v 3.000e-3 //Scanning velocity #define tr 1e-6 #define tc 50e-6 #define tf 1e-6 #define tp 100e-6 DEFINE_PROFILE(heat_flux_momin1,thread,position) { face_t f; double x[ND_ND], ft, time, vol, r, t, tempp; double a = 2*R/3; time = RP_Get_Real("flow-time"); t = RP_Get_Real("laser-pulse-time"); begin_f_loop(f,thread) { tempp = F_T(f,thread); F_CENTROID(x,f,thread); r=sqrt(pow((x[0]),2.0)+pow((x[1]),2.0)); while (t <tp) { if (t == 0) {ft = 0;} else if (t < tr) { ft = time/tr;} else if (t <= (tr + tc) && time >= tr) {ft = 1;} else if (t < (tr + tc + tf) && time > tr + tc) {ft = (tr+tc+tf-t)/tf;} else {ft == 0;}; } t = time -tp ; r=sqrt(pow((x[0]),2.0)+pow((x[1]),2.0)); vol=2.0*r*r/(a*a); F_PROFILE(f,thread,position)=2.0*I*sigma_q*exp(-vol)*ft; //Set face flux } end_f_loop(f,thread) } |
|
Tags |
parse error, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 03:36 |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
[Gmsh] Problem with Gmsh | nishant_hull | OpenFOAM Meshing & Mesh Conversion | 23 | August 5, 2015 03:09 |
[CAD formats] my stl surface is seen as just a line | rcastilla | OpenFOAM Meshing & Mesh Conversion | 2 | January 6, 2010 02:30 |
NACA0012 geometry/design software needed | Franny | Main CFD Forum | 13 | July 7, 2007 16:57 |