|
[Sponsors] |
February 22, 2023, 03:11 |
Unit Normal vector Component Divided by Zero
|
#1 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
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 |
|
February 22, 2023, 04:19 |
|
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,695
Rep Power: 143 |
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. |
|
February 22, 2023, 04:28 |
|
#3 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
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
|
|
February 22, 2023, 04:47 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,695
Rep Power: 143 |
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. |
|
February 22, 2023, 10:33 |
|
#5 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
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 |
|
February 22, 2023, 14:31 |
|
#6 |
Senior Member
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,827
Rep Power: 27 |
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) |
|
February 22, 2023, 15:13 |
|
#7 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
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) |
|
February 22, 2023, 15:29 |
|
#8 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
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
|
|
February 22, 2023, 15:33 |
|
#9 |
Senior Member
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,827
Rep Power: 27 |
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.
|
|
February 23, 2023, 00:11 |
|
#10 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
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 |
|
February 23, 2023, 03:26 |
|
#11 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,695
Rep Power: 143 |
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. |
|
February 23, 2023, 03:36 |
|
#12 |
Senior Member
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,827
Rep Power: 27 |
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. |
|
February 23, 2023, 03:46 |
|
#13 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,695
Rep Power: 143 |
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. |
|
February 23, 2023, 04:24 |
|
#14 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
ohhh i ll try Max function and feedback.thanks for Gert-Jan&ghorrocks
|
|
February 23, 2023, 05:40 |
|
#15 |
New Member
libya
Join Date: Aug 2022
Posts: 15
Rep Power: 3 |
it worked thanks again
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |