Good day and a warm new year to all,
I have a code, where I have the mesh changed in every iteration and the previous solution interpolated to the new mesh. In the new mesh, there are new elements added, which need to be initialized to a value, say T_init, which I presently do in the following way:
Here the Extrapolate_fn() takes the arguments, the functionspace in the new mesh; step data, the previous solution, and T_init the initial value for nodes that were added.
The newElement() returns true or false based on if the coordinate from previous mesh is in the new mesh, if not, the node is given a T_init value,
def Extrapolate_fn(Space,step,T1,T_init):
T1_proj = Function(Space)
LagrangeInterpolator.interpolate(T1_proj,T1)
F = T1_proj.vector().get_local() # get a vector with the local components of T1 in mesh2
X = Space.tabulate_dof_coordinates() # array of all nodes coordinates
T2 = Function(Space) # create a new function in mesh2 for the output
i = 0 # index for element number
for x in X: # for each dof x in Space
if newElement(x,step) == False: # if x wasn't in mesh1, we give the value T_init to the new function T2
F[i]=T_init
i+=1
T2.vector().set_local(F) # T2 is filled with the local components of F (T1 project on Space and the values added)
return T2
This code works well in serial execution, but in parallel, this reinitalization crashes.
Is there a way I can reinitialization of nodes of a specific region in parallel?
Thank you!