|
[Sponsors] |
December 7, 2020, 05:43 |
cell next to the wall
|
#1 |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Hi everybody,
I have a question, and I desperately ask everyone to see this message and some familiar with this problem. My project is a multiphase simulation, and I have a defined profile for heat flux on the wall; this is a rotation wall, and therefore, this heat flux shoulder be applied on the wall by their amount of the phase. the problem is that there is NOT any macro for VOF on the wall, so I use VOF(c0, to), but there were a problem and fluent crash out (the image attached) Is there anybody who can help me to find out a way for this problem? this is my code: DEFINE_PROFILE(heatflux_slip_shoulder_W, t, i) { face_t f; double pi = 3.1415927; double w = 1120; double U = 0.002; double press = 12700000; double delta = 0.9; double etta = 0.7; double heat_ratio = 0.6383; begin_f_loop(f,t) { double p[ND_ND]; /* this will hold the position vector */ double x, y, r, sigma_6, sigma_5, tav_6, tav_5, tav, fric, qslip, FV; double temp = F_T(f,t); FV = C_VOF(F_C0(f,t),THREAD_T0(t)); F_CENTROID(p, f, t); x = p[0]; y = p[1]; r = sqrt((x*x) + (y*y)); ********* for simplicity and not bothering you, I remove the body of code here************ F_PROFILE(f, t, i) = heat_ratio * qslip; } end_f_loop(f,t) } and this my errors: Error [node 999999] [time 10/24/20 13:57:27] Abnormal Exit! Node 0 Fatal signal raised sig = Segmentation fault Error [node 0] [time 10/23/20 13:47:28] Abnormal Exit! Thanks a lot |
|
December 7, 2020, 08:59 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
F_VOF(f,t) does not exist anymore???
|
|
December 7, 2020, 09:33 |
|
#3 |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Well, there is one mentioning of that in 3.2.12.6. Example UDF that Utilizes UDM and UDS Variables
Except that there is not any of that. Thanks to your attention, I should say that I asked somebody, and they said that I should use udmi, so my question is: HOW? I should define which one of the udmi (C or F)? And I should save the VOF(c0, t0), on what? I ask this question because of my lack of knowing writing code and UDF... so maybe they are too simple to answer, but I truly beg you to answer completely. |
|
December 7, 2020, 13:07 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
You had a segmentation fault, which means that you read (or write) memory that does not exist.
The VOF line that you mentioned is the main candidate for the problem. You claim that no face version for VOF exists, but that claim is false, it seems that F_VOF exists. So, use that one. I don't see in what way a UDM could do something useful here. Just use F_VOF. |
|
December 7, 2020, 14:50 |
|
#5 |
Senior Member
duri
Join Date: May 2010
Posts: 245
Rep Power: 16 |
THREAD_T0 will return a thread pointer to mixture phase. In case of VOF you need to select the required phase. Something like this, THREAD_SUB_THREADS(mixture_thread)[phase_num]
|
|
December 8, 2020, 08:37 |
|
#6 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
So I think the problem is in my code. So can you do me a more favor and take a look at that and guide me. ******* my code: DEFINE_PROFILE(heatflux_slip_shoulder_W, t, i) { face_t f; begin_f_loop(f,t) { double p[ND_ND]; /* this will hold the position vector */ double x, y, r, qslip, sigma, tav_stick, tav_fric, temp, Vx, Vy, Vz, V_W, V_T; double w = 1120; double pi = 3.1415927; double U = 0.002; double press = 50000000; double delta = 0.65; double etta = 0.7; double heat_ratio = 0.6383; double Rshol = 0.0075; double fric ; double Rpin = 0.0025; double vf = F_VOF(f,t); F_CENTROID(p, f, t); x = p[0]; y = p[1]; r = sqrt((x*x) + (y*y)); temp = F_T(f,t); Vx = F_U(f,t); Vy = F_V(f,t); Vz = F_W(f,t); V_W = sqrt (Vx*Vx + Vy*Vy + Vz*Vz); V_T = (pi*w*r/30) + (U*y/r); * * * F_PROFILE(f, t, i) = heat_ratio * qslip * vf; } end_f_loop(f,t) } Thank you |
||
December 8, 2020, 08:49 |
|
#7 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
Can you explain to me more. I'm not so familiar with this part of fluent, so I will appreciate you explaining what I should do (the steps I should take) and what example and reference I should look at? |
||
December 8, 2020, 09:41 |
|
#8 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
So here is the image. |
||
December 8, 2020, 14:27 |
|
#9 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Quote:
2. Declare all variables before you do anything else. 3. What are those stars at the end??? 4. Where do you define qslip? |
||
December 9, 2020, 00:07 |
|
#10 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
well, answering your recommendation: 1: I did. 2: I did. 3: those are the replacement of the body of my code for shorting the comment. 4: in the star replacement. Thank you. |
||
December 9, 2020, 01:15 |
|
#11 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Quote:
2. No, not in the code that you shared above. 3+4: how do you expect us to find the mistake in your code, if you don't share the code? If you don't want to share the code for confidentiality reasons, simplify the code, just check if you get the same errors. |
||
December 9, 2020, 04:46 |
|
#12 | |
Senior Member
duri
Join Date: May 2010
Posts: 245
Rep Power: 16 |
Quote:
Try to debig the code and get the exact line that has the issue. My initial understanding is that the C_VOF function has failed. If this is true then pass the correct phase cell thread instead of mixture thread. |
||
December 9, 2020, 05:40 |
|
#13 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
Yes, it is. The problem is from V_VOF. I read the help, but I can't understand anything good from that. And it's because I didn't get any professional course. So, I'm sorry to asking you this, but can you explain what I should do step by step. Again I know it's not my job, and I'm so sorry. |
||
December 9, 2020, 05:51 |
|
#14 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
1. yes, Mr pakk, I have two systems. This image is from a personal system that I haven't visual studio on, but I try this first on the lab's system, and it crashes out without any error, crash out. But I should mention that this crash occurs when I initialize the solution. In both ways. If first of all, I initialize when I want to hover the macro on the crash out. 2. can you tell me which variable please? because I haven't experienced it, I think the problem is from this part. 3. no no no, it's not because of the confidentiality. I share it in the next post. I think that maybe it will be confusing you. |
||
December 9, 2020, 07:11 |
|
#15 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
My simulation consists of two-phase, and my primary phase is al6061, and my secondary is al5052. And it's a bit different from the last code I post because I wanted to make that simple. #include "udf.h" #include "mem.h" DEFINE_PROFILE(heatflux_slip_shoulder_W, t, i) { face_t f; double pi = 3.1415927; double w = 1120; double U = 0.002; double press = 12700000; double delta = 0.9; double etta = 0.7; double heat_ratio = 0.6383; begin_f_loop(f,t) { double p[ND_ND]; /* this will hold the position vector */ double x, y, r, sigma_6, sigma_5, tav_6, tav_5, tav, fric, qslip, FV; double temp = F_T(f,t); FV = C_VOF(F_C0(f,t),THREAD_T0(t)); F_CENTROID(p, f, t); x = p[0]; y = p[1]; r = sqrt((x*x) + (y*y)); if (297.<=temp<=373.) { sigma_6 = 325.80263157895 + (-0.171052631578952 * temp); sigma_5 = 282.355263157897 + (-0.0921052631578974*temp); } else if (373.<=temp<=423.) { sigma_6 = 612.620000000003 + (-0.939999999999998 * temp); sigma_5 = 658.299999999996 + (-1.09999999999999*temp); } else if (423.<=temp<=478.) { sigma_6 = 1076.38181818182 + (-2.03636363636365 * temp); sigma_5 = 546.236363636355 + (-0.927272727272715 * temp); } else if (478.<=temp<=533.) { sigma_6 = 693.981818181812 + (-1.23636363636363 * temp); sigma_5 = 546.236363636355 + (-0.927272727272715 * temp); } else if (533.<=temp<=588.) { sigma_6 = 190.054545454545 + (-0.290909090909089 * temp); sigma_5 = 187.672727272726 + (-0.25454545454545 * temp); } else if (588.<=temp<=643.) { sigma_6 = 93.8363636363629 + (-0.127272727272725 * temp); sigma_5 = 219.745454545453 + (-0.309090909090905 * temp); } else if (643.<=temp<=855.) { sigma_6 = 44.5569620253164 + (-0.050632911392405 * temp); sigma_5 = 77.9746835443038 + (-0.0886075949367088 * temp); } else { sigma_6 = 0; sigma_5 = 0; } if (298. <= temp <=855.) fric = 0.383752244165171 + (-0.000448833034111311 * temp); else fric = 0; tav_6 = sigma_6*1000000/1.732; tav_5 = sigma_5*1000000/1.732; tav = FV * tav_6 + (1 - FV) * tav_5; qslip = ((pi*w*r/30) - (U*y/r)) * ((etta * (1 - delta) * tav) + (delta * fric * press)); F_PROFILE(f, t, i) = heat_ratio * qslip; } end_f_loop(f,t) } Thank you for your attention. |
||
December 9, 2020, 10:02 |
|
#16 | ||||
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Quote:
Quote:
Quote:
Code:
begin_f_loop(f,t) { double p[ND_ND]; /* this will hold the position vector */ Quote:
Code:
if (297.<=temp<=373.) Code:
if ((297.<=temp)<=373.) Now, I know this is not what you want: you want to check if the temperature is between 297 and 373. Check it in this way: Code:
if ((297.<=temp)&&(temp<=373.)) Code:
FV = C_VOF(F_C0(f,t),THREAD_T0(t)); If you want to test if that line is the reason: simplify it! Code:
FV = 0.5; Keep simplifying, until you find the cause! But you really have to do the work. Don't just expect to throw a large UDF on a forum and let others do the digging for the error; do some digging yourself! |
|||||
December 9, 2020, 10:08 |
|
#17 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Oh, and of course, if your domain includes (x,y)=(0,0), you divide by zero and get errors.
But that is a problem of your physical model/equations, not of your code. |
|
December 10, 2020, 02:23 |
|
#18 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Quote:
I did not mean to imply that you are lazy. I wanted to say that you should learn how to debug. Debugging is a skill that nobody is born with, it takes time to learn. And you should take the time and effort to do so, that it what I meant to say. |
||
December 10, 2020, 16:16 |
|
#19 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
I will apply your advice on code, plus that, I should say I actually try FV=0.5, before and there was no problem. This question comes up for me (because I was rereading the multiphase macro section) is there any problem with my data access and looping macro? There was a lot of subdomain and sub-thread thing, and I became suspicious that maybe I was wrong in there ( because I'm not experienced in UDF coding, especially multiphase). So I've really appreciated you; I know that I am bothering you and want something I should not want. So I will be reading the manual more carefully and try to ask good questions. |
||
May 30, 2021, 18:03 |
|
#20 |
New Member
Yao liming
Join Date: Apr 2020
Posts: 1
Rep Power: 0 |
Dear mohammadreza,
I read your discussion carefully and want to ask you some questions. I do multiphase flow species transport (VOF+species transport), the primary is air, and the secondary phase is water and ink. I want to calculate the diffusion of water and ink. At present, I have encountered a problem when extracting the species gradient. The following code always runs incorrectly. Can you give some suggestions for modification? ~~~~~ DEFINE_ADJUST(store_Y_gradient, domain) { Thread *t; Thread *ppt; Thread **pt; cell_t c; int phase_domain_index=0; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index); Alloc_Storage_Vars(pDomain,SV_Y_RG,SV_Y_G,SV_NULL) ; Scalar_Reconstruction(pDomain, SV_Y,-1,SV_Y_RG,NULL); Scalar_Derivatives(pDomain,SV_Y,-1,SV_Y_G,SV_Y_RG,NULL); mp_thread_loop_c (t,domain,pt) { if (FLUID_THREAD_P(t)) { begin_c_loop (c,t) { C_UDMI(c,t,0) = C_YI_G(c,pt[1],0)[0]; } end_c_loop (c,t) } } Free_Storage_Vars(pDomain,SV_Y_RG,SV_Y_G,SV_NULL); } ~~~~~~~~ error: Node 0: Process 22016: Received signal SIGSEGV. . . . Node 8: Process 20312: Received signal SIGSEGV. MPI Application rank 0 exited before MPI_Finalize() with status 2. The fl process could not be started. ~~~~~~~~ Thank you for any suggestions! Best wishes. Liming |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 05:38 |
Difficulty In Setting Boundary Conditions | Moinul Haque | CFX | 4 | November 25, 2014 17:30 |
Question about the way to calculate the maximum wall cell width | Anna Tian | Main CFD Forum | 9 | October 23, 2012 18:05 |
[ICEM] Export ICEM mesh to Gambit / Fluent | romekr | ANSYS Meshing & Geometry | 1 | November 26, 2011 12:11 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 04:15 |