dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #02050
viscosity at each vertex
Hi,
I have a rather simple question I guess. I tried to figure out how to
give the stokes solver a viscosity for each vertex and started of with
the stokes solver with a constant viscosity nu:
modified from Anders file:
---------------
P1 = FiniteElement("Lagrange", "triangle", 1)
P2 = FiniteElement("Vector Lagrange", "triangle", 2)
TH = P2 + P1
(v, q) = BasisFunctions(TH)
(u, p) = BasisFunctions(TH)
nu = Constant() #viscosity
f = Function(P2)
a = (dot(nu*grad(u), grad(v)) - p*div(v) + div(u)*q)*dx
L = dot(f, v)*dx
---------------
now that works fine and now i have the viscosity values for each vertex
in a vector as values and in a function like:
Function viscfunc(viscosity, mesh, element);
Now i tried to get a form file which takes these values like:
---------------
P1 = FiniteElement("Lagrange", "triangle", 1)
P2 = FiniteElement("Vector Lagrange", "triangle", 2)
element1 = FiniteElement("Discontinuous vector Lagrange", "triangle", 0, 1)
TH = P2 + P1
(v, q) = BasisFunctions(TH)
(u, p) = BasisFunctions(TH)
nu = Function(element1) #viscosity
f = Function(P2)
a = (dot(dot(nu, grad(u)), grad(v)) - p*div(v) + div(u)*q)*dx
L = dot(f, v)*dx
---------------
well and it does not work, as well as the approach like:
---------------
P1 = FiniteElement("Lagrange", "triangle", 1)
P2 = FiniteElement("Vector Lagrange", "triangle", 2)
constant_scalar = FiniteElement("Discontinuous Lagrange", "triangle", 1)
TH = P2 + P1
(v, q) = BasisFunctions(TH)
(u, p) = BasisFunctions(TH)
nu = Function(constant_scalar) #viscosity
#nu = Constant()
f = Function(P2)
a = (dot(nu*grad(u), grad(v)) - p*div(v) + div(u)*q)*dx
L = dot(f, v)*dx
---------------
which actually takes my viscosity vector and starts to solve but does
not converge.
might be a simple mistake in there, I appreciate any help or hints.
Alex
Follow ups