how to evaluate the angle from the x-axis of a gradient
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_
return np.cos(
L = L - dt*anisotropic_
...
-------
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.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Kristian B. Ølgaard
- Solved:
- Last query:
- Last reply: