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

Segmentation error when initializing solver using UDFs

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2021, 03:58
Default Segmentation error when initializing solver using UDFs
  #1
New Member
 
--
Join Date: Sep 2021
Posts: 4
Rep Power: 4
xiaotaoo is on a distinguished road
Hey everyone,

Thank you in advance for all your help.

I am facing some trouble regarding using my Ansys Fluent UDF in customizing my "pressure-outlet" boundary condition. To give some context, I am using quadrilateral meshes and using the finite volume method to obtain the velocity gradient of the flow at the outlet. To do so, I need to obtain the velocities at the nodes and calculate the velocity gradient of the cell to be used at the outlet. The boundary condition that I am trying to set at the outlet is p = (-2/re)*(dv/dx).

The UDF seems to be compiled so the error does not seem to be a syntax error but rather an error in trying to pull data from the software. The error occurs when I select "all" in the initialization tab of the fluent solver.

I have attached a screenshot of the UDF code, the finite volume gradient formula that I am taking reference from and the error given by Ansys Fluent.

Thank you so much for your help!
Attached Images
File Type: jpg Screenshot 2021-10-02 155147.jpg (112.1 KB, 16 views)
File Type: jpg Screenshot 2021-10-02 155308.jpg (27.4 KB, 8 views)
File Type: jpg Screenshot 2021-10-02 155256.jpg (17.2 KB, 9 views)
File Type: jpg photo_2021-10-02_15-55-35.jpg (10.3 KB, 8 views)
xiaotaoo is offline   Reply With Quote

Old   October 2, 2021, 09:18
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Your UDF calculates pressure from velocity data.
If the initialization tries to set pressure before initializing velocities, it will fail.

Solution can be to initialize before applying the UDF.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   October 2, 2021, 11:13
Default
  #3
New Member
 
--
Join Date: Sep 2021
Posts: 4
Rep Power: 4
xiaotaoo is on a distinguished road
Thank you so much! I understand how it works now thanks to your explanation
xiaotaoo is offline   Reply With Quote

Old   October 2, 2021, 22:19
Default
  #4
New Member
 
--
Join Date: Sep 2021
Posts: 4
Rep Power: 4
xiaotaoo is on a distinguished road
Hi Pakk, sorry to bother you again.

I am able to load the UDF by first initializing with the 0 pressure-outlet boundary condition, however, upon running the calculations, the solver crashes again with a bad termination error and also a segmentation error similar to when initializing my solution previously.

I was wondering if there was anything wrong with the way my UDF is extracting data from the cell nodes which results in this error? Thank you so much!
xiaotaoo is offline   Reply With Quote

Old   October 4, 2021, 10:08
Default
  #5
New Member
 
--
Join Date: Sep 2021
Posts: 4
Rep Power: 4
xiaotaoo is on a distinguished road
Hey everyone,

I have managed to make the UDF work, I've realized I did not define the node variable when looping through the cell nodes

Here's the final version of the stress-free boundary condition UDF using the finite volume method to obtain the gradients, hope it helps anyone looking to implement this on Ansys Fluent one day.

Thank you for the help!
Attached Images
File Type: jpg Screenshot 2021-10-04 220759.jpg (106.6 KB, 15 views)
xiaotaoo 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
New solver and Segmentation fault (core dumped) MinShin OpenFOAM Running, Solving & CFD 3 September 4, 2021 05:00
foam-extend-4.1 release hjasak OpenFOAM Announcements from Other Sources 19 July 16, 2021 05:02
viscosity udf don't use correct temperature and strain rate rezvani Fluent UDF and Scheme Programming 8 May 27, 2021 05:40
Will the results of steady state solver and transient solver be same? carye OpenFOAM Running, Solving & CFD 9 December 28, 2019 05:21
Setting a B.C using UserFortran in 4.3 tokai CFX 10 July 17, 2001 16:25


All times are GMT -4. The time now is 15:58.