Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Boundary conditions for 3D eddy current problem

More
3 years 7 months ago #3119 by swiper
Hello everybody,

I'm currently working on a 3D eddy current problem regarding a conducting cube in homogenous magnetic field in the time domain. While doing this some questions arose about the correct implementation of non-homogeneous Dirichlet boundary conditions.

I tried the following so far:
Code:
coeff_dirichlet = CoefficientFunction(( CoefficientFunction([0,0,0,0,0,-25e-3*y*B0*sin(omega * t)]), CoefficientFunction([0,0,0,25e-3*B0*x*sin(omega * t),0,0]), CoefficientFunction([0,0,0,0,0,0]))) uh.Set(coeff_dirichlet, BND)

with the entries in the list being the different surfaces (1: bottom, 2: top, 3: left, 4: right, 5: front, 6: back). Drawing these onto the mesh shows in the GUI that the values are set to the correct surfaces.

Even though there is a lot of well written documentation I don't fully understand how to mark the boundaries correctly as the keyword BND tells Set that the CoefficientFunction need only be interpolated at the marked boundaries.
Note the attached code. Any help is very much appreciated as I'm pretty new to FEM-Simulation in general.

Best
Sebastian
More
3 years 7 months ago #3120 by joachim
Hi Sebastian,

it is much easier to work with labels for the boundary conditions. Try to set them already in the geometry.

If you don't have them, you can assign them like here:
Code:
mesh = Mesh("cube.vol") names = [ "bottom", "top", "left", "right", "front", "back", "inner" ] for i, name in enumerate(names): mesh.ngmesh.SetBCName(i, name) print (mesh.GetBoundaries())

Be careful, there is some inconsistency whether we enumerate boundaries 0-based or 1-based. We check and see that we got 7 distinct boundary regions.

We use the names when defining dirichlet boundaries:
Code:
V = HCurl(mesh, order = 1, dirichlet = "right|back")

and use them later as you do for the material coefficients. See the attached file.

Best, Joachim
The following user(s) said Thank You: swiper
More
3 years 7 months ago - 3 years 7 months ago #3154 by swiper
Hi Joachim,

thanks again for your super fast help. Unfortunately I still have a problem with my current test case for Eddy currents.

To slim the overall problem I'm currently tryin to solve a simple test case for a pure homogenous magnetic field. Here I'm using [tex]A = \left(
\begin{array}{c}
y\\
-x\\
0\\
\end{array}
\right)[/tex]
for my Dirichlet boundary conditions. Unfortunately that doesn't result the correct magnetic field.

I also found some examples for Eddy current problems (pretty much the same problem) from your User-Meeting 2019. Sadly I currently can't completely comprehend why these boundary conditions have been used.

I attached the volume and the code again. I'm sure there is just a small mistake about the implementation. Maybe someone knows where the problem is.

EDIT: Could solve it myself will be marked as resolved!
Last edit: 3 years 7 months ago by swiper. Reason: Solved myself
Time to create page: 0.182 seconds