CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   magnetostaticFoam / how to set correct boundary conditions for every cell..? (https://www.cfd-online.com/Forums/openfoam-programming-development/156968-magnetostaticfoam-how-set-correct-boundary-conditions-every-cell.html)

riddim July 16, 2015 09:23

magnetostaticFoam / how to set correct boundary conditions for every cell..?
 
Hey there,

I'm trying to use a solver for magnetostatic fields (with areas of different permeability) … I thought that shouldn't be a problem for openFoam and started very enthusiastic
… I did quite some reading lately … but am a little bit frustrated right now ;) …

… i ran some tutorials, programmed the rodfoam-solver (http://www.tfd.chalmers.se/~hani/kurser/OS_CFD – works perfectly) and then programmed this (http://webfiles.portal.chalmers.se/e...heHuangMSc.pdf) solver that should have been perfect for my purposes.
First I was a little bit irritated I wasn't able to find it ready-to-use in the openfoam-package … but now I'm pretty sure it is because it simply doesn't work properly …

At first it seems like an easy task to set up a magnetostatic solver … just
Code:

solve ( 1.0/(muMag*muR)*fvm::laplacian(A)==-J;
should do the job … but with different muR's the tangential component of the B-Field is not continuous (just like the normal component of the H-Field). This is not addressed by this simple equation …

In my mind at least these boundary conditions (on every cell face) have to be implemented … (the mhdFoam-solver doesn't use a magnetic vector potential and ignores these boundary conditions in the same way the other solvers do … i already looked how it was done there)

How can I get access to „neighbour-variables“ within a solver …?
I found
http://www.cfd-online.com/Forums/ope...vsf1-vsf2.html
but am not sure if it really is what I need and if i can use these commands in any solver or if I would have to change the source of OpenFoam itself …
and to be honest … I have some problems with the solver algorithms …

why is the output of
Code:

solve ( fvm::laplacian(viR,A)==-J*muMag );
different to
Code:

 
 solve ( fvm::laplacian(A)==-J*muMag/viR );

…? it shouldn't be … should it ..?
This has something to do with local variable values of different cells …?

I'm a little bit lost … and I don't really see where to start right now … I would like to set somewhere the relations
B_tan2 = B_tan1*muR_2/muR_1 and B_normal == const.
And then have my div(B) == 0 and rot(H)=J solved :-O …

Could you please help me to get started with this task ..? I'm looking forward for hints how to get this solver running!

Saleh Abuhanieh July 14, 2019 11:25

magnetostatic in openfoam
 
Hi,


I wonder if anybody figure out how to solve a magnetostatic model using openfoam.




Regards,


Saleh


All times are GMT -4. The time now is 14:34.