Changeset 435 in PSPA


Ignore:
Timestamp:
Nov 25, 2013, 11:11:05 AM (10 years ago)
Author:
lemeur
Message:

corrections traces (divisions par 0)

Location:
Interface_Web/trunk/pspaWT
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r434 r435  
    1414particleBeam::particleBeam()  {
    1515  P0Transport_ = 0.0;
     16  clear();
    1617  particleRepresentationOk_ = false;
    1718  momentRepresentationOk_ = false;
     
    233234
    234235  double gref = referenceParticle_.getGamma() - 1.0;
    235   double P_reference_MeV_sur_c = sqrt( gref*(gref+2) );
     236
     237  double P_reference_MeV_sur_c =  gref*(gref+2);
     238
     239  if ( P_reference_MeV_sur_c > 0.0 ) P_reference_MeV_sur_c = sqrt( P_reference_MeV_sur_c );
     240  else P_reference_MeV_sur_c = 0.0;
    236241
    237242  cout << " gref = " << gref << " P_reference_MeV_sur_c = " << P_reference_MeV_sur_c << endl;
     
    266271    begamz = begam.getComponent(2);
    267272    g = gamma -1.0;
    268     PMeVsc = sqrt( g*(g+2) );
    269     del = 100.0 * ( PMeVsc -  P_reference_MeV_sur_c ) / P_reference_MeV_sur_c ; // en %
     273    PMeVsc =  g*(g+2);
     274    if ( PMeVsc > 0.)  PMeVsc = sqrt( PMeVsc );
     275    else PMeVsc = 0.0;
     276
     277
     278
    270279
    271280    //    dz = begamz * cdt / gamma;
     
    274283
    275284    part[0] = positionDeployee.getComponent(0);
    276     part[1] = begam.getComponent(0)/begamz;
    277285    part[2] = positionDeployee.getComponent(1);
    278     part[3] = begam.getComponent(1)/begamz;
    279286    part[4] = positionDeployee.getComponent(2);
    280     part[5] = del;
     287
     288    if ( begamz == 0.0 ) {
     289      part[1] = 0.0;
     290      part[3] = 0.0;
     291    } else {
     292      part[1] = begam.getComponent(0)/begamz;
     293      part[3] = begam.getComponent(1)/begamz;
     294    }
     295
     296    if ( P_reference_MeV_sur_c > 0.0 ) {
     297      del = 100.0 * ( PMeVsc -  P_reference_MeV_sur_c ) / P_reference_MeV_sur_c ; // en %
     298      part[5] = del;
     299    } else {
     300      if ( PMeVsc > 0.0 ) part[5] = 100.;
     301      else part[5] = 0.0;
     302    }
    281303
    282304    for ( j = 0; j < 6; j++) {
     
    285307        {
    286308          auxm = part.at(m) - centroid_.at(m);
    287 
    288309          ( matrice.at(j) ).at(m) += auxj*auxm;
    289           //      ( rij_transportMoments_.at(j) ).at(m) += auxj*auxm;
    290 
    291 
    292           //          cout << " j= " << j << " m= " << m << " rjm= " << ( rij_transportMoments_.at(j) ).at(m) << endl;
    293310        }
    294311    }
     
    299316  double facmoy = 1.0/double( relativePartic_.size() );
    300317  for ( j = 0; j < 6; j++) {
    301         ( matrice.at(j) ).at(j) = sqrt(( matrice.at(j) ).at(j) * facmoy );
     318    double aux = ( matrice.at(j) ).at(j);
     319    if ( aux > 0.0 ) ( matrice.at(j) ).at(j) = sqrt(aux * facmoy );
     320    else ( matrice.at(j) ).at(j) = 0.0;
    302321  }
    303322
     
    306325    for (m=0; m < j; m++) {
    307326      auxm = ( matrice.at(m) ).at(m);
    308       (  matrice.at(j) ).at(m) *= facmoy/(auxj * auxm);
    309     }
     327      if ( auxm != 0.0 && auxj != 0.0  ) ( matrice.at(j) ).at(m) *= facmoy/(auxj * auxm);
     328      else ( matrice.at(j) ).at(m) = 0.0;
     329    }     
    310330  }
    311331   
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r434 r435  
    2727#include <Wt/WMessageBox>
    2828
    29 #define HAS_IMAGEMAGIC 1
     29//#define HAS_IMAGEMAGIC 1
    3030
    3131using namespace Wt::Chart;
  • Interface_Web/trunk/pspaWT/workingArea/pspa.save

    r304 r435  
    11 globals
    222998.65 1 100000 10
     3 lattice
     4CIRCULAR 0 0 0
    35rfgun
    46rfgun01
Note: See TracChangeset for help on using the changeset viewer.