CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Unit Normal vector Component Divided by Zero (https://www.cfd-online.com/Forums/cfx/248057-unit-normal-vector-component-divided-zero.html)

gyr February 22, 2023 03:11

Unit Normal vector Component Divided by Zero
 
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

ghorrocks February 22, 2023 04:19

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.

gyr February 22, 2023 04:28

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

ghorrocks February 22, 2023 04:47

Or maybe just simply make the function something like:

ComponentX = if(GradMag == 0, 0, GradX/GradMag)

gyr February 22, 2023 10:33

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

Gert-Jan February 22, 2023 14:31

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)

gyr February 22, 2023 15:13

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 February 22, 2023 15:29

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

Gert-Jan February 22, 2023 15:33

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.

gyr February 23, 2023 00:11

i found the same issue but in openfoam
https://www.cfd-online.com/Forums/op...tml#post844858
but i didnt catch the solution as i dont used to use openfoam

ghorrocks February 23, 2023 03:26

Your function is incorrect, try

Gas Normal X = Gas.vf.Gradient X/max(1e-6; AIAD VF Grad Mod Gas)

Gert-Jan February 23, 2023 03:36

Indeed. It was late in the evening........ :rolleyes:

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.

ghorrocks February 23, 2023 03:46

I am assuming gyr is calculating the gradient magnitude correctly - this should not ever be a negative number.

gyr February 23, 2023 04:24

ohhh i ll try Max function and feedback.thanks for Gert-Jan&ghorrocks
:o

gyr February 23, 2023 05:40

it worked thanks again:D


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