Hello,
I am trying to solve L(v) term for a mixed function space problem which is supposed be:
L(v) = \int_{\Gamma} n \cdot v \nabla e^{ikd_s \cdot x} \:\mathrm{d}\Gamma
Here is how I separate it for an arbitrarly shaped boundary:
L(v) = \int_{\Gamma} \mathbf{n} \cdot (v_r + i v_i) \mathbf{\nabla} \{ \cos(k \:\mathbf{d_s} \cdot \mathbf{x}) + i \sin(k \:\mathbf{d_s} \cdot \mathbf{x}) \} \:\mathrm{d}\Gamma \quad \text{where} \quad \mathbf{d_s} = (1,0)
From here I somehow end up with some set of equations which actually is possibly wrong but I get the right answer somehow when I play around with + and - signs. I would really appreciate any help regarding this derivation. The plus and negative signs I end up with are all over the place. They don’t make sense. Here is the meaningless but the correct solution:
d_s = Constant((1.0,0.0))
L_r = \
- dot( d_s*k, n*v_i*cos(k*x[0]))*ds(2)\
+ dot( d_s*k, n*v_r*sin(k*x[0]))*ds(2)\
+ dot( d_s*k, n*v_i*cos(k*x[0]))*ds(3)\
- dot( d_s*k, n*v_r*sin(k*x[0]))*ds(3)
L_i = \
+ dot( d_s*k, n*v_r*cos(k*x[0]))*ds(2)\
+ dot( d_s*k, n*v_i*sin(k*x[0]))*ds(2)\
- dot( d_s*k, n*v_r*cos(k*x[0]))*ds(3)\
- dot( d_s*k, n*v_i*sin(k*x[0]))*ds(3)
Therefore I think my real question is:
How can I know the direction of the facetnormals for an arbitrarly shaped geometry within my domain. This is not a problem with multiple subdomains. You can think of it as simple as a 2D arbitrary hole shape with two marked boundaries within some rectangular or circular single solution domain.
From some other topic I found a code that helps me to plot the boundary normals:
Here is another topic that I created sometime ago which was solved and is giving more detail about my problem and code but it was for a simple geometry. Now if I try to have a more complicated geometry, I can no longer find the correct answer:
The boundary normals for any geometry I plot always point outwards the solution domain. But the correct solution that I know and find suggests otherways. One of the boundaries should be facing another direction (or somehow should bring some -1 multiplier).
I found some other old post which is trying to find an answer to somehow a similar question:
https://fenicsproject.org/qa/13004/dirichlet-condition-with-normal-vector/
but the codes they shared are already out-dated.