Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
8a1c9185
Commit
8a1c9185
authored
Nov 13, 2020
by
niklas.baumgarten
Browse files
renaming StochasticProblem file + moved Create from CreatePDESolver
parent
00d00ac1
Pipeline
#118011
failed with stages
in 3 minutes and 35 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
mlmc/src/pdesolver/PDESolver.cpp
View file @
8a1c9185
#include "PDESolver.hpp"
MatrixGraphs
*
PDESolver
::
CreateSolutionMatrixGraphs
(
Meshes
&
meshes
)
{
auto
disc
=
this
->
GetDisc
();
auto
discType
=
typeid
(
*
disc
).
name
();
if
(
discType
==
typeid
(
LagrangeDiscretization
).
name
())
return
new
MatrixGraphs
(
meshes
,
*
disc
);
if
(
discType
==
typeid
(
RTLagrangeDiscretization
).
name
())
{
auto
assemble
=
this
->
GetAssemble
();
auto
assembleType
=
typeid
(
*
assemble
).
name
();
if
(
assembleType
==
typeid
(
HybridEllipticAssemble
).
name
())
return
new
MatrixGraphs
(
meshes
,
dof
(
new
FaceDoF
(
1
)));
if
(
assembleType
==
typeid
(
MixedEllipticAssemble
).
name
())
return
new
MatrixGraphs
(
meshes
,
*
disc
);
}
if
(
discType
==
typeid
(
DGDiscretization
).
name
())
return
new
CellMatrixGraphs
(
meshes
,
*
disc
);
if
(
discType
==
typeid
(
EGDiscretization
).
name
())
return
new
CellVertexMatrixGraphs
(
meshes
,
*
disc
);
Exit
(
string
(
discType
)
+
" not found"
)
}
void
EllipticPDESolver
::
run
(
SampleSolution
&
solution
)
{
newton
(
*
assemble
,
solution
.
U
);
}
...
...
@@ -29,14 +49,6 @@ void EllipticPDESolver::computeCost(SampleSolution &solution) {
void
EllipticPDESolver
::
plotSolution
(
SampleSolution
&
solution
)
{
if
(
!
plotting
)
return
;
plotMap
.
VtkPlot
(
solution
);
// Todo plot flux
// const auto d = dof(new CellDoF(3));
// MatrixGraph *fluxMGraph = new MatrixGraph(d, solution.U.GetMesh());
// SampleSolution fluxSolution(fluxMGraph);
// mout << fluxSolution.U << endl;
// assemble->SetFlux(solution.U, fluxSolution.U);
// plotMap.VtkPlot(fluxSolution, 3, "CellData");
}
void
TransportPDESolver
::
run
(
SampleSolution
&
solution
)
{
...
...
@@ -70,3 +82,50 @@ TimeSeries TransportPDESolver::createTimeSeries(SampleSolution &solution) {
double
h_max
=
solution
.
U
.
GetMesh
().
MeshWidth
().
second
;
return
TimeSeries
(
t0
,
T
,
CFL
*
h_max
,
"UniformTimeSeries"
);
}
PDESolver
*
PDESolverCreator
::
Create
()
{
if
(
_model
==
"LagrangeElliptic"
)
return
new
EllipticPDESolver
(
new
LagrangeEllipticAssemble
(
new
LagrangeDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"MixedElliptic"
)
return
new
EllipticPDESolver
(
new
MixedEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"HybridElliptic"
)
return
new
EllipticPDESolver
(
new
HybridEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGElliptic"
)
return
new
EllipticPDESolver
(
new
DGEllipticAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGTransport"
)
return
new
TransportPDESolver
(
new
DGTransportAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticTransportProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"PGTransport"
)
return
nullptr
;
// Todo open research question
Exit
(
_model
+
" not found"
)
}
mlmc/src/pdesolver/PDESolver.hpp
View file @
8a1c9185
...
...
@@ -79,25 +79,7 @@ public:
mout
.
EndBlock
(
verbose
==
0
);
}
MatrixGraphs
*
CreateSolutionMatrixGraphs
(
Meshes
&
meshes
)
{
auto
disc
=
this
->
GetDisc
();
auto
discType
=
typeid
(
*
disc
).
name
();
if
(
discType
==
typeid
(
LagrangeDiscretization
).
name
())
return
new
MatrixGraphs
(
meshes
,
*
disc
);
if
(
discType
==
typeid
(
RTLagrangeDiscretization
).
name
())
{
auto
assemble
=
this
->
GetAssemble
();
auto
assembleType
=
typeid
(
*
assemble
).
name
();
if
(
assembleType
==
typeid
(
HybridEllipticAssemble
).
name
())
return
new
MatrixGraphs
(
meshes
,
dof
(
new
FaceDoF
(
1
)));
if
(
assembleType
==
typeid
(
MixedEllipticAssemble
).
name
())
return
new
MatrixGraphs
(
meshes
,
*
disc
);
}
if
(
discType
==
typeid
(
DGDiscretization
).
name
())
return
new
CellMatrixGraphs
(
meshes
,
*
disc
);
if
(
discType
==
typeid
(
EGDiscretization
).
name
())
return
new
CellVertexMatrixGraphs
(
meshes
,
*
disc
);
Exit
(
string
(
discType
)
+
" not found"
)
}
MatrixGraphs
*
CreateSolutionMatrixGraphs
(
Meshes
&
meshes
);
void
SetQuantity
(
const
std
::
string
&
_quantity
)
{
this
->
quantity
=
_quantity
;
...
...
@@ -242,52 +224,7 @@ public:
return
*
this
;
}
PDESolver
*
Create
()
{
if
(
_model
==
"LagrangeElliptic"
)
return
new
EllipticPDESolver
(
new
LagrangeEllipticAssemble
(
new
LagrangeDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"MixedElliptic"
)
return
new
EllipticPDESolver
(
new
MixedEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"HybridElliptic"
)
return
new
EllipticPDESolver
(
new
HybridEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGElliptic"
)
return
new
EllipticPDESolver
(
new
DGEllipticAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGTransport"
)
return
new
TransportPDESolver
(
new
DGTransportAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticTransportProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"PGTransport"
)
return
nullptr
;
// Todo open research question
Exit
(
_model
+
" not found"
)
}
PDESolver
*
Create
();
};
#endif //PDESOLVER_HPP
mlmc/src/problem/StochasticProblem.cpp
→
mlmc/src/problem/
I
StochasticProblem.cpp
View file @
8a1c9185
#include "StochasticProblem.hpp"
#include "
I
StochasticProblem.hpp"
#include "generators/CirculantEmbedding.hpp"
#include "generators/HybridFluxGenerator.hpp"
...
...
mlmc/src/problem/StochasticProblem.hpp
→
mlmc/src/problem/
I
StochasticProblem.hpp
View file @
8a1c9185
#ifndef STOCHASTICPROBLEM_HPP
#define STOCHASTICPROBLEM_HPP
#ifndef
I
STOCHASTICPROBLEM_HPP
#define
I
STOCHASTICPROBLEM_HPP
#include "Algebra.hpp"
#include "montecarlo/Sample.hpp"
...
...
mlmc/src/problem/StochasticEllipticProblem.hpp
View file @
8a1c9185
#ifndef STOCHASTICELLIPTICPROBLEM_HPP
#define STOCHASTICELLIPTICPROBLEM_HPP
#include "problem/StochasticProblem.hpp"
#include "problem/
I
StochasticProblem.hpp"
class
IStochasticEllipticProblem
:
public
IStochasticProblem
{
...
...
mlmc/src/problem/StochasticReactionProblem.hpp
View file @
8a1c9185
#ifndef STOCHASTICREACTIONPROBLEM_HPP
#define STOCHASTICREACTIONPROBLEM_HPP
#include "StochasticProblem.hpp"
#include "
I
StochasticProblem.hpp"
// Todo rmv
...
...
mlmc/src/problem/StochasticTransportProblem.hpp
View file @
8a1c9185
#ifndef MLMC_STOCHASTICTRANSPORTPROBLEM_HPP
#define MLMC_STOCHASTICTRANSPORTPROBLEM_HPP
#include "problem/StochasticProblem.hpp"
#include "problem/
I
StochasticProblem.hpp"
class
IStochasticTransportProblem
:
public
IStochasticProblem
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment