Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
c30bd657
Commit
c30bd657
authored
Jun 29, 2020
by
steffen.schotthoefer
Browse files
dry run MN Solver works. Flux Jacobians must be reworked
parent
549b782a
Pipeline
#94321
passed with stages
in 26 minutes and 55 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
code/include/quadratures/qgausslegendretensorized.h
View file @
c30bd657
...
@@ -14,7 +14,7 @@ class QGaussLegendreTensorized : public QuadratureBase
...
@@ -14,7 +14,7 @@ class QGaussLegendreTensorized : public QuadratureBase
QGaussLegendreTensorized
(
unsigned
order
);
QGaussLegendreTensorized
(
unsigned
order
);
virtual
~
QGaussLegendreTensorized
()
{}
virtual
~
QGaussLegendreTensorized
()
{}
inline
void
SetName
()
override
{
_name
=
"Tensorized Gauss-Legendre quadrature
.
"
;
}
inline
void
SetName
()
override
{
_name
=
"Tensorized Gauss-Legendre quadrature"
;
}
inline
void
SetNq
()
override
{
_nq
=
pow
(
GetOrder
(),
2
);
}
inline
void
SetNq
()
override
{
_nq
=
pow
(
GetOrder
(),
2
);
}
void
SetPointsAndWeights
()
override
;
void
SetPointsAndWeights
()
override
;
void
SetConnectivity
()
override
;
void
SetConnectivity
()
override
;
...
...
code/include/settings/globalconstants.h
View file @
c30bd657
...
@@ -49,8 +49,8 @@ enum KERNEL_NAME { KERNEL_Isotropic };
...
@@ -49,8 +49,8 @@ enum KERNEL_NAME { KERNEL_Isotropic };
inline
std
::
map
<
std
::
string
,
KERNEL_NAME
>
Kernel_Map
{
{
"ISOTROPIC"
,
KERNEL_Isotropic
}
};
inline
std
::
map
<
std
::
string
,
KERNEL_NAME
>
Kernel_Map
{
{
"ISOTROPIC"
,
KERNEL_Isotropic
}
};
// Solver name
// Solver name
enum
SOLVER_NAME
{
SN_SOLVER
,
PN_SOLVER
};
enum
SOLVER_NAME
{
SN_SOLVER
,
PN_SOLVER
,
MN_SOLVER
};
inline
std
::
map
<
std
::
string
,
SOLVER_NAME
>
Solver_Map
{
{
"SN_SOLVER"
,
SN_SOLVER
},
{
"PN_SOLVER"
,
PN_SOLVER
}
};
inline
std
::
map
<
std
::
string
,
SOLVER_NAME
>
Solver_Map
{
{
"SN_SOLVER"
,
SN_SOLVER
},
{
"PN_SOLVER"
,
PN_SOLVER
},
{
"MN_SOLVER"
,
MN_SOLVER
}
};
#endif // GLOBAL_CONSTANTS_H
#endif // GLOBAL_CONSTANTS_H
code/include/solvers/mnsolver.h
View file @
c30bd657
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include
"solverbase.h"
#include
"solverbase.h"
#include
"sphericalharmonics.h"
#include
"sphericalharmonics.h"
class
MNSolver
:
Solver
class
MNSolver
:
public
Solver
{
{
public:
public:
/**
/**
...
@@ -20,6 +20,8 @@ class MNSolver : Solver
...
@@ -20,6 +20,8 @@ class MNSolver : Solver
* @brief Solve functions runs main time loop
* @brief Solve functions runs main time loop
*/
*/
void
Solve
()
override
;
void
Solve
()
override
;
void
Save
()
const
override
;
/*! @brief Save Output solution to VTK file */
void
Save
(
int
currEnergy
)
const
override
;
/*! @brief Save Output solution at given energy (pseudo time) to VTK file */
private:
private:
unsigned
_nTotalEntries
;
/*! @brief: Total number of equations in the system */
unsigned
_nTotalEntries
;
/*! @brief: Total number of equations in the system */
...
...
code/include/solvers/snsolver.h
View file @
c30bd657
#ifndef SNSOLVER_H
#ifndef SNSOLVER_H
#define SNSOLVER_H
#define SNSOLVER_H
#include
<mpi.h>
#include
"solvers/solverbase.h"
#include
"solvers/solverbase.h"
class
SNSolver
:
public
Solver
class
SNSolver
:
public
Solver
...
...
code/src/io.cpp
View file @
c30bd657
...
@@ -279,7 +279,7 @@ std::string ParseArguments( int argc, char* argv[] ) {
...
@@ -279,7 +279,7 @@ std::string ParseArguments( int argc, char* argv[] ) {
inputFile
=
std
::
string
(
argv
[
i
]
);
inputFile
=
std
::
string
(
argv
[
i
]
);
std
::
ifstream
f
(
inputFile
);
std
::
ifstream
f
(
inputFile
);
if
(
!
f
.
is_open
()
)
{
if
(
!
f
.
is_open
()
)
{
ErrorMessages
::
OptionNotSet
Error
(
"Unable to open inputfile '"
+
inputFile
+
"' !"
,
CURRENT_FUNCTION
);
ErrorMessages
::
Error
(
"Unable to open inputfile '"
+
inputFile
+
"' !"
,
CURRENT_FUNCTION
);
}
}
}
}
}
}
...
...
code/src/quadratures/qgausslegendretensorized.cpp
View file @
c30bd657
...
@@ -151,7 +151,8 @@ double QGaussLegendreTensorized::Pythag( const double a, const double b ) {
...
@@ -151,7 +151,8 @@ double QGaussLegendreTensorized::Pythag( const double a, const double b ) {
bool
QGaussLegendreTensorized
::
CheckOrder
()
{
bool
QGaussLegendreTensorized
::
CheckOrder
()
{
if
(
_order
%
2
==
1
)
{
// order needs to be even
if
(
_order
%
2
==
1
)
{
// order needs to be even
ErrorMessages
::
Error
(
"ERROR! Order "
+
std
::
to_string
(
_order
)
+
" for "
+
GetName
()
+
" not available. "
,
CURRENT_FUNCTION
);
ErrorMessages
::
Error
(
"ERROR! Order "
+
std
::
to_string
(
_order
)
+
" for "
+
GetName
()
+
" not available.
\n
Order must be an even number. "
,
CURRENT_FUNCTION
);
}
}
return
true
;
return
true
;
}
}
code/src/solvers/mnsolver.cpp
View file @
c30bd657
#include
"solvers/mnsolver.h"
#include
"solvers/mnsolver.h"
#include
"toolboxes/textprocessingtoolbox.h"
#include
<mpi.h>
MNSolver
::
MNSolver
(
Config
*
settings
)
:
Solver
(
settings
),
_nMaxMomentsOrder
(
settings
->
GetMaxMomentDegree
()
),
_basis
(
_nMaxMomentsOrder
)
{
MNSolver
::
MNSolver
(
Config
*
settings
)
:
Solver
(
settings
),
_nMaxMomentsOrder
(
settings
->
GetMaxMomentDegree
()
),
_basis
(
_nMaxMomentsOrder
)
{
// Is this good (fast) code using a constructor list?
// Is this good (fast) code using a constructor list?
...
@@ -24,6 +26,7 @@ MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder(
...
@@ -24,6 +26,7 @@ MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder(
// Fill System Matrices
// Fill System Matrices
ComputeSystemMatrices
();
ComputeSystemMatrices
();
TextProcessingToolbox
::
PrintVectorVector
(
_A
);
}
}
MNSolver
::~
MNSolver
()
{
delete
_quadrature
;
}
MNSolver
::~
MNSolver
()
{
delete
_quadrature
;
}
...
@@ -144,3 +147,23 @@ void MNSolver::Solve() {
...
@@ -144,3 +147,23 @@ void MNSolver::Solve() {
if
(
rank
==
0
)
log
->
info
(
"{:03.8f} {:01.5e}"
,
_energies
[
idx_energy
],
dFlux
);
if
(
rank
==
0
)
log
->
info
(
"{:03.8f} {:01.5e}"
,
_energies
[
idx_energy
],
dFlux
);
}
}
}
}
void
MNSolver
::
Save
()
const
{
std
::
vector
<
std
::
string
>
fieldNames
{
"flux"
};
std
::
vector
<
double
>
flux
;
flux
.
resize
(
_nCells
);
for
(
unsigned
i
=
0
;
i
<
_nCells
;
++
i
)
{
flux
[
i
]
=
_psi
[
i
][
0
];
}
std
::
vector
<
std
::
vector
<
double
>>
scalarField
(
1
,
flux
);
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>>>
results
{
scalarField
};
ExportVTK
(
_settings
->
GetOutputFile
(),
results
,
fieldNames
,
_mesh
);
}
void
MNSolver
::
Save
(
int
currEnergy
)
const
{
std
::
vector
<
std
::
string
>
fieldNames
{
"flux"
};
std
::
vector
<
std
::
vector
<
double
>>
scalarField
(
1
,
_solverOutput
);
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>>>
results
{
scalarField
};
ExportVTK
(
_settings
->
GetOutputFile
()
+
"_"
+
std
::
to_string
(
currEnergy
),
results
,
fieldNames
,
_mesh
);
}
code/src/solvers/snsolver.cpp
View file @
c30bd657
#include
"solvers/snsolver.h"
#include
"solvers/snsolver.h"
#include
<mpi.h>
SNSolver
::
SNSolver
(
Config
*
settings
)
:
Solver
(
settings
)
{}
SNSolver
::
SNSolver
(
Config
*
settings
)
:
Solver
(
settings
)
{}
...
...
code/src/solvers/solverbase.cpp
View file @
c30bd657
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include
"mesh.h"
#include
"mesh.h"
#include
"quadratures/quadraturebase.h"
#include
"quadratures/quadraturebase.h"
#include
"settings/globalconstants.h"
#include
"settings/globalconstants.h"
#include
"solvers/mnsolver.h"
#include
"solvers/pnsolver.h"
#include
"solvers/pnsolver.h"
#include
"solvers/snsolver.h"
#include
"solvers/snsolver.h"
...
@@ -71,6 +72,7 @@ Solver* Solver::Create( Config* settings ) {
...
@@ -71,6 +72,7 @@ Solver* Solver::Create( Config* settings ) {
switch
(
settings
->
GetSolverName
()
)
{
switch
(
settings
->
GetSolverName
()
)
{
case
SN_SOLVER
:
return
new
SNSolver
(
settings
);
case
SN_SOLVER
:
return
new
SNSolver
(
settings
);
case
PN_SOLVER
:
return
new
PNSolver
(
settings
);
case
PN_SOLVER
:
return
new
PNSolver
(
settings
);
case
MN_SOLVER
:
return
new
MNSolver
(
settings
);
default:
return
new
SNSolver
(
settings
);
default:
return
new
SNSolver
(
settings
);
}
}
}
}
...
...
Write
Preview
Supports
Markdown
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