From 0a21590dc232b8cc11e40b3d9b6ab9f5fee34bd5 Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Fri, 21 Apr 2017 16:29:53 -0400 Subject: [PATCH 1/7] Add SimulationInitializer --- src/Makefile.am | 2 + src/solver/include/grins/simulation.h | 3 + .../include/grins/simulation_initializer.h | 56 +++++++++++++++++++ src/solver/src/simulation.C | 6 +- src/solver/src/simulation_initializer.C | 42 ++++++++++++++ 5 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 src/solver/include/grins/simulation_initializer.h create mode 100644 src/solver/src/simulation_initializer.C diff --git a/src/Makefile.am b/src/Makefile.am index 9888cb241..2937d96e0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -225,6 +225,7 @@ libgrins_la_SOURCES += solver/src/steady_mesh_adaptive_solver.C libgrins_la_SOURCES += solver/src/solver_parsing.C libgrins_la_SOURCES += solver/src/time_stepping_parsing.C libgrins_la_SOURCES += solver/src/unsteady_mesh_adaptive_solver.C +libgrins_la_SOURCES += solver/src/simulation_initializer.C # src/strategies files libgrins_la_SOURCES += strategies/src/strategies_parsing.C @@ -510,6 +511,7 @@ include_HEADERS += solver/include/grins/solver_names.h include_HEADERS += solver/include/grins/time_stepping_parsing.h include_HEADERS += solver/include/grins/simulation_parsing.h include_HEADERS += solver/include/grins/unsteady_mesh_adaptive_solver.h +include_HEADERS += solver/include/grins/simulation_initializer.h # src/strategies headers include_HEADERS += strategies/include/grins/strategies_parsing.h diff --git a/src/solver/include/grins/simulation.h b/src/solver/include/grins/simulation.h index 5882c4b83..e3af37b43 100644 --- a/src/solver/include/grins/simulation.h +++ b/src/solver/include/grins/simulation.h @@ -31,6 +31,7 @@ // GRINS #include "grins_config.h" +#include "grins/simulation_initializer.h" #include "grins/shared_ptr.h" #include "grins/grins_solver.h" #include "grins/qoi_base.h" @@ -124,6 +125,8 @@ namespace GRINS void build_error_estimator(const GetPot& input); + SimulationInitializer _initializer; + SharedPtr _mesh; SharedPtr _equation_system; diff --git a/src/solver/include/grins/simulation_initializer.h b/src/solver/include/grins/simulation_initializer.h new file mode 100644 index 000000000..b5a8f508f --- /dev/null +++ b/src/solver/include/grins/simulation_initializer.h @@ -0,0 +1,56 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +#ifndef GRINS_SIMULATION_INITIALIZER_H +#define GRINS_SIMULATION_INITIALIZER_H + +namespace GRINS +{ + //! Initialize static objects needed for simulation + /*! The factory pattern used in GRINS uses static factory objects to handle + construction of various modules while providing an easy mechanism for + user extensibility for new variants. However, static linking will strip + the symbols unless the object is explicitly instantiated. So, we encapluate + instantiation of all the factory initialization objects here to ensure they + are instantiated before they are used by Simulation at construction time. */ + class SimulationInitializer + { + public: + SimulationInitializer(); + ~SimulationInitializer(){} + + private: + + // Flag to help guard against multiple initializations + /*! Simulation objects may need to be created multiple times within a single + GRINS-linked program (e.g. for parameter variations), so we need to cache + whether or not this initializer has been called during the current + program run. If so, then we don't instantiate the factory initializer objects + because they've already been created. */ + static bool _is_initialized; + + }; +} // end namespace GRINS + +#endif // GRINS_SIMULATION_INITIALIZER_H diff --git a/src/solver/src/simulation.C b/src/solver/src/simulation.C index b533c0871..5c59e5f5c 100644 --- a/src/solver/src/simulation.C +++ b/src/solver/src/simulation.C @@ -49,7 +49,8 @@ namespace GRINS Simulation::Simulation( const GetPot& input, SimulationBuilder& sim_builder, const libMesh::Parallel::Communicator &comm ) - : _mesh( sim_builder.build_mesh(input, comm) ), + : _initializer(), + _mesh( sim_builder.build_mesh(input, comm) ), _equation_system( new libMesh::EquationSystems( *_mesh ) ), _solver( sim_builder.build_solver(input) ), _system_name( input("screen-options/system_name", "GRINS" ) ), @@ -98,7 +99,8 @@ namespace GRINS GetPot& command_line, SimulationBuilder& sim_builder, const libMesh::Parallel::Communicator &comm ) - : _mesh( sim_builder.build_mesh(input, comm) ), + : _initializer(), + _mesh( sim_builder.build_mesh(input, comm) ), _equation_system( new libMesh::EquationSystems( *_mesh ) ), _solver( sim_builder.build_solver(input) ), _system_name( input("screen-options/system_name", "GRINS" ) ), diff --git a/src/solver/src/simulation_initializer.C b/src/solver/src/simulation_initializer.C new file mode 100644 index 000000000..461632963 --- /dev/null +++ b/src/solver/src/simulation_initializer.C @@ -0,0 +1,42 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +// This class +#include "grins/simulation_initializer.h" + +// GRINS +#include "grins/error_estimator_factory_initializer.h" + +namespace GRINS +{ + bool SimulationInitializer::_is_initialized = false; + + SimulationInitializer::SimulationInitializer() + { + if( !_is_initialized ) + { + _is_initialized = true; + } + } +} // end namespace GRINS From 571bda3dc3b70f757843be4a967530227a502600 Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Mon, 24 Apr 2017 16:37:25 -0400 Subject: [PATCH 2/7] Instantiate SimulationInitializer separately We can't count on when the Initializer objects will be destroyed, so we can just have SimulationInitializer be a member of Simulation, we need to instantiate it in the main program and let it live for the duration of the program. --- examples/cavity_benchmark/cavity.C | 5 ++++- examples/elastic_sheet/stretching_sheet.C | 2 ++ examples/inflating_sheet/inflating_sheet.C | 6 ++++-- src/solver/include/grins/simulation.h | 3 --- src/solver/src/grins.C | 3 +++ src/solver/src/simulation.C | 6 ++---- test/exact_soln/vorticity_qoi.C | 5 ++++- test/regression/3d_low_mach_jacobians.C | 5 ++++- test/regression/elastic_sheet_regression.C | 5 ++++- test/regression/generic_solution_regression.C | 3 +++ test/regression/grins_flow_regression.C | 5 ++++- test/regression/low_mach_cavity_benchmark_regression.C | 7 +++++-- test/regression/test_turbulent_channel.C | 3 +++ test/unit/unit_driver.C | 3 +++ 14 files changed, 45 insertions(+), 16 deletions(-) diff --git a/examples/cavity_benchmark/cavity.C b/examples/cavity_benchmark/cavity.C index 86498a0c7..221a57647 100644 --- a/examples/cavity_benchmark/cavity.C +++ b/examples/cavity_benchmark/cavity.C @@ -29,6 +29,7 @@ // GRINS #include "grins/simulation.h" #include "grins/simulation_builder.h" +#include "grins/simulation_initializer.h" // GRVY #ifdef GRINS_HAVE_GRVY @@ -72,7 +73,9 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/examples/elastic_sheet/stretching_sheet.C b/examples/elastic_sheet/stretching_sheet.C index 4f6254c73..4ab1b985a 100644 --- a/examples/elastic_sheet/stretching_sheet.C +++ b/examples/elastic_sheet/stretching_sheet.C @@ -28,6 +28,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation_builder.h" #include "grins/simulation.h" @@ -98,6 +99,7 @@ int main(int argc, char* argv[]) grvy_timer.BeginTimer("Initialize Solver"); #endif + GRINS::SimulationInitializer initializer; GRINS::SimulationBuilder sim_builder; GRINS::SharedPtr solver_factory( new GRINS::DisplacementContinuationSolverFactory ); sim_builder.attach_solver_factory(solver_factory); diff --git a/examples/inflating_sheet/inflating_sheet.C b/examples/inflating_sheet/inflating_sheet.C index d6e1db880..eec48860c 100644 --- a/examples/inflating_sheet/inflating_sheet.C +++ b/examples/inflating_sheet/inflating_sheet.C @@ -27,6 +27,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation_builder.h" #include "grins/simulation.h" @@ -65,12 +66,13 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + libMesh::out << "Starting GRINS with command:\n"; for (int i=0; i != argc; ++i) libMesh::out << argv[i] << ' '; libMesh::out << std::endl; - + + GRINS::SimulationInitializer initializer; GRINS::SimulationBuilder sim_builder; GRINS::SharedPtr sheet_factory( new GRINS::InflatingSheetSolverFactory ); diff --git a/src/solver/include/grins/simulation.h b/src/solver/include/grins/simulation.h index e3af37b43..5882c4b83 100644 --- a/src/solver/include/grins/simulation.h +++ b/src/solver/include/grins/simulation.h @@ -31,7 +31,6 @@ // GRINS #include "grins_config.h" -#include "grins/simulation_initializer.h" #include "grins/shared_ptr.h" #include "grins/grins_solver.h" #include "grins/qoi_base.h" @@ -125,8 +124,6 @@ namespace GRINS void build_error_estimator(const GetPot& input); - SimulationInitializer _initializer; - SharedPtr _mesh; SharedPtr _equation_system; diff --git a/src/solver/src/grins.C b/src/solver/src/grins.C index 6f6b08e68..1db39c275 100644 --- a/src/solver/src/grins.C +++ b/src/solver/src/grins.C @@ -28,6 +28,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation_builder.h" #include "grins/simulation.h" @@ -101,6 +102,8 @@ int main(int argc, char* argv[]) grvy_timer.BeginTimer("Initialize Solver"); #endif + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/src/solver/src/simulation.C b/src/solver/src/simulation.C index 5c59e5f5c..b533c0871 100644 --- a/src/solver/src/simulation.C +++ b/src/solver/src/simulation.C @@ -49,8 +49,7 @@ namespace GRINS Simulation::Simulation( const GetPot& input, SimulationBuilder& sim_builder, const libMesh::Parallel::Communicator &comm ) - : _initializer(), - _mesh( sim_builder.build_mesh(input, comm) ), + : _mesh( sim_builder.build_mesh(input, comm) ), _equation_system( new libMesh::EquationSystems( *_mesh ) ), _solver( sim_builder.build_solver(input) ), _system_name( input("screen-options/system_name", "GRINS" ) ), @@ -99,8 +98,7 @@ namespace GRINS GetPot& command_line, SimulationBuilder& sim_builder, const libMesh::Parallel::Communicator &comm ) - : _initializer(), - _mesh( sim_builder.build_mesh(input, comm) ), + : _mesh( sim_builder.build_mesh(input, comm) ), _equation_system( new libMesh::EquationSystems( *_mesh ) ), _solver( sim_builder.build_solver(input) ), _system_name( input("screen-options/system_name", "GRINS" ) ), diff --git a/test/exact_soln/vorticity_qoi.C b/test/exact_soln/vorticity_qoi.C index 5502a01bf..7e4a75d26 100644 --- a/test/exact_soln/vorticity_qoi.C +++ b/test/exact_soln/vorticity_qoi.C @@ -28,6 +28,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation.h" #include "grins/simulation_builder.h" #include "grins/multiphysics_sys.h" @@ -70,7 +71,9 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/test/regression/3d_low_mach_jacobians.C b/test/regression/3d_low_mach_jacobians.C index 0cda4c39f..72486efae 100644 --- a/test/regression/3d_low_mach_jacobians.C +++ b/test/regression/3d_low_mach_jacobians.C @@ -27,6 +27,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation.h" #include "grins/simulation_builder.h" @@ -75,7 +76,9 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/test/regression/elastic_sheet_regression.C b/test/regression/elastic_sheet_regression.C index 8c9d9d6b8..d975ca293 100644 --- a/test/regression/elastic_sheet_regression.C +++ b/test/regression/elastic_sheet_regression.C @@ -27,6 +27,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation.h" #include "grins/simulation_builder.h" @@ -87,7 +88,9 @@ int run( int argc, char* argv[], const GetPot& input ) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( input, diff --git a/test/regression/generic_solution_regression.C b/test/regression/generic_solution_regression.C index b1f9c13b9..642a64c49 100644 --- a/test/regression/generic_solution_regression.C +++ b/test/regression/generic_solution_regression.C @@ -25,6 +25,7 @@ #include "grins_config.h" // GRINS +#include "grins/simulation_initializer.h" #include "grins/mesh_builder.h" #include "grins/simulation.h" #include "grins/simulation_builder.h" @@ -104,6 +105,8 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/test/regression/grins_flow_regression.C b/test/regression/grins_flow_regression.C index 5fbf6b0b1..670250400 100644 --- a/test/regression/grins_flow_regression.C +++ b/test/regression/grins_flow_regression.C @@ -27,6 +27,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/simulation.h" #include "grins/simulation_builder.h" @@ -54,7 +55,9 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/test/regression/low_mach_cavity_benchmark_regression.C b/test/regression/low_mach_cavity_benchmark_regression.C index c4ebdd836..597fd854d 100644 --- a/test/regression/low_mach_cavity_benchmark_regression.C +++ b/test/regression/low_mach_cavity_benchmark_regression.C @@ -28,7 +28,8 @@ // GRINS #include "grins/simulation.h" -#include "grins/simulation_builder.h" +#include "grins/simulation_initializer.h" +#include "grins/simulation_builder.h" // Function for getting initial temperature field libMesh::Real @@ -56,12 +57,14 @@ int main(int argc, char* argv[]) // Initialize libMesh library. libMesh::LibMeshInit libmesh_init(argc, argv); - + // This is a tough problem to get to converge without PETSc libmesh_example_requires (libMesh::default_solver_package() != libMesh::LASPACK_SOLVERS, "--enable-petsc"); + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/test/regression/test_turbulent_channel.C b/test/regression/test_turbulent_channel.C index f325a750a..79364c876 100644 --- a/test/regression/test_turbulent_channel.C +++ b/test/regression/test_turbulent_channel.C @@ -28,6 +28,7 @@ #include // GRINS +#include "grins/simulation_initializer.h" #include "grins/mesh_builder.h" #include "grins/simulation.h" #include "grins/simulation_builder.h" @@ -334,6 +335,8 @@ int main(int argc, char* argv[]) GRINSTesting::SATurbBCFactoryBase::set_turb_bc_values( turbulent_bc_values.get() ); + GRINS::SimulationInitializer initializer; + GRINS::SimulationBuilder sim_builder; GRINS::Simulation grins( libMesh_inputfile, diff --git a/test/unit/unit_driver.C b/test/unit/unit_driver.C index 9ff1a8a46..f79d08f1c 100644 --- a/test/unit/unit_driver.C +++ b/test/unit/unit_driver.C @@ -23,6 +23,7 @@ //-----------------------------------------------------------------------el- #include "grins_config.h" +#include "grins/simulation_initializer.h" #ifdef GRINS_HAVE_CPPUNIT #include @@ -45,6 +46,8 @@ int main(int argc, char **argv) libMesh::LibMeshInit init(argc, argv); TestCommWorld = &init.comm(); + GRINS::SimulationInitializer initializer; + CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); From 9bef35ac9ebe419f5ed2887979c266f51e13dfac Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Fri, 21 Apr 2017 16:30:14 -0400 Subject: [PATCH 3/7] Add ErrorEstimatorFactoryInitializer --- src/Makefile.am | 3 +- src/solver/src/simulation_initializer.C | 2 + .../grins/error_estimator_factory_basic.h | 10 +++-- .../error_estimator_factory_initializer.h | 43 +++++++++++++++++++ .../src/adjoint_error_estimator_factories.C | 10 ----- ... => error_estimator_factory_initializer.C} | 25 ++++++----- 6 files changed, 68 insertions(+), 25 deletions(-) create mode 100644 src/strategies/include/grins/error_estimator_factory_initializer.h rename src/strategies/src/{error_estimator_factory_basic.C => error_estimator_factory_initializer.C} (62%) diff --git a/src/Makefile.am b/src/Makefile.am index 2937d96e0..c3a0b74f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -230,8 +230,8 @@ libgrins_la_SOURCES += solver/src/simulation_initializer.C # src/strategies files libgrins_la_SOURCES += strategies/src/strategies_parsing.C libgrins_la_SOURCES += strategies/src/error_estimator_factory_base.C -libgrins_la_SOURCES += strategies/src/error_estimator_factory_basic.C libgrins_la_SOURCES += strategies/src/adjoint_error_estimator_factories.C +libgrins_la_SOURCES += strategies/src/error_estimator_factory_initializer.C libgrins_la_SOURCES += strategies/src/error_estimator_options.C libgrins_la_SOURCES += strategies/src/adaptive_time_stepping_options.C libgrins_la_SOURCES += strategies/src/mesh_adaptivity_options.C @@ -518,6 +518,7 @@ include_HEADERS += strategies/include/grins/strategies_parsing.h include_HEADERS += strategies/include/grins/error_estimator_factory_base.h include_HEADERS += strategies/include/grins/error_estimator_factory_basic.h include_HEADERS += strategies/include/grins/adjoint_error_estimator_factories.h +include_HEADERS += strategies/include/grins/error_estimator_factory_initializer.h include_HEADERS += strategies/include/grins/error_estimator_options.h include_HEADERS += strategies/include/grins/adaptive_time_stepping_options.h include_HEADERS += strategies/include/grins/mesh_adaptivity_options.h diff --git a/src/solver/src/simulation_initializer.C b/src/solver/src/simulation_initializer.C index 461632963..bf091d751 100644 --- a/src/solver/src/simulation_initializer.C +++ b/src/solver/src/simulation_initializer.C @@ -36,6 +36,8 @@ namespace GRINS { if( !_is_initialized ) { + ErrorEstimatorFactoryInitializer error_est_init; + _is_initialized = true; } } diff --git a/src/strategies/include/grins/error_estimator_factory_basic.h b/src/strategies/include/grins/error_estimator_factory_basic.h index 147585256..3c79234bb 100644 --- a/src/strategies/include/grins/error_estimator_factory_basic.h +++ b/src/strategies/include/grins/error_estimator_factory_basic.h @@ -41,9 +41,13 @@ namespace GRINS protected: - virtual libMesh::UniquePtr build_error_estimator( const GetPot& input, - MultiphysicsSystem& system, - const ErrorEstimatorOptions& estimator_options); + virtual libMesh::UniquePtr + build_error_estimator( const GetPot & /*input*/, + MultiphysicsSystem & /*system*/, + const ErrorEstimatorOptions & /*estimator_options*/ ) + { + return libMesh::UniquePtr( new EstimatorType ); + } }; diff --git a/src/strategies/include/grins/error_estimator_factory_initializer.h b/src/strategies/include/grins/error_estimator_factory_initializer.h new file mode 100644 index 000000000..e5038b1a2 --- /dev/null +++ b/src/strategies/include/grins/error_estimator_factory_initializer.h @@ -0,0 +1,43 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +#ifndef GRINS_ERROR_ESTIMATOR_FACTORY_INITIALIZER_H +#define GRINS_ERROR_ESTIMATOR_FACTORY_INITIALIZER_H + +namespace GRINS +{ + //! Initialize all ErrorEstimatorFactory objects + /*! To avoid symbol stripping from static linking, we use this + class to initialize/register the ErrorEstimator factory objects. + + Relevant discussion: http://stackoverflow.com/questions/5202142/static-variable-initialization-over-a-library*/ + class ErrorEstimatorFactoryInitializer + { + public: + ErrorEstimatorFactoryInitializer(); + ~ErrorEstimatorFactoryInitializer(){} + }; +} + +#endif // GRINS_ERROR_ESTIMATOR_FACTORY_INITIALIZER_H diff --git a/src/strategies/src/adjoint_error_estimator_factories.C b/src/strategies/src/adjoint_error_estimator_factories.C index e1bb543e0..de4e4b393 100644 --- a/src/strategies/src/adjoint_error_estimator_factories.C +++ b/src/strategies/src/adjoint_error_estimator_factories.C @@ -24,7 +24,6 @@ // These classes #include "grins/adjoint_error_estimator_factories.h" -#include "grins/strategies_parsing.h" // libMesh #include "libmesh/patch_recovery_error_estimator.h" @@ -61,13 +60,4 @@ namespace GRINS estimator.number_p_refinements = estimator_options.n_adjoint_p_refinements(); } - // Instantiate adjoint ErrorEstimator factories - AdjointRefinementErrorEstimatorFactory - grins_factory_adjoint_refinement_estimator - (StrategiesParsing::adjoint_refinement_error_estimator()); - - AdjointResidualErrorEstimatorFactory - grins_factory_adjoint_residual_estimator - (StrategiesParsing::adjoint_residual_error_estimator()); - } // end namespace GRINS diff --git a/src/strategies/src/error_estimator_factory_basic.C b/src/strategies/src/error_estimator_factory_initializer.C similarity index 62% rename from src/strategies/src/error_estimator_factory_basic.C rename to src/strategies/src/error_estimator_factory_initializer.C index 8af9c7fe3..936e2f67e 100644 --- a/src/strategies/src/error_estimator_factory_basic.C +++ b/src/strategies/src/error_estimator_factory_initializer.C @@ -23,7 +23,11 @@ //-----------------------------------------------------------------------el- // This class +#include "grins/error_estimator_factory_initializer.h" + +// GRINS #include "grins/error_estimator_factory_basic.h" +#include "grins/adjoint_error_estimator_factories.h" #include "grins/strategies_parsing.h" // libMesh @@ -32,19 +36,18 @@ namespace GRINS { - template - libMesh::UniquePtr - ErrorEstimatorFactoryBasic::build_error_estimator - ( const GetPot& /*input*/, MultiphysicsSystem& /*system*/, const ErrorEstimatorOptions& /*estimator_options*/ ) + ErrorEstimatorFactoryInitializer::ErrorEstimatorFactoryInitializer() { - return libMesh::UniquePtr( new EstimatorType ); - } + static ErrorEstimatorFactoryBasic + grins_factory_kelly_error_est(StrategiesParsing::kelly_error_estimator()); - // Instantiate basic ErrorEstimator factories - ErrorEstimatorFactoryBasic - grins_factory_kelly_error_est(StrategiesParsing::kelly_error_estimator()); + static ErrorEstimatorFactoryBasic + grins_factory_patch_recovery_error_est(StrategiesParsing::patch_recovery_error_estimator()); - ErrorEstimatorFactoryBasic - grins_factory_patch_recovery_error_est(StrategiesParsing::patch_recovery_error_estimator()); + static AdjointRefinementErrorEstimatorFactory + grins_factory_adjoint_refinement_estimator(StrategiesParsing::adjoint_refinement_error_estimator()); + static AdjointResidualErrorEstimatorFactory + grins_factory_adjoint_residual_estimator(StrategiesParsing::adjoint_residual_error_estimator()); + } } // end namespace GRINS From 54457ca03b363a216dc0b8d6fd15d867d8cde2ea Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Mon, 24 Apr 2017 08:47:19 -0400 Subject: [PATCH 4/7] Add PhysicsFactoryInitializer For all physics factories, except the reacting flows factory, the physics factory class is now header-only and all the instantiations of the physics factory have been moved to the new PhysicsFactoryInitializer class. The PhysicsFactoryInitializer is then constructed in SimulationInitializer. --- src/Makefile.am | 9 +- .../include/grins/physics_factory_basic.h | 5 +- .../grins/physics_factory_heat_transfer.h | 43 ++++ .../physics_factory_incompressible_flow.h | 54 ++++ ...physics_factory_incompressible_turb_flow.h | 38 +++ .../grins/physics_factory_initializer.h | 43 ++++ .../physics_factory_one_d_stress_solids.h | 36 +++ .../physics_factory_plane_stress_solids.h | 54 ++++ .../physics_factory_variable_density_flow.h | 51 ++++ src/physics/src/physics_factory_basic.C | 61 ----- .../src/physics_factory_heat_transfer.C | 95 ------- .../src/physics_factory_incompressible_flow.C | 158 ------------ ...physics_factory_incompressible_turb_flow.C | 79 ------ src/physics/src/physics_factory_initializer.C | 232 ++++++++++++++++++ .../src/physics_factory_one_d_stress_solids.C | 78 ------ .../src/physics_factory_plane_stress_solids.C | 95 ------- .../physics_factory_variable_density_flow.C | 100 -------- src/solver/src/simulation_initializer.C | 2 + 18 files changed, 559 insertions(+), 674 deletions(-) create mode 100644 src/physics/include/grins/physics_factory_initializer.h delete mode 100644 src/physics/src/physics_factory_basic.C delete mode 100644 src/physics/src/physics_factory_heat_transfer.C delete mode 100644 src/physics/src/physics_factory_incompressible_flow.C delete mode 100644 src/physics/src/physics_factory_incompressible_turb_flow.C create mode 100644 src/physics/src/physics_factory_initializer.C delete mode 100644 src/physics/src/physics_factory_one_d_stress_solids.C delete mode 100644 src/physics/src/physics_factory_plane_stress_solids.C delete mode 100644 src/physics/src/physics_factory_variable_density_flow.C diff --git a/src/Makefile.am b/src/Makefile.am index c3a0b74f1..650342682 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -150,17 +150,11 @@ libgrins_la_SOURCES += physics/src/parsed_source_term.C libgrins_la_SOURCES += physics/src/physics_naming.C libgrins_la_SOURCES += physics/src/convection_diffusion.C libgrins_la_SOURCES += physics/src/physics_factory_base.C -libgrins_la_SOURCES += physics/src/physics_factory_basic.C libgrins_la_SOURCES += physics/src/physics_factory_with_core.C -libgrins_la_SOURCES += physics/src/physics_factory_incompressible_flow.C -libgrins_la_SOURCES += physics/src/physics_factory_incompressible_turb_flow.C -libgrins_la_SOURCES += physics/src/physics_factory_heat_transfer.C -libgrins_la_SOURCES += physics/src/physics_factory_variable_density_flow.C -libgrins_la_SOURCES += physics/src/physics_factory_plane_stress_solids.C -libgrins_la_SOURCES += physics/src/physics_factory_one_d_stress_solids.C libgrins_la_SOURCES += physics/src/physics_factory_reacting_flows.C libgrins_la_SOURCES += physics/src/physics_builder.C libgrins_la_SOURCES += physics/src/variable_pinning.C +libgrins_la_SOURCES += physics/src/physics_factory_initializer.C # src/properties files libgrins_la_SOURCES += properties/src/parsed_property_base.C @@ -438,6 +432,7 @@ include_HEADERS += physics/include/grins/physics_factory_one_d_stress_solids.h include_HEADERS += physics/include/grins/physics_factory_reacting_flows.h include_HEADERS += physics/include/grins/physics_builder.h include_HEADERS += physics/include/grins/variable_pinning.h +include_HEADERS += physics/include/grins/physics_factory_initializer.h # src/properties headers include_HEADERS += properties/include/grins/property_types.h diff --git a/src/physics/include/grins/physics_factory_basic.h b/src/physics/include/grins/physics_factory_basic.h index 746534820..d619d766e 100644 --- a/src/physics/include/grins/physics_factory_basic.h +++ b/src/physics/include/grins/physics_factory_basic.h @@ -42,7 +42,10 @@ namespace GRINS protected: virtual libMesh::UniquePtr build_physics( const GetPot& input, - const std::string& physics_name ); + const std::string& physics_name ) + { + return libMesh::UniquePtr( new DerivedPhysics(physics_name,input) ); + } }; diff --git a/src/physics/include/grins/physics_factory_heat_transfer.h b/src/physics/include/grins/physics_factory_heat_transfer.h index a3cb75667..c8bbfe7a6 100644 --- a/src/physics/include/grins/physics_factory_heat_transfer.h +++ b/src/physics/include/grins/physics_factory_heat_transfer.h @@ -27,6 +27,9 @@ // GRINS #include "grins/physics_factory_with_core.h" +#include "grins/physics_factory_helper.h" +#include "grins/constant_conductivity.h" +#include "grins/parsed_conductivity.h" namespace GRINS { @@ -50,6 +53,46 @@ namespace GRINS }; + template class DerivedPhysics> + inline + libMesh::UniquePtr + PhysicsFactoryHeatTransfer::build_physics + ( const GetPot& input, const std::string& physics_name ) + { + std::string core_physics = this->find_core_physics_name(physics_name); + + std::string conductivity; + PhysicsFactoryHelper::parse_conductivity_model(input,core_physics,conductivity); + + libMesh::UniquePtr new_physics; + + if( conductivity == "constant" ) + new_physics.reset( new DerivedPhysics(physics_name,input) ); + + else if( conductivity == "parsed" ) + new_physics.reset( new DerivedPhysics(physics_name,input) ); + + else + this->cond_error_msg(physics_name, conductivity); + + libmesh_assert(new_physics); + + return new_physics; + } + + template class DerivedPhysics> + inline + void PhysicsFactoryHeatTransfer::cond_error_msg( const std::string& physics, + const std::string& conductivity ) const + { + std::string error = "================================================================\n"; + error += "Invalid conductivity model for "+physics+"\n"; + error += "Conductivity model = "+conductivity+"\n"; + error += "================================================================\n"; + + libmesh_error_msg(error); + } + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_HEAT_TRANSFER_H diff --git a/src/physics/include/grins/physics_factory_incompressible_flow.h b/src/physics/include/grins/physics_factory_incompressible_flow.h index cc1a2fc2e..a280a420a 100644 --- a/src/physics/include/grins/physics_factory_incompressible_flow.h +++ b/src/physics/include/grins/physics_factory_incompressible_flow.h @@ -27,6 +27,10 @@ // GRINS #include "grins/physics_factory_with_core.h" +#include "grins/physics_factory_helper.h" +#include "grins/constant_viscosity.h" +#include "grins/parsed_viscosity.h" +#include "grins/spalart_allmaras_viscosity.h" namespace GRINS { @@ -50,6 +54,56 @@ namespace GRINS }; + template class DerivedPhysics> + inline + libMesh::UniquePtr + PhysicsFactoryIncompressibleFlow::build_physics + ( const GetPot& input, const std::string& physics_name ) + { + std::string core_physics = this->find_core_physics_name(physics_name); + + std::string viscosity; + PhysicsFactoryHelper::parse_viscosity_model(input,core_physics,viscosity); + + libMesh::UniquePtr new_physics; + + if( viscosity == "constant" ) + new_physics.reset( new DerivedPhysics(physics_name,input) ); + + else if( viscosity == "parsed" ) + new_physics.reset( new DerivedPhysics(physics_name,input) ); + + // For SA viscosity model, we need to parse what the "sub" viscosity model is + else if( viscosity == "spalartallmaras" ) + { + std::string turb_viscosity; + PhysicsFactoryHelper::parse_turb_viscosity_model(input,core_physics,turb_viscosity); + if( turb_viscosity == "constant" ) + new_physics.reset(new DerivedPhysics >(physics_name,input) ); + else + this->visc_error_msg(physics_name, turb_viscosity); + } + else + this->visc_error_msg(physics_name, viscosity); + + libmesh_assert(new_physics); + + return new_physics; + } + + template class DerivedPhysics> + inline + void PhysicsFactoryIncompressibleFlow::visc_error_msg( const std::string& physics, + const std::string& viscosity ) const + { + std::string error = "================================================================\n"; + error += "Invalid viscosity model for "+physics+"\n"; + error += "Viscosity model = "+viscosity+"\n"; + error += "================================================================\n"; + + libmesh_error_msg(error); + } + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_INCOMPRESSIBLE_FLOW_H diff --git a/src/physics/include/grins/physics_factory_incompressible_turb_flow.h b/src/physics/include/grins/physics_factory_incompressible_turb_flow.h index b9be3e8a2..29a1ea85c 100644 --- a/src/physics/include/grins/physics_factory_incompressible_turb_flow.h +++ b/src/physics/include/grins/physics_factory_incompressible_turb_flow.h @@ -27,6 +27,8 @@ // GRINS #include "grins/physics_factory_with_core.h" +#include "grins/physics_factory_helper.h" +#include "grins/constant_viscosity.h" namespace GRINS { @@ -50,6 +52,42 @@ namespace GRINS }; + template class DerivedPhysics> + inline + libMesh::UniquePtr PhysicsFactoryIncompressibleTurbFlow::build_physics( const GetPot& input, + const std::string& physics_name ) + { + std::string core_physics = this->find_core_physics_name(physics_name); + + std::string viscosity; + PhysicsFactoryHelper::parse_turb_viscosity_model(input,core_physics,viscosity); + + libMesh::UniquePtr new_physics; + + if( viscosity == "constant" ) + new_physics.reset( new DerivedPhysics(physics_name,input) ); + + else + this->visc_error_msg(physics_name, viscosity); + + libmesh_assert(new_physics); + + return new_physics; + } + + template class DerivedPhysics> + inline + void PhysicsFactoryIncompressibleTurbFlow::visc_error_msg( const std::string& physics, + const std::string& viscosity ) const + { + std::string error = "================================================================\n"; + error += "Invalid turblence viscosity model for "+physics+"\n"; + error += "Viscosity model = "+viscosity+"\n"; + error += "================================================================\n"; + + libmesh_error_msg(error); + } + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_INCOMPRESSIBLE_TURB_FLOW_H diff --git a/src/physics/include/grins/physics_factory_initializer.h b/src/physics/include/grins/physics_factory_initializer.h new file mode 100644 index 000000000..1d381f98f --- /dev/null +++ b/src/physics/include/grins/physics_factory_initializer.h @@ -0,0 +1,43 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +#ifndef GRINS_PHYSICS_FACTORY_INITIALIZER_H +#define GRINS_PHYSICS_FACTORY_INITIALIZER_H + +namespace GRINS +{ + //! Initialize all PhysicsFactory objects + /*! To avoid symbol stripping from static linking, we use this + class to initialize/register the Physics factory objects. + + Relevant discussion: http://stackoverflow.com/questions/5202142/static-variable-initialization-over-a-library*/ + class PhysicsFactoryInitializer + { + public: + PhysicsFactoryInitializer(); + ~PhysicsFactoryInitializer(){} + }; +} + +#endif // GRINS_PHYSICS_FACTORY_INITIALIZER_H diff --git a/src/physics/include/grins/physics_factory_one_d_stress_solids.h b/src/physics/include/grins/physics_factory_one_d_stress_solids.h index a34f7c20b..c546d6d3f 100644 --- a/src/physics/include/grins/physics_factory_one_d_stress_solids.h +++ b/src/physics/include/grins/physics_factory_one_d_stress_solids.h @@ -27,6 +27,8 @@ // GRINS #include "grins/physics_factory_with_core.h" +#include "grins/physics_factory_helper.h" +#include "grins/hookes_law_1d.h" namespace GRINS { @@ -48,6 +50,40 @@ namespace GRINS }; + template class DerivedPhysics> + inline + libMesh::UniquePtr PhysicsFactoryOneDStressSolids::build_physics( const GetPot& input, + const std::string& physics_name ) + { + std::string core_physics = this->find_core_physics_name(physics_name); + + std::string model = "none"; + std::string strain_energy = "none"; + + PhysicsFactoryHelper::parse_stress_strain_model( input, + core_physics, + model, + strain_energy ); + + libMesh::UniquePtr new_physics; + + if( model == std::string("hookes_law") ) + { + new_physics.reset( new DerivedPhysics + (physics_name,input, false /*is_compressible*/) ); + } + else + { + std::string error = "Error: Invalid stress-strain model: "+model+"!\n"; + error += " Valid values are: hookes_law\n"; + libmesh_error_msg(error); + } + + libmesh_assert(new_physics); + + return new_physics; + } + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_ONE_D_STRESS_SOLIDS_H diff --git a/src/physics/include/grins/physics_factory_plane_stress_solids.h b/src/physics/include/grins/physics_factory_plane_stress_solids.h index fe2571aa3..644124d0f 100644 --- a/src/physics/include/grins/physics_factory_plane_stress_solids.h +++ b/src/physics/include/grins/physics_factory_plane_stress_solids.h @@ -27,6 +27,11 @@ // GRINS #include "grins/physics_factory_with_core.h" +#include "grins/physics_factory_helper.h" +#include "grins/hookes_law.h" +#include "grins/hookes_law_1d.h" +#include "grins/incompressible_plane_stress_hyperelasticity.h" +#include "grins/mooney_rivlin.h" namespace GRINS { @@ -48,6 +53,55 @@ namespace GRINS }; + template class DerivedPhysics> + inline + libMesh::UniquePtr + PhysicsFactoryPlaneStressSolids::build_physics + ( const GetPot& input, const std::string& physics_name ) + { + std::string core_physics = this->find_core_physics_name(physics_name); + + std::string model = "none"; + std::string strain_energy = "none"; + + PhysicsFactoryHelper::parse_stress_strain_model( input, + core_physics, + model, + strain_energy ); + + libMesh::UniquePtr new_physics; + + if( model == std::string("hookes_law") ) + new_physics.reset( new DerivedPhysics + (physics_name,input, false /*is_compressible*/) ); + + else if( model == std::string("incompressible_hyperelasticity") ) + { + if( strain_energy == std::string("mooney_rivlin") ) + { + new_physics.reset( new DerivedPhysics >(physics_name,input,false /*is_compressible*/) ); + } + else + { + std::string error = "ERROR: Invalid strain_energy "+strain_energy+"!\n"; + error += " Valid values are: mooney_rivlin\n"; + libmesh_error_msg(error); + } + + } + else + { + std::string error = "Error: Invalid stress-strain model: "+model+"!\n"; + error += " Valid values are: hookes_law\n"; + error += " incompressible_hyperelasticity\n"; + libmesh_error_msg(error); + } + + libmesh_assert(new_physics); + + return new_physics; + } + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_PLANE_STRESS_SOLIDS_H diff --git a/src/physics/include/grins/physics_factory_variable_density_flow.h b/src/physics/include/grins/physics_factory_variable_density_flow.h index 218145cc8..4d1a87270 100644 --- a/src/physics/include/grins/physics_factory_variable_density_flow.h +++ b/src/physics/include/grins/physics_factory_variable_density_flow.h @@ -27,6 +27,10 @@ // GRINS #include "grins/physics_factory_with_core.h" +#include "grins/physics_factory_helper.h" +#include "grins/constant_viscosity.h" +#include "grins/constant_conductivity.h" +#include "grins/constant_specific_heat.h" namespace GRINS { @@ -53,6 +57,53 @@ namespace GRINS }; + template class DerivedPhysics> + inline + libMesh::UniquePtr PhysicsFactoryVariableDensityFlow::build_physics( const GetPot& input, + const std::string& physics_name ) + { + std::string core_physics = this->find_core_physics_name(physics_name); + + std::string conductivity; + PhysicsFactoryHelper::parse_conductivity_model(input,core_physics,conductivity); + + std::string viscosity; + PhysicsFactoryHelper::parse_viscosity_model(input,core_physics,viscosity); + + std::string specific_heat; + PhysicsFactoryHelper::parse_specific_heat_model(input,core_physics,specific_heat); + + libMesh::UniquePtr new_physics; + + if( conductivity == "constant" && viscosity == "constant" && specific_heat == "constant" ) + new_physics.reset( new DerivedPhysics + (physics_name,input) ); + + else + this->prop_error_msg(physics_name, conductivity, viscosity, specific_heat); + + libmesh_assert(new_physics); + + return new_physics; + } + + template class DerivedPhysics> + inline + void PhysicsFactoryVariableDensityFlow::prop_error_msg( const std::string& physics, + const std::string& conductivity, + const std::string& viscosity, + const std::string& specific_heat ) const + { + std::string error = "================================================================\n"; + error += "Invalid combination of models for "+physics+"\n"; + error += "Viscosity model = "+viscosity+"\n"; + error += "Conductivity model = "+conductivity+"\n"; + error += "Specific heat model = "+specific_heat+"\n"; + error += "================================================================\n"; + + libmesh_error_msg(error); + } + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_VARIABLE_DENSITY_FLOW_H diff --git a/src/physics/src/physics_factory_basic.C b/src/physics/src/physics_factory_basic.C deleted file mode 100644 index b44fca30a..000000000 --- a/src/physics/src/physics_factory_basic.C +++ /dev/null @@ -1,61 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_basic.h" - -// GRINS -#include "grins/physics_naming.h" -#include "grins/scalar_ode.h" -#include "grins/boussinesq_buoyancy.h" -#include "grins/axisym_boussinesq_buoyancy.h" -#include "grins/elastic_membrane_constant_pressure.h" -#include "grins/constant_source_term.h" -#include "grins/parsed_source_term.h" -#include "grins/convection_diffusion.h" -#include "grins/variable_pinning.h" - -namespace GRINS -{ - template - libMesh::UniquePtr PhysicsFactoryBasic::build_physics( const GetPot& input, - const std::string& physics_name ) - { - return libMesh::UniquePtr( new DerivedPhysics(physics_name,input) ); - } - - // Instantiate all the "Basic" Physics factories. - // These shouldn't be directly used by the user, we just need to instantiate them. - PhysicsFactoryBasic grins_factory_scalar_ode(PhysicsNaming::scalar_ode()); - PhysicsFactoryBasic grins_factory_boussinesq(PhysicsNaming::boussinesq_buoyancy()); - // This one needs to die. Regular Boussinesq should handle the axisymmetry - PhysicsFactoryBasic grins_factory_axi_boussinesq(PhysicsNaming::axisymmetric_boussinesq_buoyancy()); - PhysicsFactoryBasic grins_factory_elastic_membrane_pressure(PhysicsNaming::elastic_membrane_constant_pressure()); - // This one needs to die and just have the parsed version - PhysicsFactoryBasic grins_factory_constant_source_term(PhysicsNaming::constant_source_term()); - PhysicsFactoryBasic grins_factory_parsed_source_term(PhysicsNaming::parsed_source_term()); - PhysicsFactoryBasic grins_factory_convection_difffusion(PhysicsNaming::convection_diffusion()); - PhysicsFactoryBasic grins_factory_variable_pinning(PhysicsNaming::variable_pinning()); - -} // end namespace GRINS diff --git a/src/physics/src/physics_factory_heat_transfer.C b/src/physics/src/physics_factory_heat_transfer.C deleted file mode 100644 index 84297000c..000000000 --- a/src/physics/src/physics_factory_heat_transfer.C +++ /dev/null @@ -1,95 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_heat_transfer.h" - -// GRINS -#include "grins/physics_factory_helper.h" -#include "grins/constant_conductivity.h" -#include "grins/parsed_conductivity.h" - -// Physics we're instantiating -#include "grins/heat_conduction.h" -#include "grins/heat_transfer.h" -#include "grins/heat_transfer_adjoint_stab.h" -#include "grins/heat_transfer_spgsm_stab.h" -#include "grins/axisym_heat_transfer.h" - -namespace GRINS -{ - template class DerivedPhysics> - libMesh::UniquePtr PhysicsFactoryHeatTransfer::build_physics( const GetPot& input, - const std::string& physics_name ) - { - std::string core_physics = this->find_core_physics_name(physics_name); - - std::string conductivity; - PhysicsFactoryHelper::parse_conductivity_model(input,core_physics,conductivity); - - libMesh::UniquePtr new_physics; - - if( conductivity == "constant" ) - new_physics.reset( new DerivedPhysics(physics_name,input) ); - - else if( conductivity == "parsed" ) - new_physics.reset( new DerivedPhysics(physics_name,input) ); - - else - this->cond_error_msg(physics_name, conductivity); - - libmesh_assert(new_physics); - - return new_physics; - } - - template class DerivedPhysics> - void PhysicsFactoryHeatTransfer::cond_error_msg( const std::string& physics, - const std::string& conductivity ) const - { - std::string error = "================================================================\n"; - error += "Invalid conductivity model for "+physics+"\n"; - error += "Conductivity model = "+conductivity+"\n"; - error += "================================================================\n"; - - libmesh_error_msg(error); - } - - PhysicsFactoryHeatTransfer grins_factory_heat_conduction - (PhysicsNaming::heat_conduction(),PhysicsNaming::heat_conduction()); - - PhysicsFactoryHeatTransfer grins_factory_heat_transfer - (PhysicsNaming::heat_transfer(),PhysicsNaming::heat_transfer()); - - PhysicsFactoryHeatTransfer grins_factory_heat_transfer_adjoint_stab - (PhysicsNaming::heat_transfer_adjoint_stab(),PhysicsNaming::heat_transfer()); - - PhysicsFactoryHeatTransfer grins_factory_heat_transfer_spgsm_stab - (PhysicsNaming::heat_transfer_spgsm_stab(),PhysicsNaming::heat_transfer()); - - // This needs to die. Axisymmetry should be handled within heat_transfer - PhysicsFactoryHeatTransfer grins_factory_axi_heat_transfer - (PhysicsNaming::axisymmetric_heat_transfer(),PhysicsNaming::axisymmetric_heat_transfer()); - -} // end namespace GRINS diff --git a/src/physics/src/physics_factory_incompressible_flow.C b/src/physics/src/physics_factory_incompressible_flow.C deleted file mode 100644 index d873de32b..000000000 --- a/src/physics/src/physics_factory_incompressible_flow.C +++ /dev/null @@ -1,158 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_incompressible_flow.h" - -// GRINS -#include "grins/physics_factory_helper.h" -#include "grins/constant_viscosity.h" -#include "grins/parsed_viscosity.h" -#include "grins/spalart_allmaras_viscosity.h" - -// Physics we're instantiating -#include "grins/inc_navier_stokes.h" -#include "grins/stokes.h" -#include "grins/inc_navier_stokes_adjoint_stab.h" -#include "grins/inc_navier_stokes_spgsm_stab.h" -#include "grins/velocity_drag.h" -#include "grins/velocity_drag_adjoint_stab.h" -#include "grins/velocity_penalty.h" -#include "grins/velocity_penalty_adjoint_stab.h" -#include "grins/parsed_velocity_source.h" -#include "grins/parsed_velocity_source_adjoint_stab.h" -#include "grins/averaged_fan.h" -#include "grins/averaged_fan_adjoint_stab.h" -#include "grins/averaged_turbine.h" -#include "grins/boussinesq_buoyancy_adjoint_stab.h" -#include "grins/boussinesq_buoyancy_spgsm_stab.h" - -namespace GRINS -{ - template class DerivedPhysics> - libMesh::UniquePtr PhysicsFactoryIncompressibleFlow::build_physics( const GetPot& input, - const std::string& physics_name ) - { - std::string core_physics = this->find_core_physics_name(physics_name); - - std::string viscosity; - PhysicsFactoryHelper::parse_viscosity_model(input,core_physics,viscosity); - - libMesh::UniquePtr new_physics; - - if( viscosity == "constant" ) - new_physics.reset( new DerivedPhysics(physics_name,input) ); - - else if( viscosity == "parsed" ) - new_physics.reset( new DerivedPhysics(physics_name,input) ); - - // For SA viscosity model, we need to parse what the "sub" viscosity model is - else if( viscosity == "spalartallmaras" ) - { - std::string turb_viscosity; - PhysicsFactoryHelper::parse_turb_viscosity_model(input,core_physics,turb_viscosity); - if( turb_viscosity == "constant" ) - new_physics.reset(new DerivedPhysics >(physics_name,input) ); - else - this->visc_error_msg(physics_name, turb_viscosity); - } - else - this->visc_error_msg(physics_name, viscosity); - - libmesh_assert(new_physics); - - return new_physics; - } - - template class DerivedPhysics> - void PhysicsFactoryIncompressibleFlow::visc_error_msg( const std::string& physics, - const std::string& viscosity ) const - { - std::string error = "================================================================\n"; - error += "Invalid viscosity model for "+physics+"\n"; - error += "Viscosity model = "+viscosity+"\n"; - error += "================================================================\n"; - - libmesh_error_msg(error); - } - - // Instantiate all the "incompressble flow" Physics factories. - PhysicsFactoryIncompressibleFlow grins_factory_incompressible_navier_stokes - (PhysicsNaming::incompressible_navier_stokes(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_stokes - (PhysicsNaming::stokes(),PhysicsNaming::stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_ins_adjoint_stab - (PhysicsNaming::incompressible_navier_stokes_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_spsgm_adjoint_stab - (PhysicsNaming::incompressible_navier_stokes_spgsm_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_velocity_drag - (PhysicsNaming::velocity_drag(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_velocity_drag_adjoint_stab - (PhysicsNaming::velocity_drag_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty - (PhysicsNaming::velocity_penalty(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty2 - (PhysicsNaming::velocity_penalty2(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty3 - (PhysicsNaming::velocity_penalty3(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty_adjoint_stab - (PhysicsNaming::velocity_penalty_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty2_adjoint_stab - (PhysicsNaming::velocity_penalty2_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty3_adjoint_stab - (PhysicsNaming::velocity_penalty3_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_parsed_vel_source - (PhysicsNaming::parsed_velocity_source(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_parsed_vel_source_adjoint_stab - (PhysicsNaming::parsed_velocity_source_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_averaged_fan - (PhysicsNaming::averaged_fan(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_averaged_fan_adjoint_stab - (PhysicsNaming::averaged_fan_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_averaged_turbine - (PhysicsNaming::averaged_turbine(),PhysicsNaming::incompressible_navier_stokes()); - - PhysicsFactoryIncompressibleFlow grins_factory_boussinesq_adjoint_stab - (PhysicsNaming::boussinesq_buoyancy_adjoint_stab(),PhysicsNaming::boussinesq_buoyancy()); - - PhysicsFactoryIncompressibleFlow grins_factory_boussinesq_spgsm_stab - (PhysicsNaming::boussinesq_buoyancy_spgsm_stab(),PhysicsNaming::boussinesq_buoyancy()); - -} // end namespace GRINS diff --git a/src/physics/src/physics_factory_incompressible_turb_flow.C b/src/physics/src/physics_factory_incompressible_turb_flow.C deleted file mode 100644 index c27d42cd9..000000000 --- a/src/physics/src/physics_factory_incompressible_turb_flow.C +++ /dev/null @@ -1,79 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_incompressible_turb_flow.h" - -// GRINS -#include "grins/physics_factory_helper.h" -#include "grins/constant_viscosity.h" - -// Physics whose factories we're instantiating -#include "grins/spalart_allmaras.h" -#include "grins/spalart_allmaras_spgsm_stab.h" - -namespace GRINS -{ - template class DerivedPhysics> - libMesh::UniquePtr PhysicsFactoryIncompressibleTurbFlow::build_physics( const GetPot& input, - const std::string& physics_name ) - { - std::string core_physics = this->find_core_physics_name(physics_name); - - std::string viscosity; - PhysicsFactoryHelper::parse_turb_viscosity_model(input,core_physics,viscosity); - - libMesh::UniquePtr new_physics; - - if( viscosity == "constant" ) - new_physics.reset( new DerivedPhysics(physics_name,input) ); - - else - this->visc_error_msg(physics_name, viscosity); - - libmesh_assert(new_physics); - - return new_physics; - } - - template class DerivedPhysics> - void PhysicsFactoryIncompressibleTurbFlow::visc_error_msg( const std::string& physics, - const std::string& viscosity ) const - { - std::string error = "================================================================\n"; - error += "Invalid turblence viscosity model for "+physics+"\n"; - error += "Viscosity model = "+viscosity+"\n"; - error += "================================================================\n"; - - libmesh_error_msg(error); - } - - // Instantiate all the "turbulent incompressble flow" Physics factories. - PhysicsFactoryIncompressibleTurbFlow grins_factory_spalart_allmaras - (PhysicsNaming::spalart_allmaras(),PhysicsNaming::spalart_allmaras()); - - PhysicsFactoryIncompressibleTurbFlow grins_factory_spalart_allmaras_spgsm_stab - (PhysicsNaming::spalart_allmaras_spgsm_stab(),PhysicsNaming::spalart_allmaras()); - -} // end namespace GRINS diff --git a/src/physics/src/physics_factory_initializer.C b/src/physics/src/physics_factory_initializer.C new file mode 100644 index 000000000..810bada31 --- /dev/null +++ b/src/physics/src/physics_factory_initializer.C @@ -0,0 +1,232 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +// This class +#include "grins/physics_factory_initializer.h" + +// GRINS +#include "grins/physics_factory_basic.h" +#include "grins/physics_factory_heat_transfer.h" +#include "grins/physics_factory_incompressible_flow.h" +#include "grins/physics_factory_incompressible_turb_flow.h" +#include "grins/physics_factory_one_d_stress_solids.h" +#include "grins/physics_factory_plane_stress_solids.h" +#include "grins/physics_factory_variable_density_flow.h" + +#include "grins/physics_naming.h" +#include "grins/scalar_ode.h" +#include "grins/boussinesq_buoyancy.h" +#include "grins/axisym_boussinesq_buoyancy.h" +#include "grins/elastic_membrane_constant_pressure.h" +#include "grins/constant_source_term.h" +#include "grins/parsed_source_term.h" +#include "grins/convection_diffusion.h" +#include "grins/variable_pinning.h" + +#include "grins/heat_conduction.h" +#include "grins/heat_transfer.h" +#include "grins/heat_transfer_adjoint_stab.h" +#include "grins/heat_transfer_spgsm_stab.h" +#include "grins/axisym_heat_transfer.h" + +#include "grins/inc_navier_stokes.h" +#include "grins/stokes.h" +#include "grins/inc_navier_stokes_adjoint_stab.h" +#include "grins/inc_navier_stokes_spgsm_stab.h" +#include "grins/velocity_drag.h" +#include "grins/velocity_drag_adjoint_stab.h" +#include "grins/velocity_penalty.h" +#include "grins/velocity_penalty_adjoint_stab.h" +#include "grins/parsed_velocity_source.h" +#include "grins/parsed_velocity_source_adjoint_stab.h" +#include "grins/averaged_fan.h" +#include "grins/averaged_fan_adjoint_stab.h" +#include "grins/averaged_turbine.h" +#include "grins/boussinesq_buoyancy_adjoint_stab.h" +#include "grins/boussinesq_buoyancy_spgsm_stab.h" + +#include "grins/spalart_allmaras.h" +#include "grins/spalart_allmaras_spgsm_stab.h" + +#include "grins/elastic_cable.h" +#include "grins/elastic_cable_rayleigh_damping.h" + +#include "grins/elastic_membrane.h" +#include "grins/elastic_membrane_rayleigh_damping.h" + +#include "grins/low_mach_navier_stokes.h" +#include "grins/low_mach_navier_stokes_braack_stab.h" +#include "grins/low_mach_navier_stokes_spgsm_stab.h" +#include "grins/low_mach_navier_stokes_vms_stab.h" + +namespace GRINS +{ + PhysicsFactoryInitializer::PhysicsFactoryInitializer() + { + static PhysicsFactoryBasic grins_factory_scalar_ode(PhysicsNaming::scalar_ode()); + + static PhysicsFactoryBasic grins_factory_boussinesq(PhysicsNaming::boussinesq_buoyancy()); + + // This one needs to die. Regular Boussinesq should handle the axisymmetry + static PhysicsFactoryBasic + grins_factory_axi_boussinesq(PhysicsNaming::axisymmetric_boussinesq_buoyancy()); + + static PhysicsFactoryBasic + grins_factory_elastic_membrane_pressure(PhysicsNaming::elastic_membrane_constant_pressure()); + + // This one needs to die and just have the parsed version + static PhysicsFactoryBasic + grins_factory_constant_source_term(PhysicsNaming::constant_source_term()); + + static PhysicsFactoryBasic + grins_factory_parsed_source_term(PhysicsNaming::parsed_source_term()); + + static PhysicsFactoryBasic + grins_factory_convection_difffusion(PhysicsNaming::convection_diffusion()); + + static PhysicsFactoryBasic + grins_factory_variable_pinning(PhysicsNaming::variable_pinning()); + + + static PhysicsFactoryHeatTransfer grins_factory_heat_conduction + (PhysicsNaming::heat_conduction(),PhysicsNaming::heat_conduction()); + + static PhysicsFactoryHeatTransfer grins_factory_heat_transfer + (PhysicsNaming::heat_transfer(),PhysicsNaming::heat_transfer()); + + static PhysicsFactoryHeatTransfer grins_factory_heat_transfer_adjoint_stab + (PhysicsNaming::heat_transfer_adjoint_stab(),PhysicsNaming::heat_transfer()); + + static PhysicsFactoryHeatTransfer grins_factory_heat_transfer_spgsm_stab + (PhysicsNaming::heat_transfer_spgsm_stab(),PhysicsNaming::heat_transfer()); + + // This needs to die. Axisymmetry should be handled within heat_transfer + static PhysicsFactoryHeatTransfer grins_factory_axi_heat_transfer + (PhysicsNaming::axisymmetric_heat_transfer(),PhysicsNaming::axisymmetric_heat_transfer()); + + + static PhysicsFactoryIncompressibleFlow grins_factory_incompressible_navier_stokes + (PhysicsNaming::incompressible_navier_stokes(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_stokes + (PhysicsNaming::stokes(),PhysicsNaming::stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_ins_adjoint_stab + (PhysicsNaming::incompressible_navier_stokes_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_spsgm_adjoint_stab + (PhysicsNaming::incompressible_navier_stokes_spgsm_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_velocity_drag + (PhysicsNaming::velocity_drag(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_velocity_drag_adjoint_stab + (PhysicsNaming::velocity_drag_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty + (PhysicsNaming::velocity_penalty(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty2 + (PhysicsNaming::velocity_penalty2(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_vel_penalty3 + (PhysicsNaming::velocity_penalty3(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_vel_penalty_adjoint_stab + (PhysicsNaming::velocity_penalty_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_vel_penalty2_adjoint_stab + (PhysicsNaming::velocity_penalty2_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_vel_penalty3_adjoint_stab + (PhysicsNaming::velocity_penalty3_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_parsed_vel_source + (PhysicsNaming::parsed_velocity_source(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_parsed_vel_source_adjoint_stab + (PhysicsNaming::parsed_velocity_source_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_averaged_fan + (PhysicsNaming::averaged_fan(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_averaged_fan_adjoint_stab + (PhysicsNaming::averaged_fan_adjoint_stab(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow grins_factory_averaged_turbine + (PhysicsNaming::averaged_turbine(),PhysicsNaming::incompressible_navier_stokes()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_boussinesq_adjoint_stab + (PhysicsNaming::boussinesq_buoyancy_adjoint_stab(),PhysicsNaming::boussinesq_buoyancy()); + + static PhysicsFactoryIncompressibleFlow + grins_factory_boussinesq_spgsm_stab + (PhysicsNaming::boussinesq_buoyancy_spgsm_stab(),PhysicsNaming::boussinesq_buoyancy()); + + + static PhysicsFactoryIncompressibleTurbFlow grins_factory_spalart_allmaras + (PhysicsNaming::spalart_allmaras(),PhysicsNaming::spalart_allmaras()); + + static PhysicsFactoryIncompressibleTurbFlow + grins_factory_spalart_allmaras_spgsm_stab + (PhysicsNaming::spalart_allmaras_spgsm_stab(),PhysicsNaming::spalart_allmaras()); + + + static PhysicsFactoryOneDStressSolids grins_factory_elastic_cable + (PhysicsNaming::elastic_cable(),PhysicsNaming::elastic_cable()); + + static PhysicsFactoryOneDStressSolids grins_factory_elastic_cable_rayleigh_damping + (PhysicsNaming::elastic_cable_rayleigh_damping(),PhysicsNaming::elastic_cable()); + + + static PhysicsFactoryPlaneStressSolids grins_factory_elastic_membrane + (PhysicsNaming::elastic_membrane(),PhysicsNaming::elastic_membrane()); + + static PhysicsFactoryPlaneStressSolids + grins_factory_elastic_membrane_rayleigh_damping + (PhysicsNaming::elastic_membrane_rayleigh_damping(),PhysicsNaming::elastic_membrane()); + + + static PhysicsFactoryVariableDensityFlow grins_factory_low_mach_navier_stokes + (PhysicsNaming::low_mach_navier_stokes(),PhysicsNaming::low_mach_navier_stokes()); + + static PhysicsFactoryVariableDensityFlow grins_factory_lmns_spgsm_stab + (PhysicsNaming::low_mach_navier_stokes_spgsm_stab(),PhysicsNaming::low_mach_navier_stokes()); + + static PhysicsFactoryVariableDensityFlow grins_factory_lmns_vms_stab + (PhysicsNaming::low_mach_navier_stokes_vms_stab(),PhysicsNaming::low_mach_navier_stokes()); + + static PhysicsFactoryVariableDensityFlow grins_factory_lmns_braack_stab + (PhysicsNaming::low_mach_navier_stokes_braack_stab(),PhysicsNaming::low_mach_navier_stokes()); + } +}// end namespace GRINS diff --git a/src/physics/src/physics_factory_one_d_stress_solids.C b/src/physics/src/physics_factory_one_d_stress_solids.C deleted file mode 100644 index 53dd51c09..000000000 --- a/src/physics/src/physics_factory_one_d_stress_solids.C +++ /dev/null @@ -1,78 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_one_d_stress_solids.h" - -// GRINS -#include "grins/physics_factory_helper.h" -#include "grins/hookes_law_1d.h" - -// Physics whose factories we're instantiating -#include "grins/elastic_cable.h" -#include "grins/elastic_cable_rayleigh_damping.h" - -namespace GRINS -{ - template class DerivedPhysics> - libMesh::UniquePtr PhysicsFactoryOneDStressSolids::build_physics( const GetPot& input, - const std::string& physics_name ) - { - std::string core_physics = this->find_core_physics_name(physics_name); - - std::string model = "none"; - std::string strain_energy = "none"; - - PhysicsFactoryHelper::parse_stress_strain_model( input, - core_physics, - model, - strain_energy ); - - libMesh::UniquePtr new_physics; - - if( model == std::string("hookes_law") ) - { - new_physics.reset( new DerivedPhysics - (physics_name,input, false /*is_compressible*/) ); - } - else - { - std::string error = "Error: Invalid stress-strain model: "+model+"!\n"; - error += " Valid values are: hookes_law\n"; - libmesh_error_msg(error); - } - - libmesh_assert(new_physics); - - return new_physics; - } - - // Instantiate all the "variable density flow" Physics factories. - PhysicsFactoryOneDStressSolids grins_factory_elastic_cable - (PhysicsNaming::elastic_cable(),PhysicsNaming::elastic_cable()); - - PhysicsFactoryOneDStressSolids grins_factory_elastic_cable_rayleigh_damping - (PhysicsNaming::elastic_cable_rayleigh_damping(),PhysicsNaming::elastic_cable()); - -} // end namespace GRINS diff --git a/src/physics/src/physics_factory_plane_stress_solids.C b/src/physics/src/physics_factory_plane_stress_solids.C deleted file mode 100644 index 36a5e66b7..000000000 --- a/src/physics/src/physics_factory_plane_stress_solids.C +++ /dev/null @@ -1,95 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_plane_stress_solids.h" - -// GRINS -#include "grins/physics_factory_helper.h" -#include "grins/hookes_law.h" -#include "grins/hookes_law_1d.h" -#include "grins/incompressible_plane_stress_hyperelasticity.h" -#include "grins/mooney_rivlin.h" - -// Physics whose factories we're instantiating -#include "grins/elastic_membrane.h" -#include "grins/elastic_membrane_rayleigh_damping.h" - -namespace GRINS -{ - template class DerivedPhysics> - libMesh::UniquePtr PhysicsFactoryPlaneStressSolids::build_physics( const GetPot& input, - const std::string& physics_name ) - { - std::string core_physics = this->find_core_physics_name(physics_name); - - std::string model = "none"; - std::string strain_energy = "none"; - - PhysicsFactoryHelper::parse_stress_strain_model( input, - core_physics, - model, - strain_energy ); - - libMesh::UniquePtr new_physics; - - if( model == std::string("hookes_law") ) - new_physics.reset( new DerivedPhysics - (physics_name,input, false /*is_compressible*/) ); - - else if( model == std::string("incompressible_hyperelasticity") ) - { - if( strain_energy == std::string("mooney_rivlin") ) - { - new_physics.reset( new DerivedPhysics >(physics_name,input,false /*is_compressible*/) ); - } - else - { - std::string error = "ERROR: Invalid strain_energy "+strain_energy+"!\n"; - error += " Valid values are: mooney_rivlin\n"; - libmesh_error_msg(error); - } - - } - else - { - std::string error = "Error: Invalid stress-strain model: "+model+"!\n"; - error += " Valid values are: hookes_law\n"; - error += " incompressible_hyperelasticity\n"; - libmesh_error_msg(error); - } - - libmesh_assert(new_physics); - - return new_physics; - } - - // Instantiate all the "variable density flow" Physics factories. - PhysicsFactoryPlaneStressSolids grins_factory_elastic_membrane - (PhysicsNaming::elastic_membrane(),PhysicsNaming::elastic_membrane()); - - PhysicsFactoryPlaneStressSolids grins_factory_elastic_membrane_rayleigh_damping - (PhysicsNaming::elastic_membrane_rayleigh_damping(),PhysicsNaming::elastic_membrane()); - -} // end namespace GRINS diff --git a/src/physics/src/physics_factory_variable_density_flow.C b/src/physics/src/physics_factory_variable_density_flow.C deleted file mode 100644 index c0b5488d1..000000000 --- a/src/physics/src/physics_factory_variable_density_flow.C +++ /dev/null @@ -1,100 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/physics_factory_variable_density_flow.h" - -// GRINS -#include "grins/physics_factory_helper.h" -#include "grins/constant_viscosity.h" -#include "grins/constant_conductivity.h" -#include "grins/constant_specific_heat.h" - -// Physics whose factories we're instantiating -#include "grins/low_mach_navier_stokes.h" -#include "grins/low_mach_navier_stokes_braack_stab.h" -#include "grins/low_mach_navier_stokes_spgsm_stab.h" -#include "grins/low_mach_navier_stokes_vms_stab.h" - -namespace GRINS -{ - template class DerivedPhysics> - libMesh::UniquePtr PhysicsFactoryVariableDensityFlow::build_physics( const GetPot& input, - const std::string& physics_name ) - { - std::string core_physics = this->find_core_physics_name(physics_name); - - std::string conductivity; - PhysicsFactoryHelper::parse_conductivity_model(input,core_physics,conductivity); - - std::string viscosity; - PhysicsFactoryHelper::parse_viscosity_model(input,core_physics,viscosity); - - std::string specific_heat; - PhysicsFactoryHelper::parse_specific_heat_model(input,core_physics,specific_heat); - - libMesh::UniquePtr new_physics; - - if( conductivity == "constant" && viscosity == "constant" && specific_heat == "constant" ) - new_physics.reset( new DerivedPhysics - (physics_name,input) ); - - else - this->prop_error_msg(physics_name, conductivity, viscosity, specific_heat); - - libmesh_assert(new_physics); - - return new_physics; - } - - template class DerivedPhysics> - void PhysicsFactoryVariableDensityFlow::prop_error_msg( const std::string& physics, - const std::string& conductivity, - const std::string& viscosity, - const std::string& specific_heat ) const - { - std::string error = "================================================================\n"; - error += "Invalid combination of models for "+physics+"\n"; - error += "Viscosity model = "+viscosity+"\n"; - error += "Conductivity model = "+conductivity+"\n"; - error += "Specific heat model = "+specific_heat+"\n"; - error += "================================================================\n"; - - libmesh_error_msg(error); - } - - // Instantiate all the "variable density flow" Physics factories. - PhysicsFactoryVariableDensityFlow grins_factory_low_mach_navier_stokes - (PhysicsNaming::low_mach_navier_stokes(),PhysicsNaming::low_mach_navier_stokes()); - - PhysicsFactoryVariableDensityFlow grins_factory_lmns_spgsm_stab - (PhysicsNaming::low_mach_navier_stokes_spgsm_stab(),PhysicsNaming::low_mach_navier_stokes()); - - PhysicsFactoryVariableDensityFlow grins_factory_lmns_vms_stab - (PhysicsNaming::low_mach_navier_stokes_vms_stab(),PhysicsNaming::low_mach_navier_stokes()); - - PhysicsFactoryVariableDensityFlow grins_factory_lmns_braack_stab - (PhysicsNaming::low_mach_navier_stokes_braack_stab(),PhysicsNaming::low_mach_navier_stokes()); - -} // end namespace GRINS diff --git a/src/solver/src/simulation_initializer.C b/src/solver/src/simulation_initializer.C index bf091d751..a59527697 100644 --- a/src/solver/src/simulation_initializer.C +++ b/src/solver/src/simulation_initializer.C @@ -27,6 +27,7 @@ // GRINS #include "grins/error_estimator_factory_initializer.h" +#include "grins/physics_factory_initializer.h" namespace GRINS { @@ -37,6 +38,7 @@ namespace GRINS if( !_is_initialized ) { ErrorEstimatorFactoryInitializer error_est_init; + PhysicsFactoryInitializer physics_init; _is_initialized = true; } From 473e2e439d070be6333c4db8e7b1f7186d168a59 Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Mon, 24 Apr 2017 10:10:06 -0400 Subject: [PATCH 5/7] FactoryInitializer for reacting flows I didn't make this one header only, as with the others, at this point because the collision with another branch in-progress would be pretty bad. So will do this temporarily and clean it up once the other branch (updating Antioch interface) is done. --- .../grins/physics_factory_reacting_flows.h | 7 +++++++ src/physics/src/physics_factory_initializer.C | 3 +++ .../src/physics_factory_reacting_flows.C | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/physics/include/grins/physics_factory_reacting_flows.h b/src/physics/include/grins/physics_factory_reacting_flows.h index 1d0d5e57d..8c7f7f84d 100644 --- a/src/physics/include/grins/physics_factory_reacting_flows.h +++ b/src/physics/include/grins/physics_factory_reacting_flows.h @@ -53,6 +53,13 @@ namespace GRINS }; + class ReactingFlowsPhysicsFactoryInitializer + { + public: + ReactingFlowsPhysicsFactoryInitializer(); + ~ReactingFlowsPhysicsFactoryInitializer(){} + }; + } // end namespace GRINS #endif // GRINS_PHYSICS_FACTORY_REACTING_FLOWS_H diff --git a/src/physics/src/physics_factory_initializer.C b/src/physics/src/physics_factory_initializer.C index 810bada31..b139d4d74 100644 --- a/src/physics/src/physics_factory_initializer.C +++ b/src/physics/src/physics_factory_initializer.C @@ -33,6 +33,7 @@ #include "grins/physics_factory_one_d_stress_solids.h" #include "grins/physics_factory_plane_stress_solids.h" #include "grins/physics_factory_variable_density_flow.h" +#include "grins/physics_factory_reacting_flows.h" #include "grins/physics_naming.h" #include "grins/scalar_ode.h" @@ -228,5 +229,7 @@ namespace GRINS static PhysicsFactoryVariableDensityFlow grins_factory_lmns_braack_stab (PhysicsNaming::low_mach_navier_stokes_braack_stab(),PhysicsNaming::low_mach_navier_stokes()); + + ReactingFlowsPhysicsFactoryInitializer grins_factory_reacting_flows_init; } }// end namespace GRINS diff --git a/src/physics/src/physics_factory_reacting_flows.C b/src/physics/src/physics_factory_reacting_flows.C index 70e644bb6..a1ca58964 100644 --- a/src/physics/src/physics_factory_reacting_flows.C +++ b/src/physics/src/physics_factory_reacting_flows.C @@ -204,11 +204,17 @@ namespace GRINS libmesh_error_msg(error); } - // Instantiate all the "reacting flow" Physics factories. - PhysicsFactoryReactingFlows grins_factory_rlmns - (PhysicsNaming::reacting_low_mach_navier_stokes(),PhysicsNaming::reacting_low_mach_navier_stokes()); - - PhysicsFactoryReactingFlows grins_factory_rlmns_spgsm_stab - (PhysicsNaming::reacting_low_mach_navier_stokes_spgsm_stab(),PhysicsNaming::reacting_low_mach_navier_stokes()); + ReactingFlowsPhysicsFactoryInitializer::ReactingFlowsPhysicsFactoryInitializer() + { + static PhysicsFactoryReactingFlows + grins_factory_rlmns + (PhysicsNaming::reacting_low_mach_navier_stokes(), + PhysicsNaming::reacting_low_mach_navier_stokes()); + + static PhysicsFactoryReactingFlows + grins_factory_rlmns_spgsm_stab + (PhysicsNaming::reacting_low_mach_navier_stokes_spgsm_stab(), + PhysicsNaming::reacting_low_mach_navier_stokes()); + } } // end namespace GRINS From 6cd67d5463cec1a013828b9c2b1677a707e244a6 Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Mon, 24 Apr 2017 10:45:00 -0400 Subject: [PATCH 6/7] Add BoundaryConditionFactoryInitializer This moves boundary condition-related factory object instantiation to the initializer object, which is then used in the SimulationInitializer. This is for prevention of symbol stripping during static linking. --- src/Makefile.am | 12 +- .../boundary_condition_factory_initializer.h} | 22 ++- ...sothermal_dirichlet_old_style_bc_factory.h | 26 ++++ ...ed_function_neumann_old_style_bc_factory.h | 19 +++ .../boundary_condition_factory_initializer.C | 147 ++++++++++++++++++ .../src/catalycity_factories.C | 34 ---- .../src/catalycity_factories_old_style.C | 34 ---- .../constant_function_dirichlet_bc_factory.C | 6 - ...ytic_wall_neumann_bc_old_style_factories.C | 37 ----- .../src/homogeneous_dirichlet_bc_factory.C | 36 ----- .../src/homogeneous_neumann_bc_factory.C | 38 ----- ...sothermal_dirichlet_old_style_bc_factory.C | 58 ------- .../parsed_function_dirichlet_bc_factory.C | 7 +- ..._function_dirichlet_old_style_bc_factory.C | 7 +- .../src/parsed_function_neumann_bc_factory.C | 46 ------ ...ed_function_neumann_old_style_bc_factory.C | 54 ------- ...tor_value_dirichlet_old_style_bc_factory.C | 6 - .../src/symmetry_type_bc_factories.C | 45 ------ src/solver/src/simulation_initializer.C | 2 + 19 files changed, 216 insertions(+), 420 deletions(-) rename src/boundary_conditions/{src/gas_catalytic_wall_neumann_bc_factories.C => include/grins/boundary_condition_factory_initializer.h} (63%) create mode 100644 src/boundary_conditions/src/boundary_condition_factory_initializer.C delete mode 100644 src/boundary_conditions/src/catalycity_factories.C delete mode 100644 src/boundary_conditions/src/catalycity_factories_old_style.C delete mode 100644 src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_old_style_factories.C delete mode 100644 src/boundary_conditions/src/homogeneous_dirichlet_bc_factory.C delete mode 100644 src/boundary_conditions/src/homogeneous_neumann_bc_factory.C delete mode 100644 src/boundary_conditions/src/isothermal_dirichlet_old_style_bc_factory.C delete mode 100644 src/boundary_conditions/src/parsed_function_neumann_bc_factory.C delete mode 100644 src/boundary_conditions/src/parsed_function_neumann_old_style_bc_factory.C delete mode 100644 src/boundary_conditions/src/symmetry_type_bc_factories.C diff --git a/src/Makefile.am b/src/Makefile.am index 650342682..96a0e632d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,16 +34,11 @@ libgrins_la_SOURCES += boundary_conditions/src/parsed_function_factory_helper.C libgrins_la_SOURCES += boundary_conditions/src/parsed_function_dirichlet_bc_factory.C libgrins_la_SOURCES += boundary_conditions/src/constant_function_dirichlet_bc_factory.C libgrins_la_SOURCES += boundary_conditions/src/parsed_function_dirichlet_old_style_bc_factory.C -libgrins_la_SOURCES += boundary_conditions/src/homogeneous_dirichlet_bc_factory.C libgrins_la_SOURCES += boundary_conditions/src/prescribed_vector_value_dirichlet_old_style_bc_factory.C -libgrins_la_SOURCES += boundary_conditions/src/isothermal_dirichlet_old_style_bc_factory.C -libgrins_la_SOURCES += boundary_conditions/src/symmetry_type_bc_factories.C libgrins_la_SOURCES += boundary_conditions/src/pressure_pinning.C libgrins_la_SOURCES += boundary_conditions/src/catalytic_wall_instantiate.C libgrins_la_SOURCES += boundary_conditions/src/catalycity_factory_abstract.C -libgrins_la_SOURCES += boundary_conditions/src/catalycity_factories.C libgrins_la_SOURCES += boundary_conditions/src/catalycity_factory_old_style_base.C -libgrins_la_SOURCES += boundary_conditions/src/catalycity_factories_old_style.C libgrins_la_SOURCES += boundary_conditions/src/catalycity_base.C libgrins_la_SOURCES += boundary_conditions/src/constant_catalycity.C libgrins_la_SOURCES += boundary_conditions/src/arrhenius_catalycity.C @@ -53,16 +48,12 @@ libgrins_la_SOURCES += boundary_conditions/src/neumann_bc_parsed.C libgrins_la_SOURCES += boundary_conditions/src/neumann_bc_factory_abstract.C libgrins_la_SOURCES += boundary_conditions/src/neumann_bc_old_style_factory_abstract.C libgrins_la_SOURCES += boundary_conditions/src/parsed_function_neumann_bc_factory_helper.C -libgrins_la_SOURCES += boundary_conditions/src/parsed_function_neumann_bc_factory.C -libgrins_la_SOURCES += boundary_conditions/src/parsed_function_neumann_old_style_bc_factory.C -libgrins_la_SOURCES += boundary_conditions/src/homogeneous_neumann_bc_factory.C libgrins_la_SOURCES += boundary_conditions/src/gas_recombination_catalytic_wall_neumann_bc_factory_impl.C libgrins_la_SOURCES += boundary_conditions/src/gas_solid_catalytic_wall_neumann_bc_factory_impl.C libgrins_la_SOURCES += boundary_conditions/src/catalytic_wall_neumann_bc_factory_common.C libgrins_la_SOURCES += boundary_conditions/src/catalytic_wall_neumann_bc_factory_base.C libgrins_la_SOURCES += boundary_conditions/src/catalytic_wall_neumann_bc_old_style_factory_base.C -libgrins_la_SOURCES += boundary_conditions/src/gas_catalytic_wall_neumann_bc_factories.C -libgrins_la_SOURCES += boundary_conditions/src/gas_catalytic_wall_neumann_bc_old_style_factories.C +libgrins_la_SOURCES += boundary_conditions/src/boundary_condition_factory_initializer.C # src/common libgrins_la_SOURCES += common/src/builder_helper.C @@ -321,6 +312,7 @@ include_HEADERS += boundary_conditions/include/grins/catalytic_wall_neumann_bc_f include_HEADERS += boundary_conditions/include/grins/catalytic_wall_neumann_bc_old_style_factory_base.h include_HEADERS += boundary_conditions/include/grins/gas_catalytic_wall_neumann_bc_factories.h include_HEADERS += boundary_conditions/include/grins/gas_catalytic_wall_neumann_bc_old_style_factories.h +include_HEADERS += boundary_conditions/include/grins/boundary_condition_factory_initializer.h # src/common headers include_HEADERS += common/include/grins/common.h diff --git a/src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_factories.C b/src/boundary_conditions/include/grins/boundary_condition_factory_initializer.h similarity index 63% rename from src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_factories.C rename to src/boundary_conditions/include/grins/boundary_condition_factory_initializer.h index 321935f86..b94acc0fa 100644 --- a/src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_factories.C +++ b/src/boundary_conditions/include/grins/boundary_condition_factory_initializer.h @@ -22,16 +22,22 @@ // //-----------------------------------------------------------------------el- -// These classes -#include "grins/gas_catalytic_wall_neumann_bc_factories.h" +#ifndef GRINS_BOUNDARY_CONDITION_FACTORY_INITIALIZER_H +#define GRINS_BOUNDARY_CONDITION_FACTORY_INITIALIZER_H namespace GRINS { - // Instantiate and register Factory - GasRecombinationCatalyticWallNeumannBCFactory - grins_factory_gas_recomb_catalytic_wall_neumann_bc("gas_recombination_catalytic_wall"); + //! Initialize all Factory objects related to boundary conditions + /*! To avoid symbol stripping from static linking, we use this + class to initialize/register the boundary condition factory objects. - GasSolidCatalyticWallNeumannBCFactory - grins_factory_gas_solid_catalytic_wall_neumann_bc("gas_solid_catalytic_wall"); + Relevant discussion: http://stackoverflow.com/questions/5202142/static-variable-initialization-over-a-library*/ + class BoundaryConditionFactoryInitializer + { + public: + BoundaryConditionFactoryInitializer(); + ~BoundaryConditionFactoryInitializer(){} + }; +} -} // end namespace GRINS +#endif // GRINS_BOUNDARY_CONDITION_FACTORY_INITIALIZER_H diff --git a/src/boundary_conditions/include/grins/isothermal_dirichlet_old_style_bc_factory.h b/src/boundary_conditions/include/grins/isothermal_dirichlet_old_style_bc_factory.h index 0ef2880ed..ceb3e889c 100644 --- a/src/boundary_conditions/include/grins/isothermal_dirichlet_old_style_bc_factory.h +++ b/src/boundary_conditions/include/grins/isothermal_dirichlet_old_style_bc_factory.h @@ -27,6 +27,10 @@ // GRINS #include "grins/dirichlet_bc_factory_function_old_style_base.h" +#include "grins/string_utils.h" + +// libMesh +#include "libmesh/const_function.h" namespace GRINS { @@ -50,6 +54,28 @@ namespace GRINS }; + libMesh::UniquePtr > + inline + IsothermalDirichletOldStyleBCFactory::build_func( const GetPot& input, + MultiphysicsSystem& /*system*/, + std::vector& var_names, + const std::string& section ) + { + libmesh_assert_equal_to(DirichletBCFactoryAbstract::_bc_ids->size(), 1 ); + libmesh_assert_equal_to(var_names.size(), 1 ); + + std::string bc_id_string = StringUtilities::T_to_string( *(_bc_ids->begin()) ); + + std::string input_var = section+"/T_wall_"+bc_id_string; + + if( !input.have_variable(input_var) ) + libmesh_error_msg("ERROR: Could not find input variable "+input_var+"!"); + + libMesh::Number value = input(input_var, 0.0); + + return libMesh::UniquePtr >( new libMesh::ConstFunction(value) ); + } + } // end namespace GRINS #endif // GRINS_ISOTHERMAL_DIRICHLET_OLD_STYLE_BC_FACTORY_H diff --git a/src/boundary_conditions/include/grins/parsed_function_neumann_old_style_bc_factory.h b/src/boundary_conditions/include/grins/parsed_function_neumann_old_style_bc_factory.h index 99fbac826..b655aeeff 100644 --- a/src/boundary_conditions/include/grins/parsed_function_neumann_old_style_bc_factory.h +++ b/src/boundary_conditions/include/grins/parsed_function_neumann_old_style_bc_factory.h @@ -58,6 +58,25 @@ namespace GRINS }; + template + inline + SharedPtr + ParsedFunctionNeumannOldStyleBCFactory::build_neumann_func( const GetPot& input, + MultiphysicsSystem& system, + const FEVariablesBase& fe_var, + const std::string& section ) + { + libmesh_assert_equal_to( this->_bc_ids->size(), 1 ); + + std::string flux_input = section+"/"+this->flux_input()+"_"+ + StringUtilities::T_to_string( *(this->_bc_ids->begin()) ); + + // Make sure flux input specified and consistent with var_names size + this->check_for_flux(input,flux_input,fe_var.active_var_names()); + + return this->build_neumman_func_common( input, system, fe_var, flux_input ); + } + template class TractionOldStyleBCFactory : public ParsedFunctionNeumannOldStyleBCFactory { diff --git a/src/boundary_conditions/src/boundary_condition_factory_initializer.C b/src/boundary_conditions/src/boundary_condition_factory_initializer.C new file mode 100644 index 000000000..184d273a1 --- /dev/null +++ b/src/boundary_conditions/src/boundary_condition_factory_initializer.C @@ -0,0 +1,147 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +// This class +#include "grins/boundary_condition_factory_initializer.h" + +// GRINS +#include "grins/catalycity_factories.h" +#include "grins/constant_function_dirichlet_bc_factory.h" +#include "grins/gas_catalytic_wall_neumann_bc_factories.h" +#include "grins/homogeneous_dirichlet_bc_factory.h" +#include "grins/homogeneous_neumann_bc_factory.h" +#include "grins/parsed_function_dirichlet_bc_factory.h" +#include "grins/parsed_function_neumann_bc_factory.h" +#include "grins/symmetry_type_bc_factories.h" + +// GRINS-Deprecated +#include "grins/catalycity_factories_old_style.h" +#include "grins/gas_catalytic_wall_neumann_bc_old_style_factories.h" +#include "grins/isothermal_dirichlet_old_style_bc_factory.h" +#include "grins/parsed_function_dirichlet_old_style_bc_factory.h" +#include "grins/parsed_function_neumann_old_style_bc_factory.h" +#include "grins/prescribed_vector_value_dirichlet_old_style_bc_factory.h" + +namespace GRINS +{ + BoundaryConditionFactoryInitializer::BoundaryConditionFactoryInitializer() + { + static ConstantCatalycityFactory grins_factory_constant_catalycity("constant"); + static ArrheniusCatalycityFactory grins_factory_arrhenius_catalycity("arrhenius"); + static PowerLawCatalycityFactory grins_factory_power_law_catalycity("power"); + + static ConstantFunctionDirichletBCFactory grins_factory_constant_dirichlet("constant_dirichlet"); + static ConstantFunctionDirichletBCFactory grins_factory_constant_displacement("constant_displacement"); + static ConstantFunctionDirichletBCFactory grins_factory_constant_isothermal("isothermal"); + static MoleFractionsDirichletBCFactory grins_factory_mole_fractions("mole_fractions"); + + static GasRecombinationCatalyticWallNeumannBCFactory + grins_factory_gas_recomb_catalytic_wall_neumann_bc("gas_recombination_catalytic_wall"); + + static GasSolidCatalyticWallNeumannBCFactory + grins_factory_gas_solid_catalytic_wall_neumann_bc("gas_solid_catalytic_wall"); + + static HomogeneousDirichletBCFactory grins_factory_homogeneous_dirichlet("homogeneous_dirichlet"); + static HomogeneousDirichletBCFactory grins_factory_no_slip("no_slip"); + static HomogeneousDirichletBCFactory grins_factory_pinned("pinned"); + + static HomogeneousNeumannBCFactory grins_factory_homogeneous_neumann("homogeneous_neumann"); + static HomogeneousNeumannBCFactory grins_factory_adiabatic("adiabatic"); + static HomogeneousNeumannBCFactory grins_factory_temp_axisym("Temperature_axisymmetric"); + static HomogeneousNeumannBCFactory grins_factory_species_axisym("SpeciesMassFractions_axisymmetric"); + + static ParsedDirichletBCFactory grins_factory_parsed_dirichlet("parsed_dirichlet"); + static ParsedFEMDirichletBCFactory grins_factory_parsed_fem_dirichlet("parsed_fem_dirichlet"); + static ParsedDirichletBCFactory grins_factory_parsed_displacement("parsed_displacement"); + + static ParsedFunctionNeumannBCFactory > + grins_factory_parsed_neumann("parsed_neumann"); + + static ParsedFunctionNeumannBCFactory > + grins_factory_parsed_fem_neumann("parsed_fem_neumann"); + + static ParsedTractionBCFactory > + grins_factory_parsed_traction("parsed_traction"); + + static ParsedTractionBCFactory > + grins_factory_parsed_fem_traction("parsed_fem_traction"); + + static ParsedTractionBCFactory > + grins_factory_constant_traction("constant_traction"); + + static YZSymmetryBCFactory grins_factory_yz_symmetry("yz_symmetry"); + static XZSymmetryBCFactory grins_factory_xz_symmetry("xz_symmetry"); + static XYSymmetryBCFactory grins_factory_xy_symmetry("xy_symmetry"); + static RollerXBCFactory grins_factory_roller_x("roller_x"); + static RollerYBCFactory grins_factory_roller_y("roller_y"); + static RollerZBCFactory grins_factory_roller_z("roller_z"); + static AxisymmetryBCFactory grins_factory_velocity_axisymmetry("Velocity_axisymmetric"); + + // Deprecated objects that will be removed in the future + static ConstantCatalycityFactoryOldStyle grins_factory_constant_catalycity_old_style("constant_old_style"); + static ArrheniusCatalycityFactoryOldStyle grins_factory_arrhenius_catalycity_old_style("arrhenius_old_style"); + static PowerLawCatalycityFactoryOldStyle grins_factory_power_law_catalycity_old_style("power_old_style"); + + static GasRecombinationCatalyticWallNeumannBCOldStyleFactory + grins_factory_gas_recomb_catalytic_wall_neumann_bc_old_style("gas_recombination_catalytic_wall_old_style"); + + static GasSolidCatalyticWallNeumannBCOldStyleFactory + grins_factory_gas_solid_catalytic_wall_neumann_bc_old_style("gas_solid_catalytic_wall_old_style"); + + static HomogeneousDirichletBCFactory grins_factory_no_slip_old_style("no_slip_old_style"); + static HomogeneousDirichletBCFactory grins_factory_pinned_old_style("pinned_old_style"); + + static HomogeneousNeumannBCFactory grins_factory_adiabatic_old_style("adiabatic_old_style"); + static HomogeneousNeumannBCFactory grins_factory_adiabatic_wall_old_style("adiabatic_wall_old_style"); + static HomogeneousNeumannBCFactory grins_factory_temp_axisym_old_style("Temperature_axisymmetric_old_style"); + static HomogeneousNeumannBCFactory grins_factory_species_axisym_old_style("SpeciesMassFractions_axisymmetric_old_style"); + + static IsothermalDirichletOldStyleBCFactory grins_factory_isothermal_wall_old_style("isothermal_wall_old_style"); + static IsothermalDirichletOldStyleBCFactory grins_factory_isothermal_old_style("isothermal_old_style"); + + static ParsedDirichletOldStyleBCFactory grins_factory_parsed_dirichlet_old_style("parsed_dirichlet_old_style"); + static ParsedDirichletOldStyleBCFactory grins_factory_constant_dirichlet_old_style("constant_dirichlet_old_style"); + static ParsedFEMDirichletOldStyleBCFactory grins_factory_parsed_fem_dirichlet_old_style("parsed_fem_dirichlet_old_style"); + + static TractionOldStyleBCFactory > + grins_factory_traction_old_style_functionbase("constant_traction_old_style"); + + static PrescribedVelDirichletOldStyleBCFactory + grins_factory_prescribed_vel_old_style("prescribed_vel_old_style"); + static PrescribedDispDirichletOldStyleBCFactory + grins_factory_constant_displacement_old_style("constant_displacement_old_style"); + static PrescribedSpeciesDirichletOldStyleBCFactory + grins_factory_prescribed_species_old_style("prescribed_species_old_style"); + static PrescribedMoleFractionsDirichletOldStyleBCFactory + grins_factory_prescribed_mole_fraccs_old_style("prescribed_mole_fracs_old_style"); + + static YZSymmetryBCFactory grins_factory_yz_symmetry_old_style("yz_symmetry_old_style"); + static XZSymmetryBCFactory grins_factory_xz_symmetry_old_style("xz_symmetry_old_style"); + static XYSymmetryBCFactory grins_factory_xy_symmetry_old_style("xy_symmetry_old_style"); + static RollerXBCFactory grins_factory_roller_x_old_style("roller_x_old_style"); + static RollerYBCFactory grins_factory_roller_y_old_style("roller_y_old_style"); + static RollerZBCFactory grins_factory_roller_z_old_style("roller_z_old_style"); + static AxisymmetryBCFactory grins_factory_velocity_axisymmetry_old_style("Velocity_axisymmetric_old_style"); + } +}// end namespace GRINS diff --git a/src/boundary_conditions/src/catalycity_factories.C b/src/boundary_conditions/src/catalycity_factories.C deleted file mode 100644 index 4f4708cb2..000000000 --- a/src/boundary_conditions/src/catalycity_factories.C +++ /dev/null @@ -1,34 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// These classes -#include "grins/catalycity_factories.h" - -namespace GRINS -{ - // Instantiate and register factories - ConstantCatalycityFactory grins_factory_constant_catalycity("constant"); - ArrheniusCatalycityFactory grins_factory_arrhenius_catalycity("arrhenius"); - PowerLawCatalycityFactory grins_factory_power_law_catalycity("power"); -} // end namespace GRINS diff --git a/src/boundary_conditions/src/catalycity_factories_old_style.C b/src/boundary_conditions/src/catalycity_factories_old_style.C deleted file mode 100644 index 400058167..000000000 --- a/src/boundary_conditions/src/catalycity_factories_old_style.C +++ /dev/null @@ -1,34 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// These classes -#include "grins/catalycity_factories_old_style.h" - -namespace GRINS -{ - // Instantiate and register factories - ConstantCatalycityFactoryOldStyle grins_factory_constant_catalycity_old_style("constant_old_style"); - ArrheniusCatalycityFactoryOldStyle grins_factory_arrhenius_catalycity_old_style("arrhenius_old_style"); - PowerLawCatalycityFactoryOldStyle grins_factory_power_law_catalycity_old_style("power_old_style"); -} // end namespace GRINS diff --git a/src/boundary_conditions/src/constant_function_dirichlet_bc_factory.C b/src/boundary_conditions/src/constant_function_dirichlet_bc_factory.C index bb079f991..cdaa2bad6 100644 --- a/src/boundary_conditions/src/constant_function_dirichlet_bc_factory.C +++ b/src/boundary_conditions/src/constant_function_dirichlet_bc_factory.C @@ -305,10 +305,4 @@ namespace GRINS template void MoleFractionsDirichletBCFactory::add_mole_frac_to_mass_frac(const GetPot&,const std::string&,const std::set&,const std::string&,const SpeciesMassFractionsVariable&,libMesh::CompositeFunction&,std::set& ) const; #endif - // Register all the ConstantFunction factories. - ConstantFunctionDirichletBCFactory grins_factory_constant_dirichlet("constant_dirichlet"); - ConstantFunctionDirichletBCFactory grins_factory_constant_displacement("constant_displacement"); - ConstantFunctionDirichletBCFactory grins_factory_constant_isothermal("isothermal"); - MoleFractionsDirichletBCFactory grins_factory_mole_fractions("mole_fractions"); - } // end namespace GRINS diff --git a/src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_old_style_factories.C b/src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_old_style_factories.C deleted file mode 100644 index e2070692a..000000000 --- a/src/boundary_conditions/src/gas_catalytic_wall_neumann_bc_old_style_factories.C +++ /dev/null @@ -1,37 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// These classes -#include "grins/gas_catalytic_wall_neumann_bc_old_style_factories.h" - -namespace GRINS -{ - // Instantiate and register Factory - GasRecombinationCatalyticWallNeumannBCOldStyleFactory - grins_factory_gas_recomb_catalytic_wall_neumann_bc_old_style("gas_recombination_catalytic_wall_old_style"); - - GasSolidCatalyticWallNeumannBCOldStyleFactory - grins_factory_gas_solid_catalytic_wall_neumann_bc_old_style("gas_solid_catalytic_wall_old_style"); - -} // end namespace GRINS diff --git a/src/boundary_conditions/src/homogeneous_dirichlet_bc_factory.C b/src/boundary_conditions/src/homogeneous_dirichlet_bc_factory.C deleted file mode 100644 index d6ade7dca..000000000 --- a/src/boundary_conditions/src/homogeneous_dirichlet_bc_factory.C +++ /dev/null @@ -1,36 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/homogeneous_dirichlet_bc_factory.h" - -namespace GRINS -{ - // Instantiate all the AllZeroVars factories. - HomogeneousDirichletBCFactory grins_factory_homogeneous_dirichlet("homogeneous_dirichlet"); - HomogeneousDirichletBCFactory grins_factory_no_slip("no_slip"); - HomogeneousDirichletBCFactory grins_factory_no_slip_old_style("no_slip_old_style"); - HomogeneousDirichletBCFactory grins_factory_pinned("pinned"); - HomogeneousDirichletBCFactory grins_factory_pinned_old_style("pinned_old_style"); -} // end namespace GRINS diff --git a/src/boundary_conditions/src/homogeneous_neumann_bc_factory.C b/src/boundary_conditions/src/homogeneous_neumann_bc_factory.C deleted file mode 100644 index 94105a552..000000000 --- a/src/boundary_conditions/src/homogeneous_neumann_bc_factory.C +++ /dev/null @@ -1,38 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/homogeneous_neumann_bc_factory.h" - -namespace GRINS -{ - HomogeneousNeumannBCFactory grins_factory_homogeneous_neumann("homogeneous_neumann"); - HomogeneousNeumannBCFactory grins_factory_adiabatic("adiabatic"); - HomogeneousNeumannBCFactory grins_factory_adiabatic_old_style("adiabatic_old_style"); - HomogeneousNeumannBCFactory grins_factory_adiabatic_wall_old_style("adiabatic_wall_old_style"); - HomogeneousNeumannBCFactory grins_factory_temp_axisym("Temperature_axisymmetric"); - HomogeneousNeumannBCFactory grins_factory_temp_axisym_old_style("Temperature_axisymmetric_old_style"); - HomogeneousNeumannBCFactory grins_factory_species_axisym("SpeciesMassFractions_axisymmetric"); - HomogeneousNeumannBCFactory grins_factory_species_axisym_old_style("SpeciesMassFractions_axisymmetric_old_style"); -} // end namespace GRINS diff --git a/src/boundary_conditions/src/isothermal_dirichlet_old_style_bc_factory.C b/src/boundary_conditions/src/isothermal_dirichlet_old_style_bc_factory.C deleted file mode 100644 index 9952c32db..000000000 --- a/src/boundary_conditions/src/isothermal_dirichlet_old_style_bc_factory.C +++ /dev/null @@ -1,58 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/isothermal_dirichlet_old_style_bc_factory.h" -#include "grins/string_utils.h" - -// libMesh -#include "libmesh/const_function.h" - -namespace GRINS -{ - libMesh::UniquePtr > - IsothermalDirichletOldStyleBCFactory::build_func( const GetPot& input, - MultiphysicsSystem& /*system*/, - std::vector& var_names, - const std::string& section ) - { - libmesh_assert_equal_to(DirichletBCFactoryAbstract::_bc_ids->size(), 1 ); - libmesh_assert_equal_to(var_names.size(), 1 ); - - std::string bc_id_string = StringUtilities::T_to_string( *(_bc_ids->begin()) ); - - std::string input_var = section+"/T_wall_"+bc_id_string; - - if( !input.have_variable(input_var) ) - libmesh_error_msg("ERROR: Could not find input variable "+input_var+"!"); - - libMesh::Number value = input(input_var, 0.0); - - return libMesh::UniquePtr >( new libMesh::ConstFunction(value) ); - } - - // Instantiate factory - IsothermalDirichletOldStyleBCFactory grins_factory_isothermal_wall_old_style("isothermal_wall_old_style"); - IsothermalDirichletOldStyleBCFactory grins_factory_isothermal_old_style("isothermal_old_style"); -} // end namespace GRINS diff --git a/src/boundary_conditions/src/parsed_function_dirichlet_bc_factory.C b/src/boundary_conditions/src/parsed_function_dirichlet_bc_factory.C index 6dd4317b6..ceed34515 100644 --- a/src/boundary_conditions/src/parsed_function_dirichlet_bc_factory.C +++ b/src/boundary_conditions/src/parsed_function_dirichlet_bc_factory.C @@ -85,9 +85,8 @@ namespace GRINS return all_funcs; } - // Instantiate all the Parsed(FEM)Function factories. - ParsedDirichletBCFactory grins_factory_parsed_dirichlet("parsed_dirichlet"); - ParsedFEMDirichletBCFactory grins_factory_parsed_fem_dirichlet("parsed_fem_dirichlet"); - ParsedDirichletBCFactory grins_factory_parsed_displacement("parsed_displacement"); + // Instantiate + template class ParsedFunctionDirichletBCFactory >; + template class ParsedFunctionDirichletBCFactory >; } // end namespace GRINS diff --git a/src/boundary_conditions/src/parsed_function_dirichlet_old_style_bc_factory.C b/src/boundary_conditions/src/parsed_function_dirichlet_old_style_bc_factory.C index 5190efd52..9fb15d045 100644 --- a/src/boundary_conditions/src/parsed_function_dirichlet_old_style_bc_factory.C +++ b/src/boundary_conditions/src/parsed_function_dirichlet_old_style_bc_factory.C @@ -59,9 +59,8 @@ namespace GRINS return all_funcs; } - // Instantiate all the ParsedDirichletOldStyle factories. - ParsedDirichletOldStyleBCFactory grins_factory_parsed_dirichlet_old_style("parsed_dirichlet_old_style"); - ParsedDirichletOldStyleBCFactory grins_factory_constant_dirichlet_old_style("constant_dirichlet_old_style"); - ParsedFEMDirichletOldStyleBCFactory grins_factory_parsed_fem_dirichlet_old_style("parsed_fem_dirichlet_old_style"); + // Instantiate + template class ParsedFunctionDirichletOldStyleBCFactory >; + template class ParsedFunctionDirichletOldStyleBCFactory >; } // end namespace GRINS diff --git a/src/boundary_conditions/src/parsed_function_neumann_bc_factory.C b/src/boundary_conditions/src/parsed_function_neumann_bc_factory.C deleted file mode 100644 index c1ec64d3c..000000000 --- a/src/boundary_conditions/src/parsed_function_neumann_bc_factory.C +++ /dev/null @@ -1,46 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/parsed_function_neumann_bc_factory.h" - -namespace GRINS -{ - ParsedFunctionNeumannBCFactory > - grins_factory_parsed_neumann("parsed_neumann"); - - ParsedFunctionNeumannBCFactory > - grins_factory_parsed_fem_neumann("parsed_fem_neumann"); - - ParsedTractionBCFactory > - grins_factory_parsed_traction("parsed_traction"); - - ParsedTractionBCFactory > - grins_factory_parsed_fem_traction("parsed_fem_traction"); - - // backward compatibility - ParsedTractionBCFactory > - grins_factory_constant_traction("constant_traction"); - -} // end namespace GRINS diff --git a/src/boundary_conditions/src/parsed_function_neumann_old_style_bc_factory.C b/src/boundary_conditions/src/parsed_function_neumann_old_style_bc_factory.C deleted file mode 100644 index 28055ad07..000000000 --- a/src/boundary_conditions/src/parsed_function_neumann_old_style_bc_factory.C +++ /dev/null @@ -1,54 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// These classes -#include "grins/parsed_function_neumann_old_style_bc_factory.h" - -namespace GRINS -{ - template - SharedPtr - ParsedFunctionNeumannOldStyleBCFactory::build_neumann_func( const GetPot& input, - MultiphysicsSystem& system, - const FEVariablesBase& fe_var, - const std::string& section ) - { - libmesh_assert_equal_to( this->_bc_ids->size(), 1 ); - - std::string flux_input = section+"/"+this->flux_input()+"_"+ - StringUtilities::T_to_string( *(this->_bc_ids->begin()) ); - - // Make sure flux input specified and consistent with var_names size - this->check_for_flux(input,flux_input,fe_var.active_var_names()); - - return this->build_neumman_func_common( input, system, fe_var, flux_input ); - } - - template class ParsedFunctionNeumannOldStyleBCFactory >; - template class ParsedFunctionNeumannOldStyleBCFactory >; - - TractionOldStyleBCFactory > - grins_factory_traction_old_style_functionbase("constant_traction_old_style"); - -} // end namespace GRINS diff --git a/src/boundary_conditions/src/prescribed_vector_value_dirichlet_old_style_bc_factory.C b/src/boundary_conditions/src/prescribed_vector_value_dirichlet_old_style_bc_factory.C index c9bbddb54..b2bae22a2 100644 --- a/src/boundary_conditions/src/prescribed_vector_value_dirichlet_old_style_bc_factory.C +++ b/src/boundary_conditions/src/prescribed_vector_value_dirichlet_old_style_bc_factory.C @@ -205,10 +205,4 @@ namespace GRINS template void PrescribedMoleFractionsDirichletOldStyleBCFactory::convert_mole_fracs_and_add_to_func(const GetPot&, const std::vector&, const SpeciesMassFractionsVariable&,libMesh::CompositeFunction& ) const; #endif - // Register factories - PrescribedVelDirichletOldStyleBCFactory grins_factory_prescribed_vel_old_style("prescribed_vel_old_style"); - PrescribedDispDirichletOldStyleBCFactory grins_factory_constant_displacement_old_style("constant_displacement_old_style"); - PrescribedSpeciesDirichletOldStyleBCFactory grins_factory_prescribed_species_old_style("prescribed_species_old_style"); - PrescribedMoleFractionsDirichletOldStyleBCFactory grins_factory_prescribed_mole_fraccs_old_style("prescribed_mole_fracs_old_style"); - } // end namespace GRINS diff --git a/src/boundary_conditions/src/symmetry_type_bc_factories.C b/src/boundary_conditions/src/symmetry_type_bc_factories.C deleted file mode 100644 index 36f423a53..000000000 --- a/src/boundary_conditions/src/symmetry_type_bc_factories.C +++ /dev/null @@ -1,45 +0,0 @@ -//-----------------------------------------------------------------------bl- -//-------------------------------------------------------------------------- -// -// 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- - -// This class -#include "grins/symmetry_type_bc_factories.h" - -namespace GRINS -{ - // Instantiate all the SymmetryType factories. - YZSymmetryBCFactory grins_factory_yz_symmetry("yz_symmetry"); - YZSymmetryBCFactory grins_factory_yz_symmetry_old_style("yz_symmetry_old_style"); - XZSymmetryBCFactory grins_factory_xz_symmetry("xz_symmetry"); - XZSymmetryBCFactory grins_factory_xz_symmetry_old_style("xz_symmetry_old_style"); - XYSymmetryBCFactory grins_factory_xy_symmetry("xy_symmetry"); - XYSymmetryBCFactory grins_factory_xy_symmetry_old_style("xy_symmetry_old_style"); - RollerXBCFactory grins_factory_roller_x("roller_x"); - RollerXBCFactory grins_factory_roller_x_old_style("roller_x_old_style"); - RollerYBCFactory grins_factory_roller_y("roller_y"); - RollerYBCFactory grins_factory_roller_y_old_style("roller_y_old_style"); - RollerZBCFactory grins_factory_roller_z("roller_z"); - RollerZBCFactory grins_factory_roller_z_old_style("roller_z_old_style"); - AxisymmetryBCFactory grins_factory_velocity_axisymmetry("Velocity_axisymmetric"); - AxisymmetryBCFactory grins_factory_velocity_axisymmetry_old_style("Velocity_axisymmetric_old_style"); -} // end namespace GRINS diff --git a/src/solver/src/simulation_initializer.C b/src/solver/src/simulation_initializer.C index a59527697..5bfa0d539 100644 --- a/src/solver/src/simulation_initializer.C +++ b/src/solver/src/simulation_initializer.C @@ -28,6 +28,7 @@ // GRINS #include "grins/error_estimator_factory_initializer.h" #include "grins/physics_factory_initializer.h" +#include "grins/boundary_condition_factory_initializer.h" namespace GRINS { @@ -39,6 +40,7 @@ namespace GRINS { ErrorEstimatorFactoryInitializer error_est_init; PhysicsFactoryInitializer physics_init; + BoundaryConditionFactoryInitializer bc_init; _is_initialized = true; } From bffdd65a6e5ff491d68b21d25be9b97b23eb2f33 Mon Sep 17 00:00:00 2001 From: "Paul T. Bauman" Date: Mon, 24 Apr 2017 16:38:46 -0400 Subject: [PATCH 7/7] Add VariableFactoryInitializer --- src/Makefile.am | 2 + src/solver/src/simulation_initializer.C | 2 + .../include/grins/variable_factory.h | 47 +++++++++++ .../grins/variable_factory_initializer.h | 43 ++++++++++ src/variables/src/variable_factory.C | 78 +------------------ .../src/variable_factory_initializer.C | 65 ++++++++++++++++ 6 files changed, 160 insertions(+), 77 deletions(-) create mode 100644 src/variables/include/grins/variable_factory_initializer.h create mode 100644 src/variables/src/variable_factory_initializer.C diff --git a/src/Makefile.am b/src/Makefile.am index 96a0e632d..29b66715c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -226,6 +226,7 @@ libgrins_la_SOURCES += variables/src/variable_warehouse.C libgrins_la_SOURCES += variables/src/variable_factory.C libgrins_la_SOURCES += variables/src/variable_builder.C libgrins_la_SOURCES += variables/src/default_variable_builder.C +libgrins_la_SOURCES += variables/src/variable_factory_initializer.C # src/utilities files libgrins_la_SOURCES += utilities/src/grins_version.C @@ -521,6 +522,7 @@ include_HEADERS += variables/include/grins/variable_warehouse.h include_HEADERS += variables/include/grins/variable_factory.h include_HEADERS += variables/include/grins/variable_builder.h include_HEADERS += variables/include/grins/default_variable_builder.h +include_HEADERS += variables/include/grins/variable_factory_initializer.h # src/utilities headers include_HEADERS += $(top_builddir)/src/utilities/include/grins/grins_version.h diff --git a/src/solver/src/simulation_initializer.C b/src/solver/src/simulation_initializer.C index 5bfa0d539..1cf53ed6a 100644 --- a/src/solver/src/simulation_initializer.C +++ b/src/solver/src/simulation_initializer.C @@ -29,6 +29,7 @@ #include "grins/error_estimator_factory_initializer.h" #include "grins/physics_factory_initializer.h" #include "grins/boundary_condition_factory_initializer.h" +#include "grins/variable_factory_initializer.h" namespace GRINS { @@ -41,6 +42,7 @@ namespace GRINS ErrorEstimatorFactoryInitializer error_est_init; PhysicsFactoryInitializer physics_init; BoundaryConditionFactoryInitializer bc_init; + VariableFactoryInitializer var_init; _is_initialized = true; } diff --git a/src/variables/include/grins/variable_factory.h b/src/variables/include/grins/variable_factory.h index 13f332b1d..7acd36ad0 100644 --- a/src/variables/include/grins/variable_factory.h +++ b/src/variables/include/grins/variable_factory.h @@ -28,6 +28,7 @@ // GRINS #include "grins/factory_with_getpot.h" #include "grins/fe_variables_base.h" +#include "grins/materials_parsing.h" // libMesh #include "libmesh/factory.h" @@ -244,6 +245,52 @@ namespace GRINS std::string _material; }; + template + inline + std::vector VariableFactoryBasic::parse_var_names( const GetPot& input, + const std::string& var_section ) + { + std::vector var_names; + + std::string input_sec = var_section+"/names"; + + // Make sure the names are present + if( !input.have_variable(input_sec) ) + libmesh_error_msg("ERROR: Could not find input parameter "+input_sec); + + unsigned int n_names = input.vector_variable_size(input_sec); + + var_names.resize(n_names); + for( unsigned int i = 0; i < n_names; i++ ) + var_names[i] = input(input_sec,std::string("DIE!"),i); + + return var_names; + } + + template + inline + std::vector SpeciesVariableFactory::parse_var_names( const GetPot& input, + const std::string& var_section ) + { + // Make sure the prefix is present + std::string prefix_sec = var_section+"/names"; + if( !input.have_variable(prefix_sec) ) + libmesh_error_msg("ERROR: Could not find input parameter "+prefix_sec+" for species prefix!"); + + // Make sure the material is present + std::string material_sec = var_section+"/material"; + if( !input.have_variable(material_sec) ) + libmesh_error_msg("ERROR: Could not find input parameter "+material_sec+" for species material!"); + + this->_prefix = input(prefix_sec,std::string("DIE!")); + this->_material = input(material_sec,std::string("DIE!")); + + std::vector var_names; + MaterialsParsing::parse_species_varnames(input,this->_material,this->_prefix,var_names); + + return var_names; + } + } // end namespace GRINS #endif // GRINS_VARIABLE_FACTORY_H diff --git a/src/variables/include/grins/variable_factory_initializer.h b/src/variables/include/grins/variable_factory_initializer.h new file mode 100644 index 000000000..2bd46860d --- /dev/null +++ b/src/variables/include/grins/variable_factory_initializer.h @@ -0,0 +1,43 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +#ifndef GRINS_VARIABLE_FACTORY_INITIALIZER_H +#define GRINS_VARIABLE_FACTORY_INITIALIZER_H + +namespace GRINS +{ + //! Initialize all VariableFactory objects + /*! To avoid symbol stripping from static linking, we use this + class to initialize/register the Variable factory objects. + + Relevant discussion: http://stackoverflow.com/questions/5202142/static-variable-initialization-over-a-library*/ + class VariableFactoryInitializer + { + public: + VariableFactoryInitializer(); + ~VariableFactoryInitializer(){} + }; +} + +#endif // GRINS_VARIABLE_FACTORY_INITIALIZER_H diff --git a/src/variables/src/variable_factory.C b/src/variables/src/variable_factory.C index ed308578a..92f396b16 100644 --- a/src/variables/src/variable_factory.C +++ b/src/variables/src/variable_factory.C @@ -25,12 +25,6 @@ // This class #include "grins/variable_factory.h" -// GRINS -#include "grins/materials_parsing.h" -#include "grins/single_variable.h" -#include "grins/multicomponent_variable.h" -#include "grins/multi_component_vector_variable.h" - namespace GRINS { libMesh::UniquePtr VariableFactoryAbstract::create() @@ -109,6 +103,7 @@ namespace GRINS _subdomain_ids = NULL; } + void VariableFactoryAbstract::check_build_parse_state() { if( !_input ) @@ -124,50 +119,6 @@ namespace GRINS _var_section = std::string("DIE!"); } - template - std::vector VariableFactoryBasic::parse_var_names( const GetPot& input, - const std::string& var_section ) - { - std::vector var_names; - - std::string input_sec = var_section+"/names"; - - // Make sure the names are present - if( !input.have_variable(input_sec) ) - libmesh_error_msg("ERROR: Could not find input parameter "+input_sec); - - unsigned int n_names = input.vector_variable_size(input_sec); - - var_names.resize(n_names); - for( unsigned int i = 0; i < n_names; i++ ) - var_names[i] = input(input_sec,std::string("DIE!"),i); - - return var_names; - } - - template - std::vector SpeciesVariableFactory::parse_var_names( const GetPot& input, - const std::string& var_section ) - { - // Make sure the prefix is present - std::string prefix_sec = var_section+"/names"; - if( !input.have_variable(prefix_sec) ) - libmesh_error_msg("ERROR: Could not find input parameter "+prefix_sec+" for species prefix!"); - - // Make sure the material is present - std::string material_sec = var_section+"/material"; - if( !input.have_variable(material_sec) ) - libmesh_error_msg("ERROR: Could not find input parameter "+material_sec+" for species material!"); - - this->_prefix = input(prefix_sec,std::string("DIE!")); - this->_material = input(material_sec,std::string("DIE!")); - - std::vector var_names; - MaterialsParsing::parse_species_varnames(input,this->_material,this->_prefix,var_names); - - return var_names; - } - // Full specialization for the Factory template<> std::map*>& @@ -185,31 +136,4 @@ namespace GRINS std::string VariableFactoryAbstract::_var_section = std::string("DIE!"); const std::set* VariableFactoryAbstract::_subdomain_ids = NULL; - VariableFactoryBasic - grins_factory_disp_fe_var(VariablesParsing::displacement_section()); - - VariableFactoryBasic - grins_factory_single_var(VariablesParsing::single_var_section()); - - VariableFactoryBasic - grins_factory_press_fe_var(VariablesParsing::pressure_section()); - - VariableFactoryBasic - grins_factory_temp_fe_var(VariablesParsing::temperature_section()); - - SpeciesVariableFactory - grins_factory_species_mass_frac_fe_var(VariablesParsing::species_mass_fractions_section()); - - ScalarVariableFactory - grins_factory_thermo_press_fe_var(VariablesParsing::thermo_pressure_section()); - - VariableFactoryBasic - grins_factory_turb_fe_var(VariablesParsing::turbulence_section()); - - VariableFactoryBasic - grins_factory_velocity_fe_var(VariablesParsing::velocity_section()); - - ScalarVariableFactory - grins_factory_scalar_var(VariablesParsing::scalar_var_section()); - } // end namespace GRINS diff --git a/src/variables/src/variable_factory_initializer.C b/src/variables/src/variable_factory_initializer.C new file mode 100644 index 000000000..00b530f53 --- /dev/null +++ b/src/variables/src/variable_factory_initializer.C @@ -0,0 +1,65 @@ +//-----------------------------------------------------------------------bl- +//-------------------------------------------------------------------------- +// +// 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- + +// This class +#include "grins/variable_factory_initializer.h" + +// GRINS +#include "grins/variable_factory.h" +#include "grins/single_variable.h" +#include "grins/multicomponent_variable.h" +#include "grins/multi_component_vector_variable.h" + +namespace GRINS +{ + VariableFactoryInitializer::VariableFactoryInitializer() + { + static VariableFactoryBasic + grins_factory_disp_fe_var(VariablesParsing::displacement_section()); + + static VariableFactoryBasic + grins_factory_single_var(VariablesParsing::single_var_section()); + + static VariableFactoryBasic + grins_factory_press_fe_var(VariablesParsing::pressure_section()); + + static VariableFactoryBasic + grins_factory_temp_fe_var(VariablesParsing::temperature_section()); + + static SpeciesVariableFactory + grins_factory_species_mass_frac_fe_var(VariablesParsing::species_mass_fractions_section()); + + static ScalarVariableFactory + grins_factory_thermo_press_fe_var(VariablesParsing::thermo_pressure_section()); + + static VariableFactoryBasic + grins_factory_turb_fe_var(VariablesParsing::turbulence_section()); + + static VariableFactoryBasic + grins_factory_velocity_fe_var(VariablesParsing::velocity_section()); + + static ScalarVariableFactory + grins_factory_scalar_var(VariablesParsing::scalar_var_section()); + } +} // end namespace GRINS