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

error while calculation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 26, 2018, 07:51
Default error while calculation
  #1
New Member
 
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8
sahoo is on a distinguished road
Hi everyone,
Actually I am trying to solve the following equation(to calculate voltage from temperature difference) :-
∇V=-α(T)*∇T-ρ(T)*J , where α & ρ are known and for J(current density), first I have calculated I(current) from UDS1 and then then divided it by face area to calculate J.
And J is also implemented as boundary condition for UDS0.
∇UDS0=-ρ(T)*J
∇UDS1=-α(T)*∇T
And the code is in 2D.

Combined equation for UDS0, UDS1, J is as follows :-
Quote:
#include "udf.h"
#include "math.h"
#define R 2.0
#define ID 5.0
real A[ND_ND],J;
real At=0;

enum
{
teg,
teg1,
N_REQUIRED_UDS
};

real alpha_function(real T)
{
return 8.439e-4 - 3.81e-6*T + 6.736e-9*pow(T,-9.) - 3.934e-12*pow(T,-12.);
}

DEFINE_SOURCE(teg1_source, c, t, dS, eqn)
{
real T = C_T(c,t);
C_UDSI(c,t,teg) = (-alpha_function(C_T(c,t)))*C_T_G(c,t)[0];
dS[eqn] = C_UDSI(c,t,teg1);
return C_UDSI_G(c,t,teg1)[0];
}

real rho_function(real T)
{
return -3.982e-5 + 2.98e-7*T - 4.685e-10*T*T + 2.51e-12*T*T*T;
}

DEFINE_ADJUST(teg_adjust, domain)
{
Thread *tf, *t;
face_t f;
cell_t c;
tf = Lookup_Thread(domain, ID);
t = THREAD_T0(tf);
c=F_C0(f,tf);

begin_f_loop (f,t)
{
F_AREA(A, f, t) ;
At += NV_MAG(A);
}
end_f_loop (f,t)

begin_f_loop (f,t)
{
J = F_UDSI(f,t,teg1)/R/At;
}
end_f_loop (f,t)
}

DEFINE_DIFFUSIVITY(teg_diffusivity, c, t, i)
{
C_UDSI(c,t,teg) = (-rho_function(C_T(c,t)))*(J);
return 1./rho_function(C_T(c,t));
}

DEFINE_PROFILE( J1, t, p)
{
face_t f ;

begin_f_loop(f,t)
{
F_PROFILE(f, t, p) = J;
}
end_f_loop(f,t)
}
But it gives 'fatal error' while calculation. I have also tried to eliminate some parts and run the code but it seems that diffusivity and rho function are looping with each other.
I hope someone will get it, whats wrong with the code.
sahoo is offline   Reply With Quote

Old   June 26, 2018, 22:34
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
looks like you dont understand, how scalar works.

look into this link. https://wenku.baidu.com/view/dd152b2...b.html?re=view
there is a presentation which could be useful for you, however you should download it somehow.
Unfortunately, I cant upload files.

best regards
AlexanderZ is offline   Reply With Quote

Reply


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
Transfer output data as input for second calculation mannobot Main CFD Forum 3 December 7, 2018 10:37
Dynamic mesh adaption in parallel calculation xh110120 FLUENT 1 March 12, 2016 09:05
Determining the calculation sequence of the regions in multe regions calculation peterhess OpenFOAM Running, Solving & CFD 4 March 9, 2016 04:07
MRF and Heat transfer calculation Susan YU FLUENT 0 June 2, 2010 09:46
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 13:43.