Boundary condition set using groovyBC or codedFixedValue
Hi dear foamers,
I want to solve equation and obtain B (magnetic flux density) that is defined like . actually the maxwell equations are rewritten based on vector potential that in 2D becomes and https://www.cfdonline.com/Forums/vb...61005c231.gif. my reference paper is "Level set method for twophase incompressible flows under magnetic fields" http://www.sciencedirect.com/science...10465510000226 . I've implemented the equation in my base solver. Now i want to test functionality of the new solver but i have some boundary condition problem before testing. For example if i want to get in boundaries i need to set and . is this condition my right boundary condition? correct me if I'm wrong. How can i implement this BCs? am i had to code new BC? Thanks in advance, 
Dear Nicolas any guidance is appreciated.

Dear Behzad,
it seems that fixedNormalSlip will fit your requirements: you will have tangential gradient component zero and the normal one equal to unity. Please check Doxygen for more description at https://cpp.openfoam.org/v5/classFoa...d.html#details An example: Code:

Quote:
Thanks for your adequate reply. in your example I see fixedValue as vector but is a scalarField. I used this type and got error complaining that fixedNormalSlip is unknown. but when I use with same solver for vectorField like U it works. Any suggestion? 
It's okay. I appreciate your effort to help me. waiting for your guidances dear Alexander.
Kind regards 
In 3D then 2D
Hi behzadcfd,
I would you to clarify, the 3D equation you want to solve. Is it: Then deduce field from using So to solve finite volume vector field the field you need boundary condition on it. Your boundary condition should be set on the tensor at the boundary, guessing with the value on you gave: ??? I'm I correct ? Sadly i don't have access to the paper you mentioned to verify for my self. It seam mote like you wish So in the case you did the hole work of using 3D quantity you have to fix at the boundary. 2D Now If my assumption are correct and if you are only interested in the component of field this is a fix gradient boundary condition on where at the BC provided you did not implemented but the scalar field to solve only the "2D magnetic equation". Then is a 3D vector with component "z" always equal to zero. But is a scalar and the boundary condition you set is I hope this help. But I'm not quit certain to understand your question properly. I would need more clarification on the boundary you wish to set and access to the article in order to be of more help. 
4 Attachment(s)
Quote:
It appears that i couldn't explain the problem well. I took some screen shots from equations section of paper. maybe it'll help to clarify the problem. the last picture is magnetic field lines. I would like to get uniform magnetic filed like that. Regards, Behzad 
Quote:
One thing that can cause problem with this way of doing is that there is no reference value for so this make the simulation less stable and can cause difficulty. In this regard you can set one of the BC (that is suppose to be homogeneous) to fix value 0 (in this case left or right). 
Quote:
As far as i know there is not any boundary condition to calculate scalar gradient in vector form and give the tangential part. All of gradient BCs calculate patch normal gradient. am i correct? 
Take a look at the tutorial:
surfaceTracking/bubbleInterTrackFoam/bubble2D_r0.75mm/ Code:
0/U:38: gradient uniform (0 0 0); So for U (velocity) it is which is a vector !! And for p (pressure) it is which is a scalar !! Mosley meaning that you can setup the entry BC for Code:
gradient uniform 1; Code:
fixedValue; Code:
gradient uniform 0; Hope this is clear now. You'd be kind to provide a picture of the result. Now if you want to create your own BC and use to setup you can. Use the mathematical relation we discussed to set up the correct BC. But if I'd be you I'd do it in 3D from the start and apply it to once you write the 3D version of the solver. (Just an opinion) 
Quote:
I know what do you mean. but won't give us . Let us test this condition for bottom boundary where we want to impose B = (0, 1, 0): (1) (2) (1),(2)> For this reason I believe we should have tangential gradient value = 1 to get desired B field. 
No wrong boundary. You can send me your case if you want... Just think of the distribution (or the map) you want on to have . There is a 90 degree rotation between and . You want
you do this with So BC are : On On I'm not sure I understand your confusion. Do you wish to use ?? If you really want to use to set up you would have to solve for For the time being you can simply think of the map you need to have the value you want. With the BC I suggest, you have what you want. If you think about it on 2 side of the box you have a normal gradient and on the other 2 boundary you have a variation tangent to the boundary !!! Like you wish just not by imposing it on the same boundary ! You could setup a "tangent" BC by fixing value on the boundary by building your own BC. But this seam to me like looking for trouble. If you really want to do this I suggest you start testing and compiling your BC before asking how to do it. You can find tutorial and documentation ... 
Quote:
Best regards 
Quote:

3 Attachment(s)
Hi Nicolas,
Sorry about the delay. I had some issues with my solver. I was about to send the results. BTW here you are. First picture: ksi boundary condition: Code:
bottom Code:
bottom Code:
bottom If i finished I'll report the results here. Kind Regards, Behzad 
Try this and show me the result please. Has this is the boundary condition I was trying to describe to you. Obviously it seam I was not clear enough. This boundary condition will give you a uniform of magnitude 1 and directed towards the outlet. Understanding that outlet is the top boundary condition. Finally according to your equation it should give you an horizontal magnetic field. If you do not get it there is something wrong
Code:
bottom Code:
bottom As an end remark your result seam to be coherent with the profile. If you plot the value of field and think of the implication of the equation you describe you'll understand what I mean. Regards 
Quote:
The problem solved and i got the uniform magnetic field by setting side walls as fixedGradient and top and bottom zeroGradiendt. As you mentioned there is a 90 degree transformation in equations and i should have rotated BCs 90 degree to achieve desired field. Kind regards, Behzad 
All times are GMT 4. The time now is 03:58. 