openturns / otfmi

FMI models manipulation module
http://openturns.github.io/otfmi/master/
GNU Lesser General Public License v3.0
8 stars 9 forks source link

The FMUFunction should not exist #118

Open mbaudin47 opened 3 weeks ago

mbaudin47 commented 3 weeks ago

The FMUFunction class should not exist. Only the FMUPointToFieldFunction class needs to exist. This is because, provided we can access to the whole trajectory of the output depending on the time, then we can always access the last value of the time series. To do this, the user can implement a new FinalValueFMUFunction an OpenTURNSPythonFunction which takes the FMUPointToFieldFunction model as input:

model = otfmi.FMUPointToFieldFunction()
fmuFunction = FinalValueFMUFunction(model)

In the exec() method, we evaluate the underlying function, then extracts the last value of the time series and returns it.

We could, however, make this much easier if a new ot.VertexFunction class is created in OpenTURNS. This function would have the constructor:

function = ot.VertexFunction(pointToFieldFunction, indices)

where pointToFieldFunction is a PointToFieldFunction and indices is:

These indices must be in the integer interval $[0, n - 1]$ where $n$ is the number of vertices. This new VertexFunction would return the value of the output Field corresponding to the indices at the vertices corresponding to the given indices.

To make things clearer, I consider the SIR epidemiological model as an example. This is a PointToField function with input dimension 2 corresponding to $\beta$ and $\gamma$ and output the Field corresponding to the time series.