GRINS-0.8.0
3d_low_mach_jacobians.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 #include <iostream>
28 
29 // GRINS
30 #include "grins/runner.h"
31 
32 // libMesh
33 #include "libmesh/parallel.h"
34 
35 // Function for getting initial temperature field
36 libMesh::Real
37 initial_values( const libMesh::Point& p, const libMesh::Parameters &params,
38  const std::string& system_name, const std::string& unknown_name );
39 
40 int main(int argc, char* argv[])
41 {
42  GRINS::Runner grins(argc,argv);
43  grins.init();
44 
45  const GetPot & inputfile = grins.get_input_file();
46 
47  //FIXME: We need to move this to within the Simulation object somehow...
48  std::string restart_file = inputfile( "restart-options/restart_file", "none" );
49 
50  if( restart_file == "none" )
51  {
52  GRINS::Simulation & sim = grins.get_simulation();
53  // Asssign initial temperature value
54  std::string system_name = inputfile( "screen-options/system_name", "GRINS" );
55  GRINS::SharedPtr<libMesh::EquationSystems> es = sim.get_equation_system();
56  const libMesh::System& system = es->get_system(system_name);
57 
58  libMesh::Parameters &params = es->parameters;
59  libMesh::Real T_init = inputfile("Materials/TestMaterial/ReferenceTemperature/value", 0.0);
60  libMesh::Real p0_init = inputfile("Materials/TestMaterial/ThermodynamicPressure/value", 0.0);
61 
62  libMesh::Real& dummy_T = params.set<libMesh::Real>("T_init");
63  dummy_T = T_init;
64 
65  libMesh::Real& dummy_p0 = params.set<libMesh::Real>("p0_init");
66  dummy_p0 = p0_init;
67 
68  system.project_solution( initial_values, NULL, params );
69  }
70 
71  grins.run();
72 
73  return 0;
74 }
75 
76 libMesh::Real
77 initial_values( const libMesh::Point&, const libMesh::Parameters &params,
78  const std::string& , const std::string& unknown_name )
79 {
80  libMesh::Real value = 0.0;
81 
82  if( unknown_name == "T" )
83  value = params.get<libMesh::Real>("T_init");
84 
85  else if( unknown_name == "p0" )
86  value = params.get<libMesh::Real>("p0_init");
87 
88  else
89  value = 0.0;
90 
91  return value;
92 }
void init()
Initialize the Simulation objects.
Definition: runner.C:53
SharedPtr< libMesh::EquationSystems > get_equation_system()
Definition: simulation.C:393
const GetPot & get_input_file() const
Definition: runner.h:60
libMesh::Real initial_values(const libMesh::Point &p, const libMesh::Parameters &params, const std::string &system_name, const std::string &unknown_name)
Class to encapsulate initializing and running GRINS Simulation.
Definition: runner.h:47
int main(int argc, char *argv[])
void run()
Runs the simulation that was setup at construction time.
Definition: runner.C:104
Simulation & get_simulation()
Definition: runner.h:66

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