|
[Sponsors] |
May 20, 2021, 15:40 |
Error in magneticFoam ??
|
#1 |
Member
MNM
Join Date: Aug 2017
Posts: 69
Rep Power: 8 |
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 () to produce a divergence free field. To obtain this, it uses a scalar potential () formulation and gradient of this volScalarField (which will be volVector) is then defined as strength of magnetic field () The solution of where is written in source code as Code:
solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf)) After solving the above equation, is then used to construct the H field () as Code:
fvc::reconstruct(fvc::snGrad(psi)*mesh.magSf()) Further B is also constructed in the similar fashion using 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 () for electrically insulating media, as the curl of gradient of scalar is always zero (). 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]); } Code:
Sf[facei] 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 and reconstruct . 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. |
|
Tags |
magneticfoam, permanent magnets |
|
|
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 |