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

Divergence detected in AMG solver:species-0

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 15, 2011, 05:22
Default Divergence detected in AMG solver:species-0
  #1
New Member
 
arul
Join Date: Sep 2010
Posts: 2
Rep Power: 0
arulmurugan is on a distinguished road
Hi all,

I am using fluent 12, I am simualting flow in duct which is separated by a membrane and need to findout the mass transfer(concentration gradiant) through the membrane. I am also using compiled UDFs which contains the macros DEFINE_ADJUST, DEFINE_SOURCE. While compling UDF i dont get any error. The UDF is below.
#include "udf.h"
#include "sg.h"
int memb_id = 10;
cell_t c0;
cell_t c1;
Thread *t0;
Thread *t1;
real A[ND_ND];
real At;
real C0_COORD[ND_ND];
real C1_COORD[ND_ND];
real del_xi;
DEFINE_ADJUST(filter_adjust, domain)
{
face_t f, f_shadow;
real x_GAS_outer;
real x_AIR_outer;
real x_GAS_inner;
real x_AIR_inner;
real P_outer = 1;
real P_inner = 1;
Thread *memb_thread;
Thread *memb_thread_shadow;
real flux_GAS , flux_AIR, tot_flux;
real MW_GAS=32, MW_AIR=29;
real Q_GAS = 0.2206, Q_AIR =0.2258;
/* find membrane thread by ID in BC panel*/
memb_thread = Lookup_Thread(domain,memb_id);
/* looping over cells faces of membrane*/
begin_f_loop (f, memb_thread)
{
/* get cell pointer for side of membrane on high pressure*/
c0 = F_C0(f,memb_thread);
/* get face thread pointer for shadow membrane surface*/
memb_thread_shadow = THREAD_SHADOW(memb_thread);
/* get face pointer for shadow membrane surface*/
f_shadow = F_SHADOW(f,memb_thread);
/* get cell pointer from shadow side of membrane*/
c1 = F_C0(f_shadow,memb_thread_shadow);
/* get cell thread pointer for side of membrane*/
t0 = F_C0_THREAD(f,memb_thread);
/* get cell thread pointer for shadow side of membrane*/
t1 =memb_thread_shadow->t0;
/* calculate molar concentration for side of membrane*/
x_GAS_outer = molefrac(C_YI(c0, t0, 0), MW_GAS, MW_AIR);
x_AIR_outer = 1.- x_GAS_outer;
/* calculate molar concentration for shadow side of membrane*/
x_GAS_inner = molefrac(C_YI(c1, t1, 0), MW_GAS, MW_AIR);
x_AIR_inner = 1.- x_GAS_inner;
/* calculate membrane face area*/
F_AREA(A, f, memb_thread);
At = NV_MAG(A);
/* calculate species mass fluxes across the membrane, Pi=P*Xi*/
flux_GAS = Q_GAS * ((x_GAS_outer*P_outer) - (x_GAS_inner*P_inner));
flux_AIR = Q_AIR * ((x_AIR_outer*P_outer) - (x_AIR_inner*P_inner));
tot_flux = tot_flux + MW_GAS*flux_GAS*At + MW_AIR*flux_AIR*At;
C_UDMI(c0, t0, 0) = - (MW_GAS*flux_GAS)*At/C_VOLUME(c0,t0);
C_UDMI(c1, t1, 0) = (MW_GAS*flux_GAS)*At/C_VOLUME(c1,t1);=0.0;
C_UDMI(c0, t0, 1) = -(MW_AIR*flux_AIR)*At/C_VOLUME(c0,t0);
C_UDMI(c1, t1, 1) = (MW_AIR*flux_AIR)*At/C_VOLUME(c1,t1);
}
end_f_loop (f, memb_thread)
}
DEFINE_SOURCE(mass_source, c, t, dS, eqn)
{
real source;
source = C_UDMI(c, t, 0) + C_UDMI(c, t, 1);
dS[eqn] = 0.0;
return source;
}
real molefrac(real sp_mass, real mol_wt_comp_1, real mol_wt_comp_2)
{
real mfract = 0;
mfract = sp_mass * (mol_wt_comp_1 + mol_wt_comp_2) / mol_wt_comp_1;
return mfract;
}
After initialization, when the run started i got " Divergence detected in AMG solver:species-0". I used F-cycle in the solver-->control.
If I removed that coloured line in that UDF means, there is no divergence. But in the outlet I get Zero mass flux. This shows there is no mass transfer through the membrane. I need some mass flux in the outlet.
Can anyone help me to rectify this problem?


Thanks
Arulmurugan

Last edited by arulmurugan; February 17, 2011 at 02:11. Reason: Missing of a file
arulmurugan is offline   Reply With Quote

Reply

Tags
hai


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Divergence detected in AMG solver siri FLUENT 8 March 12, 2018 18:08
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 12:34
Divergence detected in AMG solver: pressure correction jimmer FLUENT 2 August 7, 2010 07:47
user subroutine error CFDUSER CFX 2 December 9, 2006 07:31
user defined function cfduser CFX 0 April 29, 2006 11:58


All times are GMT -4. The time now is 16:42.