Add Lorentz force to CFD simulation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Add Lorentz force to CFD simulation

Marco Passoni
Dear,

i have a molten metal bath with cilindrical shape and induction heating, from electromagnetic simulation i know the Lorentz forces field.

I would like to simulate the metal movement, is it possible to import the force field into the simulation?

Sorry for my bad simulation of the question, i am new in CFD problems, thanks in advance for understanding.

Marco  
 
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Precise Simulation
Administrator
Marco Passoni wrote
i have a molten metal bath with cilindrical shape and induction heating, from electromagnetic simulation i know the Lorentz forces field.

I would like to simulate the metal movement, is it possible to import the force field into the simulation?
This sounds like a quite difficult simulation, and if you need to account for moving boundaries, possible melting and solidification then FEATool is not really a suitable software.

That said, if you have measured data (such as your forces) you can create user defined coeffcient functions (Fx, Fy, Fz) where you would interpolate your data to the computational mesh used in the simulation. A 2D example is available in the documentation

https://www.featool.com/doc/physics#phys_coef_user
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Marco Passoni
Dear,

it looks wonderful, many thanks for the feedback.

So, i have run the tutorial Axisymmetric Fluid flow, i changed the boundry condition of inlet/velocity into  wall/no slip and i get the fluid without movement, this was ok.

After this, i try to put into Fr anf Fz fields constants or simple functions but there is no way to see movement of the fluid.

I have misunderstood your suggestions? Do i have to edit equations?

Thanks again for help.

Best regards
Marco
Equation setting
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Precise Simulation
Administrator
This would be correct, however your coefficients might not be physically meaningful to generate flow via body forces (compared to other variables). The heat exchanger and natural convection tutorials show how to use the body/volume forces for a flow physics mode

https://www.featool.com/doc/Multiphysics_00_heat_exchanger1

https://www.featool.com/doc/Multiphysics_04_natural_convection1
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Marco Passoni
Many thanks for the reply.

Thanks to the indicated tutorial i am now able to apply forces and see the resulting movement.

Now i have to find the rigth way to import my force field into the model, i should be able to do by myself, 25 years ago i used Matlab during my PhD....

Best regards
Marco

 
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Marco Passoni
In reply to this post by Precise Simulation
Dear,

i was able to use two m-functions to apply the forces along x and y direction.

To explain better, functions are myfunFX(x,y) and myfunFY(x,y) for the forces in the two directions, i test in Matlab and works correctly.

Anyway, based on the formula that i use i can have errors on FEATool simulation

For example if i use return=1 or return =x or it works, if i use return = x^2 i get the error :



Of course function on Matlab console works  
     
Please give me a feedback on where i am wrong, many thanks.
Marco
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Precise Simulation
Administrator
You need to ensure that the output has the same expected array size as the input (in your case x and y). So here I guess you would need to use elementwise .dot notation, that is "x.^2" instead of "x^2" (which computes a matrix instead of vector).

https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Marco Passoni
You are rigth, now it works, thanks for the help!!!

So, my function must work with array and not with scalar, are x and y rows or column?

In general my problem is that i can't check x and y variables on workspace.

Is there a way to check FEATool variables on workspace?

Best regards
Marco
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Precise Simulation
Administrator
Marco Passoni wrote
So, my function must work with array and not with scalar, are x and y rows or column?

In general my problem is that i can't check x and y variables on workspace.

Is there a way to check FEATool variables on workspace?
Variables you call custom functions "res = myfun(x,y,T,...)" are evaluated in the quadrature points in grid cells and are ordered as a column vector (note that myfun can be called several times in each solver step with different size inputs depending on how the evaluation is split over a number of cells). The result "res" is assumed to have the same size as the input. If you want to check in your function, you can put a breakpoint

>> dbstop myfun

https://www.mathworks.com/help/matlab/ref/dbstop.html

this will stop execution once your function is reached and you can proceed to inspect the variables (continue with dbcont/dbquit).
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Marco Passoni
Many thanks for the replies, as usual it solved the problem.

Now, I see some results that i can't explain physically. When i apply a constant force (to take into account gravity) i get a stationary velocity field in the fluid.

I have prepared an example in attachment starting from a tutorial, so that in few steps you see what i refer to.  

Once again, i kindly ask where i am wrong?

Thank you in advance
Best regards
Marco

tutorial_laminar_flow.pdf
Reply | Threaded
Open this post in threaded view
|

Re: Add Lorentz force to CFD simulation

Precise Simulation
Administrator
This seems to be a particular issue to using first order approximations (FEM Discretization) and pressure stabilization. Turning off Artificial Stabilization > Pressure Stabilization should resolve this issue, however can result in "checkerboard" pressure in the solutions. So better is probably to switch to a higher order P2P1 FEM Discretization (2nd order for velocities, 1st order for pressure, which does not need pressure stabilization).