CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

UDF: trying to implement a Kinetic Equation source term

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

Like Tree2Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   May 23, 2013, 01:57
Default
  #21
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 147
Rep Power: 9
mvee is on a distinguished road
Yes possible, but why do you require to use adjust macro. You can directly store some variable into memory in unsteady macro itself.
mvee is offline   Reply With Quote

Old   May 23, 2013, 02:19
Default
  #22
Member
 
Shashank
Join Date: Apr 2011
Posts: 70
Rep Power: 7
shashank312 is on a distinguished road
Thanks Mahesh. I am calculating all UDMs in the adjust macro. Just wanted to know if one of them can be directly plugged in as the explicit term of the unsteady uds term.

Also one more question: I am trying to use the implicit part of the same uds to calculate one of the other UDMs. That specific UDM is hooked as a mass source term in the "vapor" phase of a VOF model. Can this be possible? All I am aware of is that the VOF equation is calculated first (which will require the vapor phase source term) and the uds equation is calculated at the last, so the coupling cannot be done if a segregated solver is used. What's your stance?
shashank312 is offline   Reply With Quote

Old   May 23, 2013, 07:55
Default
  #23
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 147
Rep Power: 9
mvee is on a distinguished road
It is possible to store all UDM through adjust macro. Do this for few iteration and check contours it it meets your expectation.
This coupling is possible. You have to be cautious about under relaxation and type of discretization scheme.

Best wishes
Mvee
mvee is offline   Reply With Quote

Old   May 23, 2013, 12:55
Default
  #24
Member
 
Shashank
Join Date: Apr 2011
Posts: 70
Rep Power: 7
shashank312 is on a distinguished road
Speaking of coupling and under relaxation factors, I have been having x-momentum divergence while running this same code. I know that in a segregated solver, first adjust macro is run, and then Fluent calculates the x-momentum equation. Divergence at this point would indicate I am doing something wrong in the adjust macro?
shashank312 is offline   Reply With Quote

Old   June 15, 2015, 15:22
Default
  #25
New Member
 
Subham Mishra
Join Date: Jun 2015
Posts: 2
Rep Power: 0
subham is on a distinguished road
hello people!!
I am working on mhd module of fluent for the simulation of m.r. fluid in magnetic field. I am facing problem in writing the udf for the magnetic body force that can be applied to the whole fluid. Also, if i am specifying any value of flux density in mhd module, how that value will be stored in the variable used for flux density in the udf.
Please help. Thanking in advance,

Subham
subham is offline   Reply With Quote

Old   June 22, 2015, 07:31
Default
  #26
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 147
Rep Power: 9
mvee is on a distinguished road
Dear Shashank

Yes, It can be possible to use UDM values. Please keep remind that you will have only cell centered values of UDM, no face values.

Best wishes
Mvee
mvee is offline   Reply With Quote

Old   June 26, 2015, 14:49
Default udf to incorporate body force in mhd module
  #27
New Member
 
Subham Mishra
Join Date: Jun 2015
Posts: 2
Rep Power: 0
subham is on a distinguished road
I actually want to apply a magnetic field on a moving magnetic fluid. We have to couple the fluid flow and the mhd model. For this , we need to incorporate a body force which we have to give through udf. The formula is as follows:

F(x) = (m*s*B(x)*(dB(x)/dx))/U
Where F(x) is the force, m is the mass of fluid, B(x) is the magnetic field strength, U is the permeability of the free space.

As the magnetic field strength will vary at every x position, how to incorporate that in the udf and how to access the value of magnetic field in the udf?

The code which we have written is as follows:

#include "udf.h"
DEFINE_DPM_BODY_FORCE(mhd_dpm_force,p,i)
/* This file needs to be "interpreted" in FLUENT before it can be used */
{
face_t f;
Thread *t;
real b_force=0;
if(i==1)
{
b_force=0.00833*1800/(4*3.14*(10^-7)*4)*F_UDSI(f,t,1)*F_UDSI_G(f,t,1);
}
return b_force;
}


please help..
subham is offline   Reply With Quote

Old   June 29, 2015, 00:06
Default
  #28
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 147
Rep Power: 9
mvee is on a distinguished road
F_UDSI_G(f,t,1) wont work. Gradient would be used on cell centered values not face values. In order to use it use adjacent cell values.
You can incorporate following in your code. For more help on it use help manual.

c0 = F_CO(),
t0 =THREAD_T0()
C_UDSI_G(c0,t0,<index of UDS>)[0]
mvee is offline   Reply With Quote

Old   June 29, 2015, 00:08
Default
  #29
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 147
Rep Power: 9
mvee is on a distinguished road
Do you want to use dBx/dx on boundaries? if yes then only use above macro otherwise you can directly use C_UDSI_G()[0]
mvee is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 02:22
Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Installation 9 June 12, 2015 17:18
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 01:41
UDF source term Rajani Kanth.B Fluent UDF and Scheme Programming 4 May 1, 2013 09:31
UDF Scalar Code: HT 1 Greg Perkins FLUENT 8 October 20, 2000 12:40


All times are GMT -4. The time now is 21:35.