|
[Sponsors] |
December 7, 2011, 12:07 |
magneticFoam
|
#1 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Hello, Foamers!
So, there is magneticFoam solver, but there isn't any tutorial. Is there anyone who could share one? I know I'm not the only one looking for it. Yours, latvietis |
|
December 12, 2011, 18:23 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Greetings latvietis and welcome to the forum!
You don't seem to be alone in wanting a tutorial for that solver:
edit: oops, only now did I read about you already knowing you aren't the only one looking... so it begs to ask: why didn't you ask on those threads instead? Best regards, Bruno
__________________
Last edited by wyldckat; December 12, 2011 at 18:24. Reason: see "edit:" |
|
December 13, 2011, 21:22 |
|
#3 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Well, you know, they were old and there weren't any answers.
Will check those solvers. |
|
December 16, 2011, 13:27 |
|
#4 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Ok, the problem is in the transportProperties. Before explaining I have to tell I'm total noob in OpenFOAM, I have managed to get through tutorials only. But this... Ok, so I can't find any similar tutorial (I haven't checked all yet), but how should my transportProperties file look? I don't understand what should I write there. createFields file looks like this
List<magnet> magnets(transportProperties.lookup("magnets")); surfaceScalarField murf ( IOobject ( "murf", runTime.timeName(), mesh ), mesh, 1 ); surfaceScalarField Mrf ( IOobject ( "Mrf", runTime.timeName(), mesh ), mesh, dimensionedScalar("Mr", dimensionSet(0, 1, 0, 0, 0, 1, 0), 0) ); forAll(magnets, i) { label magnetZonei = mesh.faceZones().findZoneID(magnets[i].name()); if (magnetZonei == -1) { FatalIOErrorIn(args.executable().c_str(), transportProperties) << "Cannot find faceZone for magnet " << magnets[i].name() << exit(FatalIOError); } const labelList& faces = mesh.faceZones()[magnetZonei]; const scalar muri = magnets[i].mur(); const scalar Mri = magnets[i].Mr().value(); const vector& orientationi = magnets[i].orientation(); const surfaceVectorField& Sf = mesh.Sf(); forAll(faces, i) { label facei = faces[i]; murf[facei] = muri; Mrf[facei] = Mri*(orientationi & Sf[facei]); } } |
|
December 17, 2011, 20:00 |
|
#5 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi latvietis,
OK, I'll try to give you a boost based on what I know (which might not be much). So, first thing to take into account is the description available on the top comment header of "magneticFoam.C": Quote:
To go onward, first follow this tutorial: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam Then base yourself on that tutorial and the tips I tried to give you here to continue onward! Here you'll find more helpful info: http://www.openfoamworkshop.org/6th_...m/training.htm - starting with:
Bruno
__________________
|
|||
December 20, 2011, 20:49 |
|
#6 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Ok, sir. I'm more confused than before, sorry. First things first, I did read the header and understood that. And here comes the bad part.. I didn't get your help.
First, about this "magnet" class. You gave me link that takes me to localPoints class reference. What should I find there? I'm really bad at reading short descriptions where most part is in C. How did you think something like that in code? What those numbers stand for? Why in that order? magnet1 0.2 5000 (0,0,1); Last is about temperature? How knowing how to add temperature could help in magnets? I'm really bad at seeing things, sorry. Thanks for those presentation links, interesting start. Yours sincerely, latvietis |
|
December 21, 2011, 09:34 |
|
#7 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Oh, I think I got one answer to my own question.
What I need to define is found in magnet.H magnet1 0.2 5000 (0,0,1); And then it means you defined 1) name of magnet 2) mur 3) Mr 4) orientation of magnet Right? So this should be saved it transportProperties? But then again, it means that magnet is oriented in z-axis? The fields you mentioned should be saved in "0" folder? |
|
December 21, 2011, 09:59 |
|
#8 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
I kinda tried what you said, but got this:
--> FOAM FATAL IO ERROR: Attempt to return dictionary entry as a primitive file: /run/magnets/constant/transportProperties::magnets from line 20 to line 21. From function ITstream& primitiveEntry::stream() const in file db/dictionary/dictionaryEntry/dictionaryEntry.C at line 82. FOAM aborting So what is meant with 'primitive' in magnets? |
|
December 21, 2011, 16:26 |
|
#9 | |||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi latvietis,
Quote:
Quote:
And yes, the fields I listed are meant to be placed in the 0 (zero) folder. Again, the other tutorial shows the example of having to add a new field file. Quote:
A trick that I remembered that usually works is ... the bananas trick: http://openfoamwiki.net/index.php/Op...de/Use_bananas Good luck! Bruno
__________________
|
||||
December 22, 2011, 21:26 |
|
#10 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
I guess the problem is that I have no idea how to define transportProperties.
So I see what is needed: //- Construct from components inline magnet ( const word& name, const scalar mur, const scalar Mr, const vector& orientation ) but how it must be defined? Also what is that 'orientation'? |
|
December 23, 2011, 14:30 |
|
#11 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
I would guess orientation is supposed to point from the south to the north pole for each magnet. I'm not sure bananas will work for this constructor. How do readBegin and readEnd take input?
I wanted to add that for each magnet you will need to make a faceZone that defines the physical extent of the permanent magnet. You can use setSet or topoSet, and the name of the cellZone must have the same name as the magnet in the transportProperties. Last edited by mturcios777; December 23, 2011 at 14:33. Reason: Address the question on orientation |
|
December 24, 2011, 09:20 |
|
#12 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
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 Code:
foamCleanTutorials Code:
magneticFoam -help Development details:
Best regards, Bruno
__________________
Last edited by wyldckat; April 25, 2014 at 07:26. Reason: removed "innocent" advertising... |
|
December 25, 2011, 12:09 |
|
#13 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Ok, I have a question. Is there any other ways how to tell how great this is besides adding to reputation and liking it?
But now for the good part - so, there are some results etc. But I guess I also am useless in ParaView. Any chance you could tell me how to see H and B? |
|
December 25, 2011, 12:42 |
|
#14 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi latvietis,
Quote:
And the link is already accessible from where it should be accessible, namely here: http://openfoamwiki.net/index.php/Main_OFSolvers Quote:
You will only be able to see the fields on the time snapshot "1", which is accessible on the upper right corner on the Figure 2.3: http://www.openfoam.org/docs/user/cavity.php#x5-110123 Good luck! And Merry Christmas Bruno
__________________
|
|||
December 25, 2011, 13:11 |
|
#15 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Oh, how silly, I just forgot to check volume fields in properties window. Now I can see some picks! It is time for some playing!
|
|
December 27, 2011, 14:56 |
|
#16 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
What am I defining with
1) orientation 2) topoSet To be more precise with my questions.. 1) What can I define in magnet with one vector? Something with poles? All I can think of is that for example (1 0 0) would say that my magnet is oriented in x axis with poles like this [- +]. But I don't know how scientific that could sound. What else could be called with 'orientation'? 2) In topoSet I define 2 faces for each magnet. It defines the centers of faces with given coordinates. For example (0.5 0.5 0.5) can be seen as my magnets pole center is in the middle if its 'face' is 1x1. Is that right? But why 2 faces? I believe it defines the centers of north (first) and south (second) pole. Is this the right guess? |
|
December 27, 2011, 18:24 |
|
#17 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi latvietis,
Let's see: Quote:
Although, the other possibility is the usage of the "right hand rule": http://en.wikipedia.org/wiki/File:Manoderecha.svg - where the vector indicates where the thumb is pointing to. You'll have to figure that one out from the source code and the equations at hand. I didn't focus on what psi, B and H represent, I only focused on having something that simply works, looked nice and non-random. I tried with other psi values, but things got very strange and nonsensical. Quote:
This means that if the selection box were to be extended in order to pick up more faces, all of those faces would have the same magnet specification. In other words, this way of selecting faces you could have a magnet placed in the middle of the domain, with a thickness of either:
I used two magnets simply to make sure that there was a list of magnets and that said list was being properly defined and used. Each one represents an independent magnet. Their placement was only made as an example, in an attempt to have two magnets that were either deflecting or continuing a magnetic flow that wasn't linear. From another view, if I had placed the two magnets on opposite sides of the geometry, it would be harder to see any understandable results without previously knowing how things really work... which we don't know. Oh, and don't forget that important detail I mentioned near the end of the other post: Code:
The fields "murf" and "Mrf" have pre-set values when created, as shown in "createFields.H". Best regards, Bruno
__________________
Last edited by wyldckat; December 27, 2011 at 18:36. Reason: psi, not Phi... |
|||
December 27, 2011, 20:02 |
|
#18 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
For second question I wanted to know something else. Why you define
box (0 0.999 0) (1 1.001 0.1); My explanation is the first part defines the center of Npole, second part the center of Spole. Do I understand this correctly? Good idea about right hand law, will try to figure this out. Thank you. |
|
December 27, 2011, 20:17 |
|
#19 |
Member
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 14 |
Oh, no.. It means the coordinates of opposite corners? In this way I define my 'box'? But then what is this face of magnet? Where are its poles then? Defined by orientation?
|
|
December 28, 2011, 09:06 |
|
#20 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi latvietis,
OK, I probably shouldn't have written so much, but I wasn't feeling artistic enough to do videos or drawings... and I'm still not in the mood to draw So I'll quote myself instead: Quote:
Let's take the cavity tutorial as an example once more:
Best regards, Bruno
__________________
|
||
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 |