Hello,
I’m currently building a stochastic PDE solver based on a specific algorithm, under the theme of my master’s thesis.
The main idea behind my code is simple, given some inputs (time span, physical domain, number of simulations, etc) provided by a user, the code must return a numerical solution computed in the time instants previously specified. Since I’m working with 2D solutions, my output will be one matrix for each instant for each simulation.
Thus, I want my output to be in such way that the time instants are linked with the respective matrix.
sol = solveSPDE(inputs)
sol[t1] = V1 # V1 is the solution correspondent to t1
I don’t know how to do this in a clever and optimized way.
First, I thought that sol
could be an object of some structure that I would define, but in that case I would lose that “friendly” syntax, mentioned above, and use the dot
to refer to the fields of the object,
sol.t[1] = t1
sol.V[1] = V1
Then I came up with the idea of using a dictionary to store my solution and time instants with the respective link between them.
But as I said, I’m dealing with matrices (approx 500x500), stored in 4/5 time steps for each simulation. This is a lot of data and probably using dictionaries in this situation would be a mess in terms of performance.
Probably, I could try to define a struct
that somehow have similar properties to dictionaries. But I’m not getting there .
Does anyone have any suggestions, ideas, tips?
Thank you,
Tiago