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}

[30]:
from __future__ import print_function
import openturns as ot
import math as m
[31]:
# Create a mesh
N = 100
mesh = ot.RegularGrid(0.0, 1.0, N)
[32]:
# Create the function that acts the values of the mesh
h = ot.SymbolicFunction(['t', 'x1', 'x2'],  ['t+x1^2+x2^2'])
[33]:
# Create the field function
f = ot.VertexValueFunction(h, mesh)
[35]:
# 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]
[35]:
tX0X1y0
00.0-0.2123086987944725-0.78930400716015870.6680757993028859
11.01.5290373341626469-1.3044494125886665.039543439266129
22.00.3736086588719189-0.64187234370380792.551583535595893
33.00.7298081558085032-0.98324786953525694.4993963172302305
44.00.96608227148139480.14904166751176664.955528373925339
55.00.040300235046664541.31741791036027346.737214059482846
66.0-0.29491525112219150.61532726373979036.465602646845962
77.00.5106266891413226-0.53697996827607677.549087101993205
88.00.9674464251994424-0.256735375591221849.001865638711145
99.0-1.0063128915366755-1.232433018424494311.531556780575814