|
[Sponsors] |
June 20, 2018, 06:49 |
using boundary condition in uds
|
#1 | ||
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
Hello everyone,
I have a problem regarding using the boundary condition in an UDS I need to make the following equation in UDS0 :- ∇UDS0=-ρ(T)*J ∇J=0 ∇[-1/ρ(T) *∇UDS0]=0 Quote:
∆V=∇UDS0+∇UDS1 I=∆V/R J=I/(face area) For which made the code :- Quote:
'voltage_function' must return a value I wanted to know how to use this 'J' in UDS0 and whats wrong in this code, since it is a boundary condition. I hope the doubt is understandable. Please suggest me a way to solve this. Thank you |
|||
June 20, 2018, 08:20 |
|
#2 | |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
You do not need to create functions for everything; it appears that creating the functions are complicating things (in particular, you are sending the face temperature to the voltage_function on line 46). Instead, you could write out your equations with one line each. For example, if your equations were: then your code would look like: Code:
dV = F_UDSI(f,t,0) + F_UDSI(f,t,1); I = dV/R; J = I/A; Code:
J = (F_UDSI(f,t,0) + F_UDSI(f,t,1))/R/A; |
||
June 20, 2018, 09:58 |
|
#3 |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
Yes I think the problem was with the scalar and vector. Now its working .
But my main problem was using this 'J' in UDS0 which I am still not getting. ∇UDS0=-ρ(T)*J How can I import the J value to UDS0? |
|
June 20, 2018, 23:22 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use DEFINE_SOURCE macros to define J
best regards |
|
June 21, 2018, 10:43 |
|
#5 |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
Thanks for your reply. But it was something different and I got it.
|
|
June 21, 2018, 16:54 |
|
#6 | |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
While loading the code I am getting the error received a fatal signal (Segmentation fault)
I have also tried to solve this using link Error: received a fatal signal (Segmentation fault). But it didnt work. I am still getting the error. UDF is as follows :- Quote:
|
||
June 22, 2018, 04:30 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
||
June 23, 2018, 03:35 |
|
#8 | |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
Also, should the evaluation for J (line 24) be within the second face loop? What equation are you applying on the boundary? |
||
March 9, 2021, 07:57 |
|
#9 |
New Member
Anas Nur Fauzan
Join Date: Oct 2019
Posts: 18
Rep Power: 7 |
Hello guys, I know this thread is a bit old. But I wanted to ask you guys to elaborate on how to implement the J term. As sahoo stated, the J term is a boundary but based on the reference it's a specified flux boundary for UDS0.
Mr. AlexanderZ said that we could use DEFINE_SOURCE macro but since the J term is actually a flux term. I still don't get the idea of how to implement J term in UDS0. Best regards. Thank you. Last edited by luzikato; March 9, 2021 at 10:36. |
|
March 17, 2021, 22:13 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you may specify boundary flux using define_profile macro, as sahoo did.
check his code above. there could be a lot of reasons, why he had that error, code may not be a problem the only this to be changed in code: was Code:
J = (F_UDSI(f,t,teg) + F_UDSI(f,t,teg1))/R/At; begin_f_loop(f,t) { F_PROFILE(f, t, p) = J; } end_f_loop(f,t) Code:
begin_f_loop(f,t) { J = (F_UDSI(f,t,teg) + F_UDSI(f,t,teg1))/R/At; F_PROFILE(f, t, p) = J; } end_f_loop(f,t)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
March 17, 2021, 22:44 |
|
#11 |
New Member
Anas Nur Fauzan
Join Date: Oct 2019
Posts: 18
Rep Power: 7 |
I was thinking that this thread is not active anymore. I opened another thread with similar topic.
Thank you for your reply. Yes, i figured the code after quite a time. Yes, I also had error like sahoo did. I also figured the solution. Basically, when it's applied on boundary, the profile udf need to read temperature profile from the boundary which is not exist yet at the initial condition. So to fix the error you need to use standard initialization specifying temperature. After this, the error just gone. However, I have another question. If I want to specifiy the flux at a boundary like this. Should I use the area of the whole boundary or just the face at every loop? Since the loop is being done on faces. |
|
March 18, 2021, 00:57 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
don't really get your question
flux is in unit/m2. for instance you can apply heat -> flux is W/m2 to get total applied energy you need integral over whole boundary -> W/m2 * m2 = W
__________________
best regards ****************************** press LIKE if this message was helpful |
|
March 18, 2021, 02:05 |
|
#13 |
New Member
Anas Nur Fauzan
Join Date: Oct 2019
Posts: 18
Rep Power: 7 |
A boundary is consist of multiple faces, right? So I'm thinking that each faces has its own flux value. And total flux on that boundary would be integral of flux values from multiple faces on the boundary.
Let's say a boundary consist of 50 faces with different heat flux values. So total flux on that boundary would be sum of 50 different heat flux values. Each of those 50 faces has its own flux values. So from what I understand, to calculate flux value from one specific face, we need to divide heat by area of that specific face only, right? I'm a little bit confused because from the code sahoo made. I think he was trying to divide scalar value with sum of area of the entire boundary on each loop which contradict my understanding on calculating flux. I hope you understand my point. Nevertheless, thank you for all your reply. Best regards. |
|
March 18, 2021, 21:50 |
|
#14 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
as far as I understand, for your case with 50 faces, you should divide total heat flux on total area of boundary (area of all 50 faces), and apply it to each face
__________________
best regards ****************************** press LIKE if this message was helpful |
|
March 24, 2021, 06:12 |
|
#15 |
New Member
Anas Nur Fauzan
Join Date: Oct 2019
Posts: 18
Rep Power: 7 |
Okay. I get it now.
I have another question. So, like sahoo. I'm trying to simulate a thermoelectric generator. The source term involve Temperature-dependent Seeback Coefficient which defined with a polynomial function below. Code:
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); } Code:
real alpha (real T){ return 8.439e-4 - 3.81e-6*T + 6.736e-9*pow(T,-9) - 3.934e-12*pow(T,-12); } DEFINE_EXECUTE_AT_END(CalculateScalarsAtEnd) { cell_t c; Thread *t; begin_c_loop(c, t) { C_UDSI(c,t,2) = alpha(C_T(c,t)); C_UDSI(c,t,3) = C_UDSI(c,t,2)*C_T_G(c,t)[0]; C_UDSI(c,t,4) = C_UDSI(c,t,2)*C_T_G(c,t)[1]; C_UDSI(c,t,5) = C_UDSI(c,t,2)*C_T_G(c,t)[2]; } end_c_loop(c,t) } Quote:
Thank you. Best regards. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mixed inflow/outflow downstream boundary condition question | peob | OpenFOAM Running, Solving & CFD | 3 | February 3, 2017 11:54 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 09:44 |
UDS problem with wall boundary condition | Alex F. | FLUENT | 15 | September 21, 2015 10:28 |
External Radiation Boundary Condition (Two sided wall), Grid Interface | CFD XUE | FLUENT | 0 | July 8, 2010 07:49 |
vorticity boundary condition | bearcharge | Main CFD Forum | 0 | May 14, 2010 12:32 |