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
df903b84
Commit
df903b84
authored
Oct 06, 2020
by
Steffen Schotthöfer
Browse files
added option to control output write frequency
Former-commit-id:
379ab8f9
parent
178e4838
Changes
7
Show whitespace changes
Inline
Side-by-side
code/include/common/config.h
View file @
df903b84
...
...
@@ -93,6 +93,7 @@ class Config
// Output Options
unsigned
short
_nVolumeOutput
;
/*!< @brief Number of volume outputs */
std
::
vector
<
VOLUME_OUTPUT
>
_volumeOutput
;
/*!< @brief Output groups for volume output*/
unsigned
short
_outputFrequency
;
/*!< @brief Frequency of vtk write of volume output*/
// --- Parsing Functionality and Initializing of Options ---
/*!
...
...
@@ -244,6 +245,7 @@ class Config
// Linesource
double
inline
GetSigmaS
()
const
{
return
_sigmaS
;
}
// Optimizer
double
inline
GetNewtonOptimizerEpsilon
()
const
{
return
_optimizerEpsilon
;
}
unsigned
inline
GetNewtonIter
()
const
{
return
_newtonIter
;
}
...
...
@@ -261,6 +263,7 @@ class Config
// Output Structure
std
::
vector
<
VOLUME_OUTPUT
>
inline
GetVolumeOutput
()
{
return
_volumeOutput
;
}
unsigned
short
inline
GetNVolumeOutput
()
{
return
_nVolumeOutput
;
}
unsigned
short
inline
GetOutputFrequency
()
{
return
_outputFrequency
;
}
// ---- Setters for option structure
...
...
code/include/solvers/pnsolver.h
View file @
df903b84
...
...
@@ -56,7 +56,7 @@ class PNSolver : public Solver
/*! @brief Function that prepares VTK export and csv export of the current solver iteration
@returns: Mass of current iteration
*/
double
WriteOutputFields
();
double
WriteOutputFields
(
unsigned
idx_pseudoTime
);
// Solver
/*! @brief: parameter functions for setting up system matrix
...
...
code/input/exampleMN.cfg
View file @
df903b84
...
...
@@ -29,7 +29,7 @@ CFL_NUMBER = 0.7
% Final time for simulation
TIME_FINAL = 0.3
% Maximal Moment degree
MAX_MOMENT_SOLVER =
1
MAX_MOMENT_SOLVER =
2
%
%% Entropy settings
ENTROPY_FUNCTIONAL = MAXWELL_BOLZMANN
...
...
code/input/examplePN.cfg
View file @
df903b84
...
...
@@ -31,7 +31,7 @@ CFL_NUMBER = 0.7
% Final time for simulation
TIME_FINAL = 0.3
% Maximal Moment degree
MAX_MOMENT_SOLVER =
3
MAX_MOMENT_SOLVER =
2
% ---- Boundary Conditions ----
% Example: BC_DIRICLET = (dummyMarker1, dummyMarker2)
...
...
code/src/common/config.cpp
View file @
df903b84
...
...
@@ -273,10 +273,14 @@ void Config::SetConfigOptions() {
AddStringListOption
(
"BC_DIRICHLET"
,
_nMarkerDirichlet
,
_MarkerDirichlet
);
AddStringListOption
(
"BC_NEUMANN"
,
_nMarkerNeumann
,
_MarkerNeumann
);
/*! @brief Scattering kernel \n DESCRIPTION: Describes used scattering kernel \n DEFAULT KERNEL_Isotropic \ingroup Config */
AddEnumOption
(
"KERNEL"
,
_kernelName
,
Kernel_Map
,
KERNEL_Isotropic
);
// Output related options
/*! @brief Volume output \n DESCRIPTION: Describes output groups to write to vtk \ingroup Config */
AddEnumListOption
(
"VOLUME_OUTPUT"
,
_nVolumeOutput
,
_volumeOutput
,
VolOutput_Map
);
/*! @brief Output Frequency \n DESCRIPTION: Describes output write frequency \n DEFAULT 0 ,i.e. only last value \ingroup Config */
AddUnsignedShortOption
(
"OUTPUT_FREQUENCY"
,
_outputFrequency
,
0
);
}
void
Config
::
SetConfigParsing
(
string
case_filename
)
{
...
...
code/src/solvers/mnsolver.cpp
View file @
df903b84
...
...
@@ -183,7 +183,7 @@ void MNSolver::Solve() {
// --- VTK and CSV Output ---
mass
=
WriteOutputFields
(
idx_energy
);
Save
(
idx_energy
);
WriteNNTrainingData
(
idx_energy
);
//
WriteNNTrainingData( idx_energy );
// --- Screen Output ---
if
(
rank
==
0
)
log
->
info
(
"{:03.8f} {:01.5e}"
,
_energies
[
idx_energy
],
mass
);
...
...
@@ -264,6 +264,8 @@ double MNSolver::WriteOutputFields( unsigned idx_pseudoTime ) {
mass
+=
_sol
[
idx_cell
][
0
]
*
_areas
[
idx_cell
];
// Should probably go to postprocessing
}
if
(
_settings
->
GetOutputFrequency
()
!=
0
&&
idx_pseudoTime
%
(
unsigned
)
_settings
->
GetOutputFrequency
()
==
0
)
{
for
(
unsigned
idx_group
=
0
;
idx_group
<
nGroups
;
idx_group
++
)
{
switch
(
_settings
->
GetVolumeOutput
()[
idx_group
]
)
{
case
MINIMAL
:
...
...
@@ -301,13 +303,16 @@ double MNSolver::WriteOutputFields( unsigned idx_pseudoTime ) {
default:
ErrorMessages
::
Error
(
"Volume Output Group not defined for MN Solver!"
,
CURRENT_FUNCTION
);
break
;
}
}
}
return
mass
;
}
void
MNSolver
::
Save
()
const
{
ExportVTK
(
_settings
->
GetOutputFile
(),
_outputFields
,
_outputFieldNames
,
_mesh
);
}
void
MNSolver
::
Save
(
int
currEnergy
)
const
{
if
(
_settings
->
GetOutputFrequency
()
!=
0
&&
currEnergy
%
(
unsigned
)
_settings
->
GetOutputFrequency
()
==
0
)
{
ExportVTK
(
_settings
->
GetOutputFile
()
+
"_"
+
std
::
to_string
(
currEnergy
),
_outputFields
,
_outputFieldNames
,
_mesh
);
}
}
void
MNSolver
::
WriteNNTrainingData
(
unsigned
idx_pseudoTime
)
{
...
...
code/src/solvers/pnsolver.cpp
View file @
df903b84
...
...
@@ -69,7 +69,7 @@ void PNSolver::Solve() {
if
(
rank
==
0
)
log
->
info
(
"{:10} {:10}"
,
"t"
,
"mass"
);
// Remove
mass
=
WriteOutputFields
();
mass
=
WriteOutputFields
(
0
);
if
(
rank
==
0
)
log
->
info
(
" {:01.5e} {:01.5e}"
,
0.0
,
mass
);
// Loop over energies (pseudo-time of continuous slowing down approach)
...
...
@@ -123,7 +123,7 @@ void PNSolver::Solve() {
_sol
=
psiNew
;
// --- VTK and CSV Output ---
mass
=
WriteOutputFields
();
mass
=
WriteOutputFields
(
idx_energy
);
Save
(
idx_energy
);
// --- Screen Output ---
...
...
@@ -371,7 +371,7 @@ void PNSolver::PrepareOutputFields() {
}
}
double
PNSolver
::
WriteOutputFields
()
{
double
PNSolver
::
WriteOutputFields
(
unsigned
idx_pseudoTime
)
{
double
mass
=
0.0
;
unsigned
nGroups
=
(
unsigned
)
_settings
->
GetNVolumeOutput
();
double
firstMomentScaleFactor
=
sqrt
(
4
*
M_PI
);
...
...
@@ -381,6 +381,8 @@ double PNSolver::WriteOutputFields() {
mass
+=
_sol
[
idx_cell
][
0
]
*
_areas
[
idx_cell
];
// Should probably go to postprocessing
}
if
(
_settings
->
GetOutputFrequency
()
!=
0
&&
idx_pseudoTime
%
(
unsigned
)
_settings
->
GetOutputFrequency
()
==
0
)
{
for
(
unsigned
idx_group
=
0
;
idx_group
<
nGroups
;
idx_group
++
)
{
switch
(
_settings
->
GetVolumeOutput
()[
idx_group
]
)
{
case
MINIMAL
:
...
...
@@ -398,13 +400,16 @@ double PNSolver::WriteOutputFields() {
default:
ErrorMessages
::
Error
(
"Volume Output Group not defined for PN Solver!"
,
CURRENT_FUNCTION
);
break
;
}
}
}
return
mass
;
}
void
PNSolver
::
Save
()
const
{
ExportVTK
(
_settings
->
GetOutputFile
(),
_outputFields
,
_outputFieldNames
,
_mesh
);
}
void
PNSolver
::
Save
(
int
currEnergy
)
const
{
if
(
_settings
->
GetOutputFrequency
()
!=
0
&&
currEnergy
%
(
unsigned
)
_settings
->
GetOutputFrequency
()
==
0
)
{
ExportVTK
(
_settings
->
GetOutputFile
()
+
"_"
+
std
::
to_string
(
currEnergy
),
_outputFields
,
_outputFieldNames
,
_mesh
);
}
}
void
PNSolver
::
CleanFluxMatrices
()
{
...
...
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