GRINS-0.8.0
boussinesq_buoyancy_base.C
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 #include "grins_config.h"
26 
27 // This class
29 
30 // GRINS
31 #include "grins/common.h"
35 
36 // libMesh
37 #include "libmesh/getpot.h"
38 #include "libmesh/string_to_enum.h"
39 #include "libmesh/fem_system.h"
40 
41 namespace GRINS
42 {
43 
44  BoussinesqBuoyancyBase::BoussinesqBuoyancyBase( const std::string& physics_name, const GetPot& input )
45  : Physics(physics_name,input),
46  _flow_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<VelocityVariable>(VariablesParsing::velocity_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
47  _press_var(GRINSPrivate::VariableWarehouse::get_variable_subclass<PressureFEVariable>(VariablesParsing::press_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
48  _temp_vars(GRINSPrivate::VariableWarehouse::get_variable_subclass<PrimitiveTempFEVariables>(VariablesParsing::temp_variable_name(input,physics_name,VariablesParsing::PHYSICS))),
49  _rho(0.0),
50  _T_ref(1.0),
51  _beta_T(1.0)
52  {
53  this->read_property(input,
54  "Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/rho_ref",
55  "Density",
56  _rho);
57 
58  this->read_property(input,
59  "Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/T_ref",
60  "ReferenceTemperature",
61  _T_ref);
62 
63 
64  this->read_property(input,
65  "Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/beta_T",
66  "ThermalExpansionCoeff",
67  _beta_T);
68 
69  unsigned int g_dim = input.vector_variable_size("Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/g");
70 
71  _g(0) = input("Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/g", 0.0, 0 );
72  _g(1) = input("Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/g", 0.0, 1 );
73 
74  if( g_dim == 3)
75  _g(2) = input("Physics/"+PhysicsNaming::boussinesq_buoyancy()+"/g", 0.0, 2 );
76 
80  }
81 
82  void BoussinesqBuoyancyBase::read_property( const GetPot& input,
83  const std::string& old_option,
84  const std::string& property,
85  libMesh::Real& value )
86  {
88 
89  // Can't specify both material and rho_ref
91  old_option,
92  "Materials/"+material+"/"+property+"/value" );
93 
94  // Deprecated
95  if( input.have_variable(old_option) )
96  {
97  MaterialsParsing::dep_input_warning( old_option,property+"/value" );
98 
99  this->set_parameter
100  (value, input,
101  old_option, 1.0 /*Old default*/);
102  }
103  // Preferred
104  else if( input.have_variable("Materials/"+material+"/"+property+"/value" ) )
105  {
106  this->set_parameter
107  (value, input,
108  "Materials/"+material+"/"+property+"/value", 0.0 /*default*/);
109  }
110  // If nothing was set, we default to 1.0. Deprecated, what was I thinking
111  else
112  {
113  this->no_input_warning( input,
114  old_option,
115  material,
116  property );
117  this->set_parameter
118  (value, input, old_option, 1.0 /*default*/);
119  }
120 
121  // Make sure density is positive
122  if( value <= 0.0 )
123  {
124  libmesh_error_msg("ERROR: Detected non-positive "+property+"!");
125  }
126  }
127 
128  void BoussinesqBuoyancyBase::no_input_warning( const GetPot& input,
129  const std::string& old_option,
130  const std::string& material,
131  const std::string& property )
132  {
133  std::string warning;
135  {
136  warning = "WARNING: Neither "+old_option+"\n";
137  warning += " nor a material_name was detected in input\n";
138  warning + " "+property+" is defaulting to 1.0. This behavior is DEPRECATED!\n";
139  warning += " Please update to use Material/MATERIAL_NAME/"+property+"/value\n";
140  }
141  else
142  {
143  warning = "WARNING: Neither "+old_option+"\n";
144  warning += " nor Material/"+material+"/"+property+"/value\n";
145  warning + " "+property+" is defaulting to 1.0. This behavior is DEPRECATED!\n";
146  warning += " Please update to use Material/MATERIAL_NAME/"+property+"/value\n";
147  }
148 
149  grins_warning(warning);
150  }
151 
152 
153 
154 } // namespace GRINS
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
void read_property(const GetPot &input, const std::string &old_option, const std::string &property, libMesh::Real &value)
Helper function for parsing/maintaing backward compatibility.
libMesh::Point _g
Gravitational vector.
const PressureFEVariable & _press_var
const VelocityVariable & _flow_vars
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
Definition: physics.h:106
void check_var_subdomain_consistency(const FEVariablesBase &var) const
Check that var is enabled on at least the subdomains this Physics is.
Definition: physics.C:174
#define grins_warning(message)
Definition: common.h:34
GRINS namespace.
libMesh::Number _T_ref
reference temperature
static PhysicsName boussinesq_buoyancy()
void no_input_warning(const GetPot &input, const std::string &old_option, const std::string &material, const std::string &property)
Helper function for parsing/maintaing backward compatibility.
static void dep_input_warning(const std::string &old_option, const std::string &property)
Helper function for parsing/maintaing backward compatibility.
const PrimitiveTempFEVariables & _temp_vars
static void duplicate_input_test(const GetPot &input, const std::string &option1, const std::string &option2)
Helper function for parsing/maintaing backward compatibility.
static std::string material_name(const GetPot &input, const std::string &physics)
Get the name of the material in the Physics/physics section.
libMesh::Number _beta_T
coefficient of thermal expansion
static bool have_material(const GetPot &input, const std::string &physics)
Check if Physics/physics section has a material variable.

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