ArityMismatch in assemble_system for thermoelasticity


133
views
0
3 months ago by
Hi, I am getting ArityMismatch("Adding expressions with non-matching form arguments {0} vs {1}.".format(a, b))
ufl.algorithms.check_arities.ArityMismatch: Adding expressions with non-matching form arguments () vs (Argument(VectorElement('Lagrange', Domain(Cell('triangle', 2), label='dolfin_mesh_with_id_0', data='<data with id 0>'), 1, dim=2, quad_scheme=None), 1, None),). while adding thermal strain part in the constitutive relation.


any idea how to fix this
Thanks for the help
from __future__ import print_function
from fenics import *
Length = 1.0;
Width = 1.0;
mesh = RectangleMesh(Point(0,0),Point(Length,Width),40,20)
E0 = 10e5
nu = 0.28
alpha = 5e-6
Tref = 293
T = 1273
delta_T = T - Tref
E  = E0
mu = E/(2*(1+nu))
lamb = E*nu/((1+nu)*(1-2*nu))
thermal_coef= alpha*delta_T*(3+2*mu/lamb)
# define rectangular beam
# define function space
V = VectorFunctionSpace(mesh,'CG',1)
# Boundary Conditions
tol = 1e-14
def clamped_boundary(x,on_boundary):
    return on_boundary and x[0]<tol
bc = DirichletBC(V,Constant((0,0)),clamped_boundary)
# define strain-displacement 
def epsilon(u):
    return sym(grad(u))
# define stifness tensor
def sigma(u):
    return lamb*((nabla_div(u)-alpha*delta_T*(3+2*mu/lamb))*Identity(d))+2*mu*epsilon(u)
# elasticity problem
u = TrialFunction(V)
d = u.geometric_dimension()
v = TestFunction(V)
f = Expression(( '0','-20'))
#a = inner(sigma(u),epsilon(v))*dx
#L = dot(f,v)*dx
form  = inner(sigma(u), epsilon(v))*dx 
Res = - dot(f,v)*dx
#a = lhs(form)
#L = rhs(form)
a,L = assemble_system(form, Res, bc)
u = Function(V)
solve(a == L,u,bc)
plot(u,mode='displacement')
interactive()
Community: FEniCS Project

1 Answer


2
3 months ago by
The term alpha*delta_T*(3+2*mu/lamb) doesn't contain trial function, yet you put it into bilinear form.

When you got this type of error carefully check that bilinear part contains trial and test function, while linear just test function.
Thanks for the help, it works :)
written 3 months ago by hirshikesh  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »