from dolfin import *
mesh=Mesh('Heiztank_alle_Abrundungen.xml')
V = VectorFunctionSpace(mesh,'CG',1)
cells = MeshFunction('size_t',mesh,'Heiztank_alle_Abrundungen_physical_region.xml')
facets = MeshFunction('size_t',mesh,'Heiztank_alle_Abrundungen_facet_region.xml')
dA = Measure('ds')[facets]
dV = Measure('dx')[cells]
p0=101325.0E-6# in MPa
g=9.81# in m/s2
rho_oel=860# in kg/(m)3
h=1.5350# in m
padd=Expression(('AB(C-x[2]1.0E-3)'),A=rho_oel,B=g,C=h)# in 1.0E-6MPa
pin=p0+1.0E-6padd# in MPa
n=FacetNormal(mesh)
tr_a=-p0n
tr_i=-pinn
null = Constant((0.0,0.0,0.0))
bc = [DirichletBC(V,null,facets,84)]
u = TrialFunction(V)
del_u = TestFunction(V)
nu = 0.38
E = 1400.0 # MPa
G = E/(2.0(1.0+nu))
l = 2.0Gnu / (1.0 - 2.0 nu)
mu = G
delta = Identity(3)
eps = as_tensor(1.0/2.0(u[i].dx(j)+u[j].dx(i)),(i,j))
sigma = as_tensor(leps[k,k]delta[i,j]+2.0mueps[i,j],(i,j))
a = sigma[j,i]del_u[i].dx(j)dV
L = tr_a[i]del_u[i]dA(83)+tr_i[i]del_u[i]dA(82)
disp = Function(V)
solve(a==L, disp, bcs=bc)
sdev = as_tensor(sigma[i,j]- 1.0/3.0sigma[k,k]delta[i,j],(i,j))
mises = as_tensor( (3.0/2.0sdev[i,j] * sdev[i,j])**0.5, () )
seq=project(mises,FunctionSpace(mesh,'CG',1),solver_type="mumps",form_compiler_parameters={"cpp_optimize":True,"representation":"quadrature","quadrature_degree":2})
Hi, this is our Code.
Everything works except for the last line. we want to write out 'seq' to file and if we run the code, it says:
Solving linear variational problem.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "/home/user/Dokumente/NumReal/Heizöltank/Klotz1500.py", line 59, in
seq = project(mises,FunctionSpace(mesh,'P',1),solver_type="mumps",form_compiler_parameters={"cpp_optimize":True,"representation":"quadrature","quadrature_degree":2})
File "/usr/lib/python2.7/dist-packages/dolfin/fem/projection.py", line 111, in project
form_compiler_parameters=form_compiler_parameters)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line 244, in assemble_system
b_dolfin_form = _create_dolfin_form(b_form, form_compiler_parameters)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line 58, in _create_dolfin_form
return Form(form, form_compiler_parameters=form_compiler_parameters)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/form.py", line 82, in init
mpi_comm=mesh.mpi_comm())
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 64, in mpi_jit
return local_jit(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 128, in jit
return form_compiler.jit(form, parameters=p)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 74, in jit
return jit_form(ufl_object, parameters)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 130, in jit_form
parameters=parameters)
File "/usr/lib/python2.7/dist-packages/ffc/compiler.py", line 154, in compile_form
analysis = analyze_forms(forms, parameters)
File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 59, in analyze_forms
parameters) for form in forms)
File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 59, in
parameters) for form in forms)
File "/usr/lib/python2.7/dist-packages/ffc/analysis.py", line 132, in _analyze_form
form_data = compute_form_data(form)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/compute_form_data.py", line 304, in compute_form_data
check_form_arity(preprocessed_form, form.arguments()) # Currently testing how fast this is
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/check_arities.py", line 123, in check_form_arity
check_integrand_arity(itg.integrand(), arguments)
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/check_arities.py", line 117, in check_integrand_arity
args = map_expr_dag(rules, expr, compress=False)
File "/usr/lib/python2.7/dist-packages/ufl/corealg/map_dag.py", line 64, in map_expr_dag
r = function(v)
File "/usr/lib/python2.7/dist-packages/ufl/corealg/multifunction.py", line 72, in call
return self._handlerso._ufl_typecode_
File "/usr/lib/python2.7/dist-packages/ufl/algorithms/check_arities.py", line 33, in nonlinear_operator
raise ArityMismatch("Applying nonlinear operator to expression depending on form argument {0}.".format(t))
ufl.algorithms.check_arities.ArityMismatch: Applying nonlinear operator to expression depending on form argument v_1.
We found another post which told us that we should use Function() in combination with a nonlinear form, but we are sure we're not having any nonlinearities.
Does anybody have a clue?
Thanks