|
[Sponsors] |
January 13, 2012, 11:10 |
|
#21 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Hello again FOAMers!
I have payed a bit with magneticFoam and I'm almost sure that it works, just want to check with some PROs and also have few questions, that I hope will be answered. 1) You see B lines from magnet. It looks kinda OK, if you ignore those 4 massive vectors from corners of magnet. What could be the reason for this kind of error? This image is scaled. 2) Again B lines, but picture isn't scaled so we can see vectors in all air field. But again an error: mesh is generated using something like this: Then the largest facet (b2xL) is one boundry and smallest (b1xl) is side of magnet and together as you can imagine there are 6 'blocks'. This construction was chosen because of possibility of grading mesh (closer to magnet more cells). The errors are circled in picture. The vectors are like sliding where 2 of these 'blocks' (or patches, don't know how to call them) meet. Is this a problem of mesh and there is a need for a different approach? Sincelery, latvietis P.S. And of course - case file magnetic.tar.gz of all this. Last edited by latvietis; January 13, 2012 at 11:26. |
|
January 15, 2012, 08:28 |
|
#22 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi latvietis,
This is looking very nice and very good indeed! And I would also like to hear/read from the PROs on this subject as well... Here's my perspective on this: Attached is a snapshot with streamlines instead of glyphs. The steps to achieve this were:
There is an interesting detail here: since it's a single iteration of calculating field equations, the zone representing the magnet is empty inside it, but the field is still calculated as if there were cells inside the magnet! As for the concentrated glyphs/lines on the corners of the magnet - my guess is this is due to two reasons:
If you could generate a mesh that isn't so homogeneous, then it could be possible to determine if this is an error introduced by the mesh... which would still be very complicated, given the sharp corners of the magnet. One thing that is bothering me is that this magnetic field doesn't feel very real when compared to that picture on wikipedia (on the magnet page): http://en.wikipedia.org/wiki/File:Magnet0873.png - I think this is because the side wall of the magnet is being disregarded as a magnetic source. I tried merging the two N-S and even the 3 patches of the magnet into a single magnet, but the solver crashed on both tries. I then added a third magnet and associated it to the side wall of the magnet, but there was not effect. My guess is because "mag_side" has a zero gradient boundary condition for the "psi" field. I don't know enough about this to even try to give a hint in the right direction. My hunch is simply that the current boundary conditions are what they are: a North patch and a South patch sources, with no magnet in between them If it is meant to represent a single N-S magnet, then the streamlines near the body of the magnet should have different angles. The other detail is that bounds of the surrounding mesh seem to affect the magnetic field itself. This could really use the help of someone with more experience on magnetic field simulation Best regards, Bruno
__________________
|
|
February 22, 2012, 10:08 |
|
#23 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Greetings!
I'm spending a lot of time to find out what magneticFoam is capable of. Firstly, thanks Bruno for meshing solution, Blender+enGrid works kinda nice though enGrid is a bit buggy and often quits without saying why. Maybe I need to find some other conversation between Blender and BlockMesh for example. Secondly, I managed to make nice (at least I think so) images with 2 magnets. Do you think they are ok? In the end I think I also managed to fill magnets with cells and it still works (it isn't showed in these pics though). But now the part where I have stopped. The thing I want to find is how magnetic field is affected by some kind of material, e.g. iron rod/wire. I also want to see how magnetic field behaves in this rod. So I have set up 2 magnet system with a plate. In image it is possible to see the outcome and it doesn't look good. I guess there are things I don't know how to define: 1) The volume inside the magnets/rod. I don't know how to define relativePermeability and remanence (from transport properties) in all volume. That means I can't define magnetic properties of my objects. I tried using boxToCell in topoSet, but I don't think it works as I want. 2) Another thing is boundary condtions of surfaces. How should I define the boundaries of my wire? zeroGradient doesn't look as the best choice, but I can't think of anything else. Yours sincerely, Martin P.S. In last image I hope you can see the 2 magnets and my rod (the largest box) perpendicular to them. |
|
February 25, 2012, 19:17 |
|
#24 | ||||||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Martin,
Quote:
Er... wait, maybe this is already being done with topoSet... Quote:
Quote:
By what I can understand, it assumes the surrounding environment is either air or (most likely) vacuum. It allows you to calculate how the magnetic fields interact between magnets, but I think that you can't go any further without doing some coding of additional terms on the equations or even adding a few more equations. Quote:
Quote:
Mmmm... maybe the "calculated" boundary condition might work... Quote:
Best regards, Bruno
__________________
|
|||||||
February 26, 2012, 23:36 |
|
#25 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Yes, the modification of solver has started, but with not much progress at the moment.
I thought about usage of "calculated" BC, but it usually just drops error message: "You are probably trying to solve for a field with a default boundary condition." I think I understand the meaning of this error, but I don't know the workaround. I believe it says that I'm solving for a field where I have defined the value of "internalField". Or something like that... How does this "calculated" BC actually work? I was looking in forums etc., but I couldn't find a simple explanation/usage of this (or maybe I lack some skills of searching). Thanks for reminding to look in other electromagnetic solvers - at least they have proper examples that could help. Best regards, Martin |
|
February 28, 2012, 17:55 |
|
#26 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Martin,
Quote:
As for searching, check the tutorials: Code:
cd $FOAM_TUTORIALS find . | xargs grep 'calculated' -sl Best regards, Bruno
__________________
|
||
March 11, 2012, 22:11 |
|
#27 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Please delete this post, found my answer.
Last edited by latvietis; March 11, 2012 at 22:28. Reason: delete |
|
March 18, 2012, 17:01 |
|
#28 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Greetings!
I'm having really hard time to find a way how to tell magneticFoam that there is also volume of magnet. I believe all my problems are in solver functions Code:
solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf)); fvc::reconstruct(fvc::snGrad(psi)*mesh.magSf()) constant::electromagnetic::mu0*fvc::reconstruct(murf*fvc::snGrad(psi)*mesh.magSf() + murf*Mrf) Do you have any suggestions what to add to solver so I could define volume of magnet not just its poles? There is another thing: since I can't define volume of magnet (I believe that is reason why), magneticFoam solves bad B-field values. They should be like the 3rd attached picture, but instead B is solved similar to H (1st and 2nd picture, they are the same though different fields are drawn). Any hints how to get proper field lines? Sincerely, Martin |
|
March 18, 2012, 17:13 |
|
#29 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Martin,
I ended up not having any spare time to look into this But I've remembered something that perhaps might help: porous solvers! Code:
find $FOAM_SOLVERS -iname "*porous*" Another question: I didn't see the equations you posted here in detail, but I'm wondering where exactly you placed them!? edit: About the first two pictures: how about showing in streamlines as well Best regards, Bruno
__________________
Last edited by wyldckat; March 18, 2012 at 17:14. Reason: see "edit:" |
|
March 18, 2012, 17:45 |
|
#30 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Oh, those equations are in magneticFoam.C file. First is to solve psi, second for H-field and last for B-field. I haven't changed them. I have tried different approaches in changing things in createfields.H. For example, I changed all face to cell so I would define one magnet in transportproperties and it should have same permeability and remanence in all volume. I could compile solver this way, but I didn't get the images I wanted.
There is another thing. I added these lines in magneticFoam.C so I could check values that I give from transportProperties: Code:
murf.write(); Mrf.write(); I attached streamline pic below (only B lines, but I can tell you that I got the same pic with H lines). Color is by psi. Ok, I'll look to that porus solver! Martin |
|
May 31, 2012, 15:20 |
|
#31 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Martin,
I was browsing the web for info on any leak about "OpenFOAM 2.2" and I picked up on this report: OpenFOAM Simulation for Electromagnetic Problems It seems to be waaaaaaaaaaaay better documented than magneticFoam I've added this reference to the wiki page: http://openfoamwiki.net/index.php/MagneticFoam Best regards, Bruno
__________________
|
|
May 31, 2012, 16:18 |
|
#32 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15 |
Yeah, I'm working with this solver for some time now, it doesn't actually work that simple as explained there. Problem is with boundary conditions (that is why I have written in many threads about mapped or cyclic BCs).
Martin |
|
February 20, 2014, 11:18 |
|
#33 |
New Member
Join Date: Feb 2014
Posts: 1
Rep Power: 0 |
Hi Latvietis,
Did you succeed in producing the boundary conditions that would make the magnetic lines in magneticFoam look reasonable? If so, could you please share? Best regards, Goga |
|
August 28, 2014, 09:51 |
|
#34 | |
New Member
Björn
Join Date: Feb 2014
Posts: 3
Rep Power: 12 |
Quote:
I've been working a lot with magneticFoam during the last weeks and I figured out, why remanence and relative permeability do not change. Both working examples provided in this thread use the following topoSetDict command: Code:
{ name magnet1; type faceZoneSet; action new; source patchToFace; sourceInfo { name mag_north; } } Code:
{ name magnet1; type faceSet; action new; source patchToFace; sourceInfo { name mag_north; } } { name magnet1; type faceZoneSet; action new; source setToFaceZone; sourceInfo { faceSet magnet1; } } Greets, Björn Last edited by wyldckat; September 13, 2014 at 17:21. Reason: Added [CODE][/CODE] |
||
December 3, 2015, 11:37 |
James
|
#35 |
New Member
James
Join Date: Nov 2015
Posts: 3
Rep Power: 11 |
Hey, thanks for this tutorial - very useful.
However, when I try to run it I get an error message 'Cannot find faceZone for magnet magnet1' Do you know why this is? I am very new to this kind of thing. |
|
December 3, 2015, 12:21 |
|
#36 | |
New Member
Björn
Join Date: Feb 2014
Posts: 3
Rep Power: 12 |
Quote:
I wrote a more comprehensive tutorial some time ago. I posted the relevant passage below: The magnetic field of a cylindrical magnet with the following specifications is computed.
The next step is to define the geometry of the magnet itself. To this end the volume of the magnet has to be set as a faceZone via topoSet: Code:
actions ( { name magnet1; type cellSet; action new; source cylinderToCell; sourceInfo { p1 (-0.01 0 0); // start point on cylinder axis p2 (0.01 0 0); // end point on cylinder axis radius 0.01; } } { name magnet1; type cellZoneSet; action new; source setToCellZone; sourceInfo { set magnet1; } } { name magnet1; type faceSet; action new; source cellToFace; sourceInfo { set magnet1; option all; } } { name magnet1; type faceZoneSet; action new; source setToFaceZone; sourceInfo { faceSet magnet1; } } ); Code:
magnets ( (magnet1 1 860000 (1 0 0)) ); Code:
dimensions [0 0 0 0 0 1 0]; internalField uniform 0; boundaryField { walls { type zeroGradient; } } The first image shows the cells that are selected by cylinderToCell. The other two pictures illustrate the magnetic field (H and B) right in the middle of the geometry. Best, Bjoern Last edited by bklose; December 3, 2015 at 13:42. |
||
December 5, 2015, 12:19 |
|
#37 |
New Member
James
Join Date: Nov 2015
Posts: 3
Rep Power: 11 |
Thanks for this response, have you got the link to the more comprehensive tutorial? I'd like to give it a go in its entirety.
|
|
February 9, 2016, 09:04 |
|
#38 |
New Member
James
Join Date: Nov 2015
Posts: 3
Rep Power: 11 |
Hey
Has anybody managed to write a code for the surrounding area of the magnets? I want to be able to see their flux lines through metal as well as through free space. Cheers James |
|
February 20, 2019, 13:31 |
cannot find murf?!?
|
#39 |
New Member
Alexander Meier
Join Date: Feb 2017
Posts: 15
Rep Power: 9 |
hi all,
trying to use magneticFoam... and failing ;-) so you might can help me... i'm just trying to run the example case with openfoam v1806 - and i get the following error message: --> FOAM FATAL ERROR cannot find file ".../0/murf" as far as i understand the code the murf and the Mrf fields should be created by the solver? has anybody tried to run magnetFoam on a recent openfoam version? |
|
March 3, 2020, 16:03 |
|
#40 | |
New Member
Cody
Join Date: Feb 2020
Location: Montana, USA
Posts: 3
Rep Power: 6 |
Quote:
|
||
Tags |
magneticfoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Looking for a magneticFoam working example | maddalena | OpenFOAM | 3 | July 12, 2013 17:42 |
what is the magneticFoam for in the OpenFOAM 2.0.0 | goodkid | OpenFOAM | 4 | December 24, 2011 09:25 |