Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dune-fem
dune-fem-dg
Commits
928c4588
Commit
928c4588
authored
9 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
pass parameter to created solvers.
parent
406efd37
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/fem-dg/solver/rungekuttasolver.hh
+25
-20
25 additions, 20 deletions
dune/fem-dg/solver/rungekuttasolver.hh
dune/fem-dg/solver/smartodesolver.hh
+6
-4
6 additions, 4 deletions
dune/fem-dg/solver/smartodesolver.hh
with
31 additions
and
24 deletions
dune/fem-dg/solver/rungekuttasolver.hh
+
25
−
20
View file @
928c4588
...
...
@@ -64,15 +64,17 @@ public:
template
<
class
Op
,
class
DF
,
bool
pardgOdeSolver
>
struct
OdeSolverSelection
{
template
<
class
OdeParameter
>
static
solverpair_t
createExplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
)
createExplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
,
const
OdeParameter
&
param
)
{
typedef
DuneODE
::
ExplicitRungeKuttaSolver
<
DiscreteFunctionType
>
ExplicitOdeSolverType
;
return
solverpair_t
(
new
ExplicitOdeSolverType
(
op
,
tp
,
rkSteps
),
nullptr
);
}
template
<
class
OdeParameter
>
static
solverpair_t
createImplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
)
createImplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
,
const
OdeParameter
&
param
)
{
typedef
Dune
::
Fem
::
DGHelmholtzOperator
<
Op
>
HelmholtzOperatorType
;
HelmholtzOperatorType
*
helmOp
=
new
HelmholtzOperatorType
(
op
);
...
...
@@ -84,12 +86,13 @@ public:
typedef
DuneODE
::
ImplicitRungeKuttaSolver
<
HelmholtzOperatorType
,
NonlinearInverseOperatorType
>
ImplicitOdeSolverType
;
return
solverpair_t
(
new
ImplicitOdeSolverType
(
*
helmOp
,
tp
,
rkSteps
),
helmOp
);
return
solverpair_t
(
new
ImplicitOdeSolverType
(
*
helmOp
,
tp
,
rkSteps
,
param
),
helmOp
);
}
template
<
class
ExplOp
,
class
ImplOp
>
template
<
class
ExplOp
,
class
ImplOp
,
class
OdeParameter
>
static
solverpair_t
createSemiImplicitSolver
(
ExplOp
&
explOp
,
ImplOp
&
implOp
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
)
createSemiImplicitSolver
(
ExplOp
&
explOp
,
ImplOp
&
implOp
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
,
const
OdeParameter
&
param
)
{
typedef
Dune
::
Fem
::
DGHelmholtzOperator
<
ImplOp
>
HelmholtzOperatorType
;
HelmholtzOperatorType
*
helmOp
=
new
HelmholtzOperatorType
(
implOp
);
...
...
@@ -101,7 +104,7 @@ public:
typedef
DuneODE
::
SemiImplicitRungeKuttaSolver
<
ExplicitOperatorType
,
HelmholtzOperatorType
,
NonlinearInverseOperatorType
>
SemiImplicitOdeSolverType
;
return
solverpair_t
(
new
SemiImplicitOdeSolverType
(
explOp
,
*
helmOp
,
tp
,
rkSteps
),
helmOp
);
return
solverpair_t
(
new
SemiImplicitOdeSolverType
(
explOp
,
*
helmOp
,
tp
,
rkSteps
,
param
),
helmOp
);
}
};
...
...
@@ -118,23 +121,25 @@ public:
typedef
DuneODE
::
ExplicitOdeSolver
<
DiscreteFunctionType
>
ExplicitOdeSolverType
;
typedef
DuneODE
::
SemiImplicitOdeSolver
<
DiscreteFunctionType
>
SemiImplicitOdeSolverType
;
template
<
class
OdeParameter
>
static
solverpair_t
createExplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
)
createExplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
,
const
OdeParameter
&
param
)
{
return
solverpair_t
(
new
ExplicitOdeSolverType
(
op
,
tp
,
rkSteps
),
nullptr
);
}
template
<
class
OdeParameter
>
static
solverpair_t
createImplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
)
createImplicitSolver
(
Op
&
op
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
,
const
OdeParameter
&
param
)
{
return
solverpair_t
(
new
ImplicitOdeSolverType
(
op
,
tp
,
rkSteps
),
nullptr
);
return
solverpair_t
(
new
ImplicitOdeSolverType
(
op
,
tp
,
rkSteps
,
param
),
nullptr
);
}
template
<
class
ExplOp
,
class
ImplOp
>
template
<
class
ExplOp
,
class
ImplOp
,
class
OdeParameter
>
static
solverpair_t
createSemiImplicitSolver
(
ExplOp
&
explOp
,
ImplOp
&
implOp
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
)
createSemiImplicitSolver
(
ExplOp
&
explOp
,
ImplOp
&
implOp
,
Fem
::
TimeProviderBase
&
tp
,
const
int
rkSteps
,
const
OdeParameter
&
param
)
{
return
solverpair_t
(
new
SemiImplicitOdeSolverType
(
explOp
,
implOp
,
tp
,
rkSteps
),
nullptr
);
return
solverpair_t
(
new
SemiImplicitOdeSolverType
(
explOp
,
implOp
,
tp
,
rkSteps
,
param
),
nullptr
);
}
};
...
...
@@ -164,10 +169,10 @@ protected:
bool
useImex_
;
public
:
RungeKuttaSolver
(
Fem
::
TimeProviderBase
&
tp
,
OperatorType
&
op
,
ExplicitOperatorType
&
advOp
,
ImplicitOperatorType
&
diffOp
,
const
SmartOdeSolverParameters
&
parameter
=
SmartOdeSolverParameters
()
)
OperatorType
&
op
,
ExplicitOperatorType
&
advOp
,
ImplicitOperatorType
&
diffOp
,
const
SmartOdeSolverParameters
&
parameter
=
SmartOdeSolverParameters
()
)
:
operator_
(
op
),
timeProvider_
(
tp
),
explicitOperator_
(
advOp
),
...
...
@@ -189,11 +194,11 @@ public:
// create implicit or explicit ode solver
if
(
odeSolverType_
==
0
)
{
solver
=
OdeSolversType
::
createExplicitSolver
(
operator_
,
tp
,
rkSteps_
);
solver
=
OdeSolversType
::
createExplicitSolver
(
operator_
,
tp
,
rkSteps_
,
*
param_
);
}
else
if
(
odeSolverType_
==
1
)
{
solver
=
OdeSolversType
::
createImplicitSolver
(
operator_
,
tp
,
rkSteps_
);
solver
=
OdeSolversType
::
createImplicitSolver
(
operator_
,
tp
,
rkSteps_
,
*
param_
);
}
else
if
(
odeSolverType_
>
1
)
{
...
...
@@ -203,11 +208,11 @@ public:
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Advection and Diffusion operator are the same, therefore IMEX cannot work!"
);
}
solver
=
OdeSolversType
::
createSemiImplicitSolver
(
explicitOperator_
,
implicitOperator_
,
tp
,
rkSteps_
);
solver
=
OdeSolversType
::
createSemiImplicitSolver
(
explicitOperator_
,
implicitOperator_
,
tp
,
rkSteps_
,
*
param_
);
// IMEX+
if
(
odeSolverType_
==
3
)
explicitSolver_
=
OdeSolversType
::
createExplicitSolver
(
operator_
,
tp
,
rkSteps_
).
first
;
explicitSolver_
=
OdeSolversType
::
createExplicitSolver
(
operator_
,
tp
,
rkSteps_
,
*
param_
).
first
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
dune/fem-dg/solver/smartodesolver.hh
+
6
−
4
View file @
928c4588
...
...
@@ -11,9 +11,11 @@ namespace Dune {
struct
SmartOdeSolverParameters
:
public
DuneODE
::
ODEParameters
{
using
DuneODE
::
ODEParameters
::
keyPrefix_
;
virtual
double
explicitFactor
()
const
{
return
Fem
::
Parameter
::
getValue
<
double
>
(
"fem.ode.
explicitfactor"
,
1.0
);
return
Fem
::
Parameter
::
getValue
<
double
>
(
keyPrefix_
+
"
explicitfactor"
,
1.0
);
}
SmartOdeSolverParameters
*
clone
()
const
...
...
@@ -27,9 +29,9 @@ struct SmartOdeSolverParameters : public DuneODE :: ODEParameters
// defined here, so that it can be used later in two different
// methods
static
const
std
::
string
odeSolver
[]
=
{
"EX"
,
"IM"
,
"IMEX"
,
"IMEX+"
};
std
::
string
key
(
"fem.ode.
odesolver"
);
std
::
string
key
(
keyPrefix_
+
"
odesolver"
);
if
(
Fem
::
Parameter
::
exists
(
key
)
)
return
Fem
::
Parameter
::
getEnum
(
"fem.ode.odesolver"
,
odeSolver
,
0
);
return
Fem
::
Parameter
::
getEnum
(
key
,
odeSolver
,
0
);
else
{
std
::
cerr
<<
"WARNING: deprecated key, use `fem.ode.odesolver' instread!"
<<
std
::
endl
;
...
...
@@ -39,7 +41,7 @@ struct SmartOdeSolverParameters : public DuneODE :: ODEParameters
virtual
int
obtainRungeKuttaSteps
(
const
int
defaultRKOrder
)
const
{
std
::
string
key
(
"fem.ode.
order"
);
std
::
string
key
(
keyPrefix_
+
"
order"
);
if
(
Fem
::
Parameter
::
exists
(
key
)
)
return
Fem
::
Parameter
::
getValue
<
int
>
(
key
);
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment