/* **************************************************************** */ void SoundSpeed2 (double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid) /*! * Define the square of the sound speed. * * \param [in] v 1D array of primitive quantities * \param [out] cs2 1D array containing the square of the sound speed * \param [in] h 1D array of enthalpy values * \param [in] beg initial index of computation * \param [in] end final index of computation * \param [in] pos an integer specifying the spatial position * inside the cell (only for spatially-dependent EOS) * \param [in] grid pointer to Grid structure * * \return This function has no return value. *********************************************************************** */ { int i; double a2, theta; Enthalpy (v, h, beg, end); for (i = beg; i <= end; i++) { theta = v[i][PRS]/v[i][RHO]; #if EOS == IDEAL a2 = g_gamma*theta/h[i]; #elif EOS == TAUB a2 = theta/(3.0*h[i]) * (5.0*h[i] - 8.0*theta)/(h[i] - theta); #endif cs2[i] = a2; } }
/* ********************************************************************* */ void SoundSpeed2 (double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid) /*! * Define the square of the sound speed. * * \param [in] v 1D array of primitive quantities * \param [out] cs2 1D array containing the square of the sound speed * \param [in] h 1D array of enthalpy values * \param [in] beg initial index of computation * \param [in] end final index of computation * \param [in] pos an integer specifying the spatial position * inside the cell (only for spatially-dependent EOS) * \param [in] grid pointer to an array of Grid structures * * \return This function has no return value. *********************************************************************** */ { int i; double theta; #if PHYSICS == RHD || PHYSICS == RMHD Enthalpy(v, h, beg, end); for (i = beg; i <= end; i++) { theta = v[i][PRS]/v[i][RHO]; #if EOS == IDEAL cs2[i] = g_gamma*theta/h[i]; #elif EOS == TAUB cs2[i] = theta/(3.0*h[i])*(5.0*h[i] - 8.0*theta)/(h[i] - theta); #endif } #else print ("! SoundSpeed2: Taub EOS not defined for this physics module.\n"); QUIT_PLUTO(1); #endif }
void OpenSMOKE_GasStream::lock() { if (assignedKineticScheme == false) ErrorMessage("The kinetic scheme was not defined!!"); if (assignedMassFlowRate == false && assignedMoleFlowRate == false && assignedVolumetricFlowRate == false) { // ErrorMessage("The flow rate was not defined!!"); AssignMassFlowRate(1.e-10, "kg/s"); iUndefinedFlowRate = true; } if (assignedMoleFractions == false && assignedMassFractions == false) ErrorMessage("The composition was not defined!!"); Composition(); if (assignedTemperature == true && assignedPressure == true && assignedDensity == true) ErrorMessage("Only 2 between: T || P || rho"); if (assignedTemperature == true && assignedPressure == true) { /* Nothing to do */ } else if (assignedDensity == true && assignedPressure == true) { T = P*MW/Constants::R_J_kmol/rho; } else if (assignedDensity == true && assignedTemperature == true) { P = rho*Constants::R_J_kmol*T/MW; } else ErrorMessage("2 between must be assigned: T || P || rho"); Concentrations(); Density(); FlowRates(); SpecificEnthalpies(); Enthalpy(); SpecificEntropies(); Entropy(); }
EXPORT void fprint_raw_gas_data( FILE *file, Locstate state, int dim) { (void) fprintf(file,"state 0x%p\n",(POINTER)state); if (state == NULL) { (void) printf("NULL state\n"); return; } (void) fprintf(file,"\tState Data "); (void) fprintf(file,"\n"); switch (state_type(state)) { case GAS_STATE: g_fprint_raw_state(file,state,dim); break; case EGAS_STATE: g_fprint_raw_Estate(file,state,dim); break; case TGAS_STATE: g_fprint_raw_Tstate(file,state,dim); break; case FGAS_STATE: g_fprint_raw_Fstate(file,state,dim); break; case OBSTACLE_STATE: (void) fprintf(file,"Obstacle state type, " "printing as GAS_STATE\n"); g_fprint_raw_state(file,state,dim); break; case VGAS_STATE: g_fprint_raw_Tstate(file,state,dim); (void) printf("Specific internal energy = %"FFMT"\n",Int_en(state)); (void) printf("Entropy = %"FFMT"\n",Entropy(state)); (void) printf("Sound_speed = %"FFMT"\n",sound_speed(state)); #if defined(VERBOSE_GAS_PLUS) (void) printf("Enthalpy = %"FFMT"\n",Enthalpy(state)); (void) printf("Temperature = %"FFMT"\n",Temp(state)); #endif /* defined(VERBOSE_GAS_PLUS) */ break; case UNKNOWN_STATE: (void) fprintf(file,"Unknown state type, printing as GAS_STATE\n"); g_fprint_raw_state(file,state,dim); break; default: screen("ERROR in fprint_raw_gas_data(), " "unknown state type %d\n",state_type(state)); clean_up(ERROR); } } /*end fprint_raw_gas_data*/
void OpenSMOKE_GasStream::ChangePressure(const double _value, const std::string _units) { if (_value<=0.) ErrorMessage("The pressure must be greater than zero!"); P = OpenSMOKE_Conversions::conversion_pressure(_value, _units); Concentrations(); Density(); FlowRates(); Enthalpy(); }
void OpenSMOKE_GasStream::ChangeMoleFractions(BzzVector &_values) { AssignMoleFractions(_values); Composition(); Concentrations(); Density(); FlowRates(); SpecificEnthalpies(); Enthalpy(); SpecificEntropies(); Entropy(); }
void OpenSMOKE_GasStream::ChangeVolumetricFlowRate(const double _value, const std::string _units) { if (_value<=0.) ErrorMessage("The volumetric flow rate must be greater than zero!"); volumetricFlowRate = OpenSMOKE_Conversions::conversion_volumetricFlowRate(_value, _units); assignedVolumetricFlowRate = true; assignedMassFlowRate = false; assignedMoleFlowRate = false; FlowRates(); Enthalpy(); }
void OpenSMOKE_GasStream::ChangeTemperature(const double _value, const std::string _units) { if (_value<=0.) ErrorMessage("The temperature must be greater than zero!"); T = OpenSMOKE_Conversions::conversion_temperature(_value, _units); Concentrations(); Density(); FlowRates(); SpecificEnthalpies(); Enthalpy(); SpecificEntropies(); Entropy(); }