CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   magneticFoam (https://www.cfd-online.com/Forums/openfoam-solving/95146-magneticfoam.html)

MichaelXPS March 31, 2020 05:34

transportproperty & topoSet wrong setting?
 
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 (Post 336913)
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 :D
  • 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


cjessup37 June 5, 2020 01:29

Working examples of magneticFoam
 
5 Attachment(s)
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!


All times are GMT -4. The time now is 10:11.