|
[Sponsors] |
Divergence in AMG solver after adding in mass source |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 25, 2017, 14:55 |
Divergence in AMG solver after adding in mass source
|
#1 |
New Member
Join Date: Oct 2017
Posts: 4
Rep Power: 9 |
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; } |
|
October 28, 2017, 23:26 |
|
#2 |
New Member
Join Date: Jun 2016
Posts: 6
Rep Power: 10 |
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 |
|
October 29, 2017, 07:36 |
|
#3 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
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. |
|
October 29, 2017, 11:53 |
|
#4 |
New Member
Join Date: Oct 2017
Posts: 4
Rep Power: 9 |
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.
|
|
Tags |
amg divergence |
|
|
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 |