Vertex value function

A vertex value function f_{vertexvalue}: \mathcal{D} \times \mathbb{R}^d \rightarrow \mathcal{D} \times \mathbb{R}^q is a particular field function that lets invariant the mesh of a field and defined by a function h : \mathbb{R}^n \times \mathbb{R}^d  \rightarrow \mathbb{R}^q such that:

\begin{aligned} f_{vertexvalue}(\underline{t}, \underline{x})=(\underline{t}, h(\underline{t},\underline{x}))\end{aligned}

Let’s note that the input dimension of f_{vertexvalue} still design the dimension of \underline{x} : d. Its output dimension is equal to q.

The creation of the VertexValueFunction object requires the function h and the integer n: the dimension of the vertices of the mesh \mathcal{M}.

This example illustrates the creation of a field from the function h:\mathbb{R}\times\mathbb{R}^2 such as:

\begin{aligned}
   h(\underline{t}, \underline{x})=(t+x_1^2+x_2^2)
\end{aligned}

from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
import math as m
ot.Log.Show(ot.Log.NONE)

Create a mesh

N = 100
mesh = ot.RegularGrid(0.0, 1.0, N)

Create the function that acts the values of the mesh

h = ot.SymbolicFunction(['t', 'x1', 'x2'],  ['t+x1^2+x2^2'])

Create the field function

f = ot.VertexValueFunction(h, mesh)

Evaluate f

inF = ot.Normal(2).getSample(N)
outF = f(inF)

# print input/output at first 10 mesh nodes
txy = mesh.getVertices()
txy.stack(inF)
txy.stack(outF)
txy[:10]
tX0X1y0
000.30936480.66665180.5401311
111.2500610.90361113.379164
22-0.67969220.3977752.620206
330.53036860.10432193.292174
44-1.047571-0.7479145.656781
55-0.49279350.24716675.303937
661.9509470.753555610.37404
77-1.7625650.917287510.94805
880.3132281-1.2602819.686419
991.156489-1.27532511.96392


Total running time of the script: ( 0 minutes 0.003 seconds)

Gallery generated by Sphinx-Gallery