# Find a 3D function knowing the numerical gradient in discrete point (mesh)

by estragiotti   Last Updated October 09, 2019 14:20 PM

I have a rectangular mesh of dimension $$n,m$$ and a scalar field $$\theta(x,y)$$ defined over the different nodes of the mesh. I want to link $$\theta(x,y)$$ to an initial condition level-set function $$\phi$$ using this relation:

$$\theta(x,y) = \frac{\pi}{2} - \arctan \Bigg( \frac{\frac{\partial \phi}{\partial y}}{\frac{\partial \phi}{\partial x}} \Bigg)$$

Since there are infinite functions that verify the above relation I've added another dummy constraint:

$$\| \nabla \phi \| = 1 \implies \sqrt{(\frac{\partial \phi}{\partial x})^2 + (\frac{\partial \phi}{\partial y})^2} = 1$$ $$\frac{\partial \phi}{\partial x} = \pm \sqrt{1-(\frac{\partial \phi}{\partial y})^2}$$

I know the scalar field $$\theta(x,y)$$ everywhere, and with the two relation written above, I also know the numerical value of the gradient of the function.

So right now, I would integrate the first relation to find $$\phi$$, but I'm completely blocked. I don't know exactly how to deal with such a discrete problem. I need the value of the function $$\phi$$ over the nodes of the mesh. I was thinking to integrate

$$\int d\phi = \int \sqrt{\frac{\tan^2(\frac{\pi}{2} - \theta(x,y))}{\tan^2(\frac{\pi}{2} - \theta(x,y))+1}} \:\:dy$$

and I've tried to implement it in MATLAB without results.

Have you any idea on how to deal with such a problem?

PS: I can if needed query my MATLAB script to get more points for $$\theta(x,y)$$.

Tags :

## Related Questions

Updated February 24, 2017 19:20 PM

Updated May 05, 2018 05:20 AM

Updated November 26, 2017 04:20 AM

Updated May 19, 2018 12:20 PM

Updated December 11, 2017 00:20 AM