This is my code,
x,t = sym.symbols('x[0] t')
mesh = Mesh()
with XDMFFile("mesh_5um/mesh_5um.xdmf") as infile:
infile.read(mesh)
H = FunctionSpace(mesh, 'P', 1) # heat
T = TrialFunction(H)
h = TestFunction(H)
q = sym.Piecewise((15e4*t, t <= 100) , (15e6, True))
q = sym.printing.ccode(q)
q = Expression(q, degree=1, t=0)
T_ini = Expression('298.15', degree=1)
T_n = interpolate(T_ini, H)
def k(T):
return 174.9274-0.1067*T+5.0067e-5*T**2-7.8349e-9*T**3
def mu(T):
return 19302.7-0.23786*T-2.2448e-5*T**2
def c(T):
return 128.308+3.2797e-2*T-3.4097e-6*T**2
class BoundaryTop(SubDomain):
def inside(self, x, on_boundary):
return on_boundary and abs(x[0] - 0) < DOLFIN_EPS
class BoundaryBottom(SubDomain):
def inside(self,x,on_boundary):
return on_boundary and abs(x[0] - 10e-6) < DOLFIN_EPS
b_Top = BoundaryTop()
b_Bottom = BoundaryBottom()
boundary_markers = MeshFunction('size_t', mesh, mesh.topology().dim()-1)
b_Top.mark(boundary_markers, 1)
b_Bottom.mark(boundary_markers,2)
bc = DirichletBC(H, 363.15, boundary_markers, 2)
ds = Measure('ds', domain = mesh, subdomain_data = boundary_markers)
T = Function(H)
T_n = Function(H)
F = mu*c*T*h*dx + dt*k*dot(grad(T), grad(h))*dx - mu*c*T_n*h*dx - dt*q*h*ds(1)
I getting an Typeerror
TypeError Traceback (most recent call last)
<ipython-input-1-f12459c7f086> in <module>
149 T_n = Function(H)
150
--> 151 F = mu*c*T*h*dx + dt*k*dot(grad(T), grad(h))*dx - mu*c*T_n*h*dx - dt*q*h*ds(1)
152
153
TypeError: unsupported operand type(s) for *: 'function' and 'function'
I do not know how to correct this error.