Vertex value function¶
A vertex value function is a particular field function that lets invariant the mesh of a field and defined by a function such that:
Let’s note that the input dimension of still design the dimension of : . Its output dimension is equal to .
The creation of the VertexValueFunction object requires the function and the integer : the dimension of the vertices of the mesh .
This example illustrates the creation of a field from the function such as:
[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]:
t | X0 | X1 | y0 | |
---|---|---|---|---|
0 | 0.0 | -0.2123086987944725 | -0.7893040071601587 | 0.6680757993028859 |
1 | 1.0 | 1.5290373341626469 | -1.304449412588666 | 5.039543439266129 |
2 | 2.0 | 0.3736086588719189 | -0.6418723437038079 | 2.551583535595893 |
3 | 3.0 | 0.7298081558085032 | -0.9832478695352569 | 4.4993963172302305 |
4 | 4.0 | 0.9660822714813948 | 0.1490416675117666 | 4.955528373925339 |
5 | 5.0 | 0.04030023504666454 | 1.3174179103602734 | 6.737214059482846 |
6 | 6.0 | -0.2949152511221915 | 0.6153272637397903 | 6.465602646845962 |
7 | 7.0 | 0.5106266891413226 | -0.5369799682760767 | 7.549087101993205 |
8 | 8.0 | 0.9674464251994424 | -0.25673537559122184 | 9.001865638711145 |
9 | 9.0 | -1.0063128915366755 | -1.2324330184244943 | 11.531556780575814 |