ZeroDimensionalSolver.hpp 5.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//@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/>.

*******************************************************************************
*/
//@HEADER

/*!
 *  @file
Cristiano Malossi's avatar
Cristiano Malossi committed
29
 *  @brief Rythmos solver
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
43
44
 */

#ifndef ZeroDimensionalSolver_H
#define ZeroDimensionalSolver_H 1

#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-parameter"

45
// Include definitions
46
#include <lifev/zero_dimensional/solver/ZeroDimensionalDefinitions.hpp>
47

48
// Includes for Rythmos:
49
#if ( defined(HAVE_NOX_THYRA) && defined(HAVE_TRILINOS_RYTHMOS) )
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <Rythmos_StepperBase.hpp>
#include <Rythmos_ForwardEulerStepper.hpp>
#include <Rythmos_BackwardEulerStepper.hpp>
#include <Rythmos_ExplicitRKStepper.hpp>
#include <Rythmos_ImplicitBDFStepper.hpp>
#include <Rythmos_ImplicitRKStepper.hpp>
#include <Rythmos_RKButcherTableau.hpp>
#include <Rythmos_RKButcherTableauBuilder.hpp>
#include <Rythmos_TimeStepNonlinearSolver.hpp>

// Includes for Thyra:
#include <Thyra_DiagonalEpetraLinearOpWithSolveFactory.hpp>
#include <Thyra_EpetraThyraWrappers.hpp>
#include <Thyra_EpetraLinearOp.hpp>
#include <Thyra_EpetraModelEvaluator.hpp>
#include <Thyra_NonlinearSolver_NOX.hpp>

// Includes for Stratimikos:
#include <Stratimikos_DefaultLinearSolverBuilder.hpp>
69
70
#endif /* HAVE_NOX_THYRA && HAVE_TRILINOS_RYTHMOS */

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Includes for Teuchos:
#include <Teuchos_Array.hpp>
#include <Teuchos_RCP.hpp>
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_CommandLineProcessor.hpp>
#include <Teuchos_FancyOStream.hpp>
#include <Teuchos_GlobalMPISession.hpp>
#include <Teuchos_VerboseObject.hpp>
#include <Teuchos_StandardCatchMacros.hpp>
#include <Teuchos_XMLParameterListHelpers.hpp>
#include <Teuchos_RCPBoostSharedPtrConversions.hpp>

#pragma GCC diagnostic warning "-Wunused-variable"
#pragma GCC diagnostic warning "-Wunused-parameter"

86
// LIFEV includes
87
88
#include <lifev/zero_dimensional/solver/ZeroDimensionalRythmosSolverInterface.hpp>
#include <lifev/zero_dimensional/solver/ZeroDimensionalData.hpp>
89

90
namespace LifeV {
91

92
93
94
95
96
97
//! Rhytmos methods
enum EMethod { METHOD_FE, METHOD_BE, METHOD_ERK, METHOD_BDF, METHOD_IRK };

//! time step method
enum STEP_METHOD { STEP_METHOD_FIXED, STEP_METHOD_VARIABLE };

98
//! ZeroDimensional Solver
99
#if ( defined(HAVE_NOX_THYRA) && defined(HAVE_TRILINOS_RYTHMOS) )
100
101
102
103
104
class ZeroDimensionalSolver
{
public:

    //! Constructor
105
    explicit ZeroDimensionalSolver( Int numCircuitElements,
106
107
                                    boost::shared_ptr< Epetra_Comm> comm,
                                    zeroDimensionalCircuitDataPtr_Type circuitData );
108
109
110
111
    //! Destructor
    virtual ~ZeroDimensionalSolver() {}

    //! setup solver
112
    void setup( const ZeroDimensionalData::solverData_Type& data );
113
114

    //! integrate the system between t1 and t2
115
116
    void takeStep(Real t1, Real t2);

117
118
private:

119
120
121
122
123
124
125
126
    rythmosSolverInterfacePtr_Type                M_solverInterface;
    rythmosModelInterfacePtr_Type                 M_modelInterface;
    rythmosSolverInterfacePtrRCP_Type             M_solverInterfaceRCP;
    rythmosModelInterfacePtrRCP_Type              M_modelInterfaceRCP;
    boost::shared_ptr< Epetra_Comm>               M_comm;
    Teuchos::RCP< Epetra_Comm>                    M_commRCP;
    Teuchos::RCP<Rythmos::StepperBase<Real> >     M_stepperPtr;
    Teuchos::RCP<Teuchos::FancyOStream>           M_out;
127
    STEP_METHOD                                   M_stepMethod;
128
129
130
131
132
133
    Real                                          M_finalTime;
    Real                                          M_startTime;
    Int                                           M_numberTimeStep;
    Int                                           M_outputLevel;
    Teuchos::EVerbosityLevel                      M_outputLevelTeuchos;
    std::string                                   M_method;
134
135

};
136

137
#else
138

139
140
141
142
143
class ZeroDimensionalSolver
{
public:

    //! Constructor
144
    explicit ZeroDimensionalSolver(Int /*numCircuitElements*/,
145
146
                                   boost::shared_ptr<Epetra_Comm> /*comm*/,
                                   zeroDimensionalCircuitDataPtr_Type /*circuitData*/) {}
147
148
149
150
    //! Destructor
    virtual ~ZeroDimensionalSolver() {}

    //! setup solver
151
    void setup(const ZeroDimensionalData::solverData_Type& /*data*/) {}
152
153

    //! integrate the system between t1 and t2
154
    void takeStep(Real /*t1*/, Real /*t2*/) {}
155
};
156

157
#endif /* HAVE_NOX_THYRA && HAVE_TRILINOS_RYTHMOS */
158

159
160
} // LifeV namespace

161
#endif //ZeroDimensionalSolver_H