Dolfin version: 2019.1.0
How installed: manual commands from a source repository in terminal
System: Ubuntu 19.10
I am solving the heat equation on the unit square x [0, T] using space-time CGq method. Each subinterval [t_n, t_n+1] there are q coupled equations that need to be solved together to find the spatial coefficient functions. I then update the “initial” solution with the t_n+1 solution calculated prior. Rinse and repeat as necessary. To start I have to create a q dimensional vector element for the solution to the coupled equations, but the “initial” solution is located in a non-vector element space. I am having an issue updating my “initial” condition. When I use the command alpha_n.assign(alpha[-1]) it gives the following error.
RuntimeError: Expected a Function or linear combinations of Functions in the same FunctionSpace
This seems to me that the component function vector spaces are different than the vector spaces that I am using for u_n at the start and when I try to assign the new value it errors out due to the objects not lying in the same vector space.
I update in my code exactly the same as the following MWE. The issue is reproduced in the MWE. I would like a way to extract the information from my vector function, or to change the vector space that I use for my initial function.
mesh = UnitSquareMesh(10, 10)
#Number of subspaces in the function space.
num_spaces = 2
P = FiniteElement(‘CG’, triangle, 2)
#Initialize element array used to make the product vector element.
element_array = 
#For loop to create the array of elements that we will use to make our product vector element.
for i in range(num_spaces):
#Create the vector element.
vector_element = MixedElement(element_array)
#Create Vector Function Space
V_mixed = FunctionSpace(mesh, vector_element)
#Create Single Vector Space
V_single = FunctionSpace(mesh, P)
#Create mixed and single functions.
f_mixed = Function(V_mixed)
f_single = Function(V_single)
#Attempt to update single function.