Exemple #1
0
bool CNSVariable::SetPrimVar_Compressible(double eddy_visc, double turb_ke, CFluidModel *FluidModel) {
	unsigned short iVar;
  bool check_dens = false, check_press = false, check_sos = false, check_temp = false, RightVol = true;
  
  
  SetVelocity();   // Computes velocity and velocity^2
  double density = GetDensity();
  double staticEnergy = GetEnergy()-0.5*Velocity2 - turb_ke;

  /* check will be moved inside fluid model plus error description strings*/
  FluidModel->SetTDState_rhoe(density, staticEnergy);

  check_dens = SetDensity();
  check_press = SetPressure(FluidModel->GetPressure());
  check_sos = SetSoundSpeed(FluidModel->GetSoundSpeed2());
  check_temp = SetTemperature(FluidModel->GetTemperature());
  
  /*--- Check that the solution has a physical meaning ---*/
  
  if (check_dens || check_press || check_sos || check_temp) {
    
    /*--- Copy the old solution ---*/
    
    for (iVar = 0; iVar < nVar; iVar++)
      Solution[iVar] = Solution_Old[iVar];
    
    /*--- Recompute the primitive variables ---*/
    
    SetVelocity();   // Computes velocity and velocity^2
	double density = GetDensity();
	double staticEnergy = GetEnergy()-0.5*Velocity2 - turb_ke;
	/* check will be moved inside fluid model plus error description strings*/
	FluidModel->SetTDState_rhoe(density, staticEnergy);

	check_dens = SetDensity();
	check_press = SetPressure(FluidModel->GetPressure());
	check_sos = SetSoundSpeed(FluidModel->GetSoundSpeed2());
	check_temp = SetTemperature(FluidModel->GetTemperature());
    
    RightVol = false;
    
  }
  
  /*--- Set enthalpy ---*/
  
	SetEnthalpy();                                  // Requires pressure computation.
  
  /*--- Set laminar viscosity ---*/
  
	SetLaminarViscosity(FluidModel->GetLaminarViscosity(FluidModel->GetTemperature(), GetDensity()));
  
  /*--- Set eddy viscosity ---*/
  
  SetEddyViscosity(eddy_visc);
  
  return RightVol;
  
}
Exemple #2
0
bool CNSVariable::SetPrimVar_Compressible(double eddy_visc, double turb_ke, CConfig *config) {
	unsigned short iVar;
  bool check_dens = false, check_press = false, check_sos = false, check_temp = false, RightVol = true;
  
  double Gas_Constant = config->GetGas_ConstantND();
	double Gamma = config->GetGamma();
  
  SetVelocity();                                  // Computes velocity and velocity^2
  check_dens = SetDensity();                      // Check the density
	check_press = SetPressure(Gamma, turb_ke);      // Requires velocity2 computation.
	check_sos = SetSoundSpeed(Gamma);               // Requires pressure computation.
	check_temp = SetTemperature(Gas_Constant);      // Requires pressure computation.
  
  /*--- Check that the solution has a physical meaning ---*/
  
  if (check_dens || check_press || check_sos || check_temp) {
    
    /*--- Copy the old solution ---*/
    
    for (iVar = 0; iVar < nVar; iVar++)
      Solution[iVar] = Solution_Old[iVar];
    
    /*--- Recompute the primitive variables ---*/
    
    SetVelocity();
    check_dens = SetDensity();
    check_press = SetPressure(Gamma, turb_ke);
    check_sos = SetSoundSpeed(Gamma);
    check_temp = SetTemperature(Gas_Constant);
    
    RightVol = false;
    
  }
  
  /*--- Set enthalpy ---*/
  
	SetEnthalpy();                                  // Requires pressure computation.
  
  /*--- Set laminar viscosity ---*/
  
	SetLaminarViscosity(config);                    // Requires temperature computation.
  
  /*--- Set eddy viscosity ---*/
  
  SetEddyViscosity(eddy_visc);
  
  return RightVol;
  
}
void OpenSMOKE_Flame1D_OpposedFlameManager::SetupFromFile(OpenSMOKE_Flame1D *_flame, OpenSMOKE_Flame1D_DataManager *_data)
{
	flame = _flame;
	data  = _data;

    std::string  string_value;
	vector<string> string_vector;
	vector<double> double_vector;

	OpenSMOKE_Dictionary_Flame1D_OpposedFlameManager dictionary;
    dictionary.ParseFile(data->opposedFlameAnalysisFileName);

	if (dictionary.Return("#FuelVelocity", string_vector))
        SetFuelVelocity(string_vector);

	if (dictionary.Return("#FuelTemperature", string_vector))
        SetFuelTemperature(string_vector);

	if (dictionary.Return("#OxidizerVelocity", string_vector))
        SetOxidizerVelocity(string_vector);

	if (dictionary.Return("#OxidizerTemperature", string_vector))
        SetOxidizerTemperature(string_vector);

	if (dictionary.Return("#Pressure", string_vector))
        SetPressure(string_vector);

	Lock();

	openOutputFileAndControl(fOpposedFlameManager, flame->nameFolderAdditionalData + "/OpposedFlameManager.out");
	openOutputFileAndControl(fLog, flame->nameFolderAdditionalData + "/OpposedFlameManager.log");
	fOpposedFlameManager.setf(ios::scientific);
	fLog.setf(ios::scientific);

	fOpposedFlameManager << setw(16) << left << "#Index(1)" 
						 << setw(16) << left << "VF[cm/s](2)" 
						 << setw(16) << left << "VO[cm/s](3)" 
						 << setw(16) << left << "TF[K](4)" 
						 << setw(16) << left << "TO[K](5)" 
						 << setw(16) << left << "X[1/s](6)" 
						 << setw(16) << left << "TFlame[K](7)" 
						 << setw(16) << left << "X(P.F.)[1/s](8)" 
						 << endl << endl;
}
Exemple #4
0
void CMfxEvent::setToDefaults()
{
	SetTime( 0 );
	SetPort( 0 );
	SetChannel( 0 );

	switch (GetType())
	{
		case Note:
			SetKey( 60 );
			SetVel( 64 );
			SetDur( 120 );
			break;

		case KeyAft:
			SetKey( 60 );
			SetPressure( 0 );
			break;

		case Control:
			SetCtrlNum( CTL_MODULATION );
			SetCtrlVal( 0 );
			break;

		case Patch:
			SetBankSelectMethod( Normal );
			SetBank( BANK_NONE );
			SetPatch( 0 );
			break;

		case ChanAft:
			SetPressure( 0 );
			break;

		case Wheel:
			SetWheel( 0 );
			break;

		case RPN:
		case NRPN:
			SetCtrlNum( 0 );
			SetCtrlVal( 0 );
			break;

		case Sysx:
		case Text:
		case Lyric:
			m_hBuffer = NULL;
			break;

		case MuteMask:
			m_mfxChannel = 0;
			m_maskSet = 0;
			m_maskClear = 0;
			break;

		case VelOfs:
		case KeyOfs:
			m_mfxChannel = 0;
			m_nOfs = 0;
			break;

		case VelTrim:
		case KeyTrim:
			m_mfxChannel = 0;
			m_nTrim = 0;
			break;

		case ShortMsg:
			m_dwShortMsg = 0;
			break;
			
		default:
			ASSERT(FALSE);
			break;
	}
}
Exemple #5
0
KVHarpeeIC::KVHarpeeIC(UInt_t number, Float_t pressure, Float_t temp, Float_t thick) : KVVAMOSDetector(number, "C4H10")
{
   // Make the ionisation chamber of Harpee composed by:
   // - one 1.5 mylar window;
   // - 3 volumes of C4H10 with thicknesses (2*dz): 2.068 cm, thick, 1.278 cm.
   //   By default thick=10.457 cm;
   //   Only the 2nd gaz volume is "active".
   //
   // The width (2*dx) of this detector is ??? and the height (2*dy) is ???.
   // The ionisation chamber is closed with the silicon wall in Harpee.
   //
   // Input: pressure - pressure of the gaz in mbar
   //        temp     - temperature of the gaz in degrees celsius.
   //                   Default temperature = 19°C
   //        thick    - the thickness in cm of the 2nd volume of gaz.
   Warning("KVHarpeeIC", "Check if the width, the height and the thickness are correct in this constructor");

   init();
   SetType("CHI");
   SetLabel("CHI");
   SetName(GetArrayName());

   // number of absorber
   Int_t Nabs = 4;

   // material of each absorber
   const Char_t* mat[] = {"Myl", "C4H10", "C4H10", "C4H10"};

   // thickness of each absorber
   Float_t th[] = {
      static_cast<Float_t>(1.5 * KVUnits::um),
      static_cast<Float_t>(2.068 * KVUnits::cm),
      static_cast<Float_t>(thick * KVUnits::cm),
      static_cast<Float_t>(1.278 * KVUnits::cm)
   };

   // active absorber flag
   Bool_t  active[] = { kFALSE, kFALSE, kTRUE, kFALSE};

   // width and height of the detector. TO BE VERIFIED
   Float_t w = 40 * KVUnits::cm;
   Float_t h = 12 * KVUnits::cm;

   // total thickness of the detector
   Float_t wtot = 0;
   for (Int_t i = 0; i < Nabs; i++) wtot += th[i];

   // pressure and temperature of the detector
   SetPressure(pressure * KVUnits::mbar);
   SetTemperature(temp);

   // Adding the absorbers
   TGeoShape* shape = NULL;
   for (Int_t i = 0; i < Nabs; i++) {

      Double_t dx = w / 2;
      Double_t dy = h / 2;
      Double_t dz = th[i] / 2;

      fTotThick += th[i];

      // box shape of the absorber
      shape  = new TGeoBBox(dx, dy, dz);

      // build and position absorber in mother volume.
      // Reference is the center of absorber
      Double_t ztrans = dz - wtot / 2;
      for (Int_t j = 0; j < Nabs - 1; j++) ztrans += (j < i) * th[j];
      TGeoTranslation* tr = new TGeoTranslation(0., 0., ztrans);
      AddAbsorber(mat[i], shape, tr, active[i]);
   }
}