# Source terms for Lorentz force

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 31, 2015, 03:48 Source terms for Lorentz force #1 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 How to include the Lorentz force equation in Fluent during Melting and solidification. the equations for x,y and z coordinates are as follows, Fx = -((mu * I^2) / (4*3.14^2 * reff^2 * r)) * (exp (-r^2 / (2*reff^2))) * (1-(exp (-r^2 / (2*reff^2)))) * (1-(z/t)^2) * (x/r) Fy = -((mu * I^2) / (4*3.14^2 * reff^2 * r)) * (exp (-r^2 / (2*reff^2))) * (1-(exp (-r^2 / (2*reff^2)))) * (1-(z/t)^2) * (y/r) Fz = -((mu*I^2)/(4*3.14*3.14*r^2*c)) * ((1-(exp (-r^2 / (2*reff^2))))^2) * (1-(z/t)) where, mu, I, c are constants. Kindly help to add this equations in Fluent without MHD module.

 November 2, 2015, 16:31 #2 Senior Member   Join Date: Mar 2015 Posts: 800 Rep Power: 11 Have you tried adding these forces as source terms using the DEFINE_SOURCE macro?

 November 3, 2015, 00:52 #3 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 dear e, i have trouble with prepare the UDF using this equation. can you show some udf using this equation ?

 November 3, 2015, 04:03 #4 Senior Member   Join Date: Mar 2015 Posts: 800 Rep Power: 11 There are detailed examples in the UDF manual, which part are you stuck on? The constants can be retrieved with macros, for example C_MU_L(c,t) returns the laminar viscosity of the local cell.

 November 3, 2015, 04:14 #5 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 the thing is i need to include the electromagnetic force in the model without MHD module. so from the reference the lorentz force equations are obtained. now i need to give this equations as momentum source. so is it possible to enter these equations directly using DEFINE_SOURCE or is there any other procedure i should follow ? the final out put will be the electromagnetic force into the model.

 November 3, 2015, 04:43 #6 Senior Member   Join Date: Mar 2015 Posts: 800 Rep Power: 11 Have a read of the "Momentum Conservation Equations" section in the theory guide, you'll find that the last term on the right hand side is the model-dependent source term. Use the DEFINE_SOURCE macro for setting this source term in the relevant equations.

 November 3, 2015, 05:01 #7 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 whether the following UDF is the correct way of representation? #include "udf.h" #define mu 1.26*(10e-6) #define I 160 #define reff 0.008 #define r 0.005 /*-------------------------------------------------------- Momentum source term in x ----------------------------------------------------------*/ DEFINE_SOURCE(xmom_source,c,t,dS,eqn) { float x[ND_ND], source; face_t f; F_CENTROID (x,f,t); source =-((mu*I*I)/(4*3.14*3.14*reff*reff*r)) * (exp (-r*r / (2*reff*reff))) * (1-(exp (-r*r / (2*reff*reff)))) * pow((1-(x[1]/t),2) * (x[0]/r); dS[eqn] = 0; return source; } /*-------------------------------------------------------- Momentum source term in y ----------------------------------------------------------*/ DEFINE_SOURCE(ymom_source,c,t,dS,eqn) { float x[ND_ND], source; face_t f; F_CENTROID (x,f,t); source = -((mu*I*I)/(4*3.14*3.14*reff*reff*r)) * (exp (-r*r / (2*reff*reff))) * (1-(exp (-r*r / (2*reff*reff)))) * pow((1-(x[1]/t),2) * (x[1]/r); dS[eqn] = 0; return source; } __________________ -- K.C.Ganesh Research Scholar NIT Trichy India

 November 3, 2015, 15:20 #8 Senior Member   Join Date: Mar 2015 Posts: 800 Rep Power: 11 Yes, that's the general approach. Are you getting similar results to the MHD module? Try a simple case to start with to validate your code. Is your viscosity 12.6e-6 or 1.26e-6? It'd be clearer to have the single value instead of multiplying by 10e-6.

 November 12, 2015, 03:18 #9 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 i have prepared the UDF of Lorentz for as source term for 3D. while compiling in fluent uing define / userdefine function / interpreted, option, am getting the following error: line 14: invalid type for binary expression: float / pointer to structure. what does this error mean and how to overcome this ? the UDF is given as follows, #include "udf.h" #define mu 0.00000126 #define I 160 #define reff 0.008 #define r 0.005 /*-------------------------------------------------------- Momentum source term in x ----------------------------------------------------------*/ DEFINE_SOURCE(xmom_source,c,t,dS,eqn) { float x[ND_ND], source; face_t f; F_CENTROID (x,f,t); source =-((mu*I*I)/(4*3.14*3.14*reff*reff*r)) * (exp (-r*r / (2*reff*reff))) * (1-(exp (-r*r / (2*reff*reff)))) * pow((1-(x[1]/t),2) * (x[0]/r); dS[eqn] = 0; return source; } /*-------------------------------------------------------- Momentum source term in y ----------------------------------------------------------*/ DEFINE_SOURCE(ymom_source,c,t,dS,eqn) { float x[ND_ND], source; face_t f; F_CENTROID (x,f,t); source =-((mu*I*I)/(4*3.14*3.14*reff*reff*r)) * (exp (-r*r / (2*reff*reff))) * (1-(exp (-r*r / (2*reff*reff)))) * pow((1-(x[1]/t),2) * (x[1]/r); dS[eqn] = 0; return source; } /*-------------------------------------------------------- Momentum source term in z ----------------------------------------------------------*/ DEFINE_SOURCE(zmom_source,c,t,dS,eqn) { float x[ND_ND], source; face_t f; F_CENTROID (x,f,t); source = -((mu*I*I)/(4*3.14*3.14*r*r)) * pow((1-(exp (-r*r / (2*reff*reff)))),2) * (1-(x[2]/t)); dS[eqn] = 0; return source; } __________________ -- K.C.Ganesh Research Scholar NIT Trichy India

 November 12, 2015, 04:57 #10 Senior Member   Join Date: Mar 2015 Posts: 800 Rep Power: 11 Line 14 corresponds to "F_CENTROID (x,f,t);". It's possible this face centroid data is only available for UDFs that are compiled. It's probably good practice to compile all UDFs because some macros require compilation. The UDF manual also notes that this macro is only available for the pressure-based solver.

 November 13, 2015, 02:11 #11 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 dear sir, i am using pressure based solver solver for the 'melting and solidification' model. should it be compiled using external c-compiler? but i could successfully use 'DEFINE_PROFILE' macro in UDF that consists of F_CENTROID. fluent could interpret that UDF. the following UDF is working without Lorentz force equations, #include "udf.h" DEFINE_PROFILE(Gauss,t,i) { real x[ND_ND], c[ND_ND]; face_t f; real r; r = 0.005; begin_f_loop(f, t) { F_CENTROID (x,f,t); F_PROFILE (f,t,i) = (3*(100*10*0.7/0.001) / (3.14*pow(r,2))) * exp (-3*(x[0]*x[0])/ pow(r,2)); } end_f_loop(f,t) } how can i include the lorentz force equations in the UDF now? __________________ -- K.C.Ganesh Research Scholar NIT Trichy India

 November 19, 2015, 01:06 #12 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 i still have same problem. can any one help me out in this ? __________________ -- K.C.Ganesh Research Scholar NIT Trichy India

 January 20, 2016, 10:26 #13 New Member   Ganesh K C Join Date: Oct 2014 Location: Tiruchirappalli, India Posts: 29 Rep Power: 4 how to compile a UDF and bring into fluent ? i need to bring the previously mentioned equations to the model __________________ -- K.C.Ganesh Research Scholar NIT Trichy India

 January 20, 2016, 17:00 #14 Senior Member   Join Date: Mar 2015 Posts: 800 Rep Power: 11 You'll need a compiler to compile the UDFs for Fluent. In Windows you could use Microsoft Visual Studio Express for Desktop (ensure the compiler is compatible with the Fluent version). There are a few comments in the FAQ on this website to get you started.

 Tags fluent - udf, lorentz force, welding

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post ofslcm OpenFOAM Pre-Processing 25 March 6, 2017 11:03 gschaider OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 134 December 5, 2015 04:30 GGerber OpenFOAM Installation 54 April 24, 2015 16:02 Jetfire OpenFOAM Running, Solving & CFD 107 December 9, 2014 14:38 Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18

All times are GMT -4. The time now is 00:31.