Ignore:
Timestamp:
Apr 6, 2009, 12:30:29 PM (15 years ago)
Author:
garnier
Message:

update processes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/de_excitation/multifragmentation/src/G4StatMFMacroMultiplicity.cc

    r819 r962  
    2525//
    2626//
    27 // $Id: G4StatMFMacroMultiplicity.cc,v 1.5 2006/06/29 20:25:10 gunter Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4StatMFMacroMultiplicity.cc,v 1.7 2008/11/19 14:33:31 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// Hadronic Process: Nuclear De-excitations
    3131// by V. Lara
    32 
     32//
     33// Modified:
     34// 25.07.08 I.Pshenichnov (in collaboration with Alexander Botvina and Igor
     35//          Mishustin (FIAS, Frankfurt, INR, Moscow and Kurchatov Institute,
     36//          Moscow, pshenich@fias.uni-frankfurt.de) additional checks in
     37//          solver of equation for the chemical potential
    3338
    3439#include "G4StatMFMacroMultiplicity.hh"
     
    8792    G4double fChemPb = this->operator()(ChemPb);
    8893   
     94
     95    // Set the precision level for locating the root.
     96    // If the root is inside this interval, then it's done!
     97    G4double intervalWidth = 1.e-4;
     98
    8999    // bracketing the solution
    90100    G4int iterations = 0;
    91     while (fChemPa*fChemPb > 0.0 && iterations < 10)
     101    while (fChemPa*fChemPb > 0.0 && iterations < 100)
    92102    {
    93103        if (std::abs(fChemPa) <= std::abs(fChemPb))
     
    95105            ChemPa += 0.6*(ChemPa-ChemPb);
    96106            fChemPa = this->operator()(ChemPa);
     107            iterations++;
    97108        }
    98109        else
     
    100111            ChemPb += 0.6*(ChemPb-ChemPa);
    101112            fChemPb = this->operator()(ChemPb);
     113            iterations++;
    102114        }
    103115    }
    104     if (fChemPa*fChemPb > 0.0)
     116
     117    if (fChemPa*fChemPb > 0.0) // the bracketing failed, complain
    105118    {
     119      G4cerr <<"G4StatMFMacroMultiplicity:"<<" ChemPa="<<ChemPa<<" ChemPb="<<ChemPb<< G4endl;
     120      G4cerr <<"G4StatMFMacroMultiplicity:"<<" fChemPa="<<fChemPa<<" fChemPb="<<fChemPb<< G4endl;
    106121        throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroMultiplicity::CalcChemicalPotentialMu: I couldn't bracket the root.");
    107122    }
    108        
    109        
    110     G4Solver<G4StatMFMacroMultiplicity> * theSolver = new G4Solver<G4StatMFMacroMultiplicity>(100,1.e-4);
     123    else if (fChemPa*fChemPb < 0.0 && std::abs(ChemPa-ChemPb) > intervalWidth) // the bracketing was OK, try to locate the root
     124    {   
     125    G4Solver<G4StatMFMacroMultiplicity> * theSolver = new G4Solver<G4StatMFMacroMultiplicity>(100,intervalWidth);
    111126    theSolver->SetIntervalLimits(ChemPa,ChemPb);
    112127    //    if (!theSolver->Crenshaw(*this))
    113128    if (!theSolver->Brent(*this))
    114129    {
     130      G4cerr <<"G4StatMFMacroMultiplicity:"<<" ChemPa="<<ChemPa<<" ChemPb="<<ChemPb<< G4endl;
     131      G4cerr <<"G4StatMFMacroMultiplicity:"<<" fChemPa="<<fChemPa<<" fChemPb="<<fChemPb<< G4endl;
    115132        throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroMultiplicity::CalcChemicalPotentialMu: I couldn't find the root.");
    116133    }
    117134    _ChemPotentialMu = theSolver->GetRoot();
    118135    delete theSolver;
     136    }
     137    else // the root is within the interval, which is shorter then the precision level - all done
     138    {
     139     _ChemPotentialMu = ChemPa;
     140    }
     141
    119142    return _ChemPotentialMu;
    120143}
Note: See TracChangeset for help on using the changeset viewer.