Hello,
i am working on fenics 2019.1 and I want to know how to interpolate a ufl.algebra.Product to a Function .there is a simple example :
from fenics import *
import numpy as np
import matplotlib.pyplot as plt
from mshr import *
mesh1 = UnitSquareMesh(10, 10)
Vh = FunctionSpace(mesh1, "P", 1)
uh = Function(Vh)
a = Constant(1.0)
uh.interpolate(a)
uh1 = Function(Vh)
aa = Constant(-1.0)*uh
uh1.interpolate(aa)
and get this error:
uh1.interpolate(aa)
File "/home/xiaohe/miniconda3/envs/fenicsproject/lib/python3.8/site-packages/dolfin/function/function.py", line 365, in interpolate
self._cpp_object.interpolate(u)
AttributeError: 'Product' object has no attribute '_cpp_object
I know a way that use the project Function ,but in my problem the matrix size is big .To reduce the time and memory i want to use the function.interpolate().