-
-
April 18, 2022 at 6:26 pm
axt5488
SubscriberHello 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?
April 19, 2022 at 4:32 pmRob
Ansys EmployeeThe 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.
Ansys Innovation SpaceEarth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
Trending discussions- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
Top Contributors-
2616
-
2098
-
1323
-
1108
-
461
Top Rated Tags© 2023 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-