void OpenSMOKE_CHEMKINInterpreter_ThermoData::ProcessElementData(BzzVectorInt &site_indices, BzzVectorInt &bulk_indices, OpenSMOKE_CHEMKINInterpreter_ElementsData &elements) { // Sites { int number_of_species = site_indices.Size(); int number_of_elements = elements.elements_in_list.size()-1; ChangeDimensions(number_of_elements, &site_elements_mw); ChangeDimensions(number_of_elements, number_of_species, &site_elements_matrix); for(int i=1;i<=number_of_species;i++) { int k = site_indices[i]; for(int j=1;j<=int(elements.elements_in_list.size())-1;j++) site_elements_matrix[j][i] = species[k].element_indices[j]; } } // Bulk { int number_of_species = bulk_indices.Size(); int number_of_elements = elements.elements_in_list.size()-1; ChangeDimensions(number_of_elements, &bulk_elements_mw); ChangeDimensions(number_of_elements, number_of_species, &bulk_elements_matrix); for(int i=1;i<=number_of_species;i++) { int k = bulk_indices[i]; for(int j=1;j<=int(elements.elements_in_list.size())-1;j++) bulk_elements_matrix[j][i] = species[k].element_indices[j]; } } }
void OpenSMOKE_Flame1D_ScheduleClass::readOperations(const std::string fileName) { const int MAXOPERATIONS=100; int i, k; int nCycle, onCycle, startCycle, endCycle; std::string stringa; std::string stringaOptional; char charIndex; double t; species = new std::string[MAXOPERATIONS]; std::string option; ChangeDimensions(0, &iOperation); ChangeDimensions(0, &iOptionA); ChangeDimensions(0, &iOptionB); // LEGENDA // ------------------------------------------ // // 0 = INITIALCOLD --- --- // 1 = NLS 1 = ONLY_MOMENTUM --- // 2 = ALL // 2 = DAESTART --- time // 3 = DAE --- time // 4 = NEWPOINTS 1 = TEMPERATURE --- ifstream fInput; openInputFileAndControl(fInput, fileName); for(;;) { fInput >> stringa; // Recupero BackUp // ----------------------------------------------- if (stringa == "RECOVER_FROM_BACK_UP") { iOperation.Append(-1); fInput >> stringa; option = stringa; iOptionA.Append(0); iOptionB.Append(0); } // Soluzione di partenza a freddo // ----------------------------------------------- //else if (stringa == "START_FROM_ZERO") //{ // iOperation.Append(0); // fInput >> t; // iOptionA.Append(0); // iOptionB.Append(t); //} // Soluzione del sistema non lineare // ----------------------------------------------- else if (stringa == "NLS")
void OpenSMOKE_CHEMKINInterpreter_ThermoData::GiveMeMolecularWeights(BzzVectorInt &indices, OpenSMOKE_CHEMKINInterpreter_ElementsData &elements) { int i; BzzVector mw_elements(elements.elements_in_list_indices.size()-1); for(i=1;i<=int(elements.elements_in_list.size())-1;i++) mw_elements[i] = elements.elements_mw[elements.elements_in_list_indices[i]]; BzzVector mw_isotope(elements.isotope_in_list.size()-1); for(i=1;i<=int(elements.isotope_in_list.size())-1;i++) mw_isotope[i] = elements.isotope_mw_in_list[i]; for(int j=1;j<=indices.Size();j++) { int h = indices[j]; ChangeDimensions(elements.elements_in_list.size()-1, &species[h].element_indices); ChangeDimensions(elements.isotope_in_list.size()-1, &species[h].isotope_indices); for(int k=1;k<=int(species[h].element_names.size())-1;k++) { int i; bool jFound = false; for(i=1;i<=int(elements.elements_in_list.size())-1;i++) if (caseInsCompare(species[h].element_names[k], elements.elements_in_list[i])==true) { jFound = true; species[h].element_indices[i] = species[h].element_numbers[k]; break; } if (jFound == false) { for(i=1;i<=int(elements.isotope_in_list.size())-1;i++) if (caseInsCompare(species[h].element_names[k], elements.isotope_in_list[i])==true) { jFound = true; species[h].isotope_indices[i] = species[h].element_numbers[k]; break; } } if (jFound == false) { for (int kk=0;kk<=species[h].element_names.size()-1;kk++) cout << kk << species[h].element_names[k] << endl; cout << species[h].name << endl; ErrorMessage("The " + species[h].element_names[k] + " element is not available in the database"); } } species[h].mw = Dot(species[h].element_indices, mw_elements); species[h].mw += Dot(species[h].isotope_indices, mw_isotope); } }
void OpenSMOKE_SolidRegression::Setup(const string filename) { ptRegression = this; int i; string dummy; ifstream fInput; openInputFileAndControl(fInput, filename); while (fInput.eof()==0) { fInput >> dummy; list_of_names_of_files.push_back(dummy); } fInput.close(); nCases = list_of_names_of_files.size(); ChangeDimensions(nCases, &indices); ChangeDimensions(nCases, &initialconditions_x); ChangeDimensions(nCases, &initialconditions_y); ChangeDimensions(nCases, &yMin); cout << "List of files: " << endl; for(i=1;i<=nCases;i++) cout << list_of_names_of_files[i-1] << endl; experiments = new OpenSMOKE_SolidExperiment[nCases+1]; for(i=1;i<=nCases;i++) experiments[i].ReadFromFile(list_of_names_of_files[i-1]); numTotal = 0; for(i=1;i<=nCases;i++) { indices[i] = numTotal+1; initialconditions_x[i] = experiments[i].x[1]; initialconditions_y[i] = experiments[i].y[1]; numTotal += experiments[i].nPoints; } ChangeDimensions(numTotal, 1, &YY); for(i=1;i<=nCases;i++) { cout << "-----------------------------------------" << endl; cout << "Experiment #" << i << endl; cout << "-----------------------------------------" << endl; cout << " * Index: " << indices[i] << endl; cout << " * x0: " << initialconditions_x[i] << endl; cout << " * y0: " << initialconditions_y[i] << endl; cout << endl; } }
void OpenSMOKE_PostProcessor_Batch::ImportSelectedAxis(int x_axis, vector<int> y_axis, BzzMatrix &xAxis, BzzMatrix &yAxis, std::string &name_x, std::string &name_y, vector<string> &names_lines) { ChangeDimensions(y_axis.size(), x.Size(), &xAxis); ChangeDimensions(y_axis.size(), x.Size(), &yAxis); name_x = list_of_x_labels.at(x_axis); name_y = list_of_y_labels.at(y_axis[0]); if (y_axis.size() > 1) { name_y = "mole fraction"; for(int j=1;j<=int(y_axis.size());j++) if (y_axis[j-1] < y_start_species) { name_y = "mixed"; break; } } int iMassFractions = false; names_lines.resize(0); for(int j=1;j<=int(y_axis.size());j++) { names_lines.push_back(list_of_y_available[y_axis[j-1]]); if (x_axis == 0) // x: contact time xAxis.SetRow(j,x); if (x_axis == 1) // x: space xAxis.SetRow(j,csi); if (y_axis[j-1] == 0) // y: temperature yAxis.SetRow(j,T); else if (y_axis[j-1] == 1) // y: concentration yAxis.SetRow(j,Ctot); else if (y_axis[j-1] == 2) // y: density yAxis.SetRow(j,rho); else if (y_axis[j-1] == 3) // y: molecular weight yAxis.SetRow(j,MW); else if (y_axis[j-1] == 4) // y: pressure yAxis.SetRow(j,P_Pa); else // y: species mole fractions { if (iMassFractions == false) yAxis.SetRow(j,X[indices[y_axis[j-1]-(y_start_species-1)]]); else yAxis.SetRow(j,omega[indices[y_axis[j-1]-(y_start_species-1)]]); } } }
void OpenSMOKE_GasStream::AssignKineticScheme(OpenSMOKE_ReactingGas &_mix) { mix = &_mix; int NC = mix->NumberOfSpecies(); ChangeDimensions(NC, &omega); ChangeDimensions(NC, &x); ChangeDimensions(NC, &c); // [kmol/m3] ChangeDimensions(NC, &h_mass); // [J/kg] ChangeDimensions(NC, &h_mole); // [J/kmol] assignedKineticScheme = true; }
HomogeneousODE::HomogeneousODE( OpenSMOKE::ThermodynamicsMap_CHEMKIN<double>& thermodynamicsMapXML, OpenSMOKE::KineticsMap_CHEMKIN<double>& kineticsMapXML) : thermodynamicsMapXML_(thermodynamicsMapXML), kineticsMapXML_(kineticsMapXML) { number_of_gas_species_ = thermodynamicsMapXML_.NumberOfSpecies(); number_of_equations_ = number_of_gas_species_ + 1; ChangeDimensions(number_of_gas_species_, &omegaSurr_, true); ChangeDimensions(number_of_gas_species_, &omegaStar_, true); ChangeDimensions(number_of_gas_species_, &xStar_, true); ChangeDimensions(number_of_gas_species_, &cStar_, true); ChangeDimensions(number_of_gas_species_, &RStar_, true); }
void OpenSMOKE_GasStream::AssignOxidizerMassFractions(BzzVector &omega_Oxidizer) { double MW_Oxidizer; ChangeDimensions(mix->NumberOfSpecies(), &x_Oxidizer); mix->GetMWAndMoleFractionsFromMassFractions(MW_Oxidizer, x_Oxidizer, omega_Oxidizer); iSetOxidizerComposition = true; }
void OpenSMOKE_GasStream::AssignFuelMassFractions(BzzVector &omega_Fuel) { double MW_Fuel; ChangeDimensions(mix->NumberOfSpecies(), &x_Fuel); mix->GetMWAndMoleFractionsFromMassFractions(MW_Fuel, x_Fuel, omega_Fuel); iSetFuelComposition = true; }
void OpenSMOKE_GasStream::AssignOxidizerMoleFractions(const vector<string> _names, const vector<double> _values) { ChangeDimensions(mix->NumberOfSpecies(), &x_Oxidizer); for(int i=1;i<=int(_names.size());i++) x_Oxidizer[mix->recognize_species(_names[i-1])] = _values[i-1]; iSetOxidizerComposition = true; }
void OpenSMOKE_DirectLinearSolver_Unsymmetric::CalculateSparsityPattern(const int index, const int blockDimension, const BzzVector& mConvectionDiffusion, const BzzVectorInt& iConvectionDiffusion, BzzVectorInt &indicesColumns) { // Global columns for row block corresponding to the current reactor) ChangeDimensions (blockDimension * (blockDimension+iConvectionDiffusion.Size()), &indicesColumns); { int jReactor = (index-1)*blockDimension; int count=1; for (int i=1;i<=blockDimension;i++) { for (int k=1;k<=mConvectionDiffusion.Size();k++) if (iConvectionDiffusion[k] < int(index)) indicesColumns[count++] = (iConvectionDiffusion[k]-1)*blockDimension+i; for (int k=1;k<=blockDimension;k++) indicesColumns[count++] = jReactor+k; for (int k=1;k<=mConvectionDiffusion.Size();k++) if (iConvectionDiffusion[k] > int(index)) indicesColumns[count++] = (iConvectionDiffusion[k]-1)*blockDimension+i; for (int k=1;k<=mConvectionDiffusion.Size();k++) if (iConvectionDiffusion[k] == int(index)) ErrorMessage("Wrong sparsity structure"); } } }
// Costruzione della matrice GAMMA (NC x NR) BzzMatrix OpenSMOKE_Kinetics::constructGamma(const string fileSt) { int i, j; double val; int numComponents, numReactions; cout << "Gamma Matrix construction... "; ifstream inputFile; openInputFileAndControl(inputFile, fileSt); inputFile >> numComponents >> numReactions; BzzMatrix gamma; ChangeDimensions(numComponents, numReactions, &gamma); while(1) { inputFile >> i >> j >> val; if (inputFile.eof()!=0) break; gamma[i][j] += val; } inputFile.close(); cout << " DONE" << endl; return gamma; }
void OpenSMOKE_Grid1D::AddPointsField(BzzMatrix &phi, BzzVectorInt &listPoints, const double ratio) { int i, j, k; int NpOld; int NCols; BzzMatrix phiOld = phi; NpOld = phiOld.Rows(); NCols = phiOld.Columns(); ChangeDimensions(Np, NCols, &phi); int count = 0; for (i=1;i<=NpOld;i++) { for(j=1;j<=NCols;j++) phi[i+count][j] = phiOld[i][j]; if (count < listPoints.Size()) if(listPoints[count+1] == i) count++; } BzzVectorInt indices(listPoints.Size()); for (k=1;k<=listPoints.Size();k++) indices[k]= listPoints[k]+k; for (k=1;k<=listPoints.Size();k++) for(j=1;j<=NCols;j++) phi[indices[k]][j] = 0.50*phi[indices[k]-1][j]+(1.-ratio)*phi[indices[k]+1][j]; }
ODE_PFR::ODE_PFR( OpenSMOKE::ThermodynamicsMap_CHEMKIN<double>& thermodynamicsMapXML, OpenSMOKE::KineticsMap_CHEMKIN<double>& kineticsMapXML) : thermodynamicsMapXML_(thermodynamicsMapXML), kineticsMapXML_(kineticsMapXML) { number_of_gas_species_ = thermodynamicsMapXML_.NumberOfSpecies(); number_of_equations_ = number_of_gas_species_ + 1 + 1; ChangeDimensions(number_of_gas_species_, &omegaStar_, true); ChangeDimensions(number_of_gas_species_, &xStar_, true); ChangeDimensions(number_of_gas_species_, &cStar_, true); ChangeDimensions(number_of_gas_species_, &RStar_, true); checkMassFractions_ = false; }
void OpenSMOKE_KPP_SingleReactor::ReconstructBlockAndDiagonals(BzzMatrix &block, BzzVector &diagonals) { ChangeDimensions(iConvectionDiffusion_.Size(), &diagonals); int count=1; for (int i=1;i<=numberOfSpecies;i++) { int iDiagonal = 1; for (int k=1;k<=mConvectionDiffusion_.Size();k++) if (iConvectionDiffusion_[k] < int(index_)) { if (diagonals[iDiagonal]!=0 && diagonals[iDiagonal] != globalIndicesSparsityValues_[count]) ErrorMessage("Something wrong!"); diagonals[iDiagonal++] = globalIndicesSparsityValues_[count++]; } for (int k=1;k<=numberOfSpecies;k++) block[i][k] = globalIndicesSparsityValues_[count++]; for (int k=1;k<=mConvectionDiffusion_.Size();k++) if (iConvectionDiffusion_[k] > int(index_)) { diagonals[iDiagonal++] = globalIndicesSparsityValues_[count++]; } } }
void OpenSMOKE_CHEMKINInterpreter_SurfaceReactionData::LangmuirHinshelwoodReactions(vector<string> instructions) { int nInstructions = instructions.size()-1; std::string error_message = "Syntax error in Langmuir-Hinshelwood Reaction (LANG) option"; // Checking for syntax errors if (nInstructions != 8) ErrorMessage(error_message); if (instructions[2] != "/") ErrorMessage(error_message); if (instructions[nInstructions] != "/") ErrorMessage(error_message); // Checkings if (iReversible == true) ErrorMessage("The LANG option can be used only for irreversible reactions"); // Reactants ChangeDimensions(nReactants, &langmuirHinshelwoodReactantSpecies); ChangeDimensions(nReactants, &langmuirHinshelwoodReactantExponent); for(int i=1;i<=nReactants;i++) { int index; char phase; ptKinetics->RecognizeSpecies(instructions[3], index, phase); if (phase != 'G') ErrorMessage(error_message); langmuirHinshelwoodReactantSpecies[i] = index; langmuirHinshelwoodReactantExponent[i] = nuDirect[i]; } // Counters iLangmuirHinshelwoodReaction = true; nLangmuirHinshelwoodReaction++; // Read parameters { int index; char phase; ptKinetics->RecognizeSpecies(instructions[3], index, phase); if (phase != 'G') ErrorMessage(error_message); langmuirHinshelwoodReactionSpecies.Append(index); // Assign properties double conversion_factor = pow(1000., -atof(instructions[7].c_str())); langmuirHinshelwoodReactionParameters.Append(atof(instructions[4].c_str())*conversion_factor); langmuirHinshelwoodReactionParameters.Append(atof(instructions[5].c_str())); langmuirHinshelwoodReactionParameters.Append(atof(instructions[6].c_str())); langmuirHinshelwoodReactionParameters.Append(atof(instructions[7].c_str())); } }
void OpenSMOKE_SensitivityAnalysis::Initialize(OpenSMOKE_ReactingGas *_mix, BzzVectorInt &_indices, bool _iTemperature) { int i,k; mix = _mix; iTemperature = _iTemperature; NC = mix->NumberOfSpecies(); // Number of Species NR = mix->NumberOfReactions(); // Number of reactions NP = NR; // Number of parameters if (iTemperature == true) { NV = NC+1; // Number of variables indexSpecies = 1; // index of species indexTemperature = NC+1; // index of temperature } if (iTemperature == false) { NV = NC; // Number of variables indexSpecies = 1; // index of species indexTemperature = 0; // index of temperature } ChangeDimensions(NV, NP, &JAlfa); ChangeDimensions(NV, NP, &S); ChangeDimensions(NV, NP, &Somega); ChangeDimensions(NV, NP, &Sx); ChangeDimensions(NV, NV, &Jacobian); ChangeDimensions(NV, &I); // Identity matrix (Diagonal) ChangeDimensions(NV, NP, &Sold); // Old sensitivity coefficient matrix ChangeDimensions(NV, &scaling); // Scaling factors M = mix->M; // Molecular weigths [kg/kmol] uM = mix->uM; // uMolecular weigths [kmol/kg] A = mix->kinetics.exp_k01; // Frequency factors [kmol, m3, s] nu = new OpenSMOKE_NuManager[NC+1]; for(i =1;i<=NC;i++) nu[i].Set(i, mix->names[i]); BuildNuMatrix(&mix->kinetics); for(k=1;k<=NC;k++) nu[k].Clean(); indices_print_species = _indices; threshold_normalization = 1e-10; iImplicit = true; I = 1.0; }
void OpenSMOKEVector<T, IndexPolicy>::Copy(OpenSMOKEVector<T, IndexPolicy> const& orig) { if (dimensions_!=orig.dimensions_) ChangeDimensions(orig.Size(), this, false); //ErrorMessage("OpenSMOKEVector<T, IndexPolicy>::Copy(OpenSMOKEVector<T, IndexPolicy> const& orig) Dimension check failure"); if(dimensions_ != 0) memcpy(vector_+this->index_, orig.vector_+orig.index_, dimensions_*sizeof(T)); }
void OpenSMOKE_ICEM::Initialize() { ChangeDimensions(NC, &u); ChangeDimensions(NC, &lambdaMap); ChangeDimensions(NC, &muMap); UpdateAngleAndVolume(0.); arm_La = (compression_ratio-1.)/2.*volume_clearance/area_base; arm_Lc = arm_ratio*arm_La; velocity_piston = 2.*arm_La*rotation_rate; // [m/s] T = inletStream->T; P = inletStream->P; omega = inletStream->omega; mass = inletStream->rho*volume; UpdateProperties(MINUSONE, NC+1); }
void OpenSMOKE_PostProcessor_RateOfProductionAnalysis::ImportSelectedAxisFormationRates(int x_axis, vector<int> y_axis, BzzMatrix &xAxis, BzzMatrix &yAxis, std::string &name_x, std::string &name_y, vector<string> &names_lines) { ChangeDimensions(y_axis.size(), post_processor->get_x().Size(), &xAxis); ChangeDimensions(y_axis.size(), post_processor->get_x().Size(), &yAxis); name_x = "x coordinate"; name_y = "formation rate [kmol/m3/s]"; names_lines.resize(0); for(int j=1;j<=int(y_axis.size());j++) { names_lines.push_back(list_of_y_labels_formation_rates[y_axis[j-1]]); BzzVector aux = formationRates.GetColumn(y_axis[j-1]+1); xAxis.SetRow(j,post_processor->get_x()); yAxis.SetRow(j,aux); } }
bool OpenSMOKE_KPP_SingleReactor::ReadTopology(ifstream &fInput) { // External feeds { unsigned int numberInlets; fInput >> numberInlets; ChangeDimensions(numberOfSpecies, &fIn_); for (int k=1; k<=int(numberInlets); k++) { tagExternalFeed_ = true; unsigned int numberSpecies; double massFlow; fInput >> massFlow; fInput >> numberSpecies; for (unsigned int j=1; j<=numberSpecies; j++) { unsigned int indexSpecies; double omegaSpecies; fInput >> indexSpecies >> omegaSpecies; fIn_[indexSpecies] += omegaSpecies*massFlow; } } } // Outputs { unsigned int numberOutputs; fInput >> numberOutputs; ChangeDimensions(numberOutputs, &cOut_); ChangeDimensions(numberOutputs, &out_); ChangeDimensions(numberOutputs, &neighbours_); ChangeDimensions(numberOutputs, &diffusion_); for (int k=1; k<=out_.Size(); k++) { fInput >> out_[k] >> cOut_[k] >> diffusion_[k]; neighbours_[k] = out_[k]; } } return true; }
void OpenSMOKE_Droplet::PrepareSystem() { if (data->iLiquidPhase == LIQUID_DROPLET_PDE_NOMOMENTUM) dimensionBlock = 1 + NC; if (data->iLiquidPhase == LIQUID_DROPLET_PDE_ONLYT) dimensionBlock = 1; // Number of equations NE = N*dimensionBlock; // Memory allocation ChangeDimensions(NE, &xMin); ChangeDimensions(NE, &xMax); ChangeDimensions(NE, &inDerAlg); ChangeDimensions(NE, &xFirstGuess); // DAE system preparation setMinimumAndMaximumValues(); setDifferentialAndAlgebraic(); setFirstGuess(); }
void OpenSMOKE_GasStream::AssignOxidizerMassFractions(const vector<string> _names, const vector<double> _values) { double MW_Oxidizer; BzzVector omega_Oxidizer(mix->NumberOfSpecies()); ChangeDimensions(mix->NumberOfSpecies(), &x_Oxidizer); for(int i=1;i<=int(_names.size());i++) omega_Oxidizer[mix->recognize_species(_names[i-1])] = _values[i-1]; mix->GetMWAndMoleFractionsFromMassFractions(MW_Oxidizer, x_Oxidizer, omega_Oxidizer); iSetOxidizerComposition = true; }
ODE_PFR::ODE_PFR( OpenSMOKE::ThermodynamicsMap_CHEMKIN& thermodynamicsMapXML, OpenSMOKE::KineticsMap_CHEMKIN& kineticsMapXML) : thermodynamicsMapXML_(thermodynamicsMapXML), kineticsMapXML_(kineticsMapXML) { number_of_gas_species_ = thermodynamicsMapXML_.NumberOfSpecies(); number_of_reactions_ = kineticsMapXML_.NumberOfReactions(); number_of_equations_ = number_of_gas_species_ + 1 + 2; // species and temperature + 2 dummy variables ChangeDimensions(number_of_gas_species_, &omegaStar_, true); ChangeDimensions(number_of_gas_species_, &xStar_, true); ChangeDimensions(number_of_gas_species_, &cStar_, true); ChangeDimensions(number_of_gas_species_, &RStar_, true); ChangeDimensions(number_of_reactions_, &rStar_, true); checkMassFractions_ = false; drgAnalysis_ = false; energyEquation_ = true; }
void MyOpenSMOKE_SolidRegression::Prepare() { ChangeDimensions(numTotal, &temperatures_global); ChangeDimensions(numTotal, &utemperatures_global); ChangeDimensions(numTotal, &pressures_Gas_global); int k=1; for(int i=1;i<=nCases;i++) { for(int j=1;j<=experiments[i].nPoints;j++) { temperatures_global[k] = experiments[i].temperature; utemperatures_global[k] = 1./temperatures_global[k]; pressures_Gas_global[k] = experiments[i].pressure; k++; } } TMeanGlobal = Mean(temperatures_global); PGasMeanGlobal = Mean(pressures_Gas_global); C2 = -1./TMeanGlobal; C3 = pressures_Gas_global.Norm2(); BzzVector auxiliar_vector = utemperatures_global; for(k=1;k<=numTotal;k++) auxiliar_vector[k] += C2; C1 = 1./auxiliar_vector.Norm2(); cout << "Tmin: " << temperatures_global.Min() << " K" << endl; cout << "Tmax: " << temperatures_global.Max() << " K" << endl; cout << "Tmean: " << TMeanGlobal << " K" << endl; cout << "PGasmin: " << pressures_Gas_global.Min() << " atm" << endl; cout << "PGasmax: " << pressures_Gas_global.Max() << " atm" << endl; cout << "PGasmean: " << PGasMeanGlobal << " atm" << endl; cout << "C1: " << C1 << " K" << endl; cout << "C2: " << C2 << " 1/K" << endl; cout << "C3: " << C3 << " atm" << endl; }
void OpenSMOKE_DQMOM::update(OpenSMOKE_PhysicalModels &_models) { // ----------------------------------------------------- // Updating of matrix A and Vector S : ATTENTION // ----------------------------------------------------- ChangeDimensions(_2N, _2N, &A); Source = 0.; powerOfCsi = _models.powerOfCsi; prepareA(); assemblingA(); }
void OpenSMOKE_CHEMKINInterpreter_ThermoData::ProcessElementData(BzzVectorInt &indices, OpenSMOKE_CHEMKINInterpreter_ElementsData &elements) { int i; int number_of_species = indices.Size(); int number_of_elements = elements.elements_in_list.size()-1; ChangeDimensions(number_of_elements, &elements_mw); ChangeDimensions(number_of_elements, number_of_species, &elements_matrix); for(i=1;i<=number_of_elements;i++) { list_of_elements.push_back(elements.elements_in_list[i]); elements_mw[i] = elements.elements_mw[elements.elements_in_list_indices[i]]; } for(i=1;i<=number_of_species;i++) { int k = indices[i]; for(int j=1;j<=int(elements.elements_in_list.size())-1;j++) elements_matrix[j][i] = species[k].element_indices[j]; } }
void Renderer::CreateConnections(QPushButton *change_dimensions, QPushButton *load_zone_plate, QPushButton *load_image, QSpinBox *size_spin, QSlider *size_slider, QDoubleSpinBox *support_spin, QComboBox *filter_choice) { QObject::connect(change_dimensions, SIGNAL(clicked()), this, SLOT(ChangeDimensions())); QObject::connect(load_zone_plate, SIGNAL(clicked()), this, SLOT(LoadZonePlate())); QObject::connect(load_image, SIGNAL(clicked()), this, SLOT(LoadImage())); QObject::connect(support_spin, SIGNAL(valueChanged(double)), this, SLOT(SetSupport(double))); QObject::connect(size_spin, SIGNAL(valueChanged(int)), size_slider, SLOT(setValue(int))); QObject::connect(size_slider, SIGNAL(valueChanged(int)), size_spin, SLOT(setValue(int))); QObject::connect(size_spin, SIGNAL(valueChanged(int)), this, SLOT(ChangeZonePlateSize(int))); QObject::connect(freq_spin_, SIGNAL(valueChanged(double)), this, SLOT(ChangeZonePlateFrequency(double))); QObject::connect(group_freq_, SIGNAL(toggled(bool)), this, SLOT(ToggleZonePlateFixedFrequency())); QObject::connect(filter_choice, SIGNAL(currentTextChanged(const QString&)), this, SLOT(ChooseFilter(const QString&))); }
void OpenSMOKE_Grid1D::DoubleField(BzzVector &phi) { int NpOld; BzzVector phiOld = phi; NpOld = phiOld.Size(); ChangeDimensions(Np, &phi); // Linear Interpolation phi[1] = phiOld[1]; for(int i=2;i<=NpOld;i++) { int index = (i-1)*2; phi[index] = 0.50*(phiOld[i-1]+phiOld[i]); phi[index+1] = phiOld[i]; } }
void OpenSMOKE_LookUp_Table_Flame::read_from_file(const string fileName) { int i,j; string dummy; ifstream fInput; openInputFileAndControl(fInput, fileName); fInput >> dummy; if (dummy != "mf") ErrorMessage("Expected: mf - Found: " + dummy); fInput >> nCsi; ChangeDimensions(nCsi, &csi); for(j=1;j<=nCsi;j++) fInput >> csi[j]; fInput >> dummy; if (dummy != "mfv") ErrorMessage("Expected: mfv - Found: " + dummy); fInput >> nCsiV; ChangeDimensions(nCsiV, &csiV); for(j=1;j<=nCsiV;j++) fInput >> csiV[j]; fInput >> dummy; if (dummy != "temperature") ErrorMessage("Expected: temperature - Found: " + dummy); ChangeDimensions(nCsi, nCsiV, &temperature); for(j=1;j<=nCsiV;j++) for(i=1;i<=nCsi;i++) fInput >> temperature[i][j]; fInput >> dummy; if (dummy != "density") ErrorMessage("Expected: density - Found: " + dummy); ChangeDimensions(nCsi, nCsiV, &density); for(j=1;j<=nCsiV;j++) for(i=1;i<=nCsi;i++) fInput >> density[i][j]; fInput >> dummy; if (dummy != "cp") ErrorMessage("Expected: cp - Found: " + dummy); ChangeDimensions(nCsi, nCsiV, &cp); for(j=1;j<=nCsiV;j++) for(i=1;i<=nCsi;i++) fInput >> cp[i][j]; fInput >> dummy; if (dummy != "as") ErrorMessage("Expected: as - Found: " + dummy); ChangeDimensions(nCsi, nCsiV, &as); for(j=1;j<=nCsiV;j++) for(i=1;i<=nCsi;i++) fInput >> as[i][j]; fInput.close(); }