//--------------------------------------------------------------
bool WeakEquationElectronMomentumDDM::N_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT &flux) const
{
  FIELD_MATS::const_iterator vField = fields.find(ELECTRON_VELOCITY);
  const DENS_MAT & velocity = vField->second;
  flux.reset(velocity.nRows(),velocity.nCols());
  thermal_stress(fields, grad_fields, material, flux);
  material->electric_displacement(fields, grad_fields, _electricForce_);


  FIELD_MATS::const_iterator nField = fields.find(ELECTRON_DENSITY);
  const DENS_MAT & n = nField->second;

  
  CLON_VEC tsx(flux,CLONE_COL,0);
  CLON_VEC tsy(flux,CLONE_COL,1);
  CLON_VEC tsz(flux,CLONE_COL,2);
  tsx += n.mult_by_element(_electricForce_[0]);
  tsy += n.mult_by_element(_electricForce_[1]);
  tsz += n.mult_by_element(_electricForce_[2]);
  return true;
}
void WeakEquationElectronMomentumDDM::thermal_stress(const FIELD_MATS &fields,
                                                     const GRAD_FIELD_MATS &gradFields,
                                                     const Material * material,
                                                     DENS_MAT &flux) const
{
  GRAD_FIELD_MATS::const_iterator dtField = gradFields.find(ELECTRON_TEMPERATURE);
  const DENS_MAT_VEC & DTe = dtField->second;

  CLON_VEC tsx(flux,CLONE_COL,0);
  CLON_VEC tsy(flux,CLONE_COL,1);
  CLON_VEC tsz(flux,CLONE_COL,2);

  // ith velocity component has thermal stress of
  // d_i n * Cp * Te
  DENS_MAT nCp(DTe[0].nRows(),DTe[0].nCols());  
  material->electron_heat_capacity(fields,nCp);
  nCp *= 2./3.;  // correction to capacity account for convection
  
  tsx += nCp.mult_by_element(DTe[0]);
  tsy += nCp.mult_by_element(DTe[1]);
  tsz += nCp.mult_by_element(DTe[2]);
  
  FIELD_MATS::const_iterator tField = fields.find(ELECTRON_TEMPERATURE);
  const DENS_MAT & Te = tField->second;
  
  material->D_electron_heat_capacity(fields,gradFields,_dnCp_);
  for (int i = 0; i < nsd_; i++)
    _dnCp_[i] *= 2./3.; // correction to capacity account for convection
  tsx += Te.mult_by_element(_dnCp_[0]);
  tsy += Te.mult_by_element(_dnCp_[1]);
  tsz += Te.mult_by_element(_dnCp_[2]);
}
Пример #3
0
void starbase( const char *gy="y2006c", 
	       Float_t etaMin=eta_min, 
	       Float_t etaMax=eta_max,
	       Float_t phiMin=phi_min,
	       Float_t phiMax=phi_max, 
	       const Char_t *path="./" )
{

  // Silence ROOT
//  gErrorIgnoreLevel = 9999;

  // Load shared libraries
  if (!loaded) { Load(); loaded = 1; }

  // Create the chain
  StChain *chain =  new StChain;
  TString tsy(gy);
  gSystem->ExpandPathName(tsy);

  // Create the geometry
  gROOT->LoadMacro   ( TString(path)+tsy+".h" );
  gROOT->ProcessLine ( tsy+"()" );
  // gROOT -> ProcessLine( TString( ".x "+tsy+".h" ) );

  std::cout << "Done creating geometry" << std::endl;


  // Create the baseline maker
  StarBASE *mk = new StarBASE("StarBASE",tsy.Data(), 1);

  // Setup fiducial volume
  mk->SetAttr("eta_min", etaMin);
  mk->SetAttr("eta_max", etaMax);
  mk->SetAttr("deta",    deta   );
  mk->SetAttr("phi_min", phiMin);
  mk->SetAttr("phi_max", phiMax);
  mk->SetAttr("dphi",    dphi);
  mk->SetAttr("sample",  nsample);

  // Initialize the chain
  chain->Init();
  steps = mk->steps();

  // Create histograms for all volumes beneath the "HALL" volume.
  steps->bookVolume("HALL");

  // Print out tracking media for all volumes for debug poirposes
  /*
  TIter next( gGeoManager->GetListOfMedia() );
  TGeoMedium *m;
  while ( (m=(TGeoMedium*)next() ) )
    {
      m->SavePrimitive(std::cout);
    }
  */

  // Run the code now
  chain->EventLoop(1);  /// NOTE THE FUGLY HACK TO 
  chain->Finish();

  // Write histograms to disk
  TFile *file = new TFile(Form("%s/%s.root",path,gy),"recreate");
  file->cd();
  mk->GetHistList()->Print();
      mk->GetHistList()->Write();

  // Write the geometry to disk
  gGeoManager->Write();
   
}