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

Error after adding (Interpreted) the UDF code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2018, 14:00
Default Error after adding (Interpreted) the UDF code
  #1
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Dear All,
I Interpreted a UDF code. When I want to solve it, the following error occurs !
Please help me.

Thanks a lot.
Attached Images
File Type: jpg Error after Interpreted.jpg (194.2 KB, 18 views)
ebtedaei is offline   Reply With Quote

Old   October 26, 2018, 15:04
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,668
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
SIGSEGV is a segmentation fault which happens when you try to access a variable that doesn't exist. You probably got a printout for each processor/thread you were running Fluent on.


If no compilation problems, then check to make sure you ran the UDM before activating the UDF, you need to allocate space for the variables eventually called by the UDF.


It might help to post the contents of your udf.
LuckyTran is offline   Reply With Quote

Old   October 26, 2018, 15:11
Default
  #3
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
SIGSEGV is a segmentation fault which happens when you try to access a variable that doesn't exist. You probably got a printout for each processor/thread you were running Fluent on.


If no compilation problems, then check to make sure you ran the UDM before activating the UDF, you need to allocate space for the variables eventually called by the UDF.


It might help to post the contents of your udf.
Thank you for your reply.
I successfully interpreted the UDF code in Fluent. But when I want to solve it, the error occurs.
What is the UDM?
How can I run the UDM before activating the UDF?
How can I allocate space for the variables eventually called by the UDF?
Please help me.

My UDF file is attached by this post.
Attached Files
File Type: c Viscosity.c (328 Bytes, 9 views)
ebtedaei is offline   Reply With Quote

Old   October 27, 2018, 14:29
Default
  #4
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Where is the one who helps me? Please please help me...

Thank you in advance.
ebtedaei is offline   Reply With Quote

Old   October 29, 2018, 09:23
Default
  #5
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi ebtedaei,

LuckyTran's suggestion about UDM (User-Defined Memory) was just a guess about the most common way to reach that error. Now that we can see your UDF, it is clear that this is not the issue here.

In your UDF, you look up the value of "C_VOF(c,pt[5])" -- which immediately requires that you have a multiphase model with at least 6 phases. Is that correct in your model? Also, "C_MU_L(c,pt[5])" implies that viscosity is calculated and stored for each phase. Is that correct?

A crude but effective way to check would be to add these lines to your UDF (before the first calculation "alfa="):
Code:
Message("Here in cell_viscosity, C_VOF(c,pt[5]) = %g\n", C_VOF(c,pt[5]));
Message("Here in cell_viscosity, C_MU_L(c,pt[5]) = %g\n", C_MU_L(c,pt[5]));
If the UDF works, you will be inundated with output. (Save your case & data before you run this UDF, or any other!) I suspect one of these lines will trigger the SIGSEGV error, and then you know that these variables do not actually exist.

Good luck!
Ed
obscureed is offline   Reply With Quote

Old   October 30, 2018, 03:58
Default
  #6
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Quote:
Originally Posted by obscureed View Post
Hi ebtedaei,

LuckyTran's suggestion about UDM (User-Defined Memory) was just a guess about the most common way to reach that error. Now that we can see your UDF, it is clear that this is not the issue here.

In your UDF, you look up the value of "C_VOF(c,pt[5])" -- which immediately requires that you have a multiphase model with at least 6 phases. Is that correct in your model? Also, "C_MU_L(c,pt[5])" implies that viscosity is calculated and stored for each phase. Is that correct?

A crude but effective way to check would be to add these lines to your UDF (before the first calculation "alfa="):
Code:
Message("Here in cell_viscosity, C_VOF(c,pt[5]) = %g\n", C_VOF(c,pt[5]));
Message("Here in cell_viscosity, C_MU_L(c,pt[5]) = %g\n", C_MU_L(c,pt[5]));
If the UDF works, you will be inundated with output. (Save your case & data before you run this UDF, or any other!) I suspect one of these lines will trigger the SIGSEGV error, and then you know that these variables do not actually exist.

Good luck!
Ed
Thank you very much for your reply. I'm not skilled in writing UDF code, but I have to use it in my problem! Please help me to correct it until the last step.

I will test your suggested commands and inform you of the results.

I have just three phases including Water, Air and Powdered material in micron size as the third fluid.
Fluent software itself has defined the third fluid as the fifth phase!!!

I just want to mix water (the first fluid) and the third fluid to produce a suspension by mixture model. Of course, before simulating the mixture model as secondary step, I've simulated water and air with the VOF model in first step.

I just want to change the viscosity of the third fluid based on its volume fraction inside the computational domain.
The image of the equation is attached by this reply. In this equation, μm is the mixture (water and the third fluid) viscosity, μc is the continuous phase (water) viscosity, and alpha (d) is the powder (the third fluid) volume fraction.

The fact is that one of my friends has written this UDF code for me!!!

Thanks a lot.
Attached Images
File Type: jpg Equation.jpg (34.1 KB, 1 views)

Last edited by ebtedaei; October 30, 2018 at 07:56.
ebtedaei is offline   Reply With Quote

Old   October 30, 2018, 07:54
Default The results of your suggested commands
  #7
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
I used your suggested commands but the UDF code did not interpreted! When I interpreted the code, the attachment error occurred!
Attached Images
File Type: jpg Error.jpg (76.2 KB, 4 views)
Attached Files
File Type: c Viscosity by Ed.c (480 Bytes, 0 views)
ebtedaei is offline   Reply With Quote

Old   October 30, 2018, 07:55
Default
  #8
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi ebtedaei,


There are occasions where secondary phases are referred to by thread ID numbers, but this is not one of them -- go and look in the manual for C_VOF. If you have water as primary phase, air as secondary phase 1 and powder as secondary phase 2, then the volume fraction of powder is "C_VOF(c,pt[2])".


If you can use a constant value for mu_c (the viscosity of water), rather than looking it up from Fluent's cell value, then this will save a lot of trouble. If you set up Fluent to use a mixture viscosity, as supplied by this UDF, then Fluent does not calculate (and, even more certainly, does not store) viscosities for all the separate phases. So, I am doubtful that C_MU_L lookups will work (though I could be wrong, depending on exactly how you have set up viscosity).


Good luck!
Ed
obscureed is offline   Reply With Quote

Old   October 30, 2018, 08:18
Default Question?
  #9
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Quote:
Originally Posted by ebtedaei View Post
I used your suggested commands but the UDF code did not interpreted! When I interpreted the code, the attachment error occurred!
Did I use your suggestions correctly in the following code?
Attached Files
File Type: c Viscosity by Ed.c (480 Bytes, 1 views)

Last edited by ebtedaei; October 30, 2018 at 13:10.
ebtedaei is offline   Reply With Quote

Old   October 30, 2018, 12:33
Default
  #10
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Quote:
Originally Posted by obscureed View Post
Hi ebtedaei,


There are occasions where secondary phases are referred to by thread ID numbers, but this is not one of them -- go and look in the manual for C_VOF. If you have water as primary phase, air as secondary phase 1 and powder as secondary phase 2, then the volume fraction of powder is "C_VOF(c,pt[2])".


If you can use a constant value for mu_c (the viscosity of water), rather than looking it up from Fluent's cell value, then this will save a lot of trouble. If you set up Fluent to use a mixture viscosity, as supplied by this UDF, then Fluent does not calculate (and, even more certainly, does not store) viscosities for all the separate phases. So, I am doubtful that C_MU_L lookups will work (though I could be wrong, depending on exactly how you have set up viscosity).


Good luck!
Ed
Hi Ed,
Again, thank you for your guides. At first, I have a question you --- Why are the IDs of different phases not regular in Fluent? that's mean, water ID= 1, Air ID= 2 and Third phase ID= 3.

In the following, I will answer your sentences above one by one:
- Yes, I have water as primary phase, air as secondary phase 1 and powder as secondary phase 2 (the attached shapes). But I do not know why Fluent has different IDs assigned to the phases!!! With this, can I the ID of the volume fraction of powder assign equal with 2 ("C_VOF(c,pt[2])")?

- I think that I can use a constant value for mu_c (the viscosity of water= 0.001003) as the attached code called "Viscosity by Ed (2)"! What do you think?

Thanks
Attached Images
File Type: jpg ID 2.jpg (41.1 KB, 2 views)
File Type: jpg ID 3.jpg (40.9 KB, 2 views)
File Type: jpg ID 5.jpg (40.7 KB, 2 views)
Attached Files
File Type: c Viscosity by Ed (2).c (439 Bytes, 0 views)
ebtedaei is offline   Reply With Quote

Old   December 18, 2018, 12:59
Default
  #11
Senior Member
 
ali
Join Date: Jul 2016
Posts: 147
Rep Power: 9
ebtedaei is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
SIGSEGV is a segmentation fault which happens when you try to access a variable that doesn't exist. You probably got a printout for each processor/thread you were running Fluent on.


If no compilation problems, then check to make sure you ran the UDM before activating the UDF, you need to allocate space for the variables eventually called by the UDF.


It might help to post the contents of your udf.
I'm so amateur in writing UDF code! The question is, what values should I add in the attached image and on what basis?

Thanks so much
Attached Images
File Type: jpg UDM.jpg (30.2 KB, 2 views)
ebtedaei 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
Interpreted UDF Bikash FLUENT 10 December 3, 2019 00:52
HELP! adding a mass source to VOF eqn. by UDF??? ROOZBEH FLUENT 5 December 3, 2016 17:53
conjugateHeatFoam + interFoam farhagim OpenFOAM Programming & Development 15 July 19, 2016 07:55
chtMultiRegionSimpleFoam samiam1000 OpenFOAM Running, Solving & CFD 39 March 31, 2016 08:43
Problem interpreted Reaction Code oTopero FLUENT 11 November 24, 2015 06:25


All times are GMT -4. The time now is 23:25.