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

Parsing error while using the following loop

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2018, 03:28
Post Parsing error while using the following loop
  #1
Member
 
Saurabh Das
Join Date: Jul 2018
Posts: 43
Rep Power: 7
Sorabh is on a distinguished road
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)
        
    }
}
This returns the following errors when interpreted by Fluent.

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.
Sorabh is offline   Reply With Quote

Old   August 26, 2018, 20:53
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
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)
    
}
blackmask is offline   Reply With Quote

Reply

Tags
parse error, udf


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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 02:09
[CAD formats] my stl surface is seen as just a line rcastilla OpenFOAM Meshing & Mesh Conversion 2 January 6, 2010 01:30
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57


All times are GMT -4. The time now is 17:22.