CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

orientationi & Sf[facei] - magneticFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 2, 2012, 09:35
Default orientationi & Sf[facei] - magneticFoam
  #1
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 5
latvietis is on a distinguished road
Greetings!

I have spent a lot of time in doing all kinds of manipulations with magneticFoam and finally I have almost come to the end. There is only one totally unclear line for me in createFields.H

Code:
const surfaceVectorField& Sf = mesh.Sf();

Mrf[facei] = Mri*(orientationi & Sf[facei]);
I guess my problem is more about C language not about magnetic field physics.

My questions:
What should I get out when these lines are compiled? I get surfaceScalarField in output, but shouldn't there be VectorField? What the first line defines, where information about this mesh.Sf will be taken from?

Mri is a constant, what should happen when I multiply a constant with those parameters in brackets? Also, there is orientation (that is some kind of vector) and then there is '&' symbol. Does it mean Mri is multiplied with orientationi and Sf[facei] in the same time?

Yours sincerely,
Martin
latvietis is offline   Reply With Quote

Old   April 2, 2012, 10:05
Default
  #2
Member
 
Björn Windén
Join Date: Feb 2012
Location: University of Southampton UK
Posts: 37
Rep Power: 5
winden is on a distinguished road
Hi Martin.

It is correct that you get a scalar if orientationi is a vector. the "&" means inner product, (vector & vector) gives a scalar inside the brackets which are then multiplied using scalar multiplication (*) with another scalar Mri.

As for Sf. The first line defines a new vectorfield Sf which is given the values of the face area normals of the mesh.

//Björn
winden is offline   Reply With Quote

Old   April 2, 2012, 13:30
Default
  #3
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 5
latvietis is on a distinguished road
Thank you so much. It actually finally starts to make sense. Sad my C skills aren't so good yet to understand this by myself.

About face area - so I have defined all faces in a volume. That means if normals are taken and my mesh consists of tetrahedrons then from one cell I get 4 faces and every face would have its normal in different direction?

What should (and is that even possible?) I change so that output stays the same surfaceScalarField when I multiply orientation with something else? I mean, I want to use my tetrahedrons as volume elements, but now it seems their face normal orientation is the problem.

Martin
latvietis is offline   Reply With Quote

Old   April 3, 2012, 12:07
Default
  #4
Member
 
Björn Windén
Join Date: Feb 2012
Location: University of Southampton UK
Posts: 37
Rep Power: 5
winden is on a distinguished road
Hi.

Not sure what the problem with the face normals is. If you post the expression you are trying to replicate, maybe we can figure out how to write it.

//Björn
winden is offline   Reply With Quote

Old   April 3, 2012, 19:24
Default
  #5
Member
 
Martin
Join Date: Dec 2011
Location: Latvia
Posts: 54
Rep Power: 5
latvietis is on a distinguished road
I'll try to explain as best I can.

At first here is full source code: http://foam.sourceforge.net/docs/cpp/a03265_source.html

As I understand then this solver is capable of solving a magnetic field only if there are defined faces of magnet, it doesn't take in calculation the volume of magnet (because of usage of faces/surfaceFields). Still I somehow managed to include a volume of a bar magnet using topoSet. From what you said I guess I included all faces in this volume.

I added picture how my bar looks like. Its volume is filled with tetrahedrons. When solver defines your mentioned Sf field, as I can understand, it then takes every face inside this volume and draws a normal from it. And here comes the problem.

The mentioned constant Mrf is now multiplied with this normal. It is a small number, lets say it is 0.6 for some iron alloys (more info http://hyperphysics.phy-astr.gsu.edu...s/magperm.html).

So using transportPropoerties I define these constants. Permeability (the first constant of material) is read almost correctly, but when it comes to Mrf (remanence)... uhh. For example, I put Mrf as 0.6, but if I check if solver has kept this value (by using Mrf.write command), then it hasn't. Below I little copy-paste from file (that is what is written as Mrf in magnet):

PHP Code:
-9.1199e-14
1.9816e-13
2.94547e-13
-1.79337e-12
1.92839e-14 
So I find this wrong because of surface normals that are in different directions (and I believe also different length) in volume.

My question then - is there a possible workaround? I need to see the magnetic field inside this magnet bar so I need to define properties of a material in all volume.

Oh, and there is another important thing. The calculations are done by using scalar potential - psi. I define it on the boundaries (magnet poles), for example 100 and -100. After the calculations are done, these values become higher, for example 130 and -120. Shouldn't this defined 'maximum' stay? What could be the cause of rising of psi value.

I hope I explained my problem.

Sincerely,
Martin
Attached Images
File Type: jpg Screenshot at 2012-04-04 01:51:33.jpg (53.9 KB, 15 views)
latvietis is offline   Reply With Quote

Old   April 4, 2012, 05:18
Default
  #6
Member
 
Björn Windén
Join Date: Feb 2012
Location: University of Southampton UK
Posts: 37
Rep Power: 5
winden is on a distinguished road
Hi.

Code:
Mrf[facei] = Mri*(orientationi & Sf[facei]);
This sets the value of Mrf only on the faces included in the faceZone as found by

Code:
label magnetZonei = mesh.faceZones().findZoneID(magnets[i].name());
And not every face in the mesh.

As for the values of Mrf: don't you mean that you put Mri to 0.6, this seems to be read from somewhere and then Mrf is calculated based on that value, the orientation and area of each face and the orientation of the magnet. I'm sorry I can't really help you with any magnet-related problems since I don't know anything about it.

//Björn
winden is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
magneticFoam latvietis OpenFOAM 33 August 28, 2014 08:51
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 09:25


All times are GMT -4. The time now is 22:21.