CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

magneticFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree23Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 13, 2012, 11:10
Default
  #21
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
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.
latvietis is offline   Reply With Quote

Old   January 15, 2012, 08:28
Default
  #22
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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:
  1. Run paraFoam and then in ParaView, open the case file a second time. On the second opened file, select the patches and walls instead of the mesh volume.
  2. Then select the first file and go to Filters -> Alphabetical -> Stream Tracer with Custom Source. A dialog box appears:
    1. With the radio button on the left at Input, select on the right the first file.
    2. With the radio button on the left at Source, select the second file on the right.
    3. Press OK.
  3. Press apply. Now we have the streamlines originating from the patches and walls.
  4. Now Filters->Alphabetical->Tube. Change radius to one tenth of the value shown and Apply.

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:
  1. Because the mesh is formed by cube-like cells, making it very complicated to calculate anything meaningful over the corners of the cells. This problem can happen with normal fluid flow as well.
  2. Because of the shape of the magnet... although a real magnet should probably have a more intense or weaker field on those corners, due to the stresses resulting from the manufacturing process.
Basically, it's like trying to calculate the tangent of 90 degrees: http://www.wolframalpha.com/input/?i=tan%2890%29

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
Attached Images
File Type: jpg mag_with_streamlines.jpg (85.7 KB, 301 views)
__________________
wyldckat is offline   Reply With Quote

Old   February 22, 2012, 10:08
Default
  #23
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
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.
Attached Images
File Type: jpg preteji.jpg (96.2 KB, 229 views)
File Type: jpg vienadi.jpg (97.6 KB, 187 views)
File Type: png rod.png (20.4 KB, 177 views)
latvietis is offline   Reply With Quote

Old   February 25, 2012, 19:17
Default
  #24
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Martin,

Quote:
Originally Posted by latvietis View Post
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.
You're welcome! There is another way for easier generation of meshes... well, if the geometries are relatively simple:
  1. Make the volume mesh, without defining the magnets and/or obstacles.
  2. Then use setSet and subsetMesh to remove the cells where the magnets and/obstacles should go! I usually go to the following tutorial for reference: http://openfoamwiki.net/index.php/SetSet
Basically, the idea is to draw the total volume with blockMesh; then with setSet, select the cells that the wall will occupy and then invert the selection, in order to have the remaining mesh. After having the cells you want to keep selected, you can use subsetMesh to write those cells as the new mesh!
Er... wait, maybe this is already being done with topoSet...

Quote:
Originally Posted by latvietis View Post
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).
Looks very nice indeed! I can't see any flaws in those two images.

Quote:
Originally Posted by latvietis View Post
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 don't think I've got very good news for you: magneticFoam is a simple solver that simply solves one or two equations and gives the solution pretty much in a single go.
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:
Originally Posted by latvietis View Post
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.
You can check the two other solvers that exist in the folder "$FOAM_APP/solvers/electromagnetics/", namely:
  • electrostaticFoam - this should be a solver somewhat similar to magneticFoam, but meant for electrostatic fields.
  • mhdFoam - from here you can get some info on how magnetic fields can interact with fluids.
You should be able to get more information for what you need by examining other solvers that OpenFOAM has. Also, seeing the following wiki tutorials should help you a bit more in understanding how things work in OpenFOAM:
Quote:
Originally Posted by latvietis View Post
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.
The closest scenario I can remember from what I've seen in OpenFOAM, would be the chtMultiRegion*Foam solvers, which transfer heat from solid regions to fluid regions. The mhdFoam tutorial "hartmann" should also give you a bit more info.
Mmmm... maybe the "calculated" boundary condition might work...

Quote:
Originally Posted by latvietis View Post
P.S. In last image I hope you can see the 2 magnets and my rod (the largest box) perpendicular to them.
Yes, I can see it. Indeed something bad/wrong is going on there. It could be a problem with not enough mesh resolution on that zone with the crooked magnetic lines, or the problem is starting to go into an area where a more complex solver will be required, in order to smoothen those crooked lines.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 26, 2012, 23:36
Default
  #25
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
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
latvietis is offline   Reply With Quote

Old   February 28, 2012, 17:55
Default
  #26
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Martin,

Quote:
Originally Posted by latvietis View Post
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've only used it properly once or twice. If I remember correctly, it only works if the boundary condition can be calculated based on all other boundaries. For example, if the velocity U is fixed, then p can be calculated for the same patch... or something like that.

As for searching, check the tutorials:
Code:
cd $FOAM_TUTORIALS
find . | xargs grep 'calculated' -sl
This will give a list of all of the files that mention the word "calculated"

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   March 11, 2012, 22:11
Default
  #27
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
Please delete this post, found my answer.

Last edited by latvietis; March 11, 2012 at 22:28. Reason: delete
latvietis is offline   Reply With Quote

Old   March 18, 2012, 17:01
Default
  #28
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
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)
I have tried different ways to change surfaceScalarField to volScalarField, but it just doesn't work.

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
Attached Images
File Type: jpg B.jpg (53.1 KB, 163 views)
File Type: jpg H.jpg (52.9 KB, 163 views)
File Type: jpg Fotoattēls0339.jpg (13.8 KB, 157 views)
latvietis is offline   Reply With Quote

Old   March 18, 2012, 17:13
Default
  #29
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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*"
There is always a limited zone of the mesh that is defined as being porous, thus having a different way to solve things there.

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:"
wyldckat is offline   Reply With Quote

Old   March 18, 2012, 17:45
Default
  #30
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
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 got really confused because it defined boundary patches (magnet poles) with default values (that is 1 and 0). Why is that? Also, I noticed that when I change values to transportproperties it actually doesn't affect result. I could set permeability to 100 or 100000 or whatever and the B/psi/H results would be the same. Any ideas why is that?

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
Attached Images
File Type: jpg Bline.jpg (98.4 KB, 185 views)
latvietis is offline   Reply With Quote

Old   May 31, 2012, 15:20
Default
  #31
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
__________________
wyldckat is offline   Reply With Quote

Old   May 31, 2012, 16:18
Default
  #32
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 15
latvietis is on a distinguished road
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
latvietis is offline   Reply With Quote

Old   February 20, 2014, 11:18
Default
  #33
New Member
 
Join Date: Feb 2014
Posts: 1
Rep Power: 0
veshapa is on a distinguished road
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
veshapa is offline   Reply With Quote

Old   August 28, 2014, 09:51
Default
  #34
New Member
 
Björn
Join Date: Feb 2014
Posts: 3
Rep Power: 12
bklose is on a distinguished road
Quote:
Originally Posted by latvietis View Post
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 got really confused because it defined boundary patches (magnet poles) with default values (that is 1 and 0). Why is that? Also, I noticed that when I change values to transportproperties it actually doesn't affect result. I could set permeability to 100 or 100000 or whatever and the B/psi/H results would be the same. Any ideas why is that?

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
Hello everyone,

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;
        }
    }
Even though faceZones are generated, they are empty (check constant/polyMesh/faceZones). So, the last loop in the createFileds.H file is skipped and only pre-set values are taken. By changing the topoSetDict code to
Code:
     {
        name    magnet1;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name mag_north;
        }
    }
    {
        name    magnet1;
        type    faceZoneSet;
        action  new;
        source  setToFaceZone;
        sourceInfo
        {
            faceSet magnet1;
        }
    }
faceZones are generated. Oddly, error massages occur in some cases. They seem to depend on the geometry of the working case. But it works in a lot of computations I've made.

Greets, Björn
wyldckat likes this.

Last edited by wyldckat; September 13, 2014 at 17:21. Reason: Added [CODE][/CODE]
bklose is offline   Reply With Quote

Old   December 3, 2015, 11:37
Default James
  #35
New Member
 
James
Join Date: Nov 2015
Posts: 3
Rep Power: 11
james.heis@durham.ac.uk is on a distinguished road
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.
james.heis@durham.ac.uk is offline   Reply With Quote

Old   December 3, 2015, 12:21
Default
  #36
New Member
 
Björn
Join Date: Feb 2014
Posts: 3
Rep Power: 12
bklose is on a distinguished road
Quote:
Originally Posted by james.heis@durham.ac.uk View Post
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.
Hey,

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.
  • Magnetization M = 860 kA/m
  • Length L = 20 mm
  • Radius R = 10 mm
Firstly, a bounding volume has to be defined. This can easily be done by using blockMesh. The volume must be large enough, so the boundaries have little influence on the magnetic field near the magnet. Here, a box with the dimensions of 200mm × 200mm × 200mm is created.
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;
         }
     }
 

 );
The permanent magnet consists of cells selected by cylinderToCell in the topoSetDict and have specific properties that are defined in the transportProperties, i.e. name, relative permeability, remanent magnetization and direction:

Code:
 magnets
 (
   (magnet1 1 860000 (1 0 0))
 );
The 0 directory contains only the file for the boundary conditions of the magnetic scalar potential psi:

Code:
 dimensions      [0 0 0 0 0 1 0];
 
 internalField   uniform 0;
 

 boundaryField
 {
     walls
     {
         type            zeroGradient;
     }
 }
It is important to note that the magnet itself is not considered to be a solid in magneticFoam. The solver needs to compute the inner material of the magnet so that the magnet material is exclusively defined via topoSet.

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
Attached Images
File Type: jpg Geometry.jpg (22.4 KB, 168 views)
File Type: jpg H_Vec.jpg (187.2 KB, 174 views)
File Type: jpg B_Vec.jpg (190.5 KB, 142 views)
AliRezaJafari and dkuesten like this.

Last edited by bklose; December 3, 2015 at 13:42.
bklose is offline   Reply With Quote

Old   December 5, 2015, 12:19
Default
  #37
New Member
 
James
Join Date: Nov 2015
Posts: 3
Rep Power: 11
james.heis@durham.ac.uk is on a distinguished road
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.
james.heis@durham.ac.uk is offline   Reply With Quote

Old   February 9, 2016, 09:04
Default
  #38
New Member
 
James
Join Date: Nov 2015
Posts: 3
Rep Power: 11
james.heis@durham.ac.uk is on a distinguished road
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
james.heis@durham.ac.uk is offline   Reply With Quote

Old   February 20, 2019, 13:31
Default cannot find murf?!?
  #39
New Member
 
Alexander Meier
Join Date: Feb 2017
Posts: 15
Rep Power: 9
flowgeek is on a distinguished road
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?
hmpham likes this.
flowgeek is offline   Reply With Quote

Old   March 3, 2020, 16:03
Default
  #40
New Member
 
Cody
Join Date: Feb 2020
Location: Montana, USA
Posts: 3
Rep Power: 6
cjessup37 is on a distinguished road
Quote:
Originally Posted by bklose View Post
Hey,

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.
  • Magnetization M = 860 kA/m
  • Length L = 20 mm
  • Radius R = 10 mm
Firstly, a bounding volume has to be defined. This can easily be done by using blockMesh. The volume must be large enough, so the boundaries have little influence on the magnetic field near the magnet. Here, a box with the dimensions of 200mm × 200mm × 200mm is created.
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;
         }
     }
 

 );
The permanent magnet consists of cells selected by cylinderToCell in the topoSetDict and have specific properties that are defined in the transportProperties, i.e. name, relative permeability, remanent magnetization and direction:

Code:
 magnets
 (
   (magnet1 1 860000 (1 0 0))
 );
The 0 directory contains only the file for the boundary conditions of the magnetic scalar potential psi:

Code:
 dimensions      [0 0 0 0 0 1 0];
 
 internalField   uniform 0;
 

 boundaryField
 {
     walls
     {
         type            zeroGradient;
     }
 }
It is important to note that the magnet itself is not considered to be a solid in magneticFoam. The solver needs to compute the inner material of the magnet so that the magnet material is exclusively defined via topoSet.

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
Hi Bjorn. Do you have a link to your comprehensive tutorial on magneticFoam with a cylindrical magnet that I may access? Your example would me understand the basics of using magneticFoam. Thanks!
cjessup37 is offline   Reply With Quote

Reply

Tags
magneticfoam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 15:59.