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

Error in magneticFoam ??

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   May 20, 2021, 15:40
Default Error in magneticFoam ??
  #1
Member
 
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 8
SHUBHAM9595 is on a distinguished road
Dear Foamers,

After going through the code for magneticFoam, and several other threads in the forum I manage to understand a bit of its working (I might be completely wrong as well).


As per the source code, the magneticFoam solves the Gauss's law for magnetism (\nabla. B) to produce a divergence free field. To obtain this, it uses a scalar potential (\Psi) formulation and gradient of this volScalarField (which will be volVector) is then defined as strength of magnetic field (H)


The solution of \nabla. B where B = \mu_{0}\mu_{r}(H + M) is written in source code as
Code:
solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf))
here murf is the relative permeability of magnet face, and Mrf is the magnetic remanance/residual magnetisation of magnet face.


After solving the above equation, \Psi is then used to construct the H field (H = \nabla \Psi) as
Code:
fvc::reconstruct(fvc::snGrad(psi)*mesh.magSf())

Further B is also constructed in the similar fashion using B = \mu_{0}\mu_{r}(H + M)
Code:
constant::electromagnetic::mu0*fvc::reconstruct(murf*fvc::snGrad(psi)*mesh.magSf() + murf*Mrf)

Now, the reason to go for the scalar potential formulation rather than vector one might be because scalar potential formulation automatically satisfies the Ampere's law (\nabla \times H = 0) for electrically insulating media, as the curl of gradient of scalar is always zero (\nabla \times \nabla \Psi = 0).

Now, here comes the interesting part, the geometry of magnets is defined using faceSet in toposet and then all the faces are assigned the same values of relative permeability (murf) and remanance (Mrf). This is achieved with the following line in createFields.H
Code:
forAll(faces, i)
        {
            label facei = faces[i];
            murf[facei] = muri;
            Mrf[facei] = Mri*(orientationi & Sf[facei]);
        }
The dimensions of remanance (Mr/Mri) in magnet.H are in Ampere per meter whereas the surfaceScalarField Mrf/Mrfi is defined with dimensions Ampere*meter. Orientation is a dimensionless vector which defines the alignment of magnet and
Code:
Sf[facei]
is the surface vector which provides area and normal of the face.

This means the magnitude of surface area of every cell face is multiplied with Mr to define the Mrf , which is then further used to calculate \Psi and reconstruct H. So, as the grid becomes finer the corresponding value of surface vector reduces and so does the Mrf. This makes the magnetic field distribution grid dependent

This strange behaviour can be easily observed by just increasing the mesh from 100*100*100 to 200*200*200 in the magnetic_rectangular case of
magneticFoam


It'll be really helpful if someone can confirm/contradict this and make the source code more clear for all of us.
SHUBHAM9595 is offline   Reply With Quote

 

Tags
magneticfoam, permanent magnets


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
magneticFoam latvietis OpenFOAM Running, Solving & CFD 41 June 5, 2020 01:29
Magnetic Field Calculation in 3D : using magneticFoam stealth OpenFOAM 2 October 7, 2012 06:15
Magnetic Field Calculation in 3D : using magneticFoam stealth OpenFOAM Running, Solving & CFD 0 August 15, 2012 11:33
orientationi & Sf[facei] - magneticFoam latvietis OpenFOAM 5 April 4, 2012 05:18
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 07:24.