RuntimeError: Use 'Function.copy(deepcopy=True)' for copying

Hi,

i am trying to compute a program to identify the orientation of fibers at any time in tensor form of form 3x3 on a cubic mesh.
So am trying to define a TensorFunctionSpace for the fiber orientation and a VectorFunctionSpace one for the Matrix (Material). I have the following beginning of my code:

from fenics import *
from mshr import *
import numpy as np

T = 5.0            # final time
num_steps = 100    # number of time steps
dt = T / num_steps # time step size
eps = 0.01         # diffusion coefficient

# Read mesh 
mesh = UnitSquareMesh(8, 8, "left/right")

# Define function spaces
W = VectorFunctionSpace(mesh, 'P', 2)
V = Function(TensorFunctionSpace(mesh, "Lagrange", 1, shape = (3,3)))

#Define boundaries
inflow  = 'near(x[0], 0)'
walls   = 'near(x[1], 0) || near(x[1], 1)'

#Define boundary conditions
bco_inflow = DirichletBC(W, Constant((0,0)), inflow)     
bco_noslip = DirichletBC(W, Constant((0, 0)), walls) 
bco = [bco_noslip]

#Define Test-function
v = TestFunction(W)

# Define functions for velocity and orientations
u = Function(W)    #velocity
o = Function(V)   #orientation
o_n = Function(V)  #orientation at next time step

'''
I get following Error Message:

RuntimeError: Use 'Function.copy(deepcopy=True)' for copying


What does that mean? I am in advance sorry for bad coding, really a newbie to FEniCs and programming.

Thanks in advance.
'''

If you remove the function-wrapper here, everything should work nicely.

1 Like

Thanks, it worked out.