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

cell next to the wall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2020, 05:43
Post cell next to the wall
  #1
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
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
Attached Images
File Type: jpg Screenshot (388).jpg (135.4 KB, 9 views)
mohammadreza_hj is offline   Reply With Quote

Old   December 7, 2020, 08:59
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
F_VOF(f,t) does not exist anymore???
pakk is offline   Reply With Quote

Old   December 7, 2020, 09:33
Default
  #3
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by pakk View Post
F_VOF(f,t) does not exist anymore???
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.
mohammadreza_hj is offline   Reply With Quote

Old   December 7, 2020, 13:07
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   December 7, 2020, 14:50
Default
  #5
Senior Member
 
duri
Join Date: May 2010
Posts: 245
Rep Power: 16
duri is on a distinguished road
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]
duri is offline   Reply With Quote

Old   December 8, 2020, 08:37
Default
  #6
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Mr pakk, thanks for your attention; I think I do what you said, and I get this error again (image attached).
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
mohammadreza_hj is offline   Reply With Quote

Old   December 8, 2020, 08:49
Default
  #7
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by duri View Post
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]
Thanks for your attention,

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?
mohammadreza_hj is offline   Reply With Quote

Old   December 8, 2020, 09:41
Default
  #8
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
I forgot to attach the image.
So here is the image.
Attached Images
File Type: jpg Screenshot (506).jpg (104.2 KB, 6 views)
mohammadreza_hj is offline   Reply With Quote

Old   December 8, 2020, 14:27
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by mohammadreza_hj View Post
Mr pakk, thanks for your attention; I think I do what you said, and I get this error again (image attached).
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
1. Compile, don't interpret.
2. Declare all variables before you do anything else.
3. What are those stars at the end???
4. Where do you define qslip?
pakk is offline   Reply With Quote

Old   December 9, 2020, 00:07
Default
  #10
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by pakk View Post
1. Compile, don't interpret.
2. Declare all variables before you do anything else.
3. What are those stars at the end???
4. Where do you define qslip?
Thanks to you,
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.
mohammadreza_hj is offline   Reply With Quote

Old   December 9, 2020, 01:15
Default
  #11
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by mohammadreza_hj View Post
Thanks to you,
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.
1. In your picture, the UDF name looks interpreted. If it's compiled, it says libudf::something. So I am not so sure about that... Did you click "build"? Did you check for errors?
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.
pakk is offline   Reply With Quote

Old   December 9, 2020, 04:46
Default
  #12
Senior Member
 
duri
Join Date: May 2010
Posts: 245
Rep Power: 16
duri is on a distinguished road
Quote:
Originally Posted by mohammadreza_hj View Post
Thanks for your attention,

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?

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.
duri is offline   Reply With Quote

Old   December 9, 2020, 05:40
Default
  #13
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by duri View Post
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.
Thanks for your attention.
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.
mohammadreza_hj is offline   Reply With Quote

Old   December 9, 2020, 05:51
Default
  #14
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by pakk View Post
1. In your picture, the UDF name looks interpreted. If it's compiled, it says libudf::something. So I am not so sure about that... Did you click "build"? Did you check for errors?
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, check if you get the same errors.
Thanks for your attention.

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.
mohammadreza_hj is offline   Reply With Quote

Old   December 9, 2020, 07:11
Default
  #15
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by duri View Post
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.
Here my code; I am so so appreciated. You if take a look at it and tell me what's wrong.
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.
mohammadreza_hj is offline   Reply With Quote

Old   December 9, 2020, 10:02
Default
  #16
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by mohammadreza_hj View Post
Here my code; I am so so appreciated. You if take a look at it and tell me what's wrong.
(code removed to keep post not too large)
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.
OK, clear.
Quote:
2. can you tell me which variable please? because I haven't experienced it, I think the problem is from this part.
Look at this part of your code:

Code:
begin_f_loop(f,t)
{
double p[ND_ND]; /* this will hold the position vector */
You started your loop before you declared variable p. That is not something you should do, and I am surprised that your compiler did not complain about it. First declare all variables in your function, then do the rest.

Quote:
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.
Good you share it, because there are bugs there.
Code:
if (297.<=temp<=373.)
The compiler interprets this as follows:
Code:
if ((297.<=temp)<=373.)
In other words: it first evaluates if the temperature is larger or equal than 297. If it is, it evaluates to true=one, otherwise it evaluates to false=zero. Then, the result is compared to 373. Is the result smaller than 373? Yes, always. So the compiler will always think it is true.

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.))
You seem to think that the line
Code:
FV = C_VOF(F_C0(f,t),THREAD_T0(t));
is causing your problems. I have suggested already to replace it by C_VOF(f,t), but you have put the old one back, it seems...

If you want to test if that line is the reason: simplify it!

Code:
FV = 0.5;
Does your problem still occur? No? Then the problem is in that line. Yes? Then it is somewhere else!
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!
pakk is offline   Reply With Quote

Old   December 9, 2020, 10:08
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   December 10, 2020, 02:23
Default
  #18
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by pakk View Post
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!
Rereading this, it sounds condescending. I should have phrased it differently.
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.
pakk is offline   Reply With Quote

Old   December 10, 2020, 16:16
Default
  #19
Member
 
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6
mohammadreza_hj is on a distinguished road
Quote:
Originally Posted by pakk View Post
OK, clear.


Look at this part of your code:

Code:
begin_f_loop(f,t)
{
double p[ND_ND]; /* this will hold the position vector */
You started your loop before you declared variable p. That is not something you should do, and I am surprised that your compiler did not complain about it. First declare all variables in your function, then do the rest.


Good you share it, because there are bugs there.
Code:
if (297.<=temp<=373.)
The compiler interprets this as follows:
Code:
if ((297.<=temp)<=373.)
In other words: it first evaluates if the temperature is larger or equal than 297. If it is, it evaluates to true=one, otherwise it evaluates to false=zero. Then, the result is compared to 373. Is the result smaller than 373? Yes, always. So the compiler will always think it is true.

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.))
You seem to think that the line
Code:
FV = C_VOF(F_C0(f,t),THREAD_T0(t));
is causing your problems. I have suggested already to replace it by C_VOF(f,t), but you have put the old one back, it seems...

If you want to test if that line is the reason: simplify it!

Code:
FV = 0.5;
Does your problem still occur? No? Then the problem is in that line. Yes? Then it is somewhere else!
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!
I'm so much, thank you.
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.
mohammadreza_hj is offline   Reply With Quote

Old   May 30, 2021, 18:03
Default
  #20
New Member
 
Yao liming
Join Date: Apr 2020
Posts: 1
Rep Power: 0
Yaoliming is on a distinguished road
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
Yaoliming 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
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


All times are GMT -4. The time now is 20:08.