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

Execute On Demand Error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 1, 2021, 03:13
Default Execute On Demand Error
  #1
Member
 
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6
Cooper24 is on a distinguished road
I am new to UDF coding. I have written an UDF for adding a moving laser heat source in energy equation. I have written the following code:

#include "udf.h"
#include "sg_mphase.h"
#include "mem.h"
#include "sg_mem.h"
#include "math.h"
#include "flow.h"
#include "unsteady.h"

#define A 0.4 // Absorption coefficient
#define P 200 // Laser power
#define R 80e-6 // spot radius
#define v 0.1 // scan speed of laser
#define h 25 // Heat transfer coefficient
#define Ta 298 // Ambient air temperature
#define s 5.67e-8 // Stefan Boltzmann constant
#define e 0.5 // Emmisivity
#define Pi 3.1415926535
#define Ts 1658 // Solidus temperature
#define Tl 1723 // Liquidus temperature
#define x0 100e-6 // Initial x position of the laser
#define y0 0.0 // Intiial y position of the laser
#define domain_ID 3 // Domain ID of metal substrate


DEFINE_INIT(volume_fraction, mixture_domain)
{
int phase_domain_index = 1;
cell_t c;
Thread *t;
Domain *subdomain;
real xc[ND_ND];
sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{
if(DOMAIN_ID(subdomain) == 3)
thread_loop_c (t,subdomain)
{
begin_c_loop_all(c,t)
{
C_CENTROID(xc,c,t);
if(xc[0] > -0.5e-3 && xc[0] < 0.5e-3 && xc[1] > -0.25e-3 && xc[1] < 0.25e-3 && xc[2] < 0 && xc[2] > -0.3e-3)
C_VOF(c,t) = 1.0;
else
C_VOF(c,t) = 0.0;
}
end_c_loop_all(c,t)
}
}
}




DEFINE_ADJUST(adjust_gradient, domain)
{
Thread *t;
cell_t c;
domain = Get_Domain(domain_ID);

thread_loop_c(t, domain)
{
begin_c_loop(c,t)
{
C_UDSI(c,t,0) = C_VOF(c,t);
}
end_c_loop(c,t)
}
}

DEFINE_ON_DEMAND(store_gradient)
{
Domain *domain;
cell_t c;
Thread *t;
domain = Get_Domain(domain_ID);

thread_loop_c(t, domain)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0));
}
end_c_loop(c,t)
}
}



DEFINE_SOURCE(heat_source, c, t, dS, eqn) // The name of the UDF is heat_source
{
real source;
real x[ND_ND], time;
time = RP_Get_Real("flow-time");
C_CENTROID(x, c, t);
real T = C_T(c,t);


if(C_VOF(c,t)>0.05 && C_VOF(c,t)<1)
{
source = (((2*A*P)/(Pi*R*R))*exp((-2*(pow(x[0]-x0-v*time,2.0) + pow(x[1]-y0,2.0)))/(R*R)) - h*(T-Ta) - s*e*(pow(T,4) - pow(Ta,4)))*C_UDMI(c,t,0);
dS[eqn] = 0.0;
}
else
{
source = 0.0;
dS[eqn] = 0.0;
}
return source;
}
The UDF compiles without any error. When I am trying to hook the functions, DEFINE_ADJUST and DEFINE_INIT are hooked without any error. When I try to hook DEFINE_ON_DEMAND using Execute on demand, FLUENT crashes with error: Node X: Process YYYY: Received Signal SIGSEGV.
The number of messages is same as the number of processors I am using, which is 6. I am not receiving any error related to MPI.

Please someone help!!
Cooper24 is offline   Reply With Quote

Reply

Tags
sigsegv


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
Reading a sequence of libraries as Execute Commands Benyounes Main CFD Forum 0 October 14, 2020 06:38
Cannot Execute on Demand Denis Fluent UDF and Scheme Programming 6 June 26, 2018 05:40
fatal error while execute on demand... fatemeh chitgarha Fluent UDF and Scheme Programming 1 July 29, 2013 03:44
execute udf in ss & transient simulation hosseinhgf FLUENT 0 December 1, 2010 09:41
error while execute on demand Anderson Main CFD Forum 4 October 17, 2008 12:48


All times are GMT -4. The time now is 16:27.