LifeV
ADRData.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the LifeV library
3  Copyright (C) 2010 EPFL, INRIA, Politecnico di Milano and Emory University
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 /*!
20  \file dataADR.cpp
21  \date 08/2010
22  \version 2.0
23 
24  \brief Implementation of DataADR
25 
26 */
27 
28 #include <lifev/core/solver/ADRData.hpp>
29 
30 namespace LifeV
31 {
32 
33 // ===================================================
34 // Constructors & Destructor
35 // ===================================================
36 
37 // Empty constructor
40  M_reactionCoefficient ( 0. ),
41  M_steady ( 1 ),
43  M_TimeDataPtr ( new TimeData_type() ),
44  M_verbose ( false ),
45  M_solFEType ( "P1" ),
46  // M_advectionFieldFEType ( "P1" ),
47  M_stabilization_list ( "Stab. list" ),
50 {
51  M_stabilization_list.add ( "ip", ADR_IP_STABILIZATION, "interior penalty " );
52  M_stabilization_list.add ( "sd", ADR_SD_STABILIZATION, "stream-line difussion" );
53  M_stabilization_list.add ( "none", ADR_NO_STABILIZATION, "none (default)" );
54 }
55 
56 
57 // Copy constructor
58 DataADR::DataADR ( const DataADR& dataADR ) :
61  M_steady ( dataADR.M_steady ),
63  M_TimeDataPtr ( dataADR.M_TimeDataPtr ),
64  M_verbose ( dataADR.M_verbose ),
65  M_solFEType ( dataADR.M_solFEType ),
66  // M_advectionFieldFEType ( dataADR.M_advectionFieldFEType ),
70 {
71 }
72 
73 // ===================================================
74 // Methods
75 // ===================================================
76 
77 // Set up the class reading from data file
78 void
79 DataADR::setup ( const GetPot& dfile, const std::string& section )
80 {
81  // We want a slash dividing the data file section from the variable name but only
82  // when not provided by the user or when not looking in the root of the data file
83  std::string corrected_section ( section );
84  if ( ( ! section.empty() ) && ( section[section.length() - 1] != '/' ) )
85  {
86  corrected_section = section + '/';
87  }
88  // physics
89  M_diffusionCoefficient = dfile ( (corrected_section + "physics/diffusionCoefficient").data(), 1. );
90  M_reactionCoefficient = dfile ( (corrected_section + "physics/reactionCoefficient").data(), 1. );
91  M_steady = dfile ( (corrected_section + "physics/steady").data(), 1 );
92  M_solutionFieldDimension = dfile ( (corrected_section + "physics/solutionFieldDimension").data(), 1 );
93 
94  // miscellaneous
95  M_verbose = dfile ( (corrected_section + "miscellaneous/verbose").data(), 1 );
96 
97  // type of finite element (P1, P2, ...)
98  M_solFEType = dfile ( (corrected_section + "space_discretization/sol_FEtype").data(), "P1");
99  // M_advectionFieldFEType = dfile( (corrected_section+"space_discretization/advectionField_FEtype").data(), "P1");
100 
101  // stabilization
102  M_stabilizationMethod = ADRStabilization ( M_stabilization_list.value ( dfile ( (corrected_section + "space_discretization/stabilization").data(), "none") ) );
103  M_stabilizationCoefficient = dfile ( (corrected_section + "space_discretization/stabilizationCoefficient").data(), 0. );
104 }
105 
106 
107 // Output
108 void
109 DataADR::showMe ( std::ostream& c ) const
110 {
111  c << "\n*** DataADR: values for user-defined data\n";
112 
113  c << "\n[/physics]" << std::endl;
114  c << "diffusionCoefficient\t\t= " << M_diffusionCoefficient << std::endl;
115  c << "reactionCoefficient\t\t= " << M_reactionCoefficient << std::endl;
116  c << "steady\t\t= " << M_steady << std::endl;
117  c << "solutionFieldDimension\t\t= " << M_solutionFieldDimension << std::endl;
118 
119  c << "\n[/miscellaneous]" << std::endl;
120  c << "verbose\t\t= " << M_verbose << std::endl;
121 
122  c << "\n[/space_discretization]" << std::endl;
123  c << "sol_FEtype\t\t= " << M_solFEType << std::endl;
124  // c << "advectionField_FEtype\t\t= " << M_advectionFieldFEType << std::endl;
125 
126  c << "stabilization\t\t= ";
127  switch ( M_stabilizationMethod )
128  {
129  case ADR_NO_STABILIZATION:
130  c << "none" ;
131  break;
132  case ADR_IP_STABILIZATION:
133  c << "ip" ;
134  break;
135  case ADR_SD_STABILIZATION:
136  c << "sd" ;
137  break;
138  }
139  c << std::endl;
140  c << "stabilizationCoefficient\t\t= " << M_stabilizationCoefficient << std::endl;
141  c << std::endl;
142 }
143 
144 }
Real M_diffusionCoefficient
Physics.
Definition: ADRData.hpp:224
DataADR()
Empty Constructor.
Definition: ADRData.cpp:38
void showMe(std::ostream &output=std::cout) const
Display the internal values.
Definition: ADRData.cpp:109
Real M_reactionCoefficient
Definition: ADRData.hpp:225
No stabilization.
Definition: ADRData.hpp:57
void updateInverseJacobian(const UInt &iQuadPt)
DataADR(const DataADR &dataADR)
Copy constructor.
Definition: ADRData.cpp:58
UInt M_verbose
Miscellaneous parameters.
Definition: ADRData.hpp:233
Real M_stabilizationCoefficient
Definition: ADRData.hpp:244
std::string M_solFEType
Type of finite element (P1, P2, ...) for the solution.
Definition: ADRData.hpp:236
TimeData_ptr_type M_TimeDataPtr
Data container for time parameters.
Definition: ADRData.hpp:230
UInt M_solutionFieldDimension
Definition: ADRData.hpp:227
ADRStabilization M_stabilizationMethod
Definition: ADRData.hpp:242
void setup(const GetPot &dataFile, const std::string &section="adr")
Read the dataFile and set all the internal quantities.
Definition: ADRData.cpp:79