Best way to express constant vectors and the position vector in a weak form
Hello,
I would like to know what is the best way to express constant 3D vectors for a Robin boundary condition in my problem. They are originally numpy arrays. Here's my approximation at the moment:
import scipy as sp
from dolfin import *
k0 = 15.0
k_dir = sp.r_[0.0, 0.0, -1.0]
E0 = sp.r_[1.0, 0.0, 0.0]
mesh = Mesh("some_
element_type = "Nedelec 1st kind H(curl)"
element_order = 1
V_c = FunctionSpace(mesh, element_type, element_order)
V = MixedFunctionSp
Ef = TrialFunctions(V)
vf = TestFunctions(V)
Er, Ei = Ef[0], Ef[1]
vr, vi = vf[0], vf[1]
# Mark boundaries
boundaries = FacetFunction(
boundaries.
class RadiationBounda
def inside(self, x, on_boundary):
return on_boundary
radiation_bnd = RadiationBoundary()
d_exc = 1; radiation_
# Integration over the boundaries
ds = Measure(
n_v = FacetNormal(mesh)
# Position or 'radius' vector
r_v = V.cell().x
# Constant vectors for weak form
k_dir_c = Constant( k_dir.tolist() )
E0_c = Constant( E0.tolist() )
pde = dot(k0*cross(n_v, cross(n_v, Ei)) + k0*sin( k0*dot(k_dir_c, r_v) )*cross(n_v, cross(E0_c, k_dir_c-n_v)), vr)*ds(d_exc) + dot(-k0*cross(n_v, cross(n_v, Ei)) + k0*cos( k0*dot(k_dir_c, r_v) )*cross(n_v, cross(E0_c, k_dir_c-n_v)), vi)*ds(d_exc)
# Thank you!
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Luis Linares
- Solved:
- Last query:
- Last reply: