From 77e7bde0b8fe029e4e25bd37d07d0d7d1eb405c6 Mon Sep 17 00:00:00 2001 From: ScSteffen Date: Fri, 1 Mar 2024 16:10:45 -0500 Subject: [PATCH] added half lattice benchmark --- include/common/globalconstants.hpp | 6 ++- include/problems/quarterhohlraum.hpp | 2 +- src/common/config.cpp | 69 +++------------------------- src/problems/problembase.cpp | 8 +++- src/solvers/solverbase.cpp | 2 +- 5 files changed, 20 insertions(+), 67 deletions(-) diff --git a/include/common/globalconstants.hpp b/include/common/globalconstants.hpp index 8ec78634..6487c85b 100644 --- a/include/common/globalconstants.hpp +++ b/include/common/globalconstants.hpp @@ -105,7 +105,8 @@ enum PROBLEM_NAME { PROBLEM_Hohlraum, PROBLEM_SymmetricHohlraum, PROBLEM_QuarterHohlraum, - PROBLEM_Lattice + PROBLEM_Lattice, + PROBLEM_HalfLattice }; inline std::map Problem_Map{ { "LINESOURCE", PROBLEM_Linesource }, @@ -122,7 +123,8 @@ inline std::map 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 }; diff --git a/include/problems/quarterhohlraum.hpp b/include/problems/quarterhohlraum.hpp index ee48b070..416e43c8 100644 --- a/include/problems/quarterhohlraum.hpp +++ b/include/problems/quarterhohlraum.hpp @@ -12,7 +12,7 @@ class QuarterHohlraum : public ProblemBase std::map _ghostCellsReflectingX; /*!< map that indicates if a ghostcell has a fixed value or is a mirroring boundary */ std::map _ghostCellsReflectingY; /*!< map that indicates if a ghostcell has a fixed value or is a mirroring boundary */ std::map _quadratureXReflection; /*!< map that gives a Reflection against the x axis for the velocity ordinates */ - std::map _quadratureYReflection; /*!< map that gives a Reflection against the x axis for the velocity ordinates */ + std::map _quadratureYReflection; /*!< map that gives a Reflection against the y axis for the velocity ordinates */ protected: Vector _sigmaS; /*!< @brief Vector of scattering crosssections */ diff --git a/src/common/config.cpp b/src/common/config.cpp index 8db5f793..73c04200 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -734,6 +734,7 @@ void Config::SetPostprocessing() { std::vector legalOutputs; std::vector::iterator it; switch( _problemName ) { + case PROBLEM_HalfLattice: case PROBLEM_Lattice: legalOutputs = { ITER, WALL_TIME, @@ -759,6 +760,7 @@ void Config::SetPostprocessing() { CURRENT_FUNCTION ); } break; + case PROBLEM_QuarterHohlraum: case PROBLEM_SymmetricHohlraum: legalOutputs = { ITER, WALL_TIME, @@ -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] ); @@ -881,10 +854,10 @@ void Config::SetPostprocessing() { // Check for doublicates in HISTORY OUTPUT std::map dublicate_map; - for( unsigned short idx_screenOutput = 0; idx_screenOutput < _nHistoryOutput; idx_screenOutput++ ) { - std::map::iterator it = dublicate_map.find( _historyOutput[idx_screenOutput] ); + for( unsigned idx_historyOutput = 0; idx_historyOutput < _nHistoryOutput; idx_historyOutput++ ) { + std::map::iterator it = dublicate_map.find( _historyOutput[idx_historyOutput] ); if( it == dublicate_map.end() ) { - dublicate_map.insert( std::pair( _historyOutput[idx_screenOutput], 0 ) ); + dublicate_map.insert( std::pair( _historyOutput[idx_historyOutput], 0 ) ); } else { it->second++; @@ -903,6 +876,7 @@ void Config::SetPostprocessing() { std::vector::iterator it; switch( _problemName ) { + case PROBLEM_HalfLattice: case PROBLEM_Lattice: legalOutputs = { ITER, WALL_TIME, @@ -928,6 +902,7 @@ void Config::SetPostprocessing() { CURRENT_FUNCTION ); } break; + case PROBLEM_QuarterHohlraum: case PROBLEM_SymmetricHohlraum: legalOutputs = { ITER, WALL_TIME, @@ -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] ); diff --git a/src/problems/problembase.cpp b/src/problems/problembase.cpp index 249ff13a..537fa322 100644 --- a/src/problems/problembase.cpp +++ b/src/problems/problembase.cpp @@ -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" @@ -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; } @@ -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 ) { diff --git a/src/solvers/solverbase.cpp b/src/solvers/solverbase.cpp index 4c471e4c..67f38e86 100644 --- a/src/solvers/solverbase.cpp +++ b/src/solvers/solverbase.cpp @@ -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 );