求助UDF并行计算的问题

各位大佬，求帮忙看一下计算出错的原因。
我模拟一个结晶的过程，在PBE模型中挂上成核与生长的UDF时，计算一开始就出现了报错，不挂UDF就可以正常计算下去。报错时控制台的提示信息如下：Initialize using the hybrid initialization method. Checking case topology... This case has both inlets & outlets Pressure information is not available at the boundaries. Case will be initialized with constant pressure iter scalar0 1 1.000000e+00 2 1.145484e05 3 8.608675e07 4 2.028824e07 5 2.753174e08 6 5.988739e09 7 9.756630e10 8 2.840014e10 9 5.402100e11 10 1.498808e11 Hybrid initialization is done. Creating new file G:\.\mass_frac_z=0rfile_1_1.out Creating new file G:\.\mass_frac_z=40rfile_1_1.out Creating new file G:\.\mass_frac_z=5rfile_1_1.out iter continuity usolution ucrystal vsolution vcrystal wsolution wcrystal energyp1 energyp2 k epsilon paracetamo watersolu bf0cryst bf1cryst bf2cryst bf3cryst bf4cryst bf5cryst bf6cryst bf7cryst bf8cryst bf9cryst bf10crys bf11crys bf12crys bf13crys bf14crys vfcrystal time/iter temperature limited to 1.000000e+00 in 1345882 cells on zone 8407 in domain 2 1 1.0000e+00 6.0854e04 0.0000e+00 6.0847e04 0.0000e+00 9.3036e04 0.0000e+00 8.2651e03 0.0000e+00 7.5450e02 1.6778e01 1.7762e+00 1.6993e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0:00:31 1 Error at Node 0: floating point exception Error at Node 1: floating point exception Error at Node 2: floating point exception Error at Node 3: floating point exception Error at Node 4: floating point exception Error at Node 5: floating point exception Error at Node 6: floating point exception Error at Node 7: floating point exception Error at Node 8: floating point exception Error at Node 9: floating point exception Error at Node 10: floating point exception Error at Node 11: floating point exception Error at Error at Node 13: floating point exception Error at Node 15: floating point exception N Error at Node 14: floating point exception ode 12: floating point exception Experiencing convergence difficulties  temporarily relaxing and trying again... Experiencing convergence difficulties  temporarily relaxing and trying again... Experiencing convergence difficulties  temporarily relaxing and trying again... Experiencing convergence difficulties  temporarily relaxing and trying again... Stabilizing pressure coupled to enhance linear solver robustness. Stabilizing pressure coupled using GMRES to enhance linear solver robustness. Experiencing convergence difficulties  temporarily relaxing and trying again... Divergence detected in AMG solver: pressure coupled Stabilizing solutionspecies0 to enhance linear solver robustness. Stabilizing solutionspecies0 using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: solutionspecies0 Stabilizing solutionspecies1 to enhance linear solver robustness. Stabilizing solutionspecies1 using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: solutionspecies1 temperature limited to 1.000000e+00 in 273407 cells on zone 8407 in domain 2 Stabilizing vof1 to enhance linear solver robustness. Stabilizing vof1 using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Divergence detected in AMG solver: pressure coupled Divergence detected in AMG solver: solutionspecies0 Divergence detected in AMG solver: solutionspecies1 Divergence detected in AMG solver: vof1 Error at host: floating point exception Error: floating point exception Error Object: #f
应该是UDF的问题，但不知道具体是什么问题。生长速率udf代码如下：
#include "sg_mphase.h" DEFINE_PB_GROWTH_RATE(growth_rate,cell,thread,d_1) { real G;/* growth rate in m/s*/ real Kg = 1.280e5; /* growth rate constant */ real g = 1.947;/* primary nucleation law power index */ real x;/* the antisolvent proportion in kgantisolvent/kgantisolvent and solvent */ real y;/* the solubility in kgsolute/kgantisolvent and solvent */ real C;/* the solute concentration in kgsolute/kgsolvent */ real Solubility;/* the solubility in kgsolute/kgsolvent */ real delta_C;/* the difference between the solute concentration and the solubility, kgsolute/kgsolvent */ real solute_mass_frac,solvent_mass_frac,antisolvent_mass_frac; Thread *tc = THREAD_SUPER_THREAD(thread); /* obtain mixture thread */ Thread **pt = THREAD_SUB_THREADS(tc); /* pointer to sub_threads */ Thread *tp = pt[P_PHASE]; /* primary phase thread */ solute_mass_frac = C_YI(cell,tp,0);/* mass fraction of solute in primary phase (solvent,antisolvent,Paracetamol) */ solvent_mass_frac = C_YI(cell,tp,2);/* mass fraction of solvent in primary phase (solvent,antisolvent,Paracetamol ) */ antisolvent_mass_frac = 1.solute_mass_fracsolvent_mass_frac;/* mass fraction of antisolvent in primary phase (solvent,antisolvent,Paracetamol) */ x = antisolvent_mass_frac/(antisolvent_mass_frac+solvent_mass_frac);/* the antisolvent proportion in kgantisolvent/kgantisolvent and solvent */ y = 2.63748*pow(x,4)+9.04654*pow(x,3)10.86277*pow(x,2)+5.04399*x0.57920;/* the solubility in kgsolute/kgantisolvent and solvent */ Solubility = y*(1.+(antisolvent_mass_frac /solvent_mass_frac));/* the solubility in kgsolute/kgsolvent */ C = solute_mass_frac/solvent_mass_frac;/* the solute concentration in kgsolute/kgsolvent */ delta_C = CSolubility; /* Definition of Supersaturation */ if (delta_C == 0.) { G = 0.; } else { G = Kg*pow(delta_C,g); } return G; }
CFD中文网 2016  2020  京ICP备15017992号2