Fluids

Fluids

Moving Volumetric Heat Flux

    • axt5488
      Subscriber

      Hello everyone

      I am trying to model a gaussian laser heat source as a moving volumetric heat source. When I tired to compile the UDF I received an error and a warning below:


      Source5.c(19,1): warning: type specifier missing, defaults to 'int' [-Wimplicit-int]

      DEFINE_SOURCE(heat_source, c, t, time, dS, eqn)

      ^

      Source5.c(19,14): error: expected ';' after top level declarator

      DEFINE_SOURCE(heat_source, c, t, time, dS, eqn)

             ^

             ;

      2 warnings and 2 errors generated.

      scons: *** [Source5.obj] Error 1

      scons: building terminated because of errors.

      /*Here is the UDF*/

      #include "udf.h"

      #include "math.h"

      #include "metric.h"

      #include "sg.h"

      #include "sg_mphase.h"

      #include "mem.h"

      #include "sg_mem.h"

      #include "flow.h"

      #include "unsteady.h"

      #define A 0.24  /*Absorption coefficient*/

      #define P 400   /*Laser Power*/

      #define re 0.1  /*radius on top*/

      #define ri 0.2  /*radius on bottom*/

      #define zi 0.05  /*cone length parameter lower z axis*/

      #define ze 0.1  /*cone length parameter upper z axis*/

      #define v1 1200  /*laser velocity*/

      #define v2 1200  /*laser velocity*/

      #define pi 3.1415;

      DEFINE_SOURCE(heat_source, c, t, time, dS, eqn)

      {

      real coord[ND_ND];

      real x, y, z;

      C_CENTROID(coord, c, t);

      real xC = 0, yC = 0, zC = 0; /*initial position of the heat flux*/


      real t0 = 3;         /*the time that the heat flux is stationary*/

      real time;

      real H = zi - ze;

      real r0;

      r0 = re + ((ri - re) / H) * (z - ze);

      real Q0;

      Q0 = (6 * A * P) / (pi * -H * ((re*re) + (re * ri) + (ri*ri)));

      real Q;

      Q = Q0 * exp(-1 * (((x - v1 * time) ^ 2 + (y - (v2*time)) ^ 2) / r0 ^ 2);

      if (time < t0)

      {

      x = xC;

      y = yC;

      z = zC;

      dS[eqn] = 0.0;

      }

      else

      {

      time = time - t0;

      x = xC + v1 * time;

      y = yC + v2 * time;

      z = zC;

      dS[eqn] = 0.0;

      }

      return source

      }


      Is anyone can figure out how can I solve this error and warning?

    • Rob
      Ansys Employee
      The error is linked to
      Source5.c(19,14): error: expected ';' after top level declarator
      DEFINE_SOURCE(heat_source, c, t, time, dS, eqn)
      and implies there's a ";" either missing or where it shouldn't be. Typically the error is triggered for the line after the code mistake. Whether that'll fix both errors is a different question.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.