Hi guys,
I am trying to solve the heat equation with (nonlinear) radiation and convection from the surfaces in 3D.
In the file demo_cahn-hilliard.py they are beginning with defining two classes - the initial condition (which is more easy to me for I just want to have a constant initial temperature) and the class for interfacing with the Newton solver.
My problem is, I dont really know how to define the class for my initial condition. What I wrote is:
u0 = Constant(293)
class InitialCondition(Constant):
def __init__(self):
u0
def eval(self, values, x):
values=u0
But I can't interpolate with this conditions:
mesh = UnitCubeMesh(10,10,10)
V = FunctionSpace(mesh, 'Lagrange', 1)
ME = V*V
du = TrialFunction(ME)
v = TestFunction(ME)
u = Function(ME)
u_1 = Function(ME)
u_init = InitialCondition()
u.interpolate(u_init)
u_1.interpolate(u_init)
I get an error message now:
TypeError: in method 'Function_interpolate', argument 2 of type 'dolfin::Generic Function const &'
What should I do?
Your help would be highly appreciated.
EDIT: I was able to fix this somehow. And I reduced the functionspace to:
ME = V
instead of
ME=V*V
because I dont have a mixture of 2 fluids but a solid body of one material.
But a new error messages appeared:
ufl.algorithms.check_arities.ArityMismatch: Adding expressions with non-matching form arguments (Argument(FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label='dolfin_mesh_with_id_0', data=''), 1, quad_scheme=None), 0, None), Argument(FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label='dolfin_mesh_with_id_0', data=''), 1, quad_scheme=None), 1, None)) vs (Argument(FiniteElement('Lagrange', Domain(Cell('tetrahedron', 3), label='dolfin_mesh_with_id_0', data=''), 1, quad_scheme=None), 0, None),).