halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
334 stars 62 forks source link

Physical Contact Constraints With Magnetic Fields #7

Closed mikeseese closed 5 years ago

mikeseese commented 5 years ago

Hey!

I made a bit of progress tonight with setting up my geometry. Essentially I've got two magnets, and each have a piece of steel attached to them (the magnet and steel share the same lines in the geometry). I'm now trying to change magforce from the magnet example to something more like totalforce which accounts for magnetic forces as well as normal forces due to contact.

The idea is these two pairs of (magnet|steel) will have magnetic forces on each other, which is what I want to see. I need to add the normal forces within each pair to be able to show the pair-to-pair interaction magnetically.

I saw the other example for cmut-collapse-mode-axisymmetry-2d which seems to add contacts in it.

It feels that in addition to the magnetostatic formulation from the permanent magnet example, I need a forcebalance formulation? It's a bit late so I'm having so I'm going to need to look at the cmut example with fresh eyes tomorrow.

However, I feel like there might be a simpler solution with the setconstraint function? Something that says "these things are attached in the xy field and their forces on each other will cancel out". I doubt it's as simple as magforce.setconstraint(regionunion({steel, magnet})); or something the like.

Figured I'd throw this out there in case the solution is simple, but I'll keep looking into this tomorrow

I can email you with a link to a private gist if that helps; my codebase is starting to get into non-public territory

Thanks!

halbux commented 5 years ago

Hi Mike,

Sorry for the late reply! I have some issues understanding exactly the question but this is what I think you want:

You are able to calculate the magnetic force between the magnet-steel pair but you also want to include the mechanical contact force (to get the total stress on the magnet?).

If so would it be what you want to solve an elasticity problem on the pair (documentation: predefinedelasticity) with magnetic forces as the mechanical force source? Have a look at the predefinedmagnetostaticforce part of the documentation, it has an example on how to combine an elasticity problem with a magnetic force source.

After having computed the mechanics you can then integrate the stress on the magnet-steel interface to get the contact force. The mechanical stress tensor can be computed as the elasticity matrix H times the strain (documentation: strain()). In your case you will maybe only want to integrate the sigma_zz stress on the interface.

Additionally you can also call the vonmises() function to get the von Mises stresses and assess if your materials are stressed a lot or not. You can as well easily include any prestress in your materials (see documentation) if you solve iteratively the problem in a nonlinear loop.

I hope this helps! I can provide a few lines of code or more if you provide more details (confidentially via email if needed).

Alexandre

mikeseese commented 5 years ago

Long story short, here is the scenario i've been trying to come up with:

The problem I'm having at this very moment is the magnet/steel attachment. Due to the electromagnetic force, the magnet has force towards the steel, and the steel has force towards the magnet. However, due to contact an the normal force, these cancel out each other and nothing will move

I don't really care about the stress factors right now, and just assuming that the components are strong enough to withstand any stress forces. However, its very possible that the elasticity formulation is what I need to simulate the "normal force" that is opposing the magnetic attraction between the magnet/steel attachment.

I'm going to email you a sketch of this scenario i'm trying to simulate

I will take a look at the documentation and see if I can apply your previous message however!

halbux commented 5 years ago

Ok I see better now. Yes, it seems to me that an elasticity formulation (predefinedelasticity, very straightforward to use and lots of examples for that) with magnetic force source is what you need,... and also the actual reason why the magnet and steel stay in place. You can then apply mechanical constraints on the magnet-steel pair to fix it for example on some regions.

Please let me know if anything is unclear.

Alex

halbux commented 5 years ago

Just had a look at your sketch,

I am wondering: It seems to me that what you want is just the integral over the whole rotor region of your magnetic force! The magnet-steel magnetic force interaction will have no contribution in the overall force, isn't it?

To convince yourself it can be interesting to just remove the stator: you should observe that the integrated force on the whole rotor drops to zero (or close to if the mesh is not ultra fine)

Alex

mikeseese commented 5 years ago

It seems to me that what you want is just the integral over the whole rotor region of your magnetic force! The magnet-steel magnetic force interaction will have no contribution in the overall force, isn't it?

Yes, exactly!

To convince yourself it can be interesting to just remove the stator: you should observe that the integrated force on the whole rotor drops to zero (or close to if the mesh is not ultra fine)

I will give this a try

Thanks!

mikeseese commented 5 years ago

A couple of things got me to the point of convincing myself that what I had was working (just observing the total magnetic force on the magnet/steel pair should be ~0):

After this, I was able to get forces close to 0, so I believe this issue is resolved! Sent you an email with some pictures/results of before and after for fun.