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 Tree20Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2020, 05:34
Default transportproperty & topoSet wrong setting?
  #41
New Member
 
Lei
Join Date: Oct 2018
Posts: 3
Rep Power: 7
MichaelXPS is on a distinguished road
To begin with, the transportProperties, i.e. murf, Mrf and orientation sets doesn't influence the results. I am confused with the motivation of toposet. It seems to me that you try to define the three properties of the magnet, but what about the three properties in the domain of simulation? Nevertheless, even if I try to change the toposetdict with murf, it doesn't influence the B field which is quite weird physics. Actually, it seems to me that the solver take the vacuum property. Would you mind to discuss another round?

Quote:
Originally Posted by wyldckat View Post
Greetings to all!

Since I have an old passion for magnetic fields and such, I had a go at creating an example myself.

First of all, Marco, thanks for the hint!

@latvietis: Attached is a working case named "magSandbox", albeit it doesn't necessarily represent anything very physical. Like the name implies, it's a case set-up for playing around with magneticFoam. To use it, run:
Code:
./Allrun
To clean it up and start over (remove mesh and solvers iterations):
Code:
foamCleanTutorials
Run:
Code:
magneticFoam -help
For more information about other options available for running from the command line. I say this because this was how I found out about "-HdotGradH" that you can see in Allrun.

Development details:
  • Base structure for the case was taken from two other cases:
    • "basic/scalarTransportFoam/pitzDaily" - most of the structure, since it has most of the basic files necessary.
    • "stressAnalysis/solidDisplacementFoam/plateHole" - took only "controlDict" from there, but I could have taken it from "basic/potentialFoam/pitzDaily/system".
  • Geometry taken from the cavity case.
    • Changed the box from 0.1 to 1m.
    • Renamed walls. 3 kinds of walls have been defined: topWall, sideWall and numbWall.
      Top and side will have magnets, "numbWall" is... numb
  • Looking at "createFields.H" from "magneticFoam.C", one can see that "psi" is a "volScalarField". Therefore I renamed "0/T" to "0/psi".
    Also, removed "0/U" for now, just to see if things worked with the minimum set of changes.
  • The new "0/psi" file was a bit of trial and error, after setting the proper boundary names for the walls.
  • "constant/transportProperties" - this took several iterations of trial and error. Bananas did not help much, but the concept of throwing stuff at it still worked
    The base idea was correct, expect for the following details:
    • "orientation" is a vector, so it doesn't use commas: (1 0 0)
    • "magnets" is a list, or perhaps better visualized as a special vector. So, instead of using "{}", one has to use "()".
    • Code:
      magnets(  (magnet1));
      This complained about missing scalar. Without the inner parenthesis, it complained about something else... which led me to believe it was meant to be a vector as well.
    In the end, this was how it should be:
    Code:
    magnets
    (
      (magnet1 0.2 5000 (0 1 0))
      (magnet2 0.4 2000 (1 0 0))
    );
    Similar, ain't it?
  • About "faceZones using topoSet" - I ran:
    Code:
    find $FOAM_TUTORIALS -name "topo*"
    And found several tutorials with examples. I'm vaguely familiar with the tutorials that exist, so I took the simplest one: "heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/topoSetDict".
    Upon examining it, I found out that it had the basic blocks that I needed, namely:
    Code:
            type    faceSet;
            action  new;
            source  boxToFace;
    Copied the file to my case and pruned out what I didn't need. A few more iterations of trial and error and found out how to properly define the bounding box and that it was "faceZoneSet", not "faceSet".
  • "system/fvSchemes": the solver complained about a missing entry at "laplacianSchemes". All I had to do was replace the one already there with the one it asked for, leaving the "Gauss linear corrected" untouched.
    Also, commented out "div(phi,T)".
  • "system/fvSolution": missing "psi" entry. Replaced "T" with "psi".
    Complained about the solution "solver", giving possible entries, so I used "PCG" since it's also one of the basic ones.
    Also complained about the "preconditioner", so I used "DIC".
    Left the rest untouched.
  • After these basics were complete, I had magneticFoam running. Keep in mind that at each iteration/trial, I ran magneticFoam for know what was missing.
  • The fields "murf" and "Mrf" have pre-set values when created, as shown in "createFields.H". I'll leave it to you to do some more trial and error.
If you have more questions, feel free to ask!


Best regards,
Bruno
MichaelXPS is offline   Reply With Quote

Old   June 5, 2020, 01:29
Default Working examples of magneticFoam
  #42
New Member
 
Cody
Join Date: Feb 2020
Location: Montana, USA
Posts: 3
Rep Power: 6
cjessup37 is on a distinguished road
Hello,

Here are examples are made that work.

Attached is a tarball of all my working cases of magneticFoam. The images are B and H fields of the cylindrical magnet case and the case with two magnets oriented opposite of each other. I manipulated the examples in this thread to get everything to work. I put README's in each case explaining the commands to input as well as the properties of the magnets. I would read the 'magnetic_cylinder' README first since the other cases are simple adjustments to that one.

One thing that confused me before was that in these cases you DO NOT need to define the geometry of the magnet in blockMesh. You need to do that in topoSet as bklose said in post #34. I spent way too much time trying to define my geometry in blockMesh and failed. I didn't read bklose's post carefully.

Another thing, the properties of the magnets, as defined in 'transportProperties', go as <name of magnet> <relative permeability> <magnetization> <orientation>.

Question: does anyone know how to implement saturation? I want to model a simple case of a permanent magnet next to a ferromagnetic material and simulate the ferromagnetic material reach saturation. Thank you!
Attached Images
File Type: png b_field_cylinder.png (188.5 KB, 65 views)
File Type: png h_field_cylinder.png (189.7 KB, 47 views)
File Type: png b_field_two_magnets_opposite.png (188.4 KB, 63 views)
File Type: png h_field_two_magnets_opposite.png (188.7 KB, 52 views)
Attached Files
File Type: gz working_cases.tar.gz (5.6 KB, 47 views)
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 16:42
what is the magneticFoam for in the OpenFOAM 2.0.0 goodkid OpenFOAM 4 December 24, 2011 08:25


All times are GMT -4. The time now is 05:33.