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

Calculating flow variables only once in begin_f_loop()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2020, 12:40
Default
  #21
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
yeah actually i need to apply velocity profile for solid-liquid interface. but now i am encountering new error. when i interpret my udf which includes 2 different functions, and then when i want to initialize my solution, it says i have a segmentation fault. what should i do?
homay95 is offline   Reply With Quote

Old   June 6, 2020, 12:42
Default
  #22
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
yeah but after interpreting my udf which includes 2 different functions, when i want to initialize my solution, it says there is "segmentation fault", what should i do to get rid of that?
homay95 is offline   Reply With Quote

Old   June 6, 2020, 16:51
Default Gradient
  #23
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The most likely reason for that is the unavailability of the velocity gradients. By default, gradients are not stored by Fluent. You need to issue following command before hooking the UDF

solve set exp

And then provide yes as answer to the question regarding keeping the memory from being freed.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 7, 2020, 06:59
Default
  #24
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
i interpreted my udf and then i provided "yes" answer to all three questions appeared after writing command "solve set exp" and hook my udf to boundary condition afterwards, but it was still encountering same error! is there any chance that there is another reason for that error??
homay95 is offline   Reply With Quote

Old   June 7, 2020, 09:17
Default Segmentation Fault
  #25
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
There is no other reason, at least, not due to the code. And don't count the number of questions, check whether the question regarding keeping the memory from being freed has been answered yes or not. As stated earlier, you have to initialize the case before hooking the UDF. And before you hook it, go to contour plots and display du-dy to ensure that C_U_G[1] exists.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 7, 2020, 11:18
Default
  #26
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
i did that and the error didnt occurred again, thanks to you. but there is another problem and that is that during the calculation it shows there is "reversed flow" in too many faces in every iteration! what is that?
homay95 is offline   Reply With Quote

Old   June 12, 2020, 05:00
Default
  #27
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
Hello
my UDF works properly for slip lenght equal to 1 micrometer, but when i apply slip lenght 20 micrometer, my calculation diverges and says "divergence in AMG" and "floating point exception". how can i get rid of them??
thanks in advance
homay95 is offline   Reply With Quote

Old   June 15, 2020, 04:46
Default Change in value
  #28
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
It is quite possible that case diverges for 20, but not for 1. The system is chaotic anyway. But if it is really this change in value or something else, you need to try some other value to debug. Try with slightly smaller or larger values, say, 17 and 22.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 07:14
Default
  #29
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
Actually I did that too, but it only works with 1 micrometer and less values, it doesnt even converges for 2 micrometer. what should i do??
homay95 is offline   Reply With Quote

Old   June 15, 2020, 07:22
Default Gradient
  #30
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Plot the gradient values and check if those are reasonable. The divergence is not because of UDF, but because of the values.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 07:50
Default
  #31
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
actually no they are not reasonable at all. neither pressure gradient, nor velocity gradient. so what should i do to get rid of that??
homay95 is offline   Reply With Quote

Old   June 15, 2020, 07:56
Default Gradients
  #32
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Gradients are based on the flow solution. If those are not accurate, then the flow is not converged.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 08:02
Default
  #33
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
during the calculation it says there is reversed flow at some faces of pressure outlet and when the calculation is diverged after 15-16 iterations, i get these errors:
divergence detected in AMG solver: pressure correction
error at host: floating point exception
error at node 0:floating point exception
error at node 1:floating point exception
error at node 2:floating point exception
homay95 is offline   Reply With Quote

Old   June 15, 2020, 08:04
Default Case Setup
  #34
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
First, run a case without any UDF. Converge it properly and then hook the UDF to run it further. Before hooking UDF, ensure that the gradient values are realistic. You may also prefer to use _RG in place of _G to ensure that the gradients are bounded.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 08:43
Default
  #35
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
now i just did that too, and thanks to you, the calculation doesnt diverge after hooking udf, but my residuals got too high. i mean my continuity residual got to about 1e+3 and doesnt vary too much. what should i do now to lower residuals??
thanks for your help
homay95 is offline   Reply With Quote

Old   June 15, 2020, 10:02
Default Residuals
  #36
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
If the case converges without the UDF, but diverges with the UDF, then most likely the boundary condition being applied using UDF is not well defined. Not the code, but the physics is not good.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 10:20
Default
  #37
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
yes my case converges without UDF, even converges with UDF for slip lenght equal to 1 micrometer or less, but when i apply another value for slip lenght over 1 micrometer, suddenly my calculation diverges. so now what is your advice for boundary condition physics? what parameters should i modify?
homay95 is offline   Reply With Quote

Old   June 15, 2020, 10:22
Default Physical Model
  #38
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
For physics, the only advice is to study more of literature. Find out the validity of the model you are using and its range of usage.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 11:05
Default
  #39
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
actually im trying to validate another project so that i know if im doing right or not!? so i dont think there would be any problem with the basis of my model, because its just the same as project, i just dont know what parameters should i modify to get the correct convergence with this UDF!
homay95 is offline   Reply With Quote

Old   June 15, 2020, 11:09
Default Validation
  #40
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
If you are trying to validate against some previously done work, then you have to use same conditions as used in that work.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Reply

Tags
fluent - udf - parallel, slip b.c., slip flow, udf and programming


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
UDF program for calculating the mass flow outlet with a pulsed output flow Benito89 Fluent UDF and Scheme Programming 9 August 22, 2019 00:57
Match Pressure Inlet/Outlet Boundary Condition Mass Flow Rate MSchneid Fluent UDF and Scheme Programming 3 February 23, 2019 07:00
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Calculating mass flow rate at multiphase flows Kuslo187 OpenFOAM Post-Processing 1 August 21, 2015 19:11
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27


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