|
[Sponsors] |
June 22, 2009, 09:23 |
UDF function diverging
|
#1 |
Member
Akour
Join Date: May 2009
Posts: 79
Rep Power: 17 |
hello all,
I am trying to implement a source term on the x and y momentum equations that equals Q (space charge) x E_i (electric field) so I have defined two User defined scalars, one for the space charge which is composed of a unsteady function, a diffusivity function and a scalar flux function. All of which I effectively took out of the udf manual so i know there are no mistakes there. The electric field UDS only has a diffusion term (diffusion of the voltage), and a source term which equals Q/epsilon...and I have tested it on its own and it works so no mistakes there. However, Every time I run these two UDSs with the momentum field on (which I need to calculate the scalar flux term in the UDS) the mass conservation residuals diverge, and so I then get a floating point error. I think the problem is with the gradient of the scalar term, i.e. the source term for x-momentum = -C_R(c,t)*C_UDSI_G(c,t,0)[0]*C_UDSI_G(c,t,1). There is no C_UDSI_RG macro as far as I am aware... please note that the field=-(gradient of the voltage). which is why I need to calculate a gradient of a user defined scalar... If anyone knows if there is a better way I can implement the user defined gradient macros I would really appreciate it... Im attaching the momentum source UDFs which I believe are the problem. 3. MOMENTUM SOURCES #include "udf.h" DEFINE_SOURCE(xmom_source,c,t,dS,eqn) { real source; source = -C_R(c,t)*C_UDSI(c,t,1)*C_UDSI_G(c,t,0)[0]; dS[eqn] = 0; return source; } DEFINE_SOURCE(ymom_source,c,t,dS,eqn) { real source; source = -C_R(c,t)*C_UDSI(c,t,1)*C_UDSI_G(c,t,0)[1]; dS[eqn] = 0; return source; } Thanks in advance AK |
|
December 23, 2013, 06:05 |
|
#2 |
Member
xingangzheng
Join Date: Jul 2009
Posts: 40
Rep Power: 17 |
Dear ak,
Do you have solved this question. I have meet the same problem as you have meet. The gradient of the scalar term! How good method you have to treat it? thank you very much! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 10:31 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 15:11 |
Error with Wmake | skabilan | OpenFOAM Installation | 3 | July 28, 2009 01:35 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |