Hi,
I usually use TimeSeries functionality to store data for later computations:
Ufe_timeseries = TimeSeries('Data_Ufe')
Ufe_timeseries.store(u_n.vector(), t)
And to work with them in an another script I use:
timeseries_T = TimeSeries('Data_Ufe')
timeseries_T.retrieve(u_n.vector(), time)
u_n1, u_n2, u_n3 = split(u_n)
However, when I work with the split functions, I realized that the data is disorganized.
This is what I get:
This is what I was expecting:
Figure 2
I guess this is due to parallel computing, although I would expect eight partitions and not seven. In any case, there is a problem storing this data for later reuse.
Second, to produce Figure 1 I had to do the following:
class MyExpression(UserExpression):
def __init__(self, u1, **kwargs):
self.u1 = u1
super().__init__(**kwargs)
def eval(self, values, x):
values[0] = self.u1(x)/1.0
def value_shape(self):
return ()
f0 = MyExpression(u_n3, degree=1)
V = FunctionSpace(mesh, 'P', 1)
u_n3_exp = interpolate(f0, V)
vtkfile = File("u_n3.pvd")
vtkfile << u_n3_exp
I don’t understand why I cannot write a new file just doing this:
vtkfile = File("U_n3.pvd")
vtkfile << u_n3
Because I get the following:
AttributeError: 'Indexed' object has no attribute '_cpp_object'
I really appreciate your help.
Regards,
Santiago