diff --git a/CHANGES b/CHANGES index abf237f19..81a6e70ee 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,22 @@ Version 0.9.0 (in progress) * C++11 compiler now required * Minimum libMesh git hash for this release is: 2d9b8bc + * Minimum Antioch git hash is now: e17822d * Use factory pattern for DiffSolver, now support specifying DiffSolver type in inputfile, add support for libMesh::PetscDiffSolver + * Refactor thermochemistry input options parsing. + See master_example_inputfile.in for details. Backward + compatibility with the input file will be maintained + for one release. + * Add Full support for Antioch XML parser for parsing + Antioch thermochemistry and transport data + * Update Cantera transport to respect transport model + specified in the XML file. + * Updated ozone_flame example with run scripts for both + Antioch and Cantera versions. Also updated to illustrate + overriding input options on the command line and AMR + for the final step. Version 0.8.0 * Minimum libMesh git hash for this release is: 8be0a4e diff --git a/README.md b/README.md index 213178879..e5089d293 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,10 @@ Optional Packages ----------------- To enable the reacting low Mach Navier-Stokes physics class, GRINS must be compiled with -an external chemistry library. While [Cantera](http://code.google.com/p/cantera/) is -partially supported, [Antioch](https://github.com/libantioch/antioch) is fully -supported. +an external chemistry library. Both [Cantera](http://code.google.com/p/cantera/) and +[Antioch](https://github.com/libantioch/antioch) are fully supported. -The current required minimum hash for using Antioch is libantioch/antioch@ad78595 (libantioch/antioch#240). +The current required minimum hash for using Antioch is libantioch/antioch@e17822d (libantioch/antioch#265). Building GRINS diff --git a/examples/master_example_inputfile.in b/examples/master_example_inputfile.in index f3b34c74b..19e3f3d13 100644 --- a/examples/master_example_inputfile.in +++ b/examples/master_example_inputfile.in @@ -173,9 +173,6 @@ # Notify that we're using Cantera thermochemistry_library = 'cantera' - # Species in this gas mixture - species = 'N2 N C CN' - [./Cantera] # Specify the mixture to be used. This is the "mixture" or "phase" # given in the chemical_data file. The user must set this @@ -197,37 +194,63 @@ # Arbitrary material name. Here we describe input parameters related # to the Antioch thermochemistry library. These are used for reacting # flow Physics. Note that units here *must* be SI. + # Although we support ASCII input to Antioch, XML format is much preferred. + # The parsing type is determined by the suffix on the chemical data file: + # .dat --> ASCII + # .xml --> XML + # .chemkin --> CHEMKIN (not yet supported) [./AntiochMaterial] [./GasMixture] # Notify that we're using Antioch thermochemistry_library = 'antioch' - # Species in this gas mixture - species = 'N2 N C CN' - - # Path to file containing kinetics data. - kinetics_data = 'datafile.xml' - # Antioch model specification [./Antioch] + # For XML, we assume you have all kinetics, thermo, and transport data + # (modulo Blotter or Sutherland data, which are specified in separate files). + # For the thermo, we will query the XML file to determine whether it's NASA7 + # or NASA9. NASA models are always used for the chemistry and if + # thermo_model (see below) is ideal_gas, then that NASA model will + # also be used there. + chemical_data = 'datafile.xml' + + # Specify the mixture to be used. This is the "mixture" or "phase" + # given in the chemical_data file if it's an xml file. + # The user must set this when using an XML file since the data file + # may contain more than one mixture. If using ASCII parsing, this + # variable is not used and not needed. + gas_mixture = 'air4sp' + + # The type of transport model. Currently accepted values # are: constant, mixture_averaged transport_model = 'constant' # Model used for computing thermodynamic quantities. - # Currently accepted values are: cea, stat_mech - # Note: CEA data is internally used to the kinetics - # calculation and this option will not effect that. - thermo_model = 'cea' + # Currently accepted values are: ideal_gas, stat_mech + # + # ideal_gas corresponds to assuming electronic states are not populated + # and vibrational are partially populated and computed by taking the NASA + # curve fit value for the total and subtracting the translational and + # vibrational energy. This is a common model in combustion applications. + # + # stat_mech will use statistical mechanics relations to compute translational, + # rotational, vibrational, and electronic energies. Note these strongly depend + # on having the correct modes/degenercies for vibrational and electronic states + # for each species. + thermo_model = 'ideal_gas' # Model used for computing viscosity. # Currently accepted values are: # constant (only valid with transport_model = constant) # blottner (transport_model = mixture_averaged, requires blottner_data) # sutherland (transport_model = mixture_averaged, requires sutherland_data), - # kinetics_theory (transport_model = mixture_averaged, requires transport_data, requires - # thermal_conductivity_model and mass_diffusivity_model to be kinetics_theory) + # kinetics_theory (* transport_model = mixture_averaged, + # * requires transport_data if using ASCII parsing or have data in XML file + # if using XML parsing + # * requires thermal_conductivity_model and mass_diffusivity_model + # to be kinetics_theory) # # For viscosity_model = 'constant', the viscosity value # will be parsed from [Materials/material-name/Viscosity/value] @@ -238,8 +261,11 @@ # constant (only valid with transport_model = constant) # constant_prandtl # eucken (transport_model = mixture_averaged, requires thermo_model = stat_mech) - # kinetics_theory (transport_model = mixture_averaged, requires transport_data, requires - # viscosity_model and mass_diffusivity_model to be kinetics_theory) + # kinetics_theory (* transport_model = mixture_averaged, + # * requires transport_data if using ASCII parsing or have data in XML file + # if using XML parsing + # * requires viscosity_model and mass_diffusivity_model + # to be kinetics_theory) # # For thermal_conductivity_model = 'constant', the conductivity value # will be parsed from [Materials/material-name/ThermalConductivity/value] @@ -251,8 +277,11 @@ # Model used for computing mass diffusivity # Currently accepted values are: # constant_lewis (transport_model = mixture_averaged, constant) - # kinetics_theory (transport_model = mixture_averaged, requires transport_data, requires - # viscosity_model and thermal_conductivity_model to be kinetics_theory) + # kinetics_theory (* transport_model = mixture_averaged, + # * requires transport_data if using ASCII parsing or have data in XML file + # if using XML parsing + # * requires viscosity_model and thermal_conductivity_model + # to be kinetics_theory) # # For mass_diffusivity_model = 'constant_lewis', the lewis number # will be parsed from [Materials/material-name/LewisNumber/value] diff --git a/src/physics/include/grins/antioch_instantiation_macro.h b/src/physics/include/grins/antioch_instantiation_macro.h index e8166e790..a223e4f96 100644 --- a/src/physics/include/grins/antioch_instantiation_macro.h +++ b/src/physics/include/grins/antioch_instantiation_macro.h @@ -41,18 +41,20 @@ Antioch::EuckenThermalConductivity >, \ Antioch::ConstantLewisDiffusivity >; \ template class GRINS::class_name, libMesh::Real>, \ + Antioch::IdealGasThermo, \ Antioch::SutherlandViscosity, \ - Antioch::EuckenThermalConductivity, libMesh::Real> >, \ + Antioch::EuckenThermalConductivity >, \ Antioch::ConstantLewisDiffusivity >; \ template class GRINS::class_name, libMesh::Real>, \ + Antioch::IdealGasThermo, \ Antioch::BlottnerViscosity, \ - Antioch::EuckenThermalConductivity, libMesh::Real> >, \ + Antioch::EuckenThermalConductivity >, \ Antioch::ConstantLewisDiffusivity > #define INSTANTIATE_ANTIOCH_TRANSPORT(class_name) \ - INSTANTIATE_ANTIOCH_TRANSPORT_RAW(class_name,Antioch::CEACurveFit) + INSTANTIATE_ANTIOCH_TRANSPORT_RAW(class_name,Antioch::CEACurveFit); \ + INSTANTIATE_ANTIOCH_TRANSPORT_RAW(class_name,Antioch::NASA7CurveFit); \ + INSTANTIATE_ANTIOCH_TRANSPORT_RAW(class_name,Antioch::NASA9CurveFit) #ifdef ANTIOCH_HAVE_GSL #define INSTANTIATE_ANTIOCH_KINETICS_THEORY_TRANSPORT_RAW(class_name,curve_fit) \ @@ -62,13 +64,15 @@ Antioch::KineticsTheoryThermalConductivity,libMesh::Real>, \ Antioch::MolecularBinaryDiffusion >; \ template class GRINS::class_name, libMesh::Real>, \ + Antioch::IdealGasThermo, \ Antioch::KineticsTheoryViscosity, \ - Antioch::KineticsTheoryThermalConductivity >,libMesh::Real>, \ + Antioch::KineticsTheoryThermalConductivity, libMesh::Real>, \ Antioch::MolecularBinaryDiffusion > #define INSTANTIATE_ANTIOCH_KINETICS_THEORY_TRANSPORT(class_name) \ - INSTANTIATE_ANTIOCH_KINETICS_THEORY_TRANSPORT_RAW(class_name,Antioch::CEACurveFit) + INSTANTIATE_ANTIOCH_KINETICS_THEORY_TRANSPORT_RAW(class_name,Antioch::CEACurveFit); \ + INSTANTIATE_ANTIOCH_KINETICS_THEORY_TRANSPORT_RAW(class_name,Antioch::NASA7CurveFit); \ + INSTANTIATE_ANTIOCH_KINETICS_THEORY_TRANSPORT_RAW(class_name,Antioch::NASA9CurveFit) #endif // ANTIOCH_HAVE_GSL diff --git a/src/physics/include/grins/reacting_low_mach_navier_stokes_macro.h b/src/physics/include/grins/reacting_low_mach_navier_stokes_macro.h index 93c398681..1c193e45a 100644 --- a/src/physics/include/grins/reacting_low_mach_navier_stokes_macro.h +++ b/src/physics/include/grins/reacting_low_mach_navier_stokes_macro.h @@ -11,18 +11,24 @@ namespace GRINSPrivate { // Need typedefs for these because the commas in the template arguments screw up the C preprocessor // when putting the full types in the argument list - typedef Antioch::IdealGasMicroThermo >, libMesh::Real> CEAIdealGasThermo; + typedef Antioch::IdealGasThermo,libMesh::Real> CEAIdealGasThermo; + typedef Antioch::IdealGasThermo,libMesh::Real> NASA7IdealGasThermo; + typedef Antioch::IdealGasThermo,libMesh::Real> NASA9IdealGasThermo; typedef Antioch::KineticsTheoryViscosity KineticsViscosity; typedef Antioch::MolecularBinaryDiffusion BinaryDiffusion; typedef Antioch::KineticsTheoryThermalConductivity,libMesh::Real> KineticsConductivityStatMech; typedef Antioch::KineticsTheoryThermalConductivity KineticsConductivityCEA; + typedef Antioch::KineticsTheoryThermalConductivity KineticsConductivityNASA7; + typedef Antioch::KineticsTheoryThermalConductivity KineticsConductivityNASA9; } #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_RAW(class_name,curve_fit,conductivity) \ template class GRINS::class_name > #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_CURVEFIT_RAW(class_name,conductivity) \ - template class GRINS::class_name,GRINS::conductivity> > + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_RAW(class_name,Antioch::CEACurveFit,conductivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_RAW(class_name,Antioch::NASA7CurveFit,conductivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_RAW(class_name,Antioch::NASA9CurveFit,conductivity) #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE(class_name) \ INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_CURVEFIT_RAW(class_name,ConstantConductivity); \ @@ -35,7 +41,11 @@ namespace GRINSPrivate #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_CURVEFIT_THERMO_RAW(class_name,conductivity) \ INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::CEACurveFit,conductivity,Antioch::StatMechThermodynamics); \ - INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::CEACurveFit,conductivity,GRINSPrivate::CEAIdealGasThermo) + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::CEACurveFit,conductivity,GRINSPrivate::CEAIdealGasThermo); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::NASA7CurveFit,conductivity,Antioch::StatMechThermodynamics); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::NASA7CurveFit,conductivity,GRINSPrivate::NASA7IdealGasThermo); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::NASA9CurveFit,conductivity,Antioch::StatMechThermodynamics); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_RAW(class_name,Antioch::NASA9CurveFit,conductivity,GRINSPrivate::NASA9IdealGasThermo) #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR(class_name) \ INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_CONSTANT_MIXTURE_AND_CONSTANT_EVALUATOR_CURVEFIT_THERMO_RAW(class_name,ConstantConductivity); \ @@ -58,6 +68,30 @@ namespace GRINSPrivate GRINSPrivate::CEAIdealGasThermo, \ viscosity, \ Antioch::EuckenThermalConductivity, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + Antioch::StatMechThermodynamics, \ + viscosity, \ + Antioch::EuckenThermalConductivity >, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + GRINSPrivate::NASA7IdealGasThermo, \ + viscosity, \ + Antioch::EuckenThermalConductivity, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + Antioch::StatMechThermodynamics, \ + viscosity, \ + Antioch::EuckenThermalConductivity >, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + GRINSPrivate::NASA9IdealGasThermo, \ + viscosity, \ + Antioch::EuckenThermalConductivity, \ Antioch::ConstantLewisDiffusivity) #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_KINETICS_THEORY_RAW(class_name) \ @@ -72,6 +106,30 @@ namespace GRINSPrivate GRINSPrivate::CEAIdealGasThermo, \ GRINSPrivate::KineticsViscosity, \ GRINSPrivate::KineticsConductivityCEA, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + Antioch::StatMechThermodynamics, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityStatMech, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + GRINSPrivate::NASA7IdealGasThermo, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityNASA7, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + Antioch::StatMechThermodynamics, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityStatMech, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_ONLY_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + GRINSPrivate::NASA9IdealGasThermo, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityNASA9, \ GRINSPrivate::BinaryDiffusion) #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTURE_ONLY(class_name) \ @@ -97,6 +155,30 @@ namespace GRINSPrivate GRINSPrivate::CEAIdealGasThermo, \ viscosity, \ Antioch::EuckenThermalConductivity, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + Antioch::StatMechThermodynamics, \ + viscosity, \ + Antioch::EuckenThermalConductivity >, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + GRINSPrivate::NASA7IdealGasThermo, \ + viscosity, \ + Antioch::EuckenThermalConductivity, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + Antioch::StatMechThermodynamics, \ + viscosity, \ + Antioch::EuckenThermalConductivity >, \ + Antioch::ConstantLewisDiffusivity); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + GRINSPrivate::NASA9IdealGasThermo, \ + viscosity, \ + Antioch::EuckenThermalConductivity, \ Antioch::ConstantLewisDiffusivity) #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_KINETICS_THEORY_RAW(class_name) \ @@ -111,6 +193,30 @@ namespace GRINSPrivate GRINSPrivate::CEAIdealGasThermo, \ GRINSPrivate::KineticsViscosity, \ GRINSPrivate::KineticsConductivityCEA, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + Antioch::StatMechThermodynamics, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityStatMech, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA7CurveFit, \ + GRINSPrivate::NASA7IdealGasThermo, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityNASA7, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + Antioch::StatMechThermodynamics, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityStatMech, \ + GRINSPrivate::BinaryDiffusion); \ + INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTUREAVERAGED_MIXTURE_AND_EVALUATOR_RAW(class_name, \ + Antioch::NASA9CurveFit, \ + GRINSPrivate::NASA9IdealGasThermo, \ + GRINSPrivate::KineticsViscosity, \ + GRINSPrivate::KineticsConductivityNASA9, \ GRINSPrivate::BinaryDiffusion) #define INSTANTIATE_REACTING_LOW_MACH_SUBCLASS_MIXTURE_AND_EVALUATOR(class_name) \ diff --git a/src/physics/src/physics_factory_reacting_flows.C b/src/physics/src/physics_factory_reacting_flows.C index f74940675..58a2588f3 100644 --- a/src/physics/src/physics_factory_reacting_flows.C +++ b/src/physics/src/physics_factory_reacting_flows.C @@ -2,6 +2,7 @@ #include "grins/physics_factory_reacting_flows.h" // GRINS +#include "grins/common.h" #include "grins/materials_parsing.h" #include "grins/cantera_mixture.h" #include "grins/cantera_evaluator.h" @@ -115,18 +116,100 @@ namespace GRINS const std::string & conductivity_model, const std::string & viscosity_model, std::unique_ptr & new_physics ) { + AntiochMixtureBuilderBase builder; + if( (thermo_model == AntiochOptions::stat_mech_thermo_model()) ) { - this->build_mix_avged_physics_with_thermo, - Antioch::StatMechThermodynamics > - (input,physics_name,material,diffusivity_model, - conductivity_model,viscosity_model, - new_physics); + ThermoEnum thermo_type = builder.get_thermo_type(input,material); + switch(thermo_type) + { + case(NASA7): + { + this->build_mix_avged_physics_with_thermo, + Antioch::StatMechThermodynamics > + (input,physics_name,material,diffusivity_model, + conductivity_model,viscosity_model, + new_physics); + + break; + } + case(NASA9): + { + this->build_mix_avged_physics_with_thermo, + Antioch::StatMechThermodynamics > + (input,physics_name,material,diffusivity_model, + conductivity_model,viscosity_model, + new_physics); + + break; + } + case(CEA): + { + this->build_mix_avged_physics_with_thermo, + Antioch::StatMechThermodynamics > + (input,physics_name,material,diffusivity_model, + conductivity_model,viscosity_model, + new_physics); + + break; + } + case(INVALID): + default: + libmesh_error_msg("ERROR: Invalid thermo type for thermo_model!"); + } + } + else if( thermo_model == AntiochOptions::ideal_gas_thermo_model() ) + { + ThermoEnum thermo_type = builder.get_thermo_type(input,material); + switch(thermo_type) + { + case(NASA7): + { + this->build_mix_avged_physics_with_thermo, + Antioch::IdealGasThermo,libMesh::Real> > + (input,physics_name,material,diffusivity_model, + conductivity_model,viscosity_model, + new_physics); + + break; + } + case(NASA9): + { + this->build_mix_avged_physics_with_thermo, + Antioch::IdealGasThermo,libMesh::Real> > + (input,physics_name,material,diffusivity_model, + conductivity_model,viscosity_model, + new_physics); + + break; + } + case(CEA): + { + this->build_mix_avged_physics_with_thermo, + Antioch::IdealGasThermo,libMesh::Real> > + (input,physics_name,material,diffusivity_model, + conductivity_model,viscosity_model, + new_physics); + + break; + } + case(INVALID): + default: + libmesh_error_msg("ERROR: Invalid thermo type for thermo_model!"); + } } else if( (thermo_model == AntiochOptions::cea_nasa_model()) ) { + { + std::string msg = "WARNING: Specifying thermo_model = "+AntiochOptions::cea_nasa_model(); + msg += "is DEPREACATED!\n"; + msg += " You should specify either "+AntiochOptions::stat_mech_thermo_model(); + msg += "or "+AntiochOptions::ideal_gas_thermo_model()+"\n"; + grins_warning(msg); + } + this->build_mix_avged_physics_with_thermo, - Antioch::IdealGasMicroThermo >, libMesh::Real> > + Antioch::IdealGasThermo,libMesh::Real> > (input,physics_name,material,diffusivity_model, conductivity_model,viscosity_model, new_physics); @@ -154,16 +237,87 @@ namespace GRINS libmesh_error_msg("Error: For constant transport_model, diffusivity model must be constant_lewis!"); + AntiochMixtureBuilderBase builder; + ThermoEnum thermo_type = builder.get_thermo_type(input,material); + if( thermo_model == AntiochOptions::stat_mech_thermo_model() ) { - this->build_const_physics_with_thermo, - Antioch::StatMechThermodynamics > - (input,physics_name,material,conductivity_model,new_physics); + switch(thermo_type) + { + case(NASA7): + { + this->build_const_physics_with_thermo, + Antioch::StatMechThermodynamics > + (input,physics_name,material,conductivity_model,new_physics); + + break; + } + case(NASA9): + { + this->build_const_physics_with_thermo, + Antioch::StatMechThermodynamics > + (input,physics_name,material,conductivity_model,new_physics); + + break; + } + case(CEA): + { + this->build_const_physics_with_thermo, + Antioch::StatMechThermodynamics > + (input,physics_name,material,conductivity_model,new_physics); + + break; + } + case(INVALID): + default: + libmesh_error_msg("ERROR: Invalid thermo type for thermo_model!"); + } + } + else if( thermo_model == AntiochOptions::ideal_gas_thermo_model() ) + { + switch(thermo_type) + { + case(NASA7): + { + this->build_const_physics_with_thermo, + Antioch::IdealGasThermo > > + (input,physics_name,material,conductivity_model,new_physics); + + break; + } + case(NASA9): + { + this->build_const_physics_with_thermo, + Antioch::IdealGasThermo > > + (input,physics_name,material,conductivity_model,new_physics); + + break; + } + case(CEA): + { + this->build_const_physics_with_thermo, + Antioch::IdealGasThermo > > + (input,physics_name,material,conductivity_model,new_physics); + + break; + } + case(INVALID): + default: + libmesh_error_msg("ERROR: Invalid thermo type for thermo_model!"); + } } else if( thermo_model == AntiochOptions::cea_nasa_model() ) { + { + std::string msg = "WARNING: Specifying thermo_model = "+AntiochOptions::cea_nasa_model(); + msg += "is DEPREACATED!\n"; + msg += " You should specify either "+AntiochOptions::stat_mech_thermo_model(); + msg += "or "+AntiochOptions::ideal_gas_thermo_model()+"\n"; + grins_warning(msg); + } + this->build_const_physics_with_thermo, - Antioch::IdealGasMicroThermo > > > + Antioch::IdealGasThermo,libMesh::Real> > (input,physics_name,material,conductivity_model,new_physics); } else diff --git a/src/properties/include/grins/antioch_constant_transport_evaluator.h b/src/properties/include/grins/antioch_constant_transport_evaluator.h index d6c048d39..b6fcd72b4 100644 --- a/src/properties/include/grins/antioch_constant_transport_evaluator.h +++ b/src/properties/include/grins/antioch_constant_transport_evaluator.h @@ -56,13 +56,13 @@ namespace GRINS public: AntiochConstantTransportEvaluator( const AntiochConstantTransportMixture& mixture ) - : AntiochEvaluator,Thermo>( mixture ), + : AntiochEvaluator( mixture ), _mu( mixture.mu() ), _conductivity( mixture.conductivity() ), _diffusivity( mixture.diffusivity() ) {} - virtual ~AntiochConstantTransportEvaluator(){} + virtual ~AntiochConstantTransportEvaluator() = default; libMesh::Real mu( const libMesh::Real /*T*/, const libMesh::Real /*P*/, diff --git a/src/properties/include/grins/antioch_evaluator.h b/src/properties/include/grins/antioch_evaluator.h index e4b8aaaef..b29e69824 100644 --- a/src/properties/include/grins/antioch_evaluator.h +++ b/src/properties/include/grins/antioch_evaluator.h @@ -40,7 +40,7 @@ #include "antioch/temp_cache.h" #include "antioch/cea_evaluator.h" #include "antioch/stat_mech_thermo.h" -#include "antioch/ideal_gas_micro_thermo.h" +#include "antioch/ideal_gas_thermo.h" namespace GRINS { @@ -57,9 +57,11 @@ namespace GRINS { public: + AntiochEvaluator() = delete; + AntiochEvaluator( const AntiochMixture& mixture ); - virtual ~AntiochEvaluator(){}; + virtual ~AntiochEvaluator() = default; // Chemistry libMesh::Real M( unsigned int species ) const; @@ -80,13 +82,20 @@ namespace GRINS std::string species_name( unsigned int species_index ) const; // Thermo - libMesh::Real cp( const libMesh::Real& T, const libMesh::Real P, const std::vector& Y ); + libMesh::Real cp( const libMesh::Real & T, const libMesh::Real P, const std::vector & Y ) + { return this->specialized_cp(T,P,Y,*_thermo); } - void cp_s( const libMesh::Real& T, const libMesh::Real P, const std::vector& Y, std::vector& Cp_s ); + void cp_s( const libMesh::Real & T, + const libMesh::Real P, + const std::vector & Y, + std::vector & cp_s ) + { this->specialized_cp_s(T,P,Y,*_thermo,cp_s); } - libMesh::Real cv( const libMesh::Real& T, const libMesh::Real P, const std::vector& Y ); + libMesh::Real cv( const libMesh::Real& T, const libMesh::Real P, const std::vector& Y ) + { return this->specialized_cv(T,P,Y,*_thermo); } - libMesh::Real h_s( const libMesh::Real& T, unsigned int species ); + libMesh::Real h_s( const libMesh::Real & T, unsigned int species ) + { return this->specialized_h_s(T,species,*_thermo); } // Kinetics void omega_dot( const libMesh::Real& T, libMesh::Real rho, @@ -120,30 +129,80 @@ namespace GRINS of Antioch::TempCache! */ void check_and_reset_temp_cache( const libMesh::Real& T ); - /* Below we will specialize the specialized_build_* functions to the appropriate type. - This way, we can control how the cached transport objects get constructed - based on the template type. This is achieved by the dummy types forcing operator - overloading for each of the specialized types. */ - void build_thermo( const AntiochMixture & mixture ) - { specialized_build_thermo( mixture, _thermo, thermo_type() ); } - private: - AntiochEvaluator(); + // StatMechThermodynamics methods + libMesh::Real specialized_cp( const libMesh::Real & T, + const libMesh::Real /*P*/, + const std::vector & Y, + const Antioch::StatMechThermodynamics & thermo ) + { + return thermo.cp( T, T, Y ); + } + + void specialized_cp_s( const libMesh::Real & T, + const libMesh::Real /*P*/, + const std::vector & Y, + const Antioch::StatMechThermodynamics & thermo, + std::vector & cp_s ) + { + libmesh_assert_equal_to(_chem.n_species(), Y.size()); + libmesh_assert_equal_to(Y.size(), cp_s.size()); + + for(unsigned int s = 0; s < Y.size(); s++) + cp_s[s] = thermo.cv(s, T, T) + this->R(s); + } + + libMesh::Real specialized_cv( const libMesh::Real & T, + const libMesh::Real /*P*/, + const std::vector & Y, + const Antioch::StatMechThermodynamics & thermo ) + { return thermo.cv( T, T, Y ); } + + libMesh::Real specialized_h_s( const libMesh::Real & T, unsigned int species, + const Antioch::StatMechThermodynamics & thermo ) + { return thermo.h_tot( species, T ) + this->_chem.h_stat_mech_ref_correction(species); } + + + + // IdealGasThermo methods + libMesh::Real specialized_cp( const libMesh::Real & T, + const libMesh::Real /*P*/, + const std::vector & Y, + const Antioch::IdealGasThermo & /*thermo*/ ) + { + this->check_and_reset_temp_cache(T); + return this->_nasa_evaluator->cp( *_temp_cache, Y ); + } + + void specialized_cp_s( const libMesh::Real & T, + const libMesh::Real /*P*/, + const std::vector & Y, + const Antioch::IdealGasThermo & /*thermo*/, + std::vector & cp_s ) + { + libmesh_assert_equal_to(_chem.n_species(), Y.size()); + libmesh_assert_equal_to(Y.size(), cp_s.size()); + + this->check_and_reset_temp_cache(T); + for(unsigned int s = 0; s < Y.size(); s++) + cp_s[s] = _nasa_evaluator->cp( *_temp_cache, s ); + } - void specialized_build_thermo( const AntiochMixture & mixture, - std::unique_ptr >& thermo, - thermo_type > ) + libMesh::Real specialized_cv( const libMesh::Real & T, + const libMesh::Real /*P*/, + const std::vector & Y, + const Antioch::IdealGasThermo & /*thermo*/ ) { - thermo.reset( new Antioch::StatMechThermodynamics( mixture.chemical_mixture() ) ); + this->check_and_reset_temp_cache(T); + return this->_nasa_evaluator->cv( *_temp_cache, Y ); } - void specialized_build_thermo( const AntiochMixture & mixture, - std::unique_ptr, libMesh::Real> > & thermo, - thermo_type, libMesh::Real> > ) + libMesh::Real specialized_h_s( const libMesh::Real & T, unsigned int species, + const Antioch::IdealGasThermo & /*thermo*/ ) { - _nasa_evaluator.reset( new Antioch::NASAEvaluator( mixture.nasa_mixture() ) ); - thermo.reset( new Antioch::IdealGasMicroThermo,libMesh::Real>( *_nasa_evaluator, mixture.chemical_mixture() ) ); + this->check_and_reset_temp_cache(T); + return this->_nasa_evaluator->h( *_temp_cache, species ); } }; diff --git a/src/properties/include/grins/antioch_mixture_averaged_transport_evaluator.h b/src/properties/include/grins/antioch_mixture_averaged_transport_evaluator.h index dbd29c274..cee920ea3 100644 --- a/src/properties/include/grins/antioch_mixture_averaged_transport_evaluator.h +++ b/src/properties/include/grins/antioch_mixture_averaged_transport_evaluator.h @@ -51,7 +51,7 @@ namespace GRINS output to confirm that Antioch was included in the build. */ template - class AntiochMixtureAveragedTransportEvaluator : public AntiochEvaluator,Thermo> + class AntiochMixtureAveragedTransportEvaluator : public AntiochEvaluator { public: diff --git a/src/properties/include/grins/antioch_mixture_averaged_transport_mixture.h b/src/properties/include/grins/antioch_mixture_averaged_transport_mixture.h index d5f7a7eb7..7d993f194 100644 --- a/src/properties/include/grins/antioch_mixture_averaged_transport_mixture.h +++ b/src/properties/include/grins/antioch_mixture_averaged_transport_mixture.h @@ -44,7 +44,7 @@ #include "antioch/vector_utils.h" #include "antioch/cea_curve_fit.h" #include "antioch/nasa_evaluator.h" -#include "antioch/ideal_gas_micro_thermo.h" +#include "antioch/ideal_gas_thermo.h" #include "antioch/stat_mech_thermo.h" #include "antioch/mixture_averaged_transport_mixture.h" #include "antioch/mixture_viscosity.h" @@ -93,9 +93,11 @@ namespace GRINS AntiochMixtureAveragedTransportMixture( std::unique_ptr > & chem_mixture, std::unique_ptr > & reaction_set, std::unique_ptr > & kinetics_thermo_mix, + std::unique_ptr & gas_thermo, std::unique_ptr > & trans_mix, std::unique_ptr > & wilke_mix, std::unique_ptr > & visc, + std::unique_ptr > & conductivity, std::unique_ptr > & diff, libMesh::Real min_T = -std::numeric_limits::max(), bool clip_negative_rho = false ); @@ -120,129 +122,16 @@ namespace GRINS std::unique_ptr _thermo; - //! For some Thermo types, we also need to cache a NASAEvaluator. - std::unique_ptr > _nasa_evaluator; - std::unique_ptr > _viscosity; std::unique_ptr > _conductivity; std::unique_ptr > _diffusivity; - /* Below we will specialize the specialized_build_* functions to the appropriate type. - This way, we can control how the cached transport objects get constructed - based on the template type. This is achieved by the dummy types forcing operator - overloading for each of the specialized types. */ - void build_thermo() - { specialized_build_thermo( _thermo, thermo_type() ); } - - void build_viscosity( const GetPot& input, const std::string& material ) - { specialized_build_viscosity( input, material, _viscosity, viscosity_type() ); } - - void build_conductivity() - { specialized_build_conductivity( _conductivity, conductivity_type() ); } - - void build_diffusivity( const GetPot& input, const std::string& material ) - { specialized_build_diffusivity( input, material, _diffusivity, diffusivity_type() ); } - private: AntiochMixtureAveragedTransportMixture(); - void specialized_build_thermo( std::unique_ptr > & thermo, - thermo_type > ) - { - thermo.reset( new Antioch::StatMechThermodynamics( *(this->_antioch_gas.get()) ) ); - } - - void specialized_build_thermo( std::unique_ptr,libMesh::Real> > & thermo, - thermo_type,libMesh::Real> > ) - { - _nasa_evaluator.reset( new Antioch::NASAEvaluator(this->nasa_mixture()) ); - thermo.reset( new Antioch::IdealGasMicroThermo, libMesh::Real>( *_nasa_evaluator, *(this->_antioch_gas.get()) ) ); - } - - void specialized_build_viscosity( const GetPot& input, - const std::string& material, - std::unique_ptr,libMesh::Real> > & viscosity, - viscosity_type > ) - { - viscosity.reset( new Antioch::MixtureViscosity,libMesh::Real>(*(_trans_mixture.get())) ); - - std::string sutherland_data = input("Materials/"+material+"/GasMixture/Antioch/sutherland_data", "default"); - if( sutherland_data == "default" ) - sutherland_data = Antioch::DefaultInstallFilename::sutherland_data(); - - Antioch::read_sutherland_data_ascii( *(viscosity.get()), sutherland_data ); - } - - void specialized_build_viscosity( const GetPot& input, - const std::string& material, - std::unique_ptr,libMesh::Real> > & viscosity, - viscosity_type > ) - { - viscosity.reset( new Antioch::MixtureViscosity,libMesh::Real>(*(_trans_mixture.get())) ); - - std::string blottner_data = input("Materials/"+material+"/GasMixture/Antioch/blottner_data", "default"); - if( blottner_data == "default" ) - blottner_data = Antioch::DefaultInstallFilename::blottner_data(); - - Antioch::read_blottner_data_ascii( *(viscosity.get()), blottner_data ); - } - -#ifdef ANTIOCH_HAVE_GSL - void specialized_build_viscosity( const GetPot& /*input*/, - const std::string& /*material*/, - std::unique_ptr,libMesh::Real> > & viscosity, - viscosity_type > ) - { - viscosity.reset( new Antioch::MixtureViscosity,libMesh::Real>(*(_trans_mixture.get())) ); - - Antioch::build_kinetics_theory_viscosity( *(viscosity.get()) ); - } -#endif // ANTIOCH_HAVE_GSL - - void specialized_build_conductivity( std::unique_ptr,libMesh::Real> > & conductivity, - conductivity_type > ) - { - conductivity.reset( new Antioch::MixtureConductivity,libMesh::Real>(*(_trans_mixture.get())) ); - Antioch::build_eucken_thermal_conductivity(*(conductivity.get()),*(_thermo.get())); - return; - } - -#ifdef ANTIOCH_HAVE_GSL - void specialized_build_conductivity( std::unique_ptr,libMesh::Real> > & conductivity, - conductivity_type > ) - { - conductivity.reset( new Antioch::MixtureConductivity,libMesh::Real>(*(_trans_mixture.get())) ); - - Antioch::build_kinetics_theory_thermal_conductivity( *(conductivity.get()), *(_thermo.get()) ); - } -#endif // ANTIOCH_HAVE_GSL - - void specialized_build_diffusivity( const GetPot& input, - const std::string& material, - std::unique_ptr,libMesh::Real> > & diffusivity, - diffusivity_type > ) - { - libMesh::Real Le = MaterialsParsing::parse_lewis_number(input,material); - - diffusivity.reset( new Antioch::MixtureDiffusion,libMesh::Real>(*(_trans_mixture.get())) ); - - Antioch::build_constant_lewis_diffusivity( *(diffusivity.get()), Le); - return; - } - -#ifdef ANTIOCH_HAVE_GSL - void specialized_build_diffusivity( const GetPot& /*input*/, - const std::string& /*material*/, - std::unique_ptr,libMesh::Real> > & diffusivity, - diffusivity_type > ) - { - diffusivity.reset( new Antioch::MixtureDiffusion,libMesh::Real>(*(_trans_mixture.get())) ); - } -#endif // ANTIOCH_HAVE_GSL - }; /* ------------------------- Inline Functions -------------------------*/ diff --git a/src/properties/include/grins/antioch_mixture_averaged_transport_mixture_builder.h b/src/properties/include/grins/antioch_mixture_averaged_transport_mixture_builder.h index 62bf606af..4891d31c1 100644 --- a/src/properties/include/grins/antioch_mixture_averaged_transport_mixture_builder.h +++ b/src/properties/include/grins/antioch_mixture_averaged_transport_mixture_builder.h @@ -46,8 +46,6 @@ namespace GRINS std::unique_ptr > build_mixture( const GetPot & input, const std::string & material ); - private: - std::unique_ptr > build_transport_mixture( const GetPot& input, const std::string& material, const Antioch::ChemicalMixture & chem_mix ); @@ -69,6 +67,14 @@ namespace GRINS const Antioch::TransportMixture & trans_mix ) { return specialized_build_diffusivity( input, material, trans_mix, diffusivity_type() ); } + template + std::unique_ptr > + build_conductivity( const Antioch::TransportMixture & trans_mix, + const Thermo & thermo ) + { return specialized_build_conductivity(trans_mix, thermo, conductivity_type() ); } + + private: + std::unique_ptr,libMesh::Real> > specialized_build_viscosity( const GetPot& input, const std::string& material, @@ -150,6 +156,35 @@ namespace GRINS } #endif // ANTIOCH_HAVE_GSL + template + std::unique_ptr,libMesh::Real> > + specialized_build_conductivity(const Antioch::TransportMixture & trans_mix, + const Thermo & thermo, + conductivity_type > ) + { + std::unique_ptr,libMesh::Real> > + conductivity( new Antioch::MixtureConductivity,libMesh::Real>(trans_mix) ); + Antioch::build_eucken_thermal_conductivity(*(conductivity.get()),thermo); + + return conductivity; + } + +#ifdef ANTIOCH_HAVE_GSL + template + std::unique_ptr,libMesh::Real> > + specialized_build_conductivity(const Antioch::TransportMixture & trans_mix, + const Thermo & thermo, + conductivity_type > ) + { + std::unique_ptr,libMesh::Real> > + conductivity( new Antioch::MixtureConductivity,libMesh::Real>(trans_mix)); + + Antioch::build_kinetics_theory_thermal_conductivity(*(conductivity.get()), thermo); + + return conductivity; + } +#endif // ANTIOCH_HAVE_GSL + }; @@ -165,9 +200,12 @@ namespace GRINS std::unique_ptr > reaction_set = this->build_reaction_set(input,material,*chem_mix); - std::unique_ptr > kinetics_thermo = + std::unique_ptr > nasa_mix = this->build_nasa_thermo_mix(input,material,*chem_mix); + std::unique_ptr gas_thermo = + this->build_gas_thermo( *chem_mix, *nasa_mix ); + std::unique_ptr > trans_mix = this->build_transport_mixture(input,material,*chem_mix); @@ -177,6 +215,9 @@ namespace GRINS std::unique_ptr > visc = this->build_viscosity(input,material,*trans_mix); + std::unique_ptr > cond = + this->build_conductivity(*trans_mix, *gas_thermo); + std::unique_ptr > diff = this->build_diffusivity(input,material,*trans_mix); @@ -185,7 +226,9 @@ namespace GRINS return std::unique_ptr > ( new AntiochMixtureAveragedTransportMixture - (chem_mix, reaction_set, kinetics_thermo, trans_mix, wilke_mix, visc, diff, min_T, clip_negative_rho) ); + (chem_mix, reaction_set, nasa_mix, gas_thermo, + trans_mix, wilke_mix, visc, cond, diff, + min_T, clip_negative_rho) ); } } // end namespace GRINS diff --git a/src/properties/include/grins/antioch_mixture_builder_base.h b/src/properties/include/grins/antioch_mixture_builder_base.h index 689b2f650..9381e2da8 100644 --- a/src/properties/include/grins/antioch_mixture_builder_base.h +++ b/src/properties/include/grins/antioch_mixture_builder_base.h @@ -32,6 +32,7 @@ // GRINS #include "grins/materials_parsing.h" +#include "grins/property_types.h" #include "grins/antioch_mixture.h" // Antioch @@ -42,6 +43,9 @@ #include "antioch/nasa_mixture.h" #include "antioch/cea_curve_fit.h" #include "antioch/nasa_mixture_parsing.h" +#include "antioch/ideal_gas_thermo.h" +#include "antioch/stat_mech_thermo.h" +#include "antioch/xml_parser.h" // libMesh #include "libmesh/auto_ptr.h" // std::unique_ptr @@ -55,6 +59,8 @@ class GetPot; namespace GRINS { + enum ThermoEnum {NASA7 = 0, NASA9, CEA, INVALID}; + //! Base class building Antioch mixture wrappers /*! This class only worries about building the kinetics and the thermo associated with kinetics. Subclasses @@ -65,21 +71,38 @@ namespace GRINS AntiochMixtureBuilderBase(){} ~AntiochMixtureBuilderBase(){} + //! Populates the passed in vector of strings with all the species names + /*! This method handles the details of how we parse the species names using Antioch's + parsing methods. The vector of strings will be sized accordingly, the user + does not need to worry about correct sizing. */ + void + build_species_names( const GetPot & input, const std::string & material, + std::vector & species_names); + + //! Returns a unique_ptr to a fully constructed Antioch::ChemicalMixture std::unique_ptr > build_chem_mix( const GetPot & input, const std::string & material ); + //! Returns a unique_ptr to a fully constructed Antioch::ReactionSet std::unique_ptr > build_reaction_set( const GetPot & input, const std::string & material, const Antioch::ChemicalMixture & chem_mix ); - template - std::unique_ptr > + ThermoEnum get_thermo_type( const GetPot & input, const std::string & material ) const; + + template + std::unique_ptr > build_nasa_thermo_mix( const GetPot & input, const std::string & material, const Antioch::ChemicalMixture & chem_mix ); + template + std::unique_ptr + build_gas_thermo( const Antioch::ChemicalMixture & chem_mix, + const Antioch::NASAThermoMixture & nasa_mix ) + { return specialized_build_gas_thermo( chem_mix, nasa_mix, thermo_type() ); } - template - std::unique_ptr > + template + std::unique_ptr > build_antioch_mixture(const GetPot & input, const std::string & material ); libMesh::Real parse_min_T( const GetPot & input, const std::string & material ) @@ -95,37 +118,163 @@ namespace GRINS protected: + template + std::unique_ptr > + specialized_build_gas_thermo( const Antioch::ChemicalMixture & chem_mix, + const Antioch::NASAThermoMixture & /*nasa_mix*/, + thermo_type > ) + { + return std::unique_ptr > + (new Antioch::StatMechThermodynamics(chem_mix)); + } + + template + std::unique_ptr > + specialized_build_gas_thermo( const Antioch::ChemicalMixture & chem_mix, + const Antioch::NASAThermoMixture & nasa_mix, + thermo_type > ) + { + return std::unique_ptr > + (new Antioch::IdealGasThermo(nasa_mix,chem_mix)); + } + void parse_nasa_data - ( Antioch::NASAThermoMixture > & nasa_mixture, - const GetPot & input, const std::string & material) + ( const GetPot & input, const std::string & material, Antioch::ParsingType parsing_type, + Antioch::NASAThermoMixture > & nasa_mixture ) { - std::string cea_data_filename = input( "Materials/"+material+"/GasMixture/Antioch/cea_data", "default" ); + switch(parsing_type) + { + case(Antioch::ASCII): + { + std::string prefix(this->antioch_prefix(material)); + std::string cea_data_filename = input( prefix+"/cea_data", "default" ); + + if( cea_data_filename == std::string("default") ) + cea_data_filename = Antioch::DefaultInstallFilename::thermo_data(); + + Antioch::read_nasa_mixture_data( nasa_mixture, cea_data_filename, Antioch::ASCII, false ); + + break; + } + case(Antioch::XML): + { + libmesh_error_msg("ERROR: XML Parsing of CEA not implemented. Use NASA7 or NASA9 instead!"); + break; + } + case(Antioch::CHEMKIN): + { + libmesh_error_msg("ERROR: ChemKin Parsing of CEA not implemented. Use NASA7!"); + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } + } - if( cea_data_filename == std::string("default") ) - cea_data_filename = Antioch::DefaultInstallFilename::thermo_data(); + void parse_nasa_data + ( const GetPot & input, const std::string & material, Antioch::ParsingType parsing_type, + Antioch::NASAThermoMixture > & nasa_mixture ) + { + switch(parsing_type) + { + case(Antioch::ASCII): + { + libmesh_error_msg("ERROR: ASCII Parsing of NASA7 not implemented. Use NASA9 instead for ASCII parser!"); + break; + } + case(Antioch::XML): + { + std::unique_ptr > parser = this->build_xml_parser(input,material); + libmesh_assert(parser->is_nasa7_curve_fit_type()); + parser->read_thermodynamic_data(nasa_mixture); + break; + } + case(Antioch::CHEMKIN): + { + libmesh_not_implemented(); + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } + } - Antioch::read_nasa_mixture_data( nasa_mixture, cea_data_filename, Antioch::ASCII, true ); + void parse_nasa_data + ( const GetPot & input, const std::string & material, Antioch::ParsingType parsing_type, + Antioch::NASAThermoMixture > & nasa_mixture ) + { + switch(parsing_type) + { + case(Antioch::ASCII): + { + libmesh_error_msg("ERROR: ASCII Parsing of NASA7 not implemented. Use NASA9 instead for ASCII parser!"); + break; + } + case(Antioch::XML): + { + std::unique_ptr > parser = this->build_xml_parser(input,material); + libmesh_assert(!parser->is_nasa7_curve_fit_type()); + parser->read_thermodynamic_data(nasa_mixture); + break; + } + case(Antioch::CHEMKIN): + { + libmesh_not_implemented(); + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } } + //! Helper function for parsing the chemical species + /*! The user-provided vector will populated with the chemical + species names in the input file. "Material/"+material+"/GasMixture/species" + is the option name. */ + void parse_chemical_species( const GetPot & input, + const std::string & option, + std::vector& species_names ); + + //! Determine the input file type the user is using for Antioch + /*! There are three valid options: ASCII, XML, and CHEMKIN. We will use a convention on the + suffix of the chemical_data file name to ascertain the parsing type. Once we know the + parsing type from this function, other functions can act accordingly. */ + Antioch::ParsingType get_antioch_parsing_type( const GetPot & input, const std::string & material ) const; + + //! Helper function to encapsulate parsing prefix + std::string antioch_prefix( const std::string & material ) const + { return std::string("Materials/"+material+"/GasMixture/Antioch"); } + + //! Helper function to build an XML parser when we need it. + /*! Builds an XMLParser using the chemical_data input option and the gas_mixture option. + Currently, not every *single* XMLParser is initialized this way, but most are. + Hopefully in the future we can stream line this a bit, but for now with + the current interface, we're building an XML parser several times, so let's + put that in one place. */ + std::unique_ptr > + build_xml_parser( const GetPot & input, const std::string & material ) const; + }; - template + template inline - std::unique_ptr > + std::unique_ptr > AntiochMixtureBuilderBase::build_nasa_thermo_mix( const GetPot & input, const std::string & material, const Antioch::ChemicalMixture & chem_mix ) { - std::unique_ptr > - nasa_mixture( new Antioch::NASAThermoMixture(chem_mix) ); + std::unique_ptr > + nasa_mixture( new Antioch::NASAThermoMixture(chem_mix) ); - this->parse_nasa_data( *nasa_mixture, input, material); + Antioch::ParsingType parsing_type = this->get_antioch_parsing_type(input,material); + + this->parse_nasa_data( input, material, parsing_type, *nasa_mixture); return nasa_mixture; } - template + template inline - std::unique_ptr > + std::unique_ptr > AntiochMixtureBuilderBase::build_antioch_mixture(const GetPot & input, const std::string & material ) { std::unique_ptr > chem_mixture = @@ -134,17 +283,55 @@ namespace GRINS std::unique_ptr > reaction_set = this->build_reaction_set(input,material,*chem_mixture); - std::unique_ptr > nasa_mixture = - this->build_nasa_thermo_mix(input,material,*chem_mixture); + std::unique_ptr > nasa_mixture = + this->build_nasa_thermo_mix(input,material,*chem_mixture); libMesh::Real min_T = this->parse_min_T(input,material); bool clip_negative_rho = this->parse_clip_negative_rho(input,material); - return std::unique_ptr > - ( new AntiochMixture + return std::unique_ptr > + ( new AntiochMixture (chem_mixture,reaction_set,nasa_mixture,min_T,clip_negative_rho) ); } + inline + ThermoEnum AntiochMixtureBuilderBase::get_thermo_type( const GetPot & input, + const std::string & material ) const + { + ThermoEnum thermo_type = ThermoEnum::INVALID; + + Antioch::ParsingType parsing_type = this->get_antioch_parsing_type(input,material); + switch(parsing_type) + { + case(Antioch::ASCII): + { + // ASCII Parsing is only CEA, so it'd better be CEA + thermo_type = ThermoEnum::CEA; + break; + } + case(Antioch::XML): + { + // XML can be NASA7 or NASA9, so we query the XML file to see which is in there. + std::unique_ptr > parser = this->build_xml_parser(input,material); + if( parser->is_nasa7_curve_fit_type() ) + thermo_type = ThermoEnum::NASA7; + else + thermo_type = ThermoEnum::NASA9; + break; + } + case(Antioch::CHEMKIN): + { + // ChemKin is NASA7 by definition of ChemKin format. + thermo_type = ThermoEnum::NASA7; + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } + + return thermo_type; + } + } // end namespace GRINS #endif // GRINS_HAVE_ANTIOCH diff --git a/src/properties/include/grins/materials_parsing.h b/src/properties/include/grins/materials_parsing.h index e86617deb..f46d5acfa 100644 --- a/src/properties/include/grins/materials_parsing.h +++ b/src/properties/include/grins/materials_parsing.h @@ -105,14 +105,6 @@ namespace GRINS //! Helper function to check for option and error out if it's not found. static void check_for_input_option( const GetPot & input, const std::string & option ); - //! Helper function for parsing the chemical species - /*! The user-provided vector will populated with the chemical - species names in the input file. "Physics/Chemistry/species" is - deprecated in favor of "Material/"+material+"/GasMixture/species" */ - static void parse_chemical_species( const GetPot & input, - const std::string & material, - std::vector& species_names ); - //! Helper function for parsing the chemical species and setting variable name /*! This function will parse the thermochemistry library requested by the user and then use the corresponding thermochemistry object to parse diff --git a/src/properties/src/antioch_chemistry.C b/src/properties/src/antioch_chemistry.C index edd4db985..5053a25db 100644 --- a/src/properties/src/antioch_chemistry.C +++ b/src/properties/src/antioch_chemistry.C @@ -32,6 +32,7 @@ // GRINS #include "grins/materials_parsing.h" +#include "grins/antioch_mixture_builder_base.h" // Antioch #include "antioch/default_filename.h" @@ -45,46 +46,14 @@ namespace GRINS const std::string& material ) : ParameterUser("AntiochChemistry") { - { - std::string warning = "==============================================\n"; - warning += "WARNING: This AntiochChemistry constructor is DEPREACTED!\n"; - warning += " Prefer alternate constructor where parsing\n"; - warning += " is done outside this class.\n"; - warning += "==============================================\n"; - - libmesh_warning(warning); - } - std::vector species_list; - MaterialsParsing::parse_chemical_species(input,material,species_list); - - bool verbose_antioch_read = input("Materials/"+material+"/GasMixture/Antioch/verbose_read",false); - - std::string species_data_filename = input("Materials/"+material+"/GasMixture/Antioch/species_data", "default" ); - if( species_data_filename == std::string("default") ) - species_data_filename = Antioch::DefaultInstallFilename::chemical_mixture(); - - std::string vibration_data_filename = input("Materials/"+material+"/GasMixture/Antioch/vibration_data", "default" ); - if( vibration_data_filename == std::string("default") ) - vibration_data_filename = Antioch::DefaultInstallFilename::vibrational_data(); - - std::string electronic_data_filename = input("Materials/"+material+"/GasMixture/Antioch/electronic_data", "default" ); - if( electronic_data_filename == std::string("default") ) - electronic_data_filename = Antioch::DefaultInstallFilename::electronic_data(); - - // By default, Antioch is using its ASCII parser. We haven't added more options yet. - _antioch_gas.reset( new Antioch::ChemicalMixture( species_list, - verbose_antioch_read, - species_data_filename, - vibration_data_filename, - electronic_data_filename ) ); + _antioch_gas = AntiochMixtureBuilderBase().build_chem_mix(input,material); } AntiochChemistry::AntiochChemistry ( std::unique_ptr > & chem_mixture ) : ParameterUser("AntiochChemistry") { - /*! \todo Use std::move when we have C++11 */ - _antioch_gas.reset( chem_mixture.release() ); + _antioch_gas = std::move(chem_mixture); } std::string AntiochChemistry::species_name( unsigned int species_index ) const diff --git a/src/properties/src/antioch_constant_transport_evaluator.C b/src/properties/src/antioch_constant_transport_evaluator.C index 9bedccccd..2a61e41e9 100644 --- a/src/properties/src/antioch_constant_transport_evaluator.C +++ b/src/properties/src/antioch_constant_transport_evaluator.C @@ -35,34 +35,18 @@ namespace GRINS { - template - AntiochConstantTransportEvaluator::AntiochConstantTransportEvaluator( const AntiochConstantTransportMixture& mixture ) - : AntiochEvaluator,Thermo>( mixture ), - _mu( mixture.mu() ), - _conductivity( mixture.conductivity() ), - _diffusivity( mixture.diffusivity() ) - { - return; - } - - template - AntiochConstantTransportEvaluator::~AntiochConstantTransportEvaluator() - { - return; - } - - template - libMesh::Real AntiochConstantTransportEvaluator::mu( const libMesh::Real /*T*/, - const libMesh::Real /*P*/, - const std::vector& /*Y*/ ) + template + libMesh::Real AntiochConstantTransportEvaluator::mu( const libMesh::Real /*T*/, + const libMesh::Real /*P*/, + const std::vector& /*Y*/ ) { return _mu; } - template - libMesh::Real AntiochConstantTransportEvaluator::k( const libMesh::Real T, - const libMesh::Real /*P*/, - const std::vector& Y ) + template + libMesh::Real AntiochConstantTransportEvaluator::k( const libMesh::Real T, + const libMesh::Real /*P*/, + const std::vector& Y ) { // Second T is dummy const libMesh::Real cp = this->cp( T, T, Y ); @@ -70,13 +54,13 @@ namespace GRINS return _conductivity( _mu, cp ); } - template - void AntiochConstantTransportEvaluator::mu_and_k_and_D( const libMesh::Real /*T*/, - const libMesh::Real rho, - const libMesh::Real cp, - const std::vector& /*Y*/, - libMesh::Real& mu, libMesh::Real& k, - std::vector& D ) + template + void AntiochConstantTransportEvaluator::mu_and_k_and_D( const libMesh::Real /*T*/, + const libMesh::Real rho, + const libMesh::Real cp, + const std::vector& /*Y*/, + libMesh::Real& mu, libMesh::Real& k, + std::vector& D ) { mu = _mu; diff --git a/src/properties/src/antioch_evaluator.C b/src/properties/src/antioch_evaluator.C index cecbb921e..d396b334d 100644 --- a/src/properties/src/antioch_evaluator.C +++ b/src/properties/src/antioch_evaluator.C @@ -36,6 +36,7 @@ // GRINS #include "grins/antioch_mixture.h" #include "grins/cached_values.h" +#include "grins/antioch_mixture_builder_base.h" namespace GRINS { @@ -43,11 +44,14 @@ namespace GRINS AntiochEvaluator:: AntiochEvaluator( const AntiochMixture& mixture ) : _chem( mixture ), + _nasa_evaluator( new Antioch::NASAEvaluator(mixture.nasa_mixture()) ), _kinetics( new AntiochKinetics(mixture) ), _minimum_T( mixture.minimum_T() ), _temp_cache( new Antioch::TempCache(1.0) ) { - this->build_thermo( mixture ); + AntiochMixtureBuilderBase builder; + _thermo = builder.build_gas_thermo + ( mixture.chemical_mixture(), mixture.nasa_mixture() ); } template @@ -61,84 +65,6 @@ namespace GRINS _kinetics->omega_dot( *(_temp_cache.get()), rho, mass_fractions, omega_dot ); } - template<> - libMesh::Real - AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> >:: - cp( const libMesh::Real& T, - const libMesh::Real /*P*/, - const std::vector& Y ) - { - this->check_and_reset_temp_cache(T); - return this->_nasa_evaluator->cp( *(_temp_cache.get()), Y ); - } - - template<> - void AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> >:: - cp_s( const libMesh::Real& T, - const libMesh::Real /*P*/, - const std::vector& Y, - std::vector& Cp_s ) - { - libmesh_assert_equal_to(Y.size(), Cp_s.size()); - this->check_and_reset_temp_cache(T); - for(unsigned int species = 0;species < Y.size();species++) - Cp_s[species] = _nasa_evaluator->cp( *(_temp_cache.get()), species ); - return; - } - - template<> - libMesh::Real AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> >:: - cv( const libMesh::Real& T, - const libMesh::Real /*P*/, - const std::vector& Y ) - { - this->check_and_reset_temp_cache(T); - return this->_nasa_evaluator->cv( *(_temp_cache.get()), Y ); - } - - template<> - libMesh::Real AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> >:: - h_s( const libMesh::Real& T, unsigned int species ) - { - this->check_and_reset_temp_cache(T); - - return this->_nasa_evaluator->h( *(_temp_cache.get()), species );; - } - - template<> - libMesh::Real AntiochEvaluator,Antioch::StatMechThermodynamics >::cp( const libMesh::Real& T, - const libMesh::Real /*P*/, - const std::vector& Y ) - { - return this->_thermo->cp( T, T, Y ); - } - - template<> - void AntiochEvaluator,Antioch::StatMechThermodynamics >::cp_s( const libMesh::Real& T, - const libMesh::Real /*P*/, - const std::vector& Y, - std::vector& Cp_s) - { - libmesh_assert_equal_to(Y.size(), Cp_s.size()); - for(unsigned int species = 0;species< Y.size();species++) - Cp_s[species] = _thermo->cv(species, T, T) + this->R(species); - return; - } - - template<> - libMesh::Real AntiochEvaluator,Antioch::StatMechThermodynamics >::cv( const libMesh::Real& T, - const libMesh::Real /*P*/, - const std::vector& Y ) - { - return this->_thermo->cv( T, T, Y ); - } - - template<> - libMesh::Real AntiochEvaluator,Antioch::StatMechThermodynamics >::h_s( const libMesh::Real& T, unsigned int species ) - { - return this->_thermo->h_tot( species, T ) + _chem.h_stat_mech_ref_correction(species); - } - } // end namespace GRINS #endif //GRINS_HAVE_ANTIOCH diff --git a/src/properties/src/antioch_evaluator_instantiate.C b/src/properties/src/antioch_evaluator_instantiate.C index 966192f7e..5030cbb7e 100644 --- a/src/properties/src/antioch_evaluator_instantiate.C +++ b/src/properties/src/antioch_evaluator_instantiate.C @@ -32,14 +32,21 @@ // Antioch #include "antioch/nasa_evaluator.h" +#include "antioch/nasa9_curve_fit.h" +#include "antioch/nasa7_curve_fit.h" #include "antioch/cea_curve_fit.h" #include "antioch/stat_mech_thermo.h" -#include "antioch/ideal_gas_micro_thermo.h" +#include "antioch/ideal_gas_thermo.h" // This class #include "antioch_evaluator.C" +template class GRINS::AntiochEvaluator,Antioch::StatMechThermodynamics >; +template class GRINS::AntiochEvaluator,Antioch::StatMechThermodynamics >; template class GRINS::AntiochEvaluator,Antioch::StatMechThermodynamics >; -template class GRINS::AntiochEvaluator, Antioch::IdealGasMicroThermo >, libMesh::Real> >; + +template class GRINS::AntiochEvaluator, Antioch::IdealGasThermo,libMesh::Real> >; +template class GRINS::AntiochEvaluator, Antioch::IdealGasThermo,libMesh::Real> >; +template class GRINS::AntiochEvaluator, Antioch::IdealGasThermo,libMesh::Real> >; #endif //GRINS_HAVE_ANTIOCH diff --git a/src/properties/src/antioch_kinetics_instantiate.C b/src/properties/src/antioch_kinetics_instantiate.C index 231d811cf..92152c843 100644 --- a/src/properties/src/antioch_kinetics_instantiate.C +++ b/src/properties/src/antioch_kinetics_instantiate.C @@ -32,10 +32,14 @@ // Antioch #include "antioch/cea_curve_fit.h" +#include "antioch/nasa9_curve_fit.h" +#include "antioch/nasa7_curve_fit.h" // This class #include "antioch_kinetics.C" +template class GRINS::AntiochKinetics >; +template class GRINS::AntiochKinetics >; template class GRINS::AntiochKinetics >; #endif //GRINS_HAVE_ANTIOCH diff --git a/src/properties/src/antioch_mixture.C b/src/properties/src/antioch_mixture.C index 88f14f52b..c09843102 100644 --- a/src/properties/src/antioch_mixture.C +++ b/src/properties/src/antioch_mixture.C @@ -33,6 +33,7 @@ // GRINS #include "grins/materials_parsing.h" +#include "grins/antioch_mixture_builder_base.h" // libMesh #include "libmesh/getpot.h" @@ -49,10 +50,10 @@ namespace GRINS AntiochMixture::AntiochMixture( const GetPot& input, const std::string& material ) : AntiochChemistry(input,material), - _reaction_set( new Antioch::ReactionSet( (*_antioch_gas.get()) ) ), - _nasa_mixture( new Antioch::NASAThermoMixture( (*_antioch_gas.get()) ) ), - _minimum_T( input( "Materials/"+material+"/GasMixture/Antioch/minimum_T", -std::numeric_limits::max() ) ), - _clip_negative_rho( input( "Materials/"+material+"/GasMixture/Antioch/clip_negative_rho", false) ) + _reaction_set( AntiochMixtureBuilderBase().build_reaction_set(input,material,(*_antioch_gas.get())) ), + _nasa_mixture( AntiochMixtureBuilderBase().build_nasa_thermo_mix(input,material,(*_antioch_gas.get())) ), + _minimum_T( AntiochMixtureBuilderBase().parse_min_T(input,material) ), + _clip_negative_rho( AntiochMixtureBuilderBase().parse_clip_negative_rho(input,material) ) { { std::string warning = "==============================================\n"; @@ -64,18 +65,6 @@ namespace GRINS libmesh_warning(warning); } - std::string kinetics_data_filename = MaterialsParsing::parse_chemical_kinetics_datafile_name( input, material ); - - bool verbose_read = input("screen-options/verbose_kinetics_read", false ); - - Antioch::read_reaction_set_data_xml( kinetics_data_filename, verbose_read, *_reaction_set.get() ); - - std::string cea_data_filename = input( "Materials/"+material+"/GasMixture/Antioch/cea_data", "default" ); - if( cea_data_filename == std::string("default") ) - cea_data_filename = Antioch::DefaultInstallFilename::thermo_data(); - - Antioch::read_nasa_mixture_data( *_nasa_mixture.get(), cea_data_filename, Antioch::ASCII, true ); - this->build_stat_mech_ref_correction(); } @@ -90,9 +79,8 @@ namespace GRINS _minimum_T(min_T), _clip_negative_rho(clip_negative_rho) { - /*! \todo Use std::move when we have C++11 */ - _reaction_set.reset( reaction_set.release() ); - _nasa_mixture.reset( nasa_mixture.release() ); + _reaction_set = std::move(reaction_set); + _nasa_mixture = std::move(nasa_mixture); this->build_stat_mech_ref_correction(); } diff --git a/src/properties/src/antioch_mixture_averaged_transport_mixture.C b/src/properties/src/antioch_mixture_averaged_transport_mixture.C index d1e8186df..2ef11a654 100644 --- a/src/properties/src/antioch_mixture_averaged_transport_mixture.C +++ b/src/properties/src/antioch_mixture_averaged_transport_mixture.C @@ -30,6 +30,9 @@ // This class #include "grins/antioch_mixture_averaged_transport_mixture.h" +// GRINS +#include "grins/antioch_mixture_averaged_transport_mixture_builder.h" + // Antioch #include "antioch/default_filename.h" @@ -53,29 +56,19 @@ namespace GRINS libmesh_warning(warning); } - std::string transport_data_filename = - input( "Materials/"+material+"/GasMixture/Antioch/transport_data", "default" ); - - if( transport_data_filename == std::string("default") ) - transport_data_filename = Antioch::DefaultInstallFilename::transport_mixture(); - - bool verbose_transport_read = - input( "Materials/"+material+"/GasMixture/Antioch/verbose_transport_read", false ); + AntiochMixtureAveragedTransportMixtureBuilder builder; - _trans_mixture.reset( new Antioch::TransportMixture( *(this->_antioch_gas.get()), - transport_data_filename, - verbose_transport_read, - Antioch::ParsingType::ASCII ) ); + _trans_mixture = builder.build_transport_mixture( input, material, *(this->_antioch_gas.get()) ); - _wilke_mixture.reset( new Antioch::MixtureAveragedTransportMixture(*(_trans_mixture.get()) ) ); + _wilke_mixture = builder.build_mix_avg_trans_mixture(*(this->_trans_mixture.get())); - this->build_thermo(); + _thermo = builder.build_gas_thermo( *(this->_antioch_gas.get()), *(this->_nasa_mixture.get()) ); - this->build_viscosity( input, material ); + _viscosity = builder.build_viscosity(input, material, (*(this->_trans_mixture.get()))); - this->build_conductivity( ); + _conductivity = builder.build_conductivity(*(this->_trans_mixture.get()), *(this->_thermo.get())); - this->build_diffusivity( input, material ); + _diffusivity = builder.build_diffusivity(input, material, (*(this->_trans_mixture.get()))); } template @@ -83,23 +76,22 @@ namespace GRINS ( std::unique_ptr > & chem_mixture, std::unique_ptr > & reaction_set, std::unique_ptr > & kinetics_thermo_mix, + std::unique_ptr & gas_thermo, std::unique_ptr > & trans_mix, std::unique_ptr > & wilke_mix, std::unique_ptr > & visc, + std::unique_ptr > & conductivity, std::unique_ptr > & diff, libMesh::Real min_T, bool clip_negative_rho ) - : AntiochMixture(chem_mixture,reaction_set,kinetics_thermo_mix,min_T,clip_negative_rho) - { - /*! \todo Use std::move when we have C++11 */ - _trans_mixture.reset( trans_mix.release() ); - _wilke_mixture.reset( wilke_mix.release() ); - _viscosity.reset( visc.release() ); - _diffusivity.reset( diff.release() ); - - this->build_thermo(); - this->build_conductivity(); - } + : AntiochMixture(chem_mixture,reaction_set,kinetics_thermo_mix,min_T,clip_negative_rho), + _trans_mixture(std::move(trans_mix)), + _wilke_mixture(std::move(wilke_mix)), + _thermo(std::move(gas_thermo)), + _viscosity(std::move(visc)), + _conductivity(std::move(conductivity)), + _diffusivity(std::move(diff)) + {} } // end namespace GRINS diff --git a/src/properties/src/antioch_mixture_averaged_transport_mixture_builder.C b/src/properties/src/antioch_mixture_averaged_transport_mixture_builder.C index 9262a7dbb..583b0b9fe 100644 --- a/src/properties/src/antioch_mixture_averaged_transport_mixture_builder.C +++ b/src/properties/src/antioch_mixture_averaged_transport_mixture_builder.C @@ -36,20 +36,48 @@ namespace GRINS build_transport_mixture( const GetPot & input, const std::string & material, const Antioch::ChemicalMixture & chem_mix ) { - std::string transport_data_filename = - input( "Materials/"+material+"/GasMixture/Antioch/transport_data", "default" ); + std::unique_ptr > trans_mix; - if( transport_data_filename == std::string("default") ) - transport_data_filename = Antioch::DefaultInstallFilename::transport_mixture(); + Antioch::ParsingType parsing_type = this->get_antioch_parsing_type(input,material); - bool verbose_transport_read = - input( "Materials/"+material+"/GasMixture/Antioch/verbose_transport_read", false ); + switch(parsing_type) + { + case(Antioch::ASCII): + { + std::string prefix(this->antioch_prefix(material)); - return std::unique_ptr > - ( new Antioch::TransportMixture( chem_mix, - transport_data_filename, - verbose_transport_read, - Antioch::ParsingType::ASCII ) ); + bool verbose_transport_read = + input( prefix+"/verbose_transport_read", false ); + + std::string transport_data_filename = + input( prefix+"/transport_data", "default" ); + + if( transport_data_filename == std::string("default") ) + transport_data_filename = Antioch::DefaultInstallFilename::transport_mixture(); + + trans_mix.reset( new Antioch::TransportMixture( chem_mix, + transport_data_filename, + verbose_transport_read, + Antioch::ParsingType::ASCII ) ); + + break; + } + case(Antioch::XML): + { + std::unique_ptr > parser = this->build_xml_parser(input,material); + trans_mix.reset( new Antioch::TransportMixture(chem_mix, parser.get()) ); + break; + } + case(Antioch::CHEMKIN): + { + libmesh_not_implemented(); + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } + + return trans_mix; } } // end namespace GRINS diff --git a/src/properties/src/antioch_mixture_builder_base.C b/src/properties/src/antioch_mixture_builder_base.C index bbcd71dc7..a6201033e 100644 --- a/src/properties/src/antioch_mixture_builder_base.C +++ b/src/properties/src/antioch_mixture_builder_base.C @@ -30,11 +30,13 @@ #include "grins/antioch_mixture_builder_base.h" // GRINS +#include "grins/common.h" #include "grins/materials_parsing.h" // Antioch #include "antioch/default_filename.h" #include "antioch/read_reaction_set_data.h" +#include "antioch/xml_parser.h" namespace GRINS { @@ -42,19 +44,21 @@ namespace GRINS AntiochMixtureBuilderBase::build_chem_mix( const GetPot & input, const std::string & material ) { std::vector species_list; - MaterialsParsing::parse_chemical_species(input,material,species_list); + this->build_species_names(input,material,species_list); - bool verbose_antioch_read = input("Materials/"+material+"/GasMixture/Antioch/verbose_read",false); + std::string prefix(this->antioch_prefix(material)); - std::string species_data_filename = input("Materials/"+material+"/GasMixture/Antioch/species_data", "default" ); + bool verbose_antioch_read = input(prefix+"/verbose_read",false); + + std::string species_data_filename = input(prefix+"/species_data", "default" ); if( species_data_filename == std::string("default") ) species_data_filename = Antioch::DefaultInstallFilename::chemical_mixture(); - std::string vibration_data_filename = input("Materials/"+material+"/GasMixture/Antioch/vibration_data", "default" ); + std::string vibration_data_filename = input(prefix+"/vibration_data", "default" ); if( vibration_data_filename == std::string("default") ) vibration_data_filename = Antioch::DefaultInstallFilename::vibrational_data(); - std::string electronic_data_filename = input("Materials/"+material+"/GasMixture/Antioch/electronic_data", "default" ); + std::string electronic_data_filename = input(prefix+"/electronic_data", "default" ); if( electronic_data_filename == std::string("default") ) electronic_data_filename = Antioch::DefaultInstallFilename::electronic_data(); @@ -74,15 +78,210 @@ namespace GRINS std::unique_ptr > reaction_set( new Antioch::ReactionSet(chem_mix) ); - std::string kinetics_data_filename = MaterialsParsing::parse_chemical_kinetics_datafile_name( input, material ); - bool verbose_read = input("screen-options/verbose_kinetics_read", false ); - Antioch::read_reaction_set_data_xml( kinetics_data_filename, verbose_read, *reaction_set ); + std::string prefix(this->antioch_prefix(material)); + std::string gas_mixture_option(prefix+"/gas_mixture"); + + Antioch::ParsingType parsing_type = this->get_antioch_parsing_type(input,material); + + switch(parsing_type) + { + // We're actually going to use Antioch's XML parser to parse the kinetics, + // but we distinguish ASCII because we need a separate GRINS input option + // to get the kinetics file. In the XML case, everything is in one XML file + // whereas with the ASCII, we have \infty files... + case(Antioch::ASCII): + { + std::string old_option("Materials/"+material+"/GasMixture/kinetics_data"); + std::string new_option(prefix+"/kinetics_data"); + + std::string filename; + if( input.have_variable(old_option) ) + { + // Deprecated message is in this function call + filename = MaterialsParsing::parse_chemical_kinetics_datafile_name( input, material ); + } + else if( input.have_variable(new_option) ) + filename = input(new_option,std::string("DIE!")); + + else + libmesh_error_msg("ERROR: Could not valid input for "+new_option+"!\n"); + + if( input.have_variable(gas_mixture_option) ) + { + std::string gas_mixture = input(gas_mixture_option,"DIE!"); + Antioch::XMLParser parser(filename, gas_mixture, verbose_read); + Antioch::read_reaction_set_data( verbose_read, *reaction_set, &parser ); + } + else + { + std::string msg = "WARNING: Option "+gas_mixture_option+" not found!\n"; + msg += " The first kinetics data set in the file "+filename+"\n"; + msg += " will be used. This is DEPRECATED behavior. In the future,\n"; + msg += " the option "+gas_mixture_option+" will be required.\n"; + grins_warning(msg); + + Antioch::read_reaction_set_data( filename, verbose_read, *reaction_set, Antioch::XML ); + } + break; + } + case(Antioch::XML): + { + std::unique_ptr > parser = this->build_xml_parser(input,material); + Antioch::read_reaction_set_data( verbose_read, *reaction_set, parser.get() ); + break; + } + case(Antioch::CHEMKIN): + { + libmesh_not_implemented(); + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } + + return reaction_set; } + void AntiochMixtureBuilderBase::build_species_names( const GetPot & input, const std::string & material, + std::vector & species_names) + { + // Clear out anything the user might've put in there. + species_names.clear(); + + Antioch::ParsingType parsing_type = this->get_antioch_parsing_type(input,material); + + std::string prefix(this->antioch_prefix(material)); + + switch(parsing_type) + { + case(Antioch::ASCII): + { + std::string old_option("Materials/"+material+"/GasMixture/species"); + std::string new_option(prefix+"/species"); + + if( input.have_variable(old_option) ) + this->parse_chemical_species(input,old_option,species_names); + + else if( input.have_variable(new_option) ) + this->parse_chemical_species(input,new_option,species_names); + + else + { + std::string msg = "ERROR: Could not find valid entry for "+new_option+" !\n"; + msg += " Using the ASCII parser with Antioch, you must explicitly\n"; + msg += " specify the list of species using the input option\n"; + msg += " "+new_option+" .\n"; + msg += " We strongly recommend switching to XML format.\n"; + + libmesh_error_msg(msg); + } + break; + } + case(Antioch::XML): + { + std::unique_ptr > parser = this->build_xml_parser(input,material); + species_names = parser->species_list(); + break; + } + case(Antioch::CHEMKIN): + { + libmesh_not_implemented(); + break; + } + default: + libmesh_error_msg("ERROR: Invalid Antioch parsing type!"); + } + } + + void AntiochMixtureBuilderBase::parse_chemical_species( const GetPot & input, + const std::string & option, + std::vector& species_names ) + { + + MaterialsParsing::check_for_input_option(input,option); + + // Read variable naming info + unsigned int n_species = input.vector_variable_size(option); + + species_names.reserve(n_species); + for( unsigned int i = 0; i < n_species; i++ ) + species_names.push_back( input( option, "DIE!", i ) ); + + } + + Antioch::ParsingType + AntiochMixtureBuilderBase::get_antioch_parsing_type( const GetPot & input, const std::string & material ) const + { + Antioch::ParsingType parsing_type = Antioch::ASCII; + + std::string prefix(this->antioch_prefix(material)); + std::string chem_data_option(prefix+"/"+MaterialsParsing::chemical_data_option()); + + // Check for old_option. If this is specified, then we are doing ASCII. + // We only really want to support XML and ChemKin parsing interfaces. + std::string old_option("Materials/"+material+"/GasMixture/species"); + if( input.have_variable(old_option) ) + { + parsing_type = Antioch::ASCII; + std::string warning = "WARNING: Specifying "+old_option+"is DEPRECATED!\n"; + warning += " Instead use the option "+prefix+"/species\n"; + warning += " or, preferred, use XML or ChemKin formats so that species\n"; + warning += " are parsed automatically.\n"; + grins_warning(warning); + } + + // If not the above, then we're new style. Check the suffix of the chemical data file. + // If .dat --> ASCII + // If .xml --> XML + // If .chemkin --> CHEMKIN + else if( input.have_variable(prefix+"/"+MaterialsParsing::chemical_data_option()) ) + { + std::string chem_data_filename = input(chem_data_option, std::string("DIE!") ); + if( chem_data_filename.find(".dat") != chem_data_filename.npos ) + parsing_type = Antioch::ASCII; + else if( chem_data_filename.find(".xml") != chem_data_filename.npos ) + parsing_type = Antioch::XML; + else if( chem_data_filename.find(".chemkin") != chem_data_filename.npos ) + parsing_type = Antioch::CHEMKIN; + else + { + std::string msg = "ERROR: Could not find valid input specification for "; + msg += prefix+"/"+MaterialsParsing::chemical_data_option()+"\n"; + msg += " Expected a filename with .dat, .xml, or .chemkin suffix.\n"; + libmesh_error_msg(msg); + } + } + else + { + std::string msg = "ERROR: Could not find valid input specification for "; + msg += prefix+"/"+MaterialsParsing::chemical_data_option()+"\n"; + libmesh_error_msg(msg); + } + + return parsing_type; + } + + std::unique_ptr > + AntiochMixtureBuilderBase::build_xml_parser( const GetPot & input, const std::string & material ) const + { + std::string prefix(this->antioch_prefix(material)); + + std::string chem_data_option(prefix+"/"+MaterialsParsing::chemical_data_option()); + std::string chem_data_filename = input(chem_data_option,std::string("DIE!")); + + std::string gas_mixture_option(prefix+"/gas_mixture"); + MaterialsParsing::check_for_input_option(input,gas_mixture_option); + + std::string gas_mixture = input(gas_mixture_option,"DIE!"); + + return std::unique_ptr > + ( new Antioch::XMLParser(chem_data_filename, gas_mixture, false) ); + } + } // end namespace GRINS #endif // GRINS_HAVE_ANTIOCH diff --git a/src/properties/src/materials_parsing.C b/src/properties/src/materials_parsing.C index 03cf57bc4..eefbee118 100644 --- a/src/properties/src/materials_parsing.C +++ b/src/properties/src/materials_parsing.C @@ -32,6 +32,10 @@ #include "grins/physics_naming.h" #include "grins/parameter_user.h" +#ifdef GRINS_HAVE_ANTIOCH +#include "grins/antioch_mixture_builder_base.h" +#endif // GRINS_HAVE_ANTIOCH + #ifdef GRINS_HAVE_CANTERA #include "grins/cantera_mixture.h" #endif //#ifdef GRINS_HAVE_CANTERA @@ -169,25 +173,6 @@ namespace GRINS libmesh_error_msg("ERROR: Detected non-positive "+property+"!"); } - void MaterialsParsing::parse_chemical_species( const GetPot & input, - const std::string & material, - std::vector& species_names ) - { - // Clear out anything the user might've put in there. - species_names.clear(); - - std::string option("Materials/"+material+"/GasMixture/species"); - MaterialsParsing::check_for_input_option(input,option); - - // Read variable naming info - unsigned int n_species = input.vector_variable_size(option); - - species_names.reserve(n_species); - for( unsigned int i = 0; i < n_species; i++ ) - species_names.push_back( input( option, "DIE!", i ) ); - - } - void MaterialsParsing::parse_species_varnames( const GetPot & input, const std::string & material, const std::string & prefix, @@ -238,7 +223,12 @@ namespace GRINS // specify the species explicitly else if( thermochem_lib == std::string("antioch") ) { - MaterialsParsing::parse_chemical_species(input,material,species_names); +#ifdef GRINS_HAVE_ANTIOCH + AntiochMixtureBuilderBase builder; + builder.build_species_names(input,material,species_names); +#else + libmesh_error_msg("ERROR: GRINS not compiled with Antioch! Reconfigure GRINS to use Antioch!"); +#endif // GRINS_HAVE_ANTIOCH } else libmesh_error_msg("ERROR: Invalid thermochem_lib value "+thermochem_lib+"!"); diff --git a/test/Makefile.am b/test/Makefile.am index f6a557857..2b796dfbe 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -141,7 +141,11 @@ interface_driver_SOURCES = interface/interface_driver.C \ interface/thermochem_test_common.h \ interface/air_5sp.C \ interface/antioch_mixture_builder_test.C \ - interface/absorption_coeff_testing.h + interface/absorption_coeff_testing.h \ + interface/antioch_parsing_type.C \ + interface/antioch_build_species_names.C + + antioch_mixture_averaged_transport_evaluator_regression_SOURCES = interface/antioch_mixture_averaged_transport_evaluator_regression.C @@ -288,6 +292,7 @@ TESTS += regression/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_arr TESTS += regression/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_power_catalytic_wall.sh TESTS += regression/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_gassolid_catalytic_wall.sh TESTS += regression/reacting_low_mach_antioch_kinetics_theory.sh +TESTS += regression/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis.sh TESTS += regression/ozone_flame_antioch_constant.sh TESTS += regression/ozone_flame_cantera.sh diff --git a/test/input_files/air.xml b/test/input_files/air.xml index a4f35f1ef..2557a687e 100644 --- a/test/input_files/air.xml +++ b/test/input_files/air.xml @@ -1000,6 +1000,14 @@ + + atom + 71.400 + 3.300 + 0.000 + 0.000 + 0.000 + @@ -1462,6 +1470,14 @@ + + linear + 75.000 + 3.860 + 0.000 + 0.000 + 1.000 + @@ -1526,6 +1542,14 @@ + + linear + 98.100 + 3.650 + 0.000 + 1.950 + 1.800 + @@ -1590,6 +1614,14 @@ + + linear + 244.000 + 3.760 + 0.000 + 2.650 + 2.100 + @@ -1894,14 +1926,14 @@ - + atom - 80.000 - 2.750 + 71.400 + 3.300 0.000 0.000 0.000 - + @@ -1966,13 +1998,13 @@ - + linear - 232.400 - 3.830 + 97.530 + 3.620 0.000 - 0.000 - 1.000 + 1.760 + 4.000 @@ -2183,14 +2215,14 @@ - + linear - 232.400 - 3.830 + 97.530 + 3.620 0.000 - 0.000 - 1.000 - + 1.760 + 4.000 + @@ -2366,14 +2398,14 @@ - + linear - 232.400 - 3.830 + 107.400 + 3.460 0.000 - 0.000 - 1.000 - + 1.600 + 3.800 + diff --git a/test/input_files/air_2sp.xml b/test/input_files/air_2sp.xml index e5bf5d264..0c059249c 100644 --- a/test/input_files/air_2sp.xml +++ b/test/input_files/air_2sp.xml @@ -515,8 +515,8 @@ atom - 80.000 - 2.750 + 71.400 + 3.298 0.000 0.000 0.000 @@ -556,11 +556,11 @@ linear - 232.400 - 3.830 + 97.53 + 3.621 0.000 - 0.000 - 1.000 + 1.76 + 4.000 diff --git a/test/input_files/reacting_low_mach_antioch_cea_constant_mole_fraction_input_regression.in b/test/input_files/reacting_low_mach_antioch_cea_constant_mole_fraction_input_regression.in index 2442285f7..e6e89c2fc 100644 --- a/test/input_files/reacting_low_mach_antioch_cea_constant_mole_fraction_input_regression.in +++ b/test/input_files/reacting_low_mach_antioch_cea_constant_mole_fraction_input_regression.in @@ -3,12 +3,12 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'constant' - thermo_model = 'cea' + thermo_model = 'ideal_gas' viscosity_model = 'constant' thermal_conductivity_model = 'constant' mass_diffusivity_model = 'constant_lewis' diff --git a/test/input_files/reacting_low_mach_antioch_cea_constant_prandtl_regression.in b/test/input_files/reacting_low_mach_antioch_cea_constant_prandtl_regression.in index f727adffa..a80600cf5 100644 --- a/test/input_files/reacting_low_mach_antioch_cea_constant_prandtl_regression.in +++ b/test/input_files/reacting_low_mach_antioch_cea_constant_prandtl_regression.in @@ -3,12 +3,12 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'constant' - thermo_model = 'cea' + thermo_model = 'ideal_gas' viscosity_model = 'constant' thermal_conductivity_model = 'constant_prandtl' mass_diffusivity_model = 'constant_lewis' diff --git a/test/input_files/reacting_low_mach_antioch_cea_constant_regression.in b/test/input_files/reacting_low_mach_antioch_cea_constant_regression.in index 9a47b8eb1..5bae0f95d 100644 --- a/test/input_files/reacting_low_mach_antioch_cea_constant_regression.in +++ b/test/input_files/reacting_low_mach_antioch_cea_constant_regression.in @@ -3,12 +3,12 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'constant' - thermo_model = 'cea' + thermo_model = 'ideal_gas' viscosity_model = 'constant' thermal_conductivity_model = 'constant' mass_diffusivity_model = 'constant_lewis' diff --git a/test/input_files/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.in b/test/input_files/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.in new file mode 100644 index 000000000..e1ca33e69 --- /dev/null +++ b/test/input_files/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.in @@ -0,0 +1,151 @@ +# Options related to all Physics +[Materials] + [./2SpeciesNGas] + [./GasMixture] + thermochemistry_library = 'antioch' + + [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' + transport_model = 'mixture_averaged' + thermo_model = 'ideal_gas' + viscosity_model = 'blottner' + thermal_conductivity_model = 'eucken' + mass_diffusivity_model = 'constant_lewis' + + [../../ThermodynamicPressure] + value = '10' #[Pa] + [../LewisNumber] + value = '1.4' +[] + +[Physics] + + enabled_physics = 'ReactingLowMachNavierStokes' + + [./ReactingLowMachNavierStokes] + + material = '2SpeciesNGas' + + ic_ids = '0' + ic_types = 'parsed' + ic_variables = 'T:w_N:w_N2:u' + ic_values = '{300.0}{0.4}{0.6}{1.0-y^2}' +[] + +[BoundaryConditions] + bc_ids = '0:2 3 1' + bc_id_name_map = 'Walls Inlet Outlet' + + [./Walls] + [./Velocity] + type = 'no_slip' + [../] + [./Temperature] + type = 'isothermal' + T = '300' + [../] + [./SpeciesMassFractions] + type = 'homogeneous_neumann' + [../] + [../] + + [./Inlet] + [./Velocity] + type = 'parsed_dirichlet' + u = '1-y^2' + v = '0.0' + [../] + [./Temperature] + type = 'isothermal' + T = '300' + [../] + [./SpeciesMassFractions] + type = 'constant_dirichlet' + w_N2 = '0.6' + w_N = '0.4' + [../] + [../] + + [./Outlet] + [./Velocity] + type = 'homogeneous_neumann' + [../] + [./Temperature] + type = 'homogeneous_neumann' + [../] + [./SpeciesMassFractions] + type = 'homogeneous_neumann' + [../] + [../] +[] + +[Variables] + [./SpeciesMassFractions] + names = 'w_' + fe_family = 'LAGRANGE' + order = 'SECOND' + material = '2SpeciesNGas' + [../] + [./Velocity] + names = 'u v' + fe_family = 'LAGRANGE' + order = 'SECOND' + [../] + [./Pressure] + names = 'p' + fe_family = 'LAGRANGE' + order = 'FIRST' + [../] + [./Temperature] + names = 'T' + fe_family = 'LAGRANGE' + order = 'SECOND' + [../] +[] + + +# Mesh related options +[Mesh] + [./Generation] + dimension = '2' + element_type = 'QUAD9' + x_min = '0.0' + x_max = '50.0' + y_min = '-1.0' + y_max = '1.0' + n_elems_x = '25' + n_elems_y = '5' +[] + +#Linear and nonlinear solver options +[linear-nonlinear-solver] +max_nonlinear_iterations = 15 +max_linear_iterations = 500 + +relative_step_tolerance = 1.0e-8 +relative_residual_tolerance = 1.0e-10 + +use_numerical_jacobians_only = 'true' + +# Visualization options +[vis-options] +output_vis = 'true' +vis_output_file_prefix = 'reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression' +output_format = 'xda' +[] + +# Options for print info to the screen +[screen-options] + +system_name = 'GRINS-TEST' + +print_equation_system_info = true +print_mesh_info = true +print_log_info = true +solver_verbose = true +solver_quiet = false + +print_element_jacobians = 'false' + +[] diff --git a/test/input_files/reacting_low_mach_antioch_kinetics_theory_regression.in b/test/input_files/reacting_low_mach_antioch_kinetics_theory_regression.in index ae5b4b9d4..f2f65ddee 100644 --- a/test/input_files/reacting_low_mach_antioch_kinetics_theory_regression.in +++ b/test/input_files/reacting_low_mach_antioch_kinetics_theory_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'mixture_averaged' thermo_model = 'stat_mech' viscosity_model = 'kinetics_theory' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_arrhenius_catalytic_wall_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_arrhenius_catalytic_wall_regression.in index c2b1b8c1d..31258c677 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_arrhenius_catalytic_wall_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_arrhenius_catalytic_wall_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'mixture_averaged' thermo_model = 'stat_mech' viscosity_model = 'blottner' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_catalytic_wall_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_catalytic_wall_regression.in index fd1dc1148..056f8812e 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_catalytic_wall_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_catalytic_wall_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'mixture_averaged' thermo_model = 'stat_mech' viscosity_model = 'blottner' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_gassolid_catalytic_wall_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_gassolid_catalytic_wall_regression.in index d642f60a2..fe6e11e78 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_gassolid_catalytic_wall_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_constant_gassolid_catalytic_wall_regression.in @@ -3,10 +3,10 @@ [./4SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N C CN' - kinetics_data = './input_files/air_4sp.xml' [./Antioch] + chemical_data = './input_files/air_4sp.xml' + gas_mixture = 'air4sp' transport_model = 'mixture_averaged' thermo_model = 'stat_mech' viscosity_model = 'blottner' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_power_catalytic_wall_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_power_catalytic_wall_regression.in index 801686cb0..98c04b078 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_power_catalytic_wall_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_power_catalytic_wall_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'mixture_averaged' thermo_model = 'stat_mech' viscosity_model = 'blottner' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_regression.in index d65a24f98..cb6e76964 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_blottner_eucken_lewis_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'mixture_averaged' thermo_model = 'stat_mech' viscosity_model = 'blottner' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_constant_prandtl_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_constant_prandtl_regression.in index 00a1affca..f6b145e64 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_constant_prandtl_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_constant_prandtl_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'constant' thermo_model = 'stat_mech' viscosity_model = 'constant' diff --git a/test/input_files/reacting_low_mach_antioch_statmech_constant_regression.in b/test/input_files/reacting_low_mach_antioch_statmech_constant_regression.in index 7c6bdb601..e48dd6e3c 100644 --- a/test/input_files/reacting_low_mach_antioch_statmech_constant_regression.in +++ b/test/input_files/reacting_low_mach_antioch_statmech_constant_regression.in @@ -3,10 +3,10 @@ [./2SpeciesNGas] [./GasMixture] thermochemistry_library = 'antioch' - species = 'N2 N' - kinetics_data = './input_files/air_2sp.xml' [./Antioch] + chemical_data = './input_files/air_2sp.xml' + gas_mixture = 'air2sp' transport_model = 'constant' thermo_model = 'stat_mech' viscosity_model = 'constant' diff --git a/test/interface/air_5sp.C b/test/interface/air_5sp.C index aae4dc644..88d244444 100644 --- a/test/interface/air_5sp.C +++ b/test/interface/air_5sp.C @@ -217,13 +217,13 @@ namespace GRINSTesting Y[_O_idx] = 0.2; Y[_N_idx] = 0.05; - this->test_cp_common >,GRINS::AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> > > + this->test_cp_common >,GRINS::AntiochEvaluator,Antioch::IdealGasThermo,libMesh::Real> > > ( *_antioch_mixture, Y, TestingUtils::epsilon()*100 ); } void test_hs() { - this->test_h_common >,GRINS::AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> > > + this->test_h_common >,GRINS::AntiochEvaluator,Antioch::IdealGasThermo,libMesh::Real> > > ( *_antioch_mixture, TestingUtils::epsilon()*100 ); } }; @@ -262,7 +262,7 @@ namespace GRINSTesting AirNASA9Thermo thermo; - this->test_omega_dot_common >,GRINS::AntiochEvaluator,Antioch::IdealGasMicroThermo >, libMesh::Real> > > + this->test_omega_dot_common >,GRINS::AntiochEvaluator,Antioch::IdealGasThermo,libMesh::Real> > > ( *_antioch_mixture, thermo, Y, TestingUtils::epsilon()*1e3 ); } }; diff --git a/test/interface/antioch_build_species_names.C b/test/interface/antioch_build_species_names.C new file mode 100644 index 000000000..bf71e2909 --- /dev/null +++ b/test/interface/antioch_build_species_names.C @@ -0,0 +1,837 @@ +//-------------------------------------------------------------------------- +// +// GRINS - General Reacting Incompressible Navier-Stokes +// +// Copyright (C) 2014-2016 Paul T. Bauman, Roy H. Stogner +// Copyright (C) 2010-2013 The PECOS Development Team +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the Version 2.1 GNU Lesser General +// Public License as published by the Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc. 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +//-----------------------------------------------------------------------el- + +#include "grins_config.h" + +#ifdef GRINS_HAVE_CPPUNIT +#ifdef GRINS_HAVE_ANTIOCH + +#include +#include + +//GRINS +#include "grins/antioch_mixture_builder_base.h" +#include "grins/antioch_mixture_averaged_transport_mixture_builder.h" + +namespace GRINSTesting +{ + class AntiochBuilderFormatTestBase + { + protected: + + // Handcoding our inputfile. Common things between all formats + std::string basic_input_setup( const std::string & chemical_data_filename ) + { + std::string text = "[Materials]\n"; + text +="[./TestMaterial]\n"; + text +="[./GasMixture]\n"; + text +="[./Antioch]\n"; + text += "chemical_data = './input_files/"+chemical_data_filename+"'\n"; + return text; + } + + // Specific for ASCII type parsing + std::string setup_ascii_input( const std::string & chemical_data_filename ) + { + std::string text = this->basic_input_setup(chemical_data_filename); + text += "species = 'O O2 O3'\n"; + + return text; + } + + // Specific for XML type parsing + std::string setup_xml_input( const std::string & chemical_data_filename, const std::string & mixture ) + { + std::string text = this->basic_input_setup(chemical_data_filename); + text += "gas_mixture = '"+mixture+"'\n"; + return text; + } + + libMesh::Real tol() + { return std::numeric_limits::epsilon() * 10; } + }; + + //! Test AntiochMixtureBuilderBase::build_species_names for different parsing formats + class AntiochBuilderFormatSpeciesNameTest : public CppUnit::TestCase, + public AntiochBuilderFormatTestBase, + public GRINS::AntiochMixtureBuilderBase + { + public: + + CPPUNIT_TEST_SUITE( AntiochBuilderFormatSpeciesNameTest ); + + CPPUNIT_TEST( test_ascii ); + CPPUNIT_TEST( test_xml_air5sp ); + CPPUNIT_TEST( test_xml_air9sp ); + + CPPUNIT_TEST_SUITE_END(); + + public: + + void test_ascii() + { + std::string inputfile = this->setup_ascii_input("ozone_species_data.dat"); + std::vector species_names = this->do_work(inputfile); + this->check_ascii(species_names); + } + + void test_xml_air5sp() + { + std::string inputfile = this->setup_xml_input("air.xml","air5sp"); + std::vector species_names = this->do_work(inputfile); + this->check_xml_air5sp(species_names); + } + + void test_xml_air9sp() + { + std::string inputfile = this->setup_xml_input("air.xml","air9sp_CO2"); + std::vector species_names = this->do_work(inputfile); + this->check_xml_air9sp(species_names); + } + + private: + + std::vector do_work( const std::string & inputfile ) + { + std::stringstream inputstream; + inputstream << inputfile; + + GetPot input(inputstream); + + std::vector species_names; + this->build_species_names(input,"TestMaterial",species_names); + + return species_names; + } + + void check_ascii( const std::vector & species_names ) + { + CPPUNIT_ASSERT_EQUAL(3,(int)species_names.size()); + CPPUNIT_ASSERT_EQUAL(std::string("O"),species_names[0]); + CPPUNIT_ASSERT_EQUAL(std::string("O2"),species_names[1]); + CPPUNIT_ASSERT_EQUAL(std::string("O3"),species_names[2]); + } + + void check_xml_air5sp( const std::vector & species_names ) + { + CPPUNIT_ASSERT_EQUAL(5,(int)species_names.size()); + CPPUNIT_ASSERT_EQUAL(std::string("N2"),species_names[0]); + CPPUNIT_ASSERT_EQUAL(std::string("O2"),species_names[1]); + CPPUNIT_ASSERT_EQUAL(std::string("NO"),species_names[2]); + CPPUNIT_ASSERT_EQUAL(std::string("N"),species_names[3]); + CPPUNIT_ASSERT_EQUAL(std::string("O"),species_names[4]); + } + + void check_xml_air9sp( const std::vector & species_names ) + { + CPPUNIT_ASSERT_EQUAL(9,(int)species_names.size()); + CPPUNIT_ASSERT_EQUAL(std::string("N2"),species_names[0]); + CPPUNIT_ASSERT_EQUAL(std::string("O2"),species_names[1]); + CPPUNIT_ASSERT_EQUAL(std::string("NO"),species_names[2]); + CPPUNIT_ASSERT_EQUAL(std::string("N"),species_names[3]); + CPPUNIT_ASSERT_EQUAL(std::string("O"),species_names[4]); + CPPUNIT_ASSERT_EQUAL(std::string("CO2"),species_names[5]); + CPPUNIT_ASSERT_EQUAL(std::string("CO"),species_names[6]); + CPPUNIT_ASSERT_EQUAL(std::string("CN"),species_names[7]); + CPPUNIT_ASSERT_EQUAL(std::string("C"),species_names[8]); + } + + }; + + //! Test AntiochMixtureBuilderBase::build_reaction_set for different parsing formats + class AntiochBuilderFormatKineticsTest : public CppUnit::TestCase, + public AntiochBuilderFormatTestBase, + public GRINS::AntiochMixtureBuilderBase + { + public: + + CPPUNIT_TEST_SUITE( AntiochBuilderFormatKineticsTest ); + + CPPUNIT_TEST( test_ascii ); + CPPUNIT_TEST( test_xml_air5sp ); + CPPUNIT_TEST( test_xml_air9sp ); + + CPPUNIT_TEST_SUITE_END(); + + public: + + void test_ascii() + { + std::string inputfile = this->setup_ascii_kinetics_input("ozone_species_data.dat", + "ozone.xml"); + std::unique_ptr > mixture; + std::unique_ptr > reaction_set; + + this->do_work( inputfile, mixture, reaction_set ); + + this->check_ozone_kinetics(*mixture,*reaction_set); + } + + void test_xml_air5sp() + { + std::string inputfile = this->setup_xml_input("air.xml","air5sp"); + std::unique_ptr > mixture; + std::unique_ptr > reaction_set; + + this->do_work( inputfile, mixture, reaction_set ); + + this->check_air5sp_kinetics(*mixture,*reaction_set); + } + + void test_xml_air9sp() + { + std::string inputfile = this->setup_xml_input("air.xml","air9sp_CO2"); + std::unique_ptr > mixture; + std::unique_ptr > reaction_set; + + this->do_work( inputfile, mixture, reaction_set ); + + this->check_air9sp_kinetics(*mixture,*reaction_set); + } + + private: + + void do_work( const std::string & inputfile, + std::unique_ptr > & mixture, + std::unique_ptr > & reaction_set ) + { + std::stringstream inputstream; + inputstream << inputfile; + + GetPot input(inputstream); + + mixture = this->build_chem_mix(input,"TestMaterial"); + reaction_set = this->build_reaction_set(input,"TestMaterial",*mixture); + } + + std::string setup_ascii_kinetics_input( const std::string & chemical_data_filename, + const std::string & kinetics_filename ) + { + std::string text = this->setup_ascii_input(chemical_data_filename); + text += "kinetics_data = './input_files/"+kinetics_filename+"'\n"; + + return text; + } + + void check_ozone_kinetics( const Antioch::ChemicalMixture & mixture, + const Antioch::ReactionSet & reaction_set ) + { + CPPUNIT_ASSERT_EQUAL(3,(int)reaction_set.n_reactions()); + + // Check first reaction + { + const Antioch::Reaction & modarr_threebody = reaction_set.reaction(0); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, modarr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, modarr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(modarr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = modarr_threebody.get_efficiency(s); + + if( species_name == std::string("O3") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.92, efficiency, this->tol()); + else if( species_name == std::string("O2") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.94, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.13, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + + // Check second reaction + { + const Antioch::Reaction & arr_threebody = reaction_set.reaction(1); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, arr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(arr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = arr_threebody.get_efficiency(s); + + if( species_name == std::string("O3") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.92, efficiency, this->tol()); + else if( species_name == std::string("O2") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.94, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.13, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + // Check third reaction + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(2); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + } + + + void check_air5sp_kinetics( const Antioch::ChemicalMixture & mixture, + const Antioch::ReactionSet & reaction_set ) + { + // This file actually has a lot more reactions, so we're additionally + // testing that we're stripping off reactions that include species + // that are not in the mixture that formed the reaction set. + CPPUNIT_ASSERT_EQUAL(5,(int)reaction_set.n_reactions()); + + this->check_air5sp_reactions_only(mixture,reaction_set); + } + + void check_air9sp_kinetics( const Antioch::ChemicalMixture & mixture, + const Antioch::ReactionSet & reaction_set ) + { + // This file actually has a lot more reactions, so we're additionally + // testing that we're stripping off reactions that include species + // that are not in the mixture that formed the reaction set. + CPPUNIT_ASSERT_EQUAL(15,(int)reaction_set.n_reactions()); + + this->check_air9sp_reactions_only(mixture,reaction_set); + } + + void check_air9sp_reactions_only( const Antioch::ChemicalMixture & mixture, + const Antioch::ReactionSet & reaction_set ) + { + // These reactions should be the same as the air5sp case + this->check_air5sp_reactions_only(mixture,reaction_set); + + // Now onto the other 10 reactions... + + // Reaction 7 in the air.xml file, reaction 5 in our ReactionSet + { + const Antioch::Reaction & arr_threebody = reaction_set.reaction(5); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, arr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(arr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = arr_threebody.get_efficiency(s); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + // Reaction 10 in the air.xml file, reaction 6 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(6); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 11 in the air.xml file, reaction 7 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(7); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 12 in the air.xml file, reaction 8 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(8); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 13 in the air.xml file, reaction 9 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(9); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 26 in the air.xml file, reaction 10 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(10); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 27 in the air.xml file, reaction 11 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(11); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 28 in the air.xml file, reaction 12 in our ReactionSet + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(12); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + + // Reaction 29 in the air.xml file, reaction 13 in our ReactionSet + { + const Antioch::Reaction & arr_threebody = reaction_set.reaction(13); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, arr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(arr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = arr_threebody.get_efficiency(s); + + if( species_name == std::string("N") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.029, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.029, efficiency, this->tol()); + else if( species_name == std::string("C") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.029, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + // Reaction 30 in the air.xml file, reaction 14 in our ReactionSet + { + const Antioch::Reaction & arr_threebody = reaction_set.reaction(14); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, arr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, arr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(arr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = arr_threebody.get_efficiency(s); + + if( species_name == std::string("N") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.478, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.478, efficiency, this->tol()); + else if( species_name == std::string("C") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.478, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + } + + + void check_air5sp_reactions_only( const Antioch::ChemicalMixture & mixture, + const Antioch::ReactionSet & reaction_set ) + { + // Check first reaction + { + const Antioch::Reaction & modarr_threebody = reaction_set.reaction(0); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, modarr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, modarr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(modarr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = modarr_threebody.get_efficiency(s); + + if( species_name == std::string("N") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(4.2857, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(4.2857, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + // Check second reaction + { + const Antioch::Reaction & modarr_threebody = reaction_set.reaction(1); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, modarr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, modarr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(modarr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = modarr_threebody.get_efficiency(s); + + if( species_name == std::string("N") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + // Check third reaction + { + const Antioch::Reaction & arr_threebody = reaction_set.reaction(2); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::THREE_BODY, arr_threebody.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_threebody.kinetics_model() ); + CPPUNIT_ASSERT(arr_threebody.reversible()); + + // Check threebody efficiencies + for( unsigned int s = 0; s < reaction_set.n_species(); s++ ) + { + std::string species_name = mixture.chemical_species()[s]->species(); + libMesh::Real efficiency = arr_threebody.get_efficiency(s); + + if( species_name == std::string("N") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(22.0, efficiency, this->tol()); + else if( species_name == std::string("O") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(22.0, efficiency, this->tol()); + else if( species_name == std::string("NO") ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(22.0, efficiency, this->tol()); + else + // Default should be 1.0 + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, efficiency, this->tol()); + } + } + + + // Check fourth reaction + { + const Antioch::Reaction & modarr_rev = reaction_set.reaction(3); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,modarr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::KOOIJ, modarr_rev.kinetics_model() ); + CPPUNIT_ASSERT(modarr_rev.reversible()); + } + + // Check fifth reaction + { + const Antioch::Reaction & arr_rev = reaction_set.reaction(4); + CPPUNIT_ASSERT_EQUAL(Antioch::ReactionType::ELEMENTARY ,arr_rev.type() ); + CPPUNIT_ASSERT_EQUAL(Antioch::KineticsModel::ARRHENIUS, arr_rev.kinetics_model() ); + CPPUNIT_ASSERT(arr_rev.reversible()); + } + } + + }; + + //! Test AntiochMixtureBuilderBase::build_reaction_set for different parsing formats + class AntiochBuilderFormatTransportTest : public CppUnit::TestCase, + public AntiochBuilderFormatTestBase, + public GRINS::AntiochMixtureAveragedTransportMixtureBuilder + { + public: + + CPPUNIT_TEST_SUITE( AntiochBuilderFormatTransportTest ); + + CPPUNIT_TEST( test_ascii ); + CPPUNIT_TEST( test_xml_air5sp ); + CPPUNIT_TEST( test_xml_air9sp ); + + CPPUNIT_TEST_SUITE_END(); + + public: + + void test_ascii() + { + std::string inputfile = this->setup_ascii_transport_input("ozone_species_data.dat", + "ozone_transport_data.dat"); + std::unique_ptr > mixture; + std::unique_ptr > transport_mixture; + + this->do_work( inputfile, mixture, transport_mixture ); + + this->check_ozone_transport(*transport_mixture); + } + + void test_xml_air5sp() + { + std::string inputfile = this->setup_xml_input("air.xml","air5sp"); + std::unique_ptr > mixture; + std::unique_ptr > transport_mixture; + + this->do_work( inputfile, mixture, transport_mixture ); + + this->check_air5sp_transport(*transport_mixture); + } + + void test_xml_air9sp() + { + std::string inputfile = this->setup_xml_input("air.xml","air9sp_CO2"); + std::unique_ptr > mixture; + std::unique_ptr > transport_mixture; + + this->do_work( inputfile, mixture, transport_mixture ); + + this->check_air9sp_transport(*transport_mixture); + } + + private: + + void do_work( const std::string & inputfile, + std::unique_ptr > & mixture, + std::unique_ptr > & transport_mixture ) + { + std::stringstream inputstream; + inputstream << inputfile; + + GetPot input(inputstream); + + mixture = this->build_chem_mix(input,"TestMaterial"); + transport_mixture = this->build_transport_mixture(input,"TestMaterial",*mixture); + } + + std::string setup_ascii_transport_input( const std::string & chemical_data_filename, + const std::string & transport_filename ) + { + std::string text = this->setup_ascii_input(chemical_data_filename); + text += "transport_data = './input_files/"+transport_filename+"'\n"; + + return text; + } + + void check_ozone_transport(const Antioch::TransportMixture & transport_mixture) + { + CPPUNIT_ASSERT_EQUAL(3,(int)transport_mixture.n_species()); + + // Check O Data + { + std::vector exact_data(5); + exact_data[0] = 80.; // LJ_depth + exact_data[1] = 2.75; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 0.; // polarizability + exact_data[4] = 0.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(0); + + this->check_transport_speces(species,exact_data); + } + + // Check O2 Data + { + std::vector exact_data(5); + exact_data[0] = 107.4; // LJ_depth + exact_data[1] = 3.458; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 1.6; // polarizability + exact_data[4] = 3.8; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(1); + + this->check_transport_speces(species,exact_data); + } + + // Check O3 Data + { + std::vector exact_data(5); + exact_data[0] = 180.; // LJ_depth + exact_data[1] = 4.1; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 0.; // polarizability + exact_data[4] = 2.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(2); + + this->check_transport_speces(species,exact_data); + } + } + + void check_air5sp_transport(const Antioch::TransportMixture & transport_mixture) + { + CPPUNIT_ASSERT_EQUAL(5,(int)transport_mixture.n_species()); + + this->check_air5sp_only(transport_mixture); + } + + void check_air9sp_transport(const Antioch::TransportMixture & transport_mixture) + { + CPPUNIT_ASSERT_EQUAL(9,(int)transport_mixture.n_species()); + + // Check first 5 species + this->check_air5sp_only(transport_mixture); + + // Now check remaining 4 species + + // Check CO2 Data + { + std::vector exact_data(5); + exact_data[0] = 244.; // LJ_depth + exact_data[1] = 3.76; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 2.65; // polarizability + exact_data[4] = 2.1; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(5); + + this->check_transport_speces(species,exact_data); + } + + // Check CO Data + { + std::vector exact_data(5); + exact_data[0] = 98.1; // LJ_depth + exact_data[1] = 3.65; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 1.95; // polarizability + exact_data[4] = 1.8; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(6); + + this->check_transport_speces(species,exact_data); + } + + // Check CN Data + { + std::vector exact_data(5); + exact_data[0] = 75.; // LJ_depth + exact_data[1] = 3.86; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 0.; // polarizability + exact_data[4] = 1.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(7); + + this->check_transport_speces(species,exact_data); + } + + // Check C Data + { + std::vector exact_data(5); + exact_data[0] = 71.4; // LJ_depth + exact_data[1] = 3.3; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 0.; // polarizability + exact_data[4] = 0.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(8); + + this->check_transport_speces(species,exact_data); + } + } + + void check_air5sp_only(const Antioch::TransportMixture & transport_mixture) + { + // Check N2 Data + { + std::vector exact_data(5); + exact_data[0] = 97.53; // LJ_depth + exact_data[1] = 3.62; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 1.76; // polarizability + exact_data[4] = 4.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(0); + + this->check_transport_speces(species,exact_data); + } + + // Check O2 Data + { + std::vector exact_data(5); + exact_data[0] = 107.4; // LJ_depth + exact_data[1] = 3.46; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 1.6; // polarizability + exact_data[4] = 3.8; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(1); + + this->check_transport_speces(species,exact_data); + } + + // Check NO Data + { + std::vector exact_data(5); + exact_data[0] = 97.53; // LJ_depth + exact_data[1] = 3.62; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 1.76; // polarizability + exact_data[4] = 4.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(2); + + this->check_transport_speces(species,exact_data); + } + + // Check N Data + { + std::vector exact_data(5); + exact_data[0] = 71.4; // LJ_depth + exact_data[1] = 3.3; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 0.; // polarizability + exact_data[4] = 0.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(3); + + this->check_transport_speces(species,exact_data); + } + + // Check O Data + { + std::vector exact_data(5); + exact_data[0] = 80.; // LJ_depth + exact_data[1] = 2.75; // LJ_diameter + exact_data[2] = 0.; // dipole moment + exact_data[3] = 0.; // polarizability + exact_data[4] = 0.; // rotational relaxation + + const Antioch::TransportSpecies & species = transport_mixture.transport_species(4); + + this->check_transport_speces(species,exact_data); + } + } + + void check_transport_speces(const Antioch::TransportSpecies & species, + const std::vector & exact_data) + { + CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_data[0], species.LJ_depth(), this->tol()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_data[1], species.LJ_diameter(), this->tol()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_data[2], species.dipole_moment(), this->tol()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_data[3], species.polarizability(), this->tol()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(exact_data[4], species.rotational_relaxation(), this->tol()); + } + }; + + CPPUNIT_TEST_SUITE_REGISTRATION( AntiochBuilderFormatSpeciesNameTest ); + CPPUNIT_TEST_SUITE_REGISTRATION( AntiochBuilderFormatKineticsTest ); + CPPUNIT_TEST_SUITE_REGISTRATION( AntiochBuilderFormatTransportTest ); + +} // end namespace GRINSTesting + +#endif // GRINS_HAVE_ANTIOCH +#endif // GRINS_HAVE_CPPUNIT diff --git a/test/interface/antioch_mixture_builder_test.C b/test/interface/antioch_mixture_builder_test.C index a58ca99b5..c20067525 100644 --- a/test/interface/antioch_mixture_builder_test.C +++ b/test/interface/antioch_mixture_builder_test.C @@ -300,14 +300,14 @@ namespace GRINSTesting GRINS::AntiochMixtureAveragedTransportMixtureBuilder builder; std::unique_ptr, - Antioch::IdealGasMicroThermo >, libMesh::Real>, + Antioch::IdealGasThermo,libMesh::Real>, Antioch::SutherlandViscosity, - Antioch::EuckenThermalConductivity >, libMesh::Real> > , + Antioch::EuckenThermalConductivity,libMesh::Real> > , Antioch::ConstantLewisDiffusivity > > mixture = builder.build_mixture, - Antioch::IdealGasMicroThermo >, libMesh::Real>, + Antioch::IdealGasThermo,libMesh::Real>, Antioch::SutherlandViscosity, - Antioch::EuckenThermalConductivity >, libMesh::Real> >, + Antioch::EuckenThermalConductivity,libMesh::Real> >, Antioch::ConstantLewisDiffusivity >( *_input, "TestMaterial" ); CPPUNIT_ASSERT(mixture); @@ -337,14 +337,14 @@ namespace GRINSTesting GRINS::AntiochMixtureAveragedTransportMixtureBuilder builder; std::unique_ptr, - Antioch::IdealGasMicroThermo >, libMesh::Real>, + Antioch::IdealGasThermo,libMesh::Real>, Antioch::KineticsTheoryViscosity, - Antioch::KineticsTheoryThermalConductivity >, libMesh::Real>,libMesh::Real>, + Antioch::KineticsTheoryThermalConductivity,libMesh::Real>,libMesh::Real>, Antioch::MolecularBinaryDiffusion > > mixture = builder.build_mixture, - Antioch::IdealGasMicroThermo >, libMesh::Real>, + Antioch::IdealGasThermo,libMesh::Real>, Antioch::KineticsTheoryViscosity, - Antioch::KineticsTheoryThermalConductivity >, libMesh::Real>,libMesh::Real>, + Antioch::KineticsTheoryThermalConductivity,libMesh::Real>,libMesh::Real>, Antioch::MolecularBinaryDiffusion >( *_input, "TestMaterial" ); CPPUNIT_ASSERT(mixture); diff --git a/test/interface/antioch_parsing_type.C b/test/interface/antioch_parsing_type.C new file mode 100644 index 000000000..9e4c7bc85 --- /dev/null +++ b/test/interface/antioch_parsing_type.C @@ -0,0 +1,105 @@ +//-------------------------------------------------------------------------- +// +// GRINS - General Reacting Incompressible Navier-Stokes +// +// Copyright (C) 2014-2016 Paul T. Bauman, Roy H. Stogner +// Copyright (C) 2010-2013 The PECOS Development Team +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the Version 2.1 GNU Lesser General +// Public License as published by the Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc. 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +//-----------------------------------------------------------------------el- + +#include "grins_config.h" + +#ifdef GRINS_HAVE_CPPUNIT +#ifdef GRINS_HAVE_ANTIOCH + +#include +#include + +//GRINS +#include "grins/antioch_mixture_builder_base.h" + +namespace GRINSTesting +{ + class AntiochParsingTypeTest : public CppUnit::TestCase, + public GRINS::AntiochMixtureBuilderBase + { + public: + + CPPUNIT_TEST_SUITE( AntiochParsingTypeTest ); + + CPPUNIT_TEST( test_ascii ); + CPPUNIT_TEST( test_xml ); + CPPUNIT_TEST( test_chemkin ); + + CPPUNIT_TEST_SUITE_END(); + + public: + + void test_ascii() + { + std::string suffix(".dat"); + this->run_test(suffix,Antioch::ASCII); + } + + void test_xml() + { + std::string suffix(".xml"); + this->run_test(suffix,Antioch::XML); + } + + void test_chemkin() + { + std::string suffix(".chemkin"); + this->run_test(suffix,Antioch::CHEMKIN); + } + + private: + + void run_test( const std::string & suffix, Antioch::ParsingType exact_parsing_type ) + { + GetPot input; + this->setup_inputfile(suffix,input); + + Antioch::ParsingType parsing_type = + this->get_antioch_parsing_type(input,std::string("TestMaterial")); + + CPPUNIT_ASSERT_EQUAL(exact_parsing_type,parsing_type); + } + + void setup_inputfile( const std::string & suffix, GetPot & input ) + { + std::string filename = "testfile"+suffix; + + std::string text = "[Materials]\n"; + text +="[./TestMaterial]\n"; + text +="[./GasMixture]\n"; + text +="[./Antioch]\n"; + text += "chemical_data = '"+filename+"'\n"; + + std::stringstream inputfile; + inputfile << text; + input.parse_input_stream(inputfile); + } + + }; + + CPPUNIT_TEST_SUITE_REGISTRATION( AntiochParsingTypeTest ); + +} // end namespace GRINSTesting + +#endif // GRINS_HAVE_ANTIOCH +#endif // GRINS_HAVE_CPPUNIT diff --git a/test/regression/ozone_flame_cantera.sh b/test/regression/ozone_flame_cantera.sh index 37bb48576..fa524895e 100755 --- a/test/regression/ozone_flame_cantera.sh +++ b/test/regression/ozone_flame_cantera.sh @@ -24,7 +24,7 @@ if [ $GRINS_CANTERA_ENABLED == 1 ]; then system_name='Ozone' \ vars='Ux Uy p T Y_O Y_O2 Y_O3' \ norms='L2 H1' \ - tol='3.0e-6' \ + tol='2.0e-5' \ gold-data=$GOLDDATA \ soln-data=$SOLNDATA diff --git a/test/regression/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis.sh b/test/regression/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis.sh new file mode 100755 index 000000000..9ba18490e --- /dev/null +++ b/test/regression/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +PROG="${GRINS_BUILDSRC_DIR}/grins" + +INPUT="${GRINS_TEST_INPUT_DIR}/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.in" + +PETSC_OPTIONS="-pc_type asm -pc_asm_overlap 10 -sub_pc_type ilu -sub_pc_factor_shift_type nonzero -sub_pc_factor_levels 10" + +# Solution output from GRINS run +SOLNDATA="./reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.xda" + +# Gold data used for regression comparsion +GOLDDATA="${GRINS_TEST_DATA_DIR}/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.xdr" + +if [ $GRINS_ANTIOCH_ENABLED == 1 ]; then + # First run the case with grins + ${LIBMESH_RUN:-} ${GRINS_BUILDSRC_DIR}/grins $INPUT $PETSC_OPTIONS + + # Now run the test part to make sure we're getting the correct thing + ${GRINS_TEST_DIR}/regression_testing_app \ + input=$INPUT \ + vars='u v p T w_N w_N2' \ + norms='L2 H1' \ + tol='3.1e-5' \ + gold-data=$GOLDDATA \ + soln-data=$SOLNDATA + + # Now remove the test turd + rm $SOLNDATA +else + exit 77; +fi diff --git a/test/regression/reacting_low_mach_cantera.sh b/test/regression/reacting_low_mach_cantera.sh index 4c7e69510..b30af2304 100755 --- a/test/regression/reacting_low_mach_cantera.sh +++ b/test/regression/reacting_low_mach_cantera.sh @@ -12,7 +12,7 @@ PETSC_OPTIONS="-pc_type asm -pc_asm_overlap 10 -sub_pc_type ilu -sub_pc_factor_s SOLNDATA="./reacting_low_mach_cantera_regression.xda" # Gold data used for regression comparsion -GOLDDATA="${GRINS_TEST_DATA_DIR}/reacting_low_mach_cantera_regression.xdr" +GOLDDATA="${GRINS_TEST_DATA_DIR}/reacting_low_mach_cantera_regression.xda.gz" if [ $GRINS_CANTERA_ENABLED == 1 ]; then # First run the case with grins @@ -23,7 +23,7 @@ if [ $GRINS_CANTERA_ENABLED == 1 ]; then input=$INPUT \ vars='u v p T w_N w_N2' \ norms='L2 H1' \ - tol='2.0e-7' \ + tol='2.2e-6' \ gold-data=$GOLDDATA \ soln-data=$SOLNDATA diff --git a/test/test_data/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.xdr b/test/test_data/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.xdr new file mode 100644 index 000000000..9bc593532 Binary files /dev/null and b/test/test_data/reacting_low_mach_antioch_ideal_gas_nasa9_blottner_eucken_lewis_regression.xdr differ diff --git a/test/test_data/reacting_low_mach_cantera_regression.xda.gz b/test/test_data/reacting_low_mach_cantera_regression.xda.gz new file mode 100644 index 000000000..248437bbe Binary files /dev/null and b/test/test_data/reacting_low_mach_cantera_regression.xda.gz differ diff --git a/test/test_data/reacting_low_mach_cantera_regression.xdr b/test/test_data/reacting_low_mach_cantera_regression.xdr deleted file mode 100644 index 82339c50e..000000000 Binary files a/test/test_data/reacting_low_mach_cantera_regression.xdr and /dev/null differ diff --git a/test/unit/input_files/variables_2d.in b/test/unit/input_files/variables_2d.in index d16e14e09..851d286a4 100644 --- a/test/unit/input_files/variables_2d.in +++ b/test/unit/input_files/variables_2d.in @@ -20,25 +20,8 @@ names = 'T' fe_family = 'LAGRANGE' order = 'FIRST' - [../SpeciesMassFractions] - material = '2SpeciesNGas' - names = 'Y_' - fe_family = 'LAGRANGE' - order = 'SECOND' [../SingleVariable] names = 'u' fe_family = 'LAGRANGE' order = 'FIRST' [] - -[Materials] - [./2SpeciesNGas] - [./GasMixture] - thermochemistry_library = 'antioch' - species = 'N2 N' -[] - -[Physics] - [./TestSpeciesMassFractionsVariables] - material = '2SpeciesNGas' -[] diff --git a/test/unit/input_files/variables_arbitrary_names.in b/test/unit/input_files/variables_arbitrary_names.in index 0b82ed84c..1ee841d4e 100644 --- a/test/unit/input_files/variables_arbitrary_names.in +++ b/test/unit/input_files/variables_arbitrary_names.in @@ -23,27 +23,9 @@ names = 'T' fe_family = 'LAGRANGE' order = 'FIRST' - [../MassFractions] - type = 'SpeciesMassFractions' - material = '2SpeciesNGas' - names = 'Y_' - fe_family = 'LAGRANGE' - order = 'SECOND' [../ForeverAlone] type = 'SingleVariable' names = 'u' fe_family = 'LAGRANGE' order = 'FIRST' [] - -[Materials] - [./2SpeciesNGas] - [./GasMixture] - thermochemistry_library = 'antioch' - species = 'N2 N' -[] - -[Physics] - [./TestSpeciesMassFractionsVariables] - material = '2SpeciesNGas' -[] diff --git a/test/unit/variables.C b/test/unit/variables.C index a1faf5829..9c1ea8b37 100644 --- a/test/unit/variables.C +++ b/test/unit/variables.C @@ -79,7 +79,6 @@ namespace GRINSTesting this->test_all_variables( GRINS::VariablesParsing::velocity_section(), GRINS::VariablesParsing::temperature_section(), - GRINS::VariablesParsing::species_mass_fractions_section(), GRINS::VariablesParsing::pressure_section(), GRINS::VariablesParsing::single_var_section() ); @@ -117,7 +116,6 @@ namespace GRINSTesting this->test_all_variables( "MySpeed", "TestingIsSoHot", - "MassFractions", "SoMuchPressure", "ForeverAlone" ); @@ -145,16 +143,36 @@ namespace GRINSTesting #endif // GRIN_HAVE_CANTERA } + void test_variable_species_from_antioch() + { +#ifdef GRIN_HAVE_ANTIOCH + std::string filename = + std::string(GRINS_TEST_UNIT_INPUT_SRCDIR)+"/variables_species_antioch.in"; + + this->setup_multiphysics_system(filename); + + GRINS::VariableBuilder::build_variables((*_input),(*_system)); + + // We're also testing the arbitrary naming of species variables with this test + const GRINS::FEVariablesBase& species_vars = + GRINS::GRINSPrivate::VariableWarehouse::get_variable("Barf"); + + const std::vector& var_names = species_vars.active_var_names(); + CPPUNIT_ASSERT_EQUAL( std::string("Y_O"), var_names[0] ); + CPPUNIT_ASSERT_EQUAL( std::string("Y_O2"), var_names[1] ); + CPPUNIT_ASSERT_EQUAL( std::string("Y_O3"), var_names[2] ); +#endif // GRIN_HAVE_ANTIOCH + } + private: void test_all_variables( const std::string& velocity_name, const std::string& temp_name, - const std::string& species_name, const std::string& press_name, const std::string& single_var_name ) { // There should be 7 variables generated from that input file - CPPUNIT_ASSERT_EQUAL((unsigned int)7,_system->n_vars()); + CPPUNIT_ASSERT_EQUAL((unsigned int)5,_system->n_vars()); // Check Velocity variables { @@ -180,18 +198,6 @@ namespace GRINSTesting this->test_temp_fe(*_system); } - // Check SpeciesMassFractions variables - { - const GRINS::FEVariablesBase& species_vars = - GRINS::GRINSPrivate::VariableWarehouse::get_variable(species_name); - - const std::vector& var_names = species_vars.active_var_names(); - this->test_species_var_names(var_names); - - // Verify the FE part - this->test_species_fe(*_system); - } - // Check Pressure variable { const GRINS::FEVariablesBase& press_vars =