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

Divergence in AMG solver after adding in mass source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2017, 14:55
Default Divergence in AMG solver after adding in mass source
  #1
New Member
 
Join Date: Oct 2017
Posts: 4
Rep Power: 9
say2017 is on a distinguished road
Hello,

I am trying to simulate a heat pipe and have managed to compile the code with no errors. However, as soon I load in one of the source terms, I get an error that says "Divergence detected in AMG solver: x-momentum". I have tried changing the URFs and reducing the time step but I still get this error. I have included the code for the mass source, which is the only source term I am currently loading, below. Any help will be appreciated! Thank you.

DEFINE_SOURCE(mass_source,c,t,dS,i)
{
face_t f;
Thread *tf;
int n;
int nn;
real S = 0;

/* loop over all faces of cell */
c_face_loop(c,t,n){
/* find face and thread */
f = C_FACE(c,t,n);
tf = C_FACE_THREAD(c,t,n);

for(nn=0;nn<N_WICK_VAPOR_INTERFACE; ++nn){
if ((THREAD_ID(tf)==t_wall_wick_id[nn])||(THREAD_ID(tf)==t_wall_vapor_id[nn])){
if (THREAD_ID(tf)==t_wall_wick_id[nn]){
S += F_UDMI(f,tf,MVAR)/C_VOLUME(c,t);
}
else{
S -= F_UDMI(f,tf,MVAR)/C_VOLUME(c,t);
}
}
}
}
return S;
}
say2017 is offline   Reply With Quote

Old   October 28, 2017, 23:26
Default
  #2
New Member
 
Join Date: Jun 2016
Posts: 6
Rep Power: 10
ahmed425 is on a distinguished road
I'm not expert in UDFs but I always see that the arguments of any source function ends with a variable called eqn and at the end before the return statements there is a command like: dS[eqn]=0;

this might be one reason

the other thing that I can think of is you can initialize your model and solve for a number of iterations without the source then you can add the source and see what happens.

good luck
ahmed425 is offline   Reply With Quote

Old   October 29, 2017, 07:36
Default
  #3
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18
Micael is on a distinguished road
For verification, return zero value and put "S" in a UDM instead so you can visualise it and assess it is right.

Otherwise, ahmed425's idea to do few iterations before including the UDF is worth trying. Sometime source term at very first iteration can cause problem.
Micael is offline   Reply With Quote

Old   October 29, 2017, 11:53
Default
  #4
New Member
 
Join Date: Oct 2017
Posts: 4
Rep Power: 9
say2017 is on a distinguished road
Thank you ahmed and micael. I have tried running it without the UDF at first and implementing it later but it still didn't work. However, I did finally manage to solve my problem. If anyone else has the same issue, try using the coupled solver especially if you have a transient simulation.
say2017 is offline   Reply With Quote

Reply

Tags
amg divergence


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
Population Balance Modeling (PBM) - Ansys Fluent chittipo FLUENT 164 November 18, 2023 12:54
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 04:04
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 11:57
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08


All times are GMT -4. The time now is 09:11.