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
938f4e77
Commit
938f4e77
authored
Apr 24, 2020
by
jannick.wolters
Browse files
added save function to solver in order to output results
parent
6b123632
Pipeline
#84011
passed with stages
in 4 minutes and 30 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
938f4e77
...
...
@@ -485,3 +485,11 @@ code/build/*
code/input/*
code/result/*
code/ext/*
# vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history
.vscode/settings.json
deleted
100644 → 0
View file @
6b123632
{
"files.associations"
:
{
"array"
:
"cpp"
,
"atomic"
:
"cpp"
,
"*.tcc"
:
"cpp"
,
"bitset"
:
"cpp"
,
"cctype"
:
"cpp"
,
"chrono"
:
"cpp"
,
"clocale"
:
"cpp"
,
"cmath"
:
"cpp"
,
"codecvt"
:
"cpp"
,
"complex"
:
"cpp"
,
"condition_variable"
:
"cpp"
,
"cstdarg"
:
"cpp"
,
"cstddef"
:
"cpp"
,
"cstdint"
:
"cpp"
,
"cstdio"
:
"cpp"
,
"cstdlib"
:
"cpp"
,
"cstring"
:
"cpp"
,
"ctime"
:
"cpp"
,
"cwchar"
:
"cpp"
,
"cwctype"
:
"cpp"
,
"deque"
:
"cpp"
,
"list"
:
"cpp"
,
"unordered_map"
:
"cpp"
,
"vector"
:
"cpp"
,
"exception"
:
"cpp"
,
"algorithm"
:
"cpp"
,
"filesystem"
:
"cpp"
,
"functional"
:
"cpp"
,
"iterator"
:
"cpp"
,
"map"
:
"cpp"
,
"memory"
:
"cpp"
,
"memory_resource"
:
"cpp"
,
"numeric"
:
"cpp"
,
"optional"
:
"cpp"
,
"random"
:
"cpp"
,
"ratio"
:
"cpp"
,
"regex"
:
"cpp"
,
"set"
:
"cpp"
,
"string"
:
"cpp"
,
"string_view"
:
"cpp"
,
"system_error"
:
"cpp"
,
"tuple"
:
"cpp"
,
"type_traits"
:
"cpp"
,
"utility"
:
"cpp"
,
"fstream"
:
"cpp"
,
"future"
:
"cpp"
,
"initializer_list"
:
"cpp"
,
"iomanip"
:
"cpp"
,
"iosfwd"
:
"cpp"
,
"iostream"
:
"cpp"
,
"istream"
:
"cpp"
,
"limits"
:
"cpp"
,
"mutex"
:
"cpp"
,
"new"
:
"cpp"
,
"ostream"
:
"cpp"
,
"shared_mutex"
:
"cpp"
,
"sstream"
:
"cpp"
,
"stdexcept"
:
"cpp"
,
"streambuf"
:
"cpp"
,
"thread"
:
"cpp"
,
"cinttypes"
:
"cpp"
,
"typeinfo"
:
"cpp"
,
"variant"
:
"cpp"
,
"bit"
:
"cpp"
}
}
\ No newline at end of file
code/include/snsolver.h
View file @
938f4e77
...
...
@@ -16,6 +16,10 @@ class SNSolver : public Solver
* @brief Solve functions runs main time loop
*/
virtual
void
Solve
();
/**
* @brief Output solution to VTK file
*/
virtual
void
Save
()
const
;
void
SolveMPI
();
// can be deleated later
};
...
...
code/include/solver.h
View file @
938f4e77
...
...
@@ -4,6 +4,7 @@
// include Matrix, Vector definitions
#include "typedef.h"
#include "io.h"
#include "numericalflux.h"
#include "settings.h"
#include <string>
...
...
@@ -85,6 +86,11 @@ class Solver
* @brief Solve functions runs main time loop
*/
virtual
void
Solve
()
=
0
;
/**
* @brief Output solution to VTK file
*/
virtual
void
Save
()
const
=
0
;
};
#endif // SOLVER_H
code/src/io.cpp
View file @
938f4e77
...
...
@@ -466,7 +466,7 @@ Settings* ReadInputFile( std::string inputFile ) {
validConfig
=
false
;
}
auto
tEnd
=
solver
->
get_as
<
double
>
(
"tEnd"
);
auto
tEnd
=
solver
->
get_as
<
double
>
(
"tEnd"
);
if
(
tEnd
)
{
settings
->
_tEnd
=
*
tEnd
;
}
...
...
@@ -475,14 +475,14 @@ Settings* ReadInputFile( std::string inputFile ) {
validConfig
=
false
;
}
auto
quadType
=
solver
->
get_as
<
std
::
string
>
(
"quadType"
);
auto
quadType
=
solver
->
get_as
<
std
::
string
>
(
"quadType"
);
if
(
quadType
)
{
std
::
string
quadTypeString
=
*
quadType
;
try
{
settings
->
_quadName
=
Quadrature_Map
.
at
(
quadTypeString
);
}
catch
(
const
std
::
exception
&
e
)
{
spdlog
::
error
(
"Error: '{0}' is not a feasible quadrature type. Please check the config template!"
,
quadTypeString
);
exit
(
EXIT_FAILURE
);
// Quit RTSN
try
{
settings
->
_quadName
=
Quadrature_Map
.
at
(
quadTypeString
);
}
catch
(
const
std
::
exception
&
e
)
{
spdlog
::
error
(
"Error: '{0}' is not a feasible quadrature type. Please check the config template!"
,
quadTypeString
);
exit
(
EXIT_FAILURE
);
// Quit RTSN
}
}
else
{
...
...
code/src/main.cpp
View file @
938f4e77
...
...
@@ -14,6 +14,7 @@ int main( int argc, char** argv ) {
// build solver
Solver
*
solver
=
Solver
::
Create
(
settings
);
solver
->
Solve
();
solver
->
Save
();
// TODO: call solver
MPI_Finalize
();
...
...
code/src/snsolver.cpp
View file @
938f4e77
...
...
@@ -32,10 +32,6 @@ void SNSolver::Solve() {
_psi
=
psiNew
;
// psiNew.reset();
}
std
::
vector
<
std
::
string
>
fieldNames
;
fieldNames
.
push_back
(
"test"
);
// ExportVTK( "test", _psi, fieldNames, _settings, _mesh );
}
void
SNSolver
::
SolveMPI
()
{
...
...
@@ -96,3 +92,14 @@ void SNSolver::SolveMPI() {
// psiNew.reset();
}*/
}
void
SNSolver
::
Save
()
const
{
std
::
vector
<
std
::
string
>
fieldNames
{
"flux"
};
std
::
vector
<
double
>
flux
(
_nCells
,
0.0
);
for
(
unsigned
i
=
0
;
i
<
_nCells
;
++
i
)
{
flux
[
i
]
=
dot
(
_psi
[
i
],
_weights
);
}
std
::
vector
<
std
::
vector
<
double
>>
scalarField
(
1
,
flux
);
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>>>
results
{
scalarField
};
ExportVTK
(
_settings
->
GetOutputFile
(),
results
,
fieldNames
,
_settings
,
_mesh
);
}
code/src/solver.cpp
View file @
938f4e77
...
...
@@ -4,10 +4,10 @@
#include "mesh.h"
#include "snsolver.h"
Solver
::
Solver
(
Settings
*
settings
)
{
Solver
::
Solver
(
Settings
*
settings
)
:
_settings
(
settings
)
{
// @TODO save parameters from settings class
std
::
cout
<<
"In Solver..."
<<
std
::
endl
;
//
std::cout << "In Solver..." << std::endl;
// build quadrature object and store quadrature points and weights
Quadrature
*
q
=
Quadrature
::
CreateQuadrature
(
settings
->
GetQuadName
(),
settings
->
GetQuadOrder
()
);
...
...
@@ -17,13 +17,13 @@ Solver::Solver( Settings* settings ) {
// build mesh and store all relevant information
Mesh
*
mesh
=
LoadSU2MeshFromFile
(
settings
);
_areas
=
mesh
->
GetCellAreas
();
_neighbors
=
mesh
->
GetNeighbours
();
_normals
=
mesh
->
GetNormals
();
_nCells
=
mesh
->
GetNumCells
();
_mesh
=
LoadSU2MeshFromFile
(
settings
);
_areas
=
_
mesh
->
GetCellAreas
();
_neighbors
=
_
mesh
->
GetNeighbours
();
_normals
=
_
mesh
->
GetNormals
();
_nCells
=
_
mesh
->
GetNumCells
();
std
::
cout
<<
"After Mesh..."
<<
std
::
endl
;
//
std::cout << "After Mesh..." << std::endl;
// setup angular flux array (maybe directly call SetupIC() from physics class? )
_psi
=
std
::
vector
(
_nCells
,
Vector
(
_nq
,
0.0
)
);
...
...
@@ -45,17 +45,17 @@ Solver::Solver( Settings* settings ) {
_g
=
NumericalFlux
::
Create
(
settings
);
// boundary type
_boundaryCells
=
mesh
->
GetBoundaryCellArray
();
_boundaryCells
=
_
mesh
->
GetBoundaryCellArray
();
}
double
Solver
::
ComputeTimeStep
(
double
cfl
)
const
{
double
maxEdge
=
-
1.0
;
std
::
cout
<<
_nCells
<<
std
::
endl
;
std
::
cout
<<
_areas
.
size
()
<<
std
::
endl
;
std
::
cout
<<
_normals
.
size
()
<<
std
::
endl
;
//
std::cout << _nCells << std::endl;
//
std::cout << _areas.size() << std::endl;
//
std::cout << _normals.size() << std::endl;
for
(
unsigned
j
=
0
;
j
<
_nCells
;
++
j
)
{
std
::
cout
<<
j
;
std
::
cout
<<
" "
<<
_areas
[
j
]
<<
" "
<<
_normals
[
j
].
size
()
<<
std
::
endl
;
//
std::cout << j;
//
std::cout << " " << _areas[j] << " " << _normals[j].size() << std::endl;
for
(
unsigned
l
=
0
;
l
<
_normals
[
j
].
size
();
++
l
)
{
// std::cout << _normals[j][l] << std::endl;
double
currentEdge
=
_areas
[
j
]
/
norm
(
_normals
[
j
][
l
]
);
...
...
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