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

Unit Normal vector Component Divided by Zero

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2023, 03:11
Default Unit Normal vector Component Divided by Zero
  #1
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
Hi,
I am running a 3D Transient simulation of Mixture model (water&air),the problem when I try to compute the unit normal vector components Nx,Ny,Nz at the interface that defined as fluid(water or gas)volume fraction gradient X,Y,Z divided by magnitude of total of fluid volume gradient.when running a case, my simulation crashes as the unit normal vector divides by 0.and if i cancel unit normals expressions from ccl and rerun solver all volume fraction gradient are ok
gyr is offline   Reply With Quote

Old   February 22, 2023, 04:19
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,705
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You will need to put something in your function to handle when the gradient is zero in all directions. Use the if() statement, or something like it, so you do not do the divide when the gradient is zero.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   February 22, 2023, 04:28
Default
  #3
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
your quick reply is appreciated thanks.really i ve to find which interrelatd function.i mean normal units needs free surface to be calculated.if i get normal units thats mean the free surface is istablished.i ll try interface length scale as conditional statement as i think it is not zero
gyr is offline   Reply With Quote

Old   February 22, 2023, 04:47
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,705
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Or maybe just simply make the function something like:

ComponentX = if(GradMag == 0, 0, GradX/GradMag)
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   February 22, 2023, 10:33
Default
  #5
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
i tried problem still persist
The problem was:
| DIVIDE-BY-ZERO
|
| FURTHER INFORMATION
|
| The problem was encountered in executing the expression for:
| Gas Normal X
| The complete expression is:
| (Gas.vf.Gradient X/AIAD VF Grad Mod Gas )
| The error occurs on sub-expression:
| Gas.vf.Gradient X/AIAD VF Grad Mod Gas
where AIAD VF Grad Mod Gas is the magnitude
gyr is offline   Reply With Quote

Old   February 22, 2023, 14:31
Default
  #6
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,828
Rep Power: 27
Gert-Jan will become famous soon enough
You are dividing by zero. Why don't you use the min-function?


Gas Normal X = Gas.vf.Gradient X/min(1e-6; AIAD VF Grad Mod Gas)
Gert-Jan is offline   Reply With Quote

Old   February 22, 2023, 15:13
Default
  #7
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
Both expressions didnt work
The problem was: |
| DIVIDE-BY-ZERO |
| |
| FURTHER INFORMATION |
| |
| The problem was encountered in executing the expression for: |
| Gas Normal X |
| The complete expression is: |
| Gas.vf.Gradient X/min(1e-6[m^-1], AIAD VF Grad Mod Gas)
gyr is offline   Reply With Quote

Old   February 22, 2023, 15:29
Default
  #8
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
The geometry consists of two horizontal tubes (T-section) and the flow of both fluids develops properly before they are mixed together.may be at first simulation time is really there is no gradient or change in volume fraction.i am not sure
gyr is offline   Reply With Quote

Old   February 22, 2023, 15:33
Default
  #9
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,828
Rep Power: 27
Gert-Jan will become famous soon enough
You have a gradient. So this might range from large negative values up to large positive values. Therefore you should create a function that prevents diving by zero coming from the negative direction and the positive direction. Currently, you are only protected for Division by zero coming from the positive direction.
Gert-Jan is offline   Reply With Quote

Old   February 23, 2023, 00:11
Default
  #10
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
i found the same issue but in openfoam
Unit Normal Vector and Interface Jump ||.||
but i didnt catch the solution as i dont used to use openfoam
gyr is offline   Reply With Quote

Old   February 23, 2023, 03:26
Default
  #11
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,705
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Your function is incorrect, try

Gas Normal X = Gas.vf.Gradient X/max(1e-6; AIAD VF Grad Mod Gas)
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   February 23, 2023, 03:36
Default
  #12
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,828
Rep Power: 27
Gert-Jan will become famous soon enough
Indeed. It was late in the evening........

Then still, now the equation caps all gradients with a negative sign. Therefore gyr should define an equation himself that caps very small negative and positive values. Then it might work.
Gert-Jan is offline   Reply With Quote

Old   February 23, 2023, 03:46
Default
  #13
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,705
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
I am assuming gyr is calculating the gradient magnitude correctly - this should not ever be a negative number.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   February 23, 2023, 04:24
Default
  #14
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
ohhh i ll try Max function and feedback.thanks for Gert-Jan&ghorrocks
gyr is offline   Reply With Quote

Old   February 23, 2023, 05:40
Default
  #15
gyr
New Member
 
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3
gyr is on a distinguished road
it worked thanks again
gyr 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
Unit Normal Vector and Interface Jump ||.|| mcfdma OpenFOAM Programming & Development 3 February 20, 2023 09:00
Need help setting up chtMultiRegion OskarT OpenFOAM Pre-Processing 1 September 25, 2019 15:51
Grid I Unit Normal and Grid J Unit Normal pawansut Tecplot 4 July 31, 2017 18:14
[snappyHexMesh] determining displacement for added points CFDnewbie147 OpenFOAM Meshing & Mesh Conversion 1 October 22, 2013 09:53
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57


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