|
[Sponsors] |
UDF: trying to implement a Kinetic Equation source term |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 23, 2013, 02:57 |
|
#21 |
Senior Member
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17 |
Yes possible, but why do you require to use adjust macro. You can directly store some variable into memory in unsteady macro itself.
|
|
May 23, 2013, 03:19 |
|
#22 |
Member
Shashank
Join Date: Apr 2011
Posts: 74
Rep Power: 15 |
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? |
|
May 23, 2013, 08:55 |
|
#23 |
Senior Member
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17 |
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 |
|
May 23, 2013, 13:55 |
|
#24 |
Member
Shashank
Join Date: Apr 2011
Posts: 74
Rep Power: 15 |
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?
|
|
June 15, 2015, 16:22 |
|
#25 |
New Member
Subham Mishra
Join Date: Jun 2015
Posts: 2
Rep Power: 0 |
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 |
|
June 22, 2015, 08:31 |
|
#26 |
Senior Member
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17 |
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 |
|
June 26, 2015, 15:49 |
udf to incorporate body force in mhd module
|
#27 |
New Member
Subham Mishra
Join Date: Jun 2015
Posts: 2
Rep Power: 0 |
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.. |
|
June 29, 2015, 01:06 |
|
#28 |
Senior Member
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17 |
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] |
|
June 29, 2015, 01:08 |
|
#29 |
Senior Member
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17 |
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]
|
|
March 6, 2017, 19:22 |
|
#30 |
New Member
Zakaria AOUCHETTE
Join Date: Feb 2017
Posts: 2
Rep Power: 0 |
hi, i'm working with the same case, i have trouble with creating UDF, please how to create it?
|
|
March 7, 2017, 11:53 |
|
#31 |
Member
Rosario Arnau
Join Date: Feb 2017
Location: Spain
Posts: 57
Rep Power: 9 |
||
March 7, 2017, 11:58 |
|
#32 | |
Member
Rosario Arnau
Join Date: Feb 2017
Location: Spain
Posts: 57
Rep Power: 9 |
Quote:
I want to now why do you mix here UDS and UDM. Is it to save in memory the value of the UDS?? Still not familiar with the difference between UDS and UDM.... DEFINE_SOURCE(uds_source,c,t,ds,eqn) { blablablah C_UDMI(c,t,2)=rate; |
||
April 20, 2017, 11:55 |
Solved
|
#33 |
Member
Rosario Arnau
Join Date: Feb 2017
Location: Spain
Posts: 57
Rep Power: 9 |
||
March 21, 2019, 05:36 |
problem regarding coupling
|
#34 |
Member
Join Date: Oct 2017
Posts: 52
Rep Power: 9 |
HII ALL,
I have been trying to simulate heat transfer problem from liquid to solid. i have successfully run the UDS transport equation for above problem but when i add an additional to the above equation it does not show coupling. can you suggest me where might be the problem?? Thanks |
|
March 22, 2019, 05:00 |
|
#35 |
Senior Member
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17 |
Hi Gourav
Please write more about your problem and share your UDF, then only one can suggest. Best wishes mvee |
|
March 22, 2019, 11:20 |
problem regarding coupling
|
#36 | |
Member
Join Date: Oct 2017
Posts: 52
Rep Power: 9 |
Quote:
Code:
#include "udf.h" #include "sg_mem.h" #include "math.h" #define solid_specific_heat 1980 /* Specific heat in J/kg.K */ #define liquid_specific_heat 1980 /* Specific heat in J/kg.K */ DEFINE_SOURCE(myfunction, c, t, dS, eqn) { real pos[ND_ND]; /* this will hold the position vector */ real y ; real x ; real lfrac ; real specific_heat ; //real h ; real r ; real source ; int zone_ID = THREAD_ID(t); begin_c_loop(c,t) { C_CENTROID(pos,c,t); x = pos[0]; y = pos[1]; r = sqrt(pow(x,2) + pow(y,2)); if(zone_ID == 4) { C_UDMI(c,t,5) = C_UDSI(c,t,0); } lfrac = C_UDMI(c,t,2); specific_heat = (lfrac*liquid_specific_heat)+((1-lfrac)*solid_specific_heat); source = -(2*(10)*(C_UDMI(c,t,5)-C_UDSI(c,t,0)))/(r*specific_heat); dS[eqn] = 0.0; } end_c_loop(c,t) return source ; } I have been solving a scalar transport equation for analyzing heat transfer in a heat exchanger and for that i need to add this additional source term to the equation for the fluid(being heated by hot fluid). Problem :"if i solve my equaiton without this term it works fine but when i add it to the equation coupling between solid and fluid interface stops occuring and i am not able to find any reason behind this problem " [EQUATION] source = 2*(h/r)*(T_fluid_interface - T_fluid_cell) [/EQUATION] |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 02:22 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 02:41 |
UDF source term | Rajani Kanth.B | Fluent UDF and Scheme Programming | 4 | May 1, 2013 10:31 |
UDF Scalar Code: HT 1 | Greg Perkins | FLUENT | 8 | October 20, 2000 13:40 |