# error while calculation

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

June 26, 2018, 06:51
error while calculation
#1
New Member

Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 4
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.

 June 26, 2018, 21:34 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,616 Rep Power: 23 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

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mannobot Main CFD Forum 3 December 7, 2018 09:37 xh110120 FLUENT 1 March 12, 2016 08:05 peterhess OpenFOAM Running, Solving & CFD 4 March 9, 2016 03:07 Susan YU FLUENT 0 June 2, 2010 08:46 AB Siemens 6 November 15, 2004 04:41

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

 Contact Us - CFD Online - Privacy Statement - Top