Show
Ignore:
Timestamp:
12/05/06 18:14:43 (2 years ago)
Author:
gary
Message:

dayslow_master.pl - use icl rather than gcc for slow test suite
ion_solver.cpp - undo bug introduced in rev 622. now looks at matrix elements to see if singular
rt_stark.cpp - resolved ambiguous overload
blr_n09_p18_Z20.in - add punch convergence error command
limit_hi_ion.in - renamed func_hi_ion.in to this since it tests code in high ionization limit

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/ion_solver.cpp

    r652 r685  
    4545        int lgNegPop; 
    4646        static int lgMustMalloc=TRUE; 
    47         static double *sink, *source; 
     47        static double *sink, *source , *sourcesave; 
    4848        int32 nerror; 
    4949        static int32 *ipiv; 
     
    221221                        BadMalloc(); 
    222222                if( (source=(double*)MALLOC( (sizeof(double)*(unsigned)ncell ))) == NULL ) 
     223                        BadMalloc(); 
     224                if( (sourcesave=(double*)MALLOC( (sizeof(double)*(unsigned)ncell ))) == NULL ) 
    223225                        BadMalloc(); 
    224226                if( (ipiv=(int32*)MALLOC( (sizeof(int32)*(unsigned)ncell ))) == NULL ) 
     
    514516                        MAT( xmatsave, i, j ) = MAT( xmat, i, j ); 
    515517                } 
     518                sourcesave[i] = source[i]; 
    516519        } 
    517520 
     
    523526        * will not be removed, a possible source of error, but they must not 
    524527        * have been significant, given that the molecular fraction is so small */ 
     528        if( !lgHomogeneous && ion_range==2 ) 
     529        { 
     530                /* solve algebraically */ 
     531                double a = MAT( xmatsave, 0, 0 ),  
     532                        b = MAT( xmatsave, 1, 0 ) , 
     533                        c = MAT( xmatsave, 0, 1 ) , 
     534                        d = MAT( xmatsave, 1, 1 ); 
     535                b = SDIV(b); 
     536                d = SDIV(d); 
     537                double ratio1 = a/b , ratio2 = c/d , fratio1=fabs(a/b),fratio2=fabs(c/d); 
     538                if( fabs(ratio1-ratio2)/MAX2(fratio1,fratio2) <DBL_EPSILON*1e4 ) 
     539                { 
     540                        abund_total = SDIV( dense.gas_phase[nelem] -  dense.xMolecules[nelem] ); 
     541                        lgHomogeneous = TRUE; 
     542                } 
     543        } 
     544#       if 0 
    525545        if( nelem==ipHYDROGEN &&  
    526546                fabs(dense.xMolecules[nelem]) / SDIV(dense.gas_phase[ipHYDROGEN]) <DBL_EPSILON*100. ) 
    527547        { 
     548                abund_total = SDIV( dense.gas_phase[nelem] -  dense.xMolecules[nelem] ); 
    528549                lgHomogeneous = TRUE; 
    529550        } 
     551#       endif 
    530552 
    531553        /* this is true if no source terms  
     
    566588        } 
    567589 
     590        for( i=0; i< ion_range; ++i ) 
     591        { 
     592                for( j=0; j< ion_range; ++j ) 
     593                { 
     594                        MAT( xmatsave, i, j ) = MAT( xmat, i, j ); 
     595                } 
     596                sourcesave[i] = source[i]; 
     597        } 
     598 
    568599        if ( FALSE && nelem == ipHYDROGEN && dynamics.lgAdvection&& iteration>1 )  
    569600        { 
     
    728759                enum {DEBUG_LOC=FALSE}; 
    729760                /*@+redef@*/ 
    730                 if( DEBUG_LOC && (nzone >380 ) && nelem == ipHYDROGEN ) 
    731                 { 
    732                         fprintf(ioQQQ,"debuggg\t%.2f\t%.4e\t%.4e\tIon\t%.3e\tRec\t%.3e\n",  
     761                if( DEBUG_LOC && nelem == ipHYDROGEN ) 
     762                { 
     763                        fprintf(ioQQQ,"debuggg ion_solver1 \t%.2f\t%.4e\t%.4e\tIon\t%.3e\tRec\t%.3e\n",  
    733764                                fnzone, 
    734765                                phycon.te,