ZeroDimensionalData.hpp 3.97 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@HEADER
/*
*******************************************************************************

    Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
    Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University

    This file is part of LifeV.

    LifeV is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    LifeV is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with LifeV.  If not, see <http://www.gnu.org/licenses/>.
22

23
24
25
26
27
28
29
*******************************************************************************
*/
//@HEADER

/*!
 *  @file
 *  @brief File containing a class for 0D model data handling.
30
 *  @version alpha (experimental)
31
32
33
34
 *
 *  @date 16-11-2011
 *  @author Mahmoud Jafargholi
 *
35
36
 *  @contributors Cristiano Malossi <cristiano.malossi@epfl.ch>
 *  @mantainer    Cristiano Malossi <cristiano.malossi@epfl.ch>
37
38
39
40
41
42
 */

#ifndef ZeroDimensionalData_H
#define ZeroDimensionalData_H

// LIFEV
43
#include <lifev/zero_dimensional/solver/ZeroDimensionalCircuitData.hpp>
44
45
46
47
48
49
50
51
52

namespace LifeV
{

//! Data container for 0D model
class ZeroDimensionalData
{
public:

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    // TODO This should be a separate class and not a struct here
    //! Rhytmos solver data container
    struct SolverData {
        std::string        method;
        Int                numberTimeStep;
        Real               maxError;
        Real               reltol;
        Real               abstol;
        Int                maxOrder;
        bool               verbose;
        Int                verboseLevel;
        bool               useNOX;
        bool               fixTimeStep;
        std::string        extraLSParamsFile;
        std::string        linearSolverParamsFile;
    };
69

70
71
    typedef struct SolverData                                         solverData_Type;
    typedef TimeData                                                  time_Type;
72
73
74
75
76
77
78
79
80
    typedef boost::shared_ptr < time_Type >                           timePtr_Type;

    //! Constructor
    explicit ZeroDimensionalData();

    //! Destructor
    virtual ~ZeroDimensionalData();

    //! setup model
81
    void setup( const GetPot& dataFile, bcPtr_Type bc, const std::string& section = "0D_Model" );
82

83
84
85
86
87
88
89
90
91
    //! initialize Solution
    void initializeSolution() ;

    //! update source elements
    void updateBC();

    //! save solution
    void saveSolution() ;

92
    //! show some information
93
    void showMe() const { M_circuitData->showMe(); }
94
95
96
97
98

    //! show variables
    void showMeVariables() ;

    //! set time
99
    void setTimeData( const timePtr_Type timeData ) { M_time = timeData; }
100

101
    const timePtr_Type& dataTime() const { return M_time; }
102

103
    //! get circuit data container
104
    zeroDimensionalCircuitDataPtr_Type circuitData() const { return M_circuitData; }
105
106

    //!total number of unknowns
107
    const Int& unknownCounter() const { return M_unknownCounter; }
108

109
    const solverData_Type& solverData() const { return M_solverData; }
110
111
112

private:

113
    // TODO: The output part should be rewritten following the example in the OneDFSI solver
114
115
116
117
118
    void writeHeaders();

    void assignVaribleIndex();

    timePtr_Type                         M_time;
119
    OutPutFormat                         M_outPutFormat;
120
    zeroDimensionalCircuitDataPtr_Type   M_circuitData;
121
122
123
    std::ofstream                        M_voltageFileStream;
    std::ofstream                        M_currentFileStream;
    std::ofstream                        M_balanceFileStream;
124
    Int                                  M_unknownCounter;
125
126
127
128
129
130
    solverData_Type                      M_solverData;
};

} // LifeV namespace

#endif //ZeroDimensionalData_H