Spatial second order derivative inside the weak form

Hi everyone,

My weak form has a spatial second order finite difference variable such as:

\frac{\partial^2}{\partial^2 \theta}

My 2D domain is a circle and I theta is a function of x[0] and x[1] obviously. I

Here is an example code that I came up with. This just to demonstrate what it is like. I would appreciate any help towards finding a solution.

from fenics import *
from dolfin import *

# Define geometry
radius_c = 1
c_points = 30
xcyl = 0
ycyl = 0
domain = Circle(Point(xcyl, ycyl), radius_c, c_points)

# Mesh the domain
mesh = generate_mesh(domain,10)
plot(mesh)

V = FunctionSpace(mesh, 'P', 1)

f = Expression ( "x[0]", degree = 1 )

(u) = TrialFunction(V)
(v) = TestFunction(V)

a = (u*v)*(1/pddtheta) * dx
# I am confused here. theta is also a dependent variable to x and y.
# my guess is \frac{\partial^2}{\partial \theta^2} term has to be evaluated with a finite-difference scheme
# but I cannot find any reference for me to find a solution.

L = (v*f) * dx

u = Function ( V )
solve ( a == L, u)

Please write down the equations you are solving and the boundary conditions for them. Use the markdown syntax please.

Hi TherealSova,

I am simply trying to solve for:

\frac{ \partial^2 u(x,y)}{\partial \theta^2}

term.

(Sorry, it is my first time trying to find how to make markdown but I don’t know how to do that here either.)

I am hoping to pull x[0] and x[1] values from the mesh itself. I’d also appreciate a little help with the chain rule too. It looks like it is possible to do something like u.dx in Fenics but I don’t know how to apply it to my problem yet.

Hi again,

I’ve solved my problem so I am just going to write down here. That term required some chain rule manipulation. But once I’ve got the final form of my weak form equation (depending only on x and y), it was quite easy to implement partial derivatives by .u.dx(0) for derivative in x-direction, u.dx(1) for derivative in y-direction, etc. and defining expressions for pulling x and y coordinates.