New question #133595 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/133595
I have a time-dependent Cahn-Hilliard-Type problem and I need to evaluate the
angle from the x-axis of a gradient in order to define my variational problem.
The angle of the gradient can be calculated by using phi = arctan( dc/dy /
dc/dx ). This is needed to model an anisotropic N-fold surface tension with the
help of cos(N*phi).
A very native approach was to use the following lines of code. It doesn't work
of course. But I think it helps to understand my problem.
--------------------
import numpy as np
from dolfin import *
...
V = FunctionSpace(mesh, "CG", 2)
w = TestFunction(V)
c = Function (V) # current solution
c0 = Function(V) # old solution
...
# Anisotropic N-fold surface tension:
def anisotropic_tension(c0):
return np.cos(N*np.arctan2(c0.dx(1),c0.dx(0)))
L = L - dt*anisotropic_tension(c0)*(inner(div(grad(w)), div(grad(c)))*dx)
...
--------------------
I think one basic problem is the interaction with numpy and the encapsuled
evaluation of the derivatives. I'm glad for any hint how to proper evaluate the
angle and how to use it in order to define L.
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
_______________________________________________
Mailing list: https://launchpad.net/~dolfin
Post to : [email protected]
Unsubscribe : https://launchpad.net/~dolfin
More help : https://help.launchpad.net/ListHelp