Skip to content

Commit

Permalink
added half lattice benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ScSteffen committed Mar 1, 2024
1 parent 5af1b34 commit 77e7bde
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 67 deletions.
6 changes: 4 additions & 2 deletions include/common/globalconstants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ enum PROBLEM_NAME {
PROBLEM_Hohlraum,
PROBLEM_SymmetricHohlraum,
PROBLEM_QuarterHohlraum,
PROBLEM_Lattice
PROBLEM_Lattice,
PROBLEM_HalfLattice
};

inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_Linesource },
Expand All @@ -122,7 +123,8 @@ inline std::map<std::string, PROBLEM_NAME> Problem_Map{ { "LINESOURCE", PROBLEM_
{ "HOHLRAUM", PROBLEM_Hohlraum },
{ "SYMMETRIC_HOHLRAUM", PROBLEM_SymmetricHohlraum },
{ "QUARTER_HOHLRAUM", PROBLEM_QuarterHohlraum },
{ "LATTICE", PROBLEM_Lattice } };
{ "LATTICE", PROBLEM_Lattice },
{ "HALF_LATTICE", PROBLEM_HalfLattice } };

// Kernel name
enum KERNEL_NAME { KERNEL_Isotropic, KERNEL_Isotropic1D };
Expand Down
2 changes: 1 addition & 1 deletion include/problems/quarterhohlraum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class QuarterHohlraum : public ProblemBase
std::map<unsigned, bool> _ghostCellsReflectingX; /*!< map that indicates if a ghostcell has a fixed value or is a mirroring boundary */
std::map<unsigned, bool> _ghostCellsReflectingY; /*!< map that indicates if a ghostcell has a fixed value or is a mirroring boundary */
std::map<unsigned, unsigned> _quadratureXReflection; /*!< map that gives a Reflection against the x axis for the velocity ordinates */
std::map<unsigned, unsigned> _quadratureYReflection; /*!< map that gives a Reflection against the x axis for the velocity ordinates */
std::map<unsigned, unsigned> _quadratureYReflection; /*!< map that gives a Reflection against the y axis for the velocity ordinates */

protected:
Vector _sigmaS; /*!< @brief Vector of scattering crosssections */
Expand Down
69 changes: 7 additions & 62 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ void Config::SetPostprocessing() {
std::vector<SCALAR_OUTPUT> legalOutputs;
std::vector<SCALAR_OUTPUT>::iterator it;
switch( _problemName ) {
case PROBLEM_HalfLattice:
case PROBLEM_Lattice:
legalOutputs = { ITER,
WALL_TIME,
Expand All @@ -759,6 +760,7 @@ void Config::SetPostprocessing() {
CURRENT_FUNCTION );
}
break;
case PROBLEM_QuarterHohlraum:
case PROBLEM_SymmetricHohlraum:
legalOutputs = { ITER,
WALL_TIME,
Expand Down Expand Up @@ -789,36 +791,7 @@ void Config::SetPostprocessing() {
CURRENT_FUNCTION );
}
break;
case PROBLEM_QuarterHohlraum:
legalOutputs = { ITER,
WALL_TIME,
MASS,
RMS_FLUX,
VTK_OUTPUT,
CSV_OUTPUT,
CUR_OUTFLOW,
TOTAL_OUTFLOW,
MAX_OUTFLOW,
TOTAL_PARTICLE_ABSORPTION_CENTER,
TOTAL_PARTICLE_ABSORPTION_VERTICAL,
TOTAL_PARTICLE_ABSORPTION_HORIZONTAL,
PROBE_MOMENT_TIME_TRACE,
VAR_ABSORPTION_GREEN };

it = std::find( legalOutputs.begin(), legalOutputs.end(), _screenOutput[idx_screenOutput] );

if( it == legalOutputs.end() ) {
std::string foundKey = findKey( ScalarOutput_Map, _screenOutput[idx_screenOutput] );
ErrorMessages::Error(
"HERE Illegal output field <" + foundKey +
"> for option SCREEN_OUTPUT for this test case.\n"
"Supported fields are: ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT, TOTAL_PARTICLE_ABSORPTION_CENTER, \n"
"TOTAL_PARTICLE_ABSORPTION_VERTICAL, TOTAL_PARTICLE_ABSORPTION_HORIZONTAL, PROBE_MOMENT_TIME_TRACE, CUR_OUTFLOW, \n "
"TOTAL_OUTFLOW, MAX_OUTFLOW, VAR_ABSORPTION_GREEN \n"
"Please check your .cfg file.",
CURRENT_FUNCTION );
}
break;
default:
legalOutputs = { ITER, WALL_TIME, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT, CUR_OUTFLOW, TOTAL_OUTFLOW, MAX_OUTFLOW };
it = std::find( legalOutputs.begin(), legalOutputs.end(), _screenOutput[idx_screenOutput] );
Expand Down Expand Up @@ -881,10 +854,10 @@ void Config::SetPostprocessing() {
// Check for doublicates in HISTORY OUTPUT
std::map<SCALAR_OUTPUT, int> dublicate_map;

for( unsigned short idx_screenOutput = 0; idx_screenOutput < _nHistoryOutput; idx_screenOutput++ ) {
std::map<SCALAR_OUTPUT, int>::iterator it = dublicate_map.find( _historyOutput[idx_screenOutput] );
for( unsigned idx_historyOutput = 0; idx_historyOutput < _nHistoryOutput; idx_historyOutput++ ) {
std::map<SCALAR_OUTPUT, int>::iterator it = dublicate_map.find( _historyOutput[idx_historyOutput] );
if( it == dublicate_map.end() ) {
dublicate_map.insert( std::pair<SCALAR_OUTPUT, int>( _historyOutput[idx_screenOutput], 0 ) );
dublicate_map.insert( std::pair<SCALAR_OUTPUT, int>( _historyOutput[idx_historyOutput], 0 ) );
}
else {
it->second++;
Expand All @@ -903,6 +876,7 @@ void Config::SetPostprocessing() {
std::vector<SCALAR_OUTPUT>::iterator it;

switch( _problemName ) {
case PROBLEM_HalfLattice:
case PROBLEM_Lattice:
legalOutputs = { ITER,
WALL_TIME,
Expand All @@ -928,6 +902,7 @@ void Config::SetPostprocessing() {
CURRENT_FUNCTION );
}
break;
case PROBLEM_QuarterHohlraum:
case PROBLEM_SymmetricHohlraum:
legalOutputs = { ITER,
WALL_TIME,
Expand Down Expand Up @@ -959,37 +934,7 @@ void Config::SetPostprocessing() {
CURRENT_FUNCTION );
}
break;
case PROBLEM_QuarterHohlraum:
legalOutputs = { ITER,
WALL_TIME,
MASS,
RMS_FLUX,
VTK_OUTPUT,
CSV_OUTPUT,
CUR_OUTFLOW,
TOTAL_OUTFLOW,
MAX_OUTFLOW,
TOTAL_PARTICLE_ABSORPTION_CENTER,
TOTAL_PARTICLE_ABSORPTION_VERTICAL,
TOTAL_PARTICLE_ABSORPTION_HORIZONTAL,
PROBE_MOMENT_TIME_TRACE,
VAR_ABSORPTION_GREEN,
VAR_ABSORPTION_GREEN_LINE };

it = std::find( legalOutputs.begin(), legalOutputs.end(), _historyOutput[idx_screenOutput] );

if( it == legalOutputs.end() ) {
std::string foundKey = findKey( ScalarOutput_Map, _historyOutput[idx_screenOutput] );
ErrorMessages::Error(
"Illegal output field <" + foundKey +
"> for option HISTORY_OUTPUT for this test case.\n"
"Supported fields are: ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT, TOTAL_PARTICLE_ABSORPTION_CENTER, \n "
"TOTAL_PARTICLE_ABSORPTION_VERTICAL, TOTAL_PARTICLE_ABSORPTION_HORIZONTAL,PROBE_MOMENT_TIME_TRACE, CUR_OUTFLOW, \n"
"TOTAL_OUTFLOW, MAX_OUTFLOW , VAR_ABSORPTION_GREEN, VAR_ABSORPTION_GREEN_LINE \n"
"Please check your .cfg file.",
CURRENT_FUNCTION );
}
break;
default:
legalOutputs = { ITER, WALL_TIME, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT, CUR_OUTFLOW, TOTAL_OUTFLOW, MAX_OUTFLOW };
it = std::find( legalOutputs.begin(), legalOutputs.end(), _historyOutput[idx_screenOutput] );
Expand Down
8 changes: 7 additions & 1 deletion src/problems/problembase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "common/mesh.hpp"
#include "problems/aircavity1d.hpp"
#include "problems/checkerboard.hpp"
#include "problems/halflattice.hpp"
#include "problems/hohlraum.hpp"
#include "problems/lattice.hpp"
#include "problems/linesource.hpp"
Expand Down Expand Up @@ -116,6 +117,12 @@ ProblemBase* ProblemBase::Create( Config* settings, Mesh* mesh, QuadratureBase*
else
return new Lattice_SN( settings, mesh, quad );
} break;
case PROBLEM_HalfLattice: {
if( settings->GetIsMomentSolver() )
return new HalfLattice_Moment( settings, mesh, quad );
else
return new HalfLattice_SN( settings, mesh, quad );
} break;

default: ErrorMessages::Error( "No valid physical problem chosen. Please check your config file", CURRENT_FUNCTION ); return nullptr;
}
Expand Down Expand Up @@ -219,7 +226,6 @@ void ProblemBase::ComputeCurrentOutflow( const VectorVector& solution ) {

// Iterate over face cell faces

#pragma omp parallel for default( shared ) reduction( + : _curScalarOutflow )
for( unsigned idx_nbr = 0; idx_nbr < neigbors[idx_cell].size(); ++idx_nbr ) {
// Find face that points outward
if( neigbors[idx_cell][idx_nbr] == nCells ) {
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/solverbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ void SolverBase::IterPostprocessing( unsigned /*idx_iter*/ ) {
_problem->ComputeTotalOutflow( _dT );
_problem->ComputeMaxOrdinatewiseOutflow( _sol );

if( _settings->GetProblemName() == PROBLEM_Lattice ) {
if( _settings->GetProblemName() == PROBLEM_Lattice || _settings->GetProblemName() == PROBLEM_HalfLattice ) {
_problem->ComputeCurrentAbsorptionLattice( _scalarFlux );
_problem->ComputeTotalAbsorptionLattice( _dT );
_problem->ComputeMaxAbsorptionLattice( _scalarFlux );
Expand Down

0 comments on commit 77e7bde

Please sign in to comment.