### Construct bilinear and linear term for Non-linear solver

204
views
0
5 months ago by
Hi, I am solving a coupled problem where in Bilinear after assembling I have [kpp kpu; kup kuu] and Residual [fp; fu] but I want to create [kpp kpu 0; kup kpp -fext; 0 0 1] and [fp; fu; phi]. How can I construct this. Any hint will help to solve my problem.
Thanks for the time.
from __future__ import print_function
from dolfin import *

mesh = UnitSquareMesh(10,10)
# define Material Properties
Gc = 2.7e-3;
E = 210;
nu = 0.3;
lmbda, mu = E*nu/((1.0 + nu )*(1.0-2.0*nu)) , E/(2*(1+nu))
lo = 2.0*mesh.hmin()
k=1e-6;
#------------------------------------------------
#          Define Space
#------------------------------------------------
Q = FunctionSpace(mesh,'CG',1)
V = VectorFunctionSpace(mesh,'CG',1)
# create mix space....
W = V*Q
w = Function(W)
(u,p) = split(w)
(v,q) = TestFunctions(W)

def eps(u):
def sigma(u):
return 2.0*mu*eps(u) + lmbda*tr(eps(u))*Identity(2)
def HistInfo(u):
IC = tr(eps(u))
ICC = tr(eps(u)*eps(u))
return 0.5*lmbda*IC**2 + mu*ICC

E1 = ( ((1.- p)**2 + k)*inner(grad(u),sigma(v)) )*dx
-2.*q*HistInfo(u) )*dx

kuu = derivative(E1,u,v)
kpp = derivative(E2,p,q)
kup = derivative(E1,p,q)
kpu = derivative(E2,u,v)
​
Community: FEniCS Project

0
5 months ago by
derivative(E1+E2,W,unsplit_trial_function)​

not tested

u and p are the trial functions. I want to aguument
extra terms in bilinear form. a = [kpp, kpu, 0; kup, kuu, -fext; 0,0, 1] and L = [[fp; fu; phi]]

when I use:
a = as_tensor([[kpp,kpu],
[kup,kuu]])​
gives error: Invalid type conversion: <class 'ufl.form.Form'> can not be converted to any UFL type.

any idea to resolve this issue ?
Thanks
written 5 months ago by hirshikesh