- **CFX**
(*http://www.cfd-online.com/Forums/cfx/*)

- - **discuss user subroutine in CFX
**
(*http://www.cfd-online.com/Forums/cfx/19840-discuss-user-subroutine-cfx.html*)

discuss user subroutine in CFX
Hello everyone,
Could anybody explain how to implement user subroutine in CFX please? I am going to use¡¡Fortran subroutines in CFX4.4, but what is about CFX5.5? I am simulating the flow in a duct, which need to add electrical and magnetic effects as user subroutine to implemented in CFX. Firstly the Lorentz force as a momentum source need to be added. In addition to this force, the scalar electrical potential and relative electrical boundary conditions must be added. But I can¡¯t know how to arrange them. Could you tell me some your experiences about it? Any help greatly appreciated. I am looking forward to hear the kindly help soon. Thank you in advance. Anicorl |

Re: discuss user subroutine in CFX
Hi, I am also doing soemthing on MHD with CFX5.5.1. I know how to add Lorentz force item to the N-S equation without using subroutine. But it's hard for the CFX to converge to obtain a good result!
Now I also want to use Subroutine to achieve it, but it seems that it's difficult. Maybe we can discuss it together. Miko |

Re: discuss user subroutine in CFX
Contact Mr. Bartsch from CFX Berlin. I think he can help you on this topic.
Pascale |

Re: discuss user subroutine in CFX
Hi Anicorl,
You can probably do this using the cel in CFX5. Then you don't need fortran at all. Glenn |

Re: discuss user subroutine in CFX
Hi, Miko,
Lorentz force dependent to not only the flow velocity but also the electrical potential is rather complicated. Moreover, the electrical boundary conditions need be considered. So it is necessary to use subroutine to achieve it. Lorentz force can be added as a source item to the momentum equation in CFX with using subroutine. The diffusion transport equation of electrical current can be derived as the temperature equation, and the electrical boundary conditions maybe be added to the equation to solve it. But I cannot confirm whether the original codes of CFX need to be rewritten. To this idea, what should you do? By the way, can you confirm these subroutines about electrical and magnetic problem can be added in CFX5.5? I look forwards to discuss it together. Anicorl |

Re: discuss user subroutine in CFX
Hi Anicorl!
You are right. But in my case, I needn't consider the electrical effect, for the external magnetic field is the only factor which influences the behaviour of the duct flow in MHD issues. I think you can achieve it stey by stey--that is, firstly consider Lorentz force, then electrical force. In CFX5.5.1, besides subroutine, we can use ccl to add Lorentz force to the N-S equation. In CFX4.4, subroutine is the only way to achieve so. I have asked local CFX office, they said that it's quite different between CFX4 and CFX5 in subroutine, and it's a common problem for CFX5.5 not to converge when we use ccl to add Lorentz force to the euqation. However, I think CFX can deal with such probelms, for I saw some CFX articles published online concerned duct flow, and the result is good. You can email to me directly at this mail box, and I also look forwards to discussing with me on this issue. Best regards! Miko |

Re: discuss user subroutine in CFX
Hi Miko,
You should contact your CFX support rep for help. Work has been done specifically for MHD which they may be able to supply you with. On another note, if your momentum source term is non-linear, you will likely have convergence problems. To help convergence, include a momentum source linearization (in Pre, right under the momentum source boxes) equal to first derivative of your momentum source wrt speed. If the source term is different in all three directions, use the largest value for the linearization. Regards, Robin |

All times are GMT -4. The time now is 19:45. |