求助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		scalar-0
    
    	1		1.000000e+00
    	2		1.145484e-05
    	3		8.608675e-07
    	4		2.028824e-07
    	5		2.753174e-08
    	6		5.988739e-09
    	7		9.756630e-10
    	8		2.840014e-10
    	9		5.402100e-11
    	10		1.498808e-11
    
    Hybrid initialization is done.
    
    Creating new file G:\.\mass_frac_z=0-rfile_1_1.out
    Creating new file G:\.\mass_frac_z=-40-rfile_1_1.out
    Creating new file G:\.\mass_frac_z=5-rfile_1_1.out
    
      iter  continuity  u-solution   u-crystal  v-solution   v-crystal  w-solution   w-crystal   energy-p1   energy-p2           k     epsilon  paracetamo  water-solu  bf-0-cryst  bf-1-cryst  bf-2-cryst  bf-3-cryst  bf-4-cryst  bf-5-cryst  bf-6-cryst  bf-7-cryst  bf-8-cryst  bf-9-cryst  bf-10-crys  bf-11-crys  bf-12-crys  bf-13-crys  bf-14-crys  vf-crystal     time/iter
     temperature limited to 1.000000e+00 in 1345882 cells on zone 8407 in domain 2
          1  1.0000e+00  6.0854e-04  0.0000e+00  6.0847e-04  0.0000e+00  9.3036e-04  0.0000e+00  8.2651e-03  0.0000e+00  7.5450e-02  1.6778e-01  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 solution-species-0 to enhance linear solver robustness.
            Stabilizing solution-species-0 using GMRES to enhance linear solver robustness.
    
    Divergence detected in AMG solver: solution-species-0        Stabilizing solution-species-1 to enhance linear solver robustness.
            Stabilizing solution-species-1 using GMRES to enhance linear solver robustness.
    
    Divergence detected in AMG solver: solution-species-1 temperature limited to 1.000000e+00 in 273407 cells on zone 8407 in domain 2
             Stabilizing vof-1 to enhance linear solver robustness.
            Stabilizing vof-1 using GMRES to enhance linear solver robustness.
    
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    Divergence detected in AMG solver: pressure coupled
    Divergence detected in AMG solver: solution-species-0
    Divergence detected in AMG solver: solution-species-1
    Divergence detected in AMG solver: vof-1
    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.280e-5; /* growth rate constant */
    	real g = 1.947;/* primary nucleation law power index */
    	real x;/* the antisolvent proportion in kg-antisolvent/kg-antisolvent and solvent */
    	real y;/* the solubility in kg-solute/kg-antisolvent and solvent */
    	real C;/* the solute concentration in kg-solute/kg-solvent */
    	real Solubility;/* the solubility in kg-solute/kg-solvent */
    	real delta_C;/* the difference between the solute concentration and the solubility, kg-solute/kg-solvent */
    	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_frac-solvent_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 kg-antisolvent/kg-antisolvent and solvent */
    	y = -2.63748*pow(x,4)+9.04654*pow(x,3)-10.86277*pow(x,2)+5.04399*x-0.57920;/* the solubility in kg-solute/kg-antisolvent and solvent */
    	Solubility = y*(1.+(antisolvent_mass_frac /solvent_mass_frac));/* the solubility in kg-solute/kg-solvent */
    	C = solute_mass_frac/solvent_mass_frac;/* the solute concentration in kg-solute/kg-solvent */
    	delta_C = C-Solubility; /* Definition of Supersaturation */
    
    	if (delta_C == 0.)
    	{
    		G = 0.;
    	}
    	else
    	{
    		G = Kg*pow(delta_C,g);
    	}
    	return G;
    }
    


  • 你的是并行计算挂载有问题,串行计算没有问题吗?



  • 看提示信息说的是浮点数溢出,没遇到过这种错误,期待UDF大佬现身说法:chouchou:



  • 你检查一下UDF里的参数



  • @关伯兰在笑 逐行排查吧,所有分母都添加一个很小的量。


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2