////////////////////////////////////////////////////////////////// // The read functions. ////////////////////////////////////////////////////////////////// Id makeStandardElements( Id pa, const string& modelname ) { Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); //cout << " kkit read " << pa << " " << modelname << " "<< MooseGlobal; string modelPath = pa.path() + "/" + modelname; if ( pa == Id() ) modelPath = "/" + modelname; Id mgr( modelPath ); if ( mgr == Id() ) mgr = shell->doCreate( "Neutral", pa, modelname, 1, MooseGlobal ); Id kinetics( modelPath + "/kinetics" ); if ( kinetics == Id() ) { kinetics = shell->doCreate( "CubeMesh", mgr, "kinetics", 1, MooseGlobal ); SetGet2< double, unsigned int >::set( kinetics, "buildDefaultMesh", 1e-15, 1 ); } assert( kinetics != Id() ); Id graphs = shell->doCreate( "Neutral", mgr, "graphs", 1, MooseGlobal); assert( graphs != Id() ); Id moregraphs = shell->doCreate( "Neutral", mgr, "moregraphs", 1, MooseGlobal ); Id geometry = shell->doCreate( "Neutral", mgr, "geometry", 1, MooseGlobal ); assert( geometry != Id() ); Id groups = shell->doCreate( "Neutral", mgr, "groups", 1, MooseGlobal ); assert( groups != Id() ); return mgr; }
int main(int argc, char* argv[]) { // Check command line count. if( argc < 2 ) { // TODO: Need more consistent error handling. std::cerr << "Error: Must specify input file." << std::endl; exit(1); } GetPot input( argv[1] ); GRINS::CanteraMixture mixture( input, GRINS::MaterialsParsing::material_name(input,GRINS::PhysicsNaming::reacting_low_mach_navier_stokes()) ); GRINS::CanteraKinetics kinetics( mixture ); libMesh::Real T0 = input( "Conditions/T0", 300.0 ); libMesh::Real T1 = input( "Conditions/T1", 300.0 ); libMesh::Real T_inc = input( "Conditions/T_increment", 100.0 ); libMesh::Real rho = input( "Conditions/density", 1.0e-3 ); const unsigned int n_species = mixture.n_species(); std::vector<double> Y(n_species,0.0); for( unsigned int s = 0; s < n_species; s++ ) { Y[s] = input( "Conditions/mass_fractions", 0.0, s ); } std::vector<double> omega_dot(n_species,0.0); libMesh::Real T = T0; std::ofstream output; output.open( "omega_dot.dat", std::ios::trunc ); output << "# Species names" << std::endl; for( unsigned int s = 0; s < n_species; s++ ) { output << mixture.species_name( s ) << " "; } output << std::endl; output << "# T [K] omega_dot [kg/m^3-s]" << std::endl; output.close(); while( T < T1 ) { kinetics.omega_dot( T, rho, Y, omega_dot ); output.open( "omega_dot.dat", std::ios::app ); output << T << " "; for( unsigned int i = 0; i < n_species; i++ ) { output << std::scientific << std::setprecision(16) << omega_dot[i] << " "; } output << std::endl; output.close(); T += T_inc; } return 0; }