GRINS-0.8.0
physics_factory_variable_density_flow.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef GRINS_PHYSICS_FACTORY_VARIABLE_DENSITY_FLOW_H
26 #define GRINS_PHYSICS_FACTORY_VARIABLE_DENSITY_FLOW_H
27 
28 // GRINS
34 
35 namespace GRINS
36 {
37  template<template<typename,typename,typename> class DerivedPhysics>
39  {
40  public:
41  PhysicsFactoryVariableDensityFlow( const std::string& physics_name,
42  const std::string& core_physics_name )
43  : PhysicsFactoryWithCore(physics_name,core_physics_name)
44  {}
45 
47 
48  protected:
49 
50  virtual libMesh::UniquePtr<Physics> build_physics( const GetPot& input,
51  const std::string& physics_name );
52 
53  void prop_error_msg( const std::string& physics,
54  const std::string& conductivity,
55  const std::string& viscosity,
56  const std::string& specific_heat ) const;
57 
58  };
59 
60  template<template<typename,typename,typename> class DerivedPhysics>
61  inline
62  libMesh::UniquePtr<Physics> PhysicsFactoryVariableDensityFlow<DerivedPhysics>::build_physics( const GetPot& input,
63  const std::string& physics_name )
64  {
65  std::string core_physics = this->find_core_physics_name(physics_name);
66 
67  std::string conductivity;
68  PhysicsFactoryHelper::parse_conductivity_model(input,core_physics,conductivity);
69 
70  std::string viscosity;
71  PhysicsFactoryHelper::parse_viscosity_model(input,core_physics,viscosity);
72 
73  std::string specific_heat;
74  PhysicsFactoryHelper::parse_specific_heat_model(input,core_physics,specific_heat);
75 
76  libMesh::UniquePtr<Physics> new_physics;
77 
78  if( conductivity == "constant" && viscosity == "constant" && specific_heat == "constant" )
79  new_physics.reset( new DerivedPhysics<ConstantViscosity,ConstantSpecificHeat,ConstantConductivity>
80  (physics_name,input) );
81 
82  else
83  this->prop_error_msg(physics_name, conductivity, viscosity, specific_heat);
84 
85  libmesh_assert(new_physics);
86 
87  return new_physics;
88  }
89 
90  template<template<typename,typename,typename> class DerivedPhysics>
91  inline
93  const std::string& conductivity,
94  const std::string& viscosity,
95  const std::string& specific_heat ) const
96  {
97  std::string error = "================================================================\n";
98  error += "Invalid combination of models for "+physics+"\n";
99  error += "Viscosity model = "+viscosity+"\n";
100  error += "Conductivity model = "+conductivity+"\n";
101  error += "Specific heat model = "+specific_heat+"\n";
102  error += "================================================================\n";
103 
104  libmesh_error_msg(error);
105  }
106 
107 } // end namespace GRINS
108 
109 #endif // GRINS_PHYSICS_FACTORY_VARIABLE_DENSITY_FLOW_H
static void parse_viscosity_model(const GetPot &input, const std::string &physics, std::string &model)
Determine viscosity model based on given physics name.
PhysicsFactory base class for Physics that may have a related "core" Physics.
void prop_error_msg(const std::string &physics, const std::string &conductivity, const std::string &viscosity, const std::string &specific_heat) const
GRINS namespace.
static void parse_conductivity_model(const GetPot &input, const std::string &physics, std::string &model)
Determine conductivity model based on given physics name.
virtual libMesh::UniquePtr< Physics > build_physics(const GetPot &input, const std::string &physics_name)
PhysicsFactoryVariableDensityFlow(const std::string &physics_name, const std::string &core_physics_name)
static void parse_specific_heat_model(const GetPot &input, const std::string &physics, std::string &model)
Determine specific heat model based on given physics name.

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1