# Boundary Conditions of the Edge element

**URL:** <https://community.freefem.org/t/boundary-conditions-of-the-edge-element/2790>\
**Category:** General Discussion\
**Created:** [November 11, 2023, 7:45pm UTC](https://community.freefem.org/t/boundary-conditions-of-the-edge-element/2790 "2023-11-11T19:45:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksugahar](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ksugahar/32/2115_2.png) [@ksugahar](https://community.freefem.org/u/ksugahar)\
**Post date:** [November 11, 2023, 7:45pm UTC](https://community.freefem.org/t/boundary-conditions-of-the-edge-element/2790/1 "2023-11-11T19:45:30Z")

</div>

We are working on a three-dimensional low-frequency electromagnetic problem based on an A-phi formulation as follows.  
We are using Nedlec elements for vector potentials A and P2 elements for scalar potentials phi. We would like to enforce the boundary conditions to \vec{\bf{n}} \times \vec{\bf{A}}= 0  
We looked into some examples, but they are written as on(S, Ax=0, Ay=0, Az=0)  
with which we are not sure with what we would like to.  
Would you tell me how to enforce \vec{\bf{n}} \times \vec{\bf{A}}= 0?

[cylinder\_Gmsh\_2D5.zip](https://community.freefem.org/uploads/short-url/rVT5OQzBx2WeooYCFIR1WQtWKOe.zip) (66.2 KB)

load “msh3”  
load “Element\_Mixte3d”  
load “gmsh”  
load “iovtk”

real a = 1;  
real h = 0.2;  
real sig = 5.8e7;  
real mu = 4_pi_1.e-7;

string meshFileName = “Cylinder\_Gmsh\_2D5.msh”; //1,side 2,top 3,bottom  
mesh3 Th = gmshload3(meshFileName);

fespace Uh(Th, [Edge13d, P2]);  
fespace Nh(Th, Edge13d);

Uh [Ax,Ay,Az, phi];  
Uh [wx,wy,wz, psi];  
Nh [Jx,Jy,Jz] = [0.0, 0.0, 1.0];

macro rot(Ax,Ay,Az) [dy(Az)-dz(Ay),dz(Ax)-dx(Az),dx(Ay)-dy(Ax)] // EOM;  
macro div(Ax,Ay,Az) (dx(Ax)+dy(Ay)+dz(Az)) // EOM;  
macro grad(phi) [dx(phi),dy(phi),dz(phi)] // EOM;

solve Prob([Ax,Ay,Az,phi],[wx,wy,wz,psi]) = int3d(Th)((1./mu)\*rot(Ax,Ay,Az)'_rot(wx,wy,wz) + grad(phi)'_[wx,wy,wz] + [Ax,Ay,Az]'_grad(psi)) - int3d(Th)([wx,wy,wz]'_[Jx,Jy,Jz]) + on(2,3, Ax=0, Ay=0, Az=0) + on(2,3, phi=0);

int[int] orderOut = [1, 1, 1, 1];  
savevtk(“A\_vect.vtu”, Th, [Ax, Ay, Az], dataname=“A vector”, order = orderOut);

---

<div class="post-metadata">

**Author:** ![ksugahar](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ksugahar/32/2115_2.png) [@ksugahar](https://community.freefem.org/u/ksugahar)\
**Post date:** [November 29, 2023, 6:09pm UTC](https://community.freefem.org/t/boundary-conditions-of-the-edge-element/2790/2 "2023-11-29T18:09:28Z")

</div>

Our question is when use use Edge13d, and use Dirichlet boundary conditions,  
then we are enforcing {\bf \vec n} \times {\bf \vec A} = 0  
If we say  
`on(2,3, Ax=0, Ay=0, Az=0)`  
it is {\bf \vec A} = 0 and it is not equivalent.

But the results seem to be equivalent.  
Are there any way to express {\bf \vec n} \times {\bf \vec A} = 0 using  
`on(2,3, **** )`  
statement?

---

<div class="post-metadata">

**Author:** ![henkel](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@henkel](https://community.freefem.org/u/henkel)\
**Post date:** [December 1, 2023, 12:03pm UTC](https://community.freefem.org/t/boundary-conditions-of-the-edge-element/2790/3 "2023-12-01T12:03:20Z")

</div>

I may be able to assist you with low-frequency electromagnetic problems, specifically those based on A-phi formulations, as it aligns with my research topic.

As far as I know: In case of edge elements the Dirichlet boundary condition `on(2,3, Ax=0, Ay=0, Az=0)` only applies to the tangential values, resulting in \vec n \times \vec A = 0. In this case, the syntax of `on()` is not intuitive.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [December 18, 2023, 3:32pm UTC](https://community.freefem.org/t/boundary-conditions-of-the-edge-element/2790/4 "2023-12-18T15:32:59Z")

</div>

Rermak, on Nedelelc Finite element (Edge13d) the interpolation is

int1d(Edge) ( [Ax,Ay,Az]'\*T)

where T is the tangent vector to the edges  
so the dirichlet Boundaru condition on(2,3, Ax=0, Ay=0, Az=0) set only tangent component of the field (Ax,Ay,Az).
