Nektar++
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
library
SolverUtils
Driver.cpp
Go to the documentation of this file.
1
///////////////////////////////////////////////////////////////////////////////
2
//
3
// File Driver.cpp
4
//
5
// For more information, please see: http://www.nektar.info
6
//
7
// The MIT License
8
//
9
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10
// Department of Aeronautics, Imperial College London (UK), and Scientific
11
// Computing and Imaging Institute, University of Utah (USA).
12
//
13
// License for the specific language governing rights and limitations under
14
// Permission is hereby granted, free of charge, to any person obtaining a
15
// copy of this software and associated documentation files (the "Software"),
16
// to deal in the Software without restriction, including without limitation
17
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
// and/or sell copies of the Software, and to permit persons to whom the
19
// Software is furnished to do so, subject to the following conditions:
20
//
21
// The above copyright notice and this permission notice shall be included
22
// in all copies or substantial portions of the Software.
23
//
24
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30
// DEALINGS IN THE SOFTWARE.
31
//
32
// Description: Base class for Drivers
33
//
34
///////////////////////////////////////////////////////////////////////////////
35
36
#include <
SolverUtils/Driver.h
>
37
38
namespace
Nektar
39
{
40
namespace
SolverUtils
41
{
42
std::string
Driver::evolutionOperatorLookupIds
[5] = {
43
LibUtilities::SessionReader::RegisterEnumValue
(
"EvolutionOperator"
,
"Nonlinear"
,
eNonlinear
),
44
LibUtilities::SessionReader::RegisterEnumValue
(
"EvolutionOperator"
,
"Direct"
,
eDirect
),
45
LibUtilities::SessionReader::RegisterEnumValue
(
"EvolutionOperator"
,
"Adjoint"
,
eAdjoint
),
46
LibUtilities::SessionReader::RegisterEnumValue
(
"EvolutionOperator"
,
"TransientGrowth"
,
eTransientGrowth
),
47
LibUtilities::SessionReader::RegisterEnumValue
(
"EvolutionOperator"
,
"SkewSymmetric"
,
eSkewSymmetric
)
48
};
49
std::string
Driver::evolutionOperatorDef
=
LibUtilities::SessionReader::RegisterDefaultSolverInfo
(
"EvolutionOperator"
,
"Nonlinear"
);
50
std::string
Driver::driverDefault
=
LibUtilities::SessionReader::RegisterDefaultSolverInfo
(
"Driver"
,
"Standard"
);
51
52
DriverFactory
&
GetDriverFactory
()
53
{
54
typedef
Loki::SingletonHolder<
DriverFactory
,
55
Loki::CreateUsingNew,
56
Loki::NoDestroy > Type;
57
return
Type::Instance();
58
}
59
60
61
/**
62
*
63
*/
64
Driver::Driver
(
const
LibUtilities::SessionReaderSharedPtr
pSession)
65
: m_comm(pSession->GetComm()),
66
m_session(pSession)
67
{
68
}
69
70
Driver::~Driver
()
71
72
{
73
}
74
75
76
/**
77
*
78
*/
79
void
Driver::v_InitObject
(ostream &out)
80
{
81
try
82
{
83
// Retrieve the equation system to solve.
84
ASSERTL0
(
m_session
->DefinesSolverInfo(
"EqType"
),
85
"EqType SolverInfo tag must be defined."
);
86
std::string vEquation =
m_session
->GetSolverInfo(
"EqType"
);
87
if
(
m_session
->DefinesSolverInfo(
"SolverType"
))
88
{
89
vEquation =
m_session
->GetSolverInfo(
"SolverType"
);
90
}
91
// Check such a module exists for this equation.
92
ASSERTL0
(
GetEquationSystemFactory
().ModuleExists(vEquation),
93
"EquationSystem '"
+ vEquation +
"' is not defined.\n"
94
"Ensure equation name is correct and module is compiled.\n"
);
95
96
97
// Retrieve the type of evolution operator to use
98
/// @todo At the moment this is Navier-Stokes specific - generalise?
99
m_EvolutionOperator
=
m_session
->GetSolverInfoAsEnum<
EvolutionOperatorType
>(
"EvolutionOperator"
);
100
101
m_nequ
= (
m_EvolutionOperator
==
eTransientGrowth
? 2 : 1);
102
m_equ
= Array<OneD, EquationSystemSharedPtr>(
m_nequ
);
103
104
// Set the AdvectiveType tag and create EquationSystem objects.
105
switch
(
m_EvolutionOperator
)
106
{
107
case
eNonlinear
:
108
m_session
->SetTag(
"AdvectiveType"
,
"Convective"
);
109
m_equ
[0] =
GetEquationSystemFactory
().
CreateInstance
(vEquation,
m_session
);
110
break
;
111
case
eDirect
:
112
m_session
->SetTag(
"AdvectiveType"
,
"Linearised"
);
113
m_equ
[0] =
GetEquationSystemFactory
().
CreateInstance
(vEquation,
m_session
);
114
break
;
115
case
eAdjoint
:
116
m_session
->SetTag(
"AdvectiveType"
,
"Adjoint"
);
117
m_equ
[0] =
GetEquationSystemFactory
().
CreateInstance
(vEquation,
m_session
);
118
break
;
119
case
eTransientGrowth
:
120
//forward timestepping
121
m_session
->SetTag(
"AdvectiveType"
,
"Linearised"
);
122
m_equ
[0] =
GetEquationSystemFactory
().
CreateInstance
(vEquation,
m_session
);
123
124
//backward timestepping
125
m_session
->SetTag(
"AdvectiveType"
,
"Adjoint"
);
126
m_equ
[1] =
GetEquationSystemFactory
().
CreateInstance
(vEquation,
m_session
);
127
break
;
128
case
eSkewSymmetric
:
129
m_session
->SetTag(
"AdvectiveType"
,
"SkewSymmetric"
);
130
m_equ
[0] =
GetEquationSystemFactory
().
CreateInstance
(vEquation,
m_session
);
131
break
;
132
default
:
133
ASSERTL0
(
false
,
"Unrecognised evolution operator."
);
134
135
}
136
}
137
catch
(
int
e)
138
{
139
ASSERTL0
(e == -1,
"No such class class defined."
);
140
out <<
"An error occurred during driver initialisation."
<< endl;
141
}
142
}
143
144
Array<OneD, NekDouble>
Driver::v_GetRealEvl
(
void
)
145
{
146
ASSERTL0
(
false
,
"This routine is not valid in this class"
);
147
return
NullNekDouble1DArray
;
148
}
149
150
Array<OneD, NekDouble>
Driver::v_GetImagEvl
(
void
)
151
{
152
ASSERTL0
(
false
,
"This routine is not valid in this class"
);
153
return
NullNekDouble1DArray
;
154
}
155
}
156
}
Generated on Sun Mar 15 2015 00:11:30 for Nektar++ by
1.8.1.2