GRINS-0.8.0
physics_factory_incompressible_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_INCOMPRESSIBLE_FLOW_H
26 #define GRINS_PHYSICS_FACTORY_INCOMPRESSIBLE_FLOW_H
27 
28 // GRINS
32 #include "grins/parsed_viscosity.h"
34 
35 namespace GRINS
36 {
37  template<template<typename> class DerivedPhysics>
39  {
40  public:
41  PhysicsFactoryIncompressibleFlow( 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 visc_error_msg( const std::string& physics, const std::string& viscosity ) const;
54 
55  };
56 
57  template<template<typename> class DerivedPhysics>
58  inline
59  libMesh::UniquePtr<Physics>
61  ( const GetPot& input, const std::string& physics_name )
62  {
63  std::string core_physics = this->find_core_physics_name(physics_name);
64 
65  std::string viscosity;
66  PhysicsFactoryHelper::parse_viscosity_model(input,core_physics,viscosity);
67 
68  libMesh::UniquePtr<Physics> new_physics;
69 
70  if( viscosity == "constant" )
71  new_physics.reset( new DerivedPhysics<ConstantViscosity>(physics_name,input) );
72 
73  else if( viscosity == "parsed" )
74  new_physics.reset( new DerivedPhysics<ParsedViscosity>(physics_name,input) );
75 
76  // For SA viscosity model, we need to parse what the "sub" viscosity model is
77  else if( viscosity == "spalartallmaras" )
78  {
79  std::string turb_viscosity;
80  PhysicsFactoryHelper::parse_turb_viscosity_model(input,core_physics,turb_viscosity);
81  if( turb_viscosity == "constant" )
82  new_physics.reset(new DerivedPhysics<SpalartAllmarasViscosity<ConstantViscosity> >(physics_name,input) );
83  else
84  this->visc_error_msg(physics_name, turb_viscosity);
85  }
86  else
87  this->visc_error_msg(physics_name, viscosity);
88 
89  libmesh_assert(new_physics);
90 
91  return new_physics;
92  }
93 
94  template<template<typename> class DerivedPhysics>
95  inline
97  const std::string& viscosity ) const
98  {
99  std::string error = "================================================================\n";
100  error += "Invalid viscosity model for "+physics+"\n";
101  error += "Viscosity model = "+viscosity+"\n";
102  error += "================================================================\n";
103 
104  libmesh_error_msg(error);
105  }
106 
107 } // end namespace GRINS
108 
109 #endif // GRINS_PHYSICS_FACTORY_INCOMPRESSIBLE_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.
virtual libMesh::UniquePtr< Physics > build_physics(const GetPot &input, const std::string &physics_name)
PhysicsFactory base class for Physics that may have a related "core" Physics.
GRINS namespace.
PhysicsFactoryIncompressibleFlow(const std::string &physics_name, const std::string &core_physics_name)
void visc_error_msg(const std::string &physics, const std::string &viscosity) const
static void parse_turb_viscosity_model(const GetPot &input, const std::string &physics, std::string &model)
Determine viscosity model used by turblence classes.

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