Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/common/globalconstants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ enum SCALAR_OUTPUT {
PROBE_MOMENT_TIME_TRACE,
VAR_ABSORPTION_GREEN,
ABSORPTION_GREEN_BLOCK,
AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED,
VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED,
ABSORPTION_GREEN_LINE
};

Expand All @@ -225,6 +227,8 @@ inline std::map<std::string, SCALAR_OUTPUT> ScalarOutput_Map{ { "ITER", ITER },
{ "PROBE_MOMENT_TIME_TRACE", PROBE_MOMENT_TIME_TRACE },
{ "VAR_ABSORPTION_GREEN", VAR_ABSORPTION_GREEN },
{ "ABSORPTION_GREEN_BLOCK", ABSORPTION_GREEN_BLOCK },
{ "AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED", AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED },
{ "VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED", VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED },
{ "ABSORPTION_GREEN_LINE", ABSORPTION_GREEN_LINE } };

// Spherical Basis Name
Expand Down
3 changes: 3 additions & 0 deletions include/solvers/snsolver_hpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class SNSolverHPC
double _curAbsorptionHohlraumVertical;
double _curAbsorptionHohlraumHorizontal;
double _varAbsorptionHohlraumGreen;
double _avgAbsorptionHohlraumGreenBlockIntegrated;
double _varAbsorptionHohlraumGreenBlockIntegrated;

std::vector<std::vector<unsigned>> _probingCellsHohlraum; /*!< @brief Indices of cells that contain a probing sensor */
std::vector<double> _probingMoments; /*!< @brief Solution Momnets at the probing cells that contain a probing sensor */
Expand All @@ -125,6 +127,7 @@ class SNSolverHPC
unsigned _nProbingCellsBlocksGreen;
std::vector<std::vector<unsigned>> _probingCellsBlocksGreen; /*!< @brief Indices of cells that contain a probing sensor blocks */
std::vector<double> _absorptionValsBlocksGreen; /*!< @brief Avg Absorption value at the sampleing blocks of lineGreen */
std::vector<double> _absorptionValsBlocksGreenIntegrated; /*!< @brief Internal QoI-3 running values A_i(t) = |g_i|^{-1} \int_{g_i}\int_0^t sigma_a phi d\tau dxdy */

// Design parameters
std::vector<double> _cornerUpperLeftGreen; /*!< @brief Coord of corner of the green area (minus thickness/2 of it) relative to the green center */
Expand Down
3 changes: 3 additions & 0 deletions include/solvers/snsolver_hpc_cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class SNSolverHPCCUDA
double _curAbsorptionHohlraumVertical;
double _curAbsorptionHohlraumHorizontal;
double _varAbsorptionHohlraumGreen;
double _avgAbsorptionHohlraumGreenBlockIntegrated;
double _varAbsorptionHohlraumGreenBlockIntegrated;

std::vector<std::vector<unsigned>> _probingCellsHohlraum; /*!< @brief Indices of cells that contain a probing sensor */
std::vector<double> _probingMoments; /*!< @brief Solution Momnets at the probing cells that contain a probing sensor */
Expand All @@ -127,6 +129,7 @@ class SNSolverHPCCUDA
unsigned _nProbingCellsBlocksGreen;
std::vector<std::vector<unsigned>> _probingCellsBlocksGreen; /*!< @brief Indices of cells that contain a probing sensor blocks */
std::vector<double> _absorptionValsBlocksGreen; /*!< @brief Avg Absorption value at the sampleing blocks of lineGreen */
std::vector<double> _absorptionValsBlocksGreenIntegrated; /*!< @brief Internal QoI-3 running values A_i(t) = |g_i|^{-1} \int_{g_i}\int_0^t sigma_a phi d\tau dxdy */

// Design parameters
std::vector<double> _cornerUpperLeftGreen; /*!< @brief Coord of corner of the green area (minus thickness/2 of it) relative to the green center */
Expand Down
3 changes: 3 additions & 0 deletions include/solvers/snsolver_hpc_hip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class SNSolverHPCHIP
double _curAbsorptionHohlraumVertical;
double _curAbsorptionHohlraumHorizontal;
double _varAbsorptionHohlraumGreen;
double _avgAbsorptionHohlraumGreenBlockIntegrated;
double _varAbsorptionHohlraumGreenBlockIntegrated;

std::vector<std::vector<unsigned>> _probingCellsHohlraum; /*!< @brief Indices of cells that contain a probing sensor */
std::vector<double> _probingMoments; /*!< @brief Solution Momnets at the probing cells that contain a probing sensor */
Expand All @@ -127,6 +129,7 @@ class SNSolverHPCHIP
unsigned _nProbingCellsBlocksGreen;
std::vector<std::vector<unsigned>> _probingCellsBlocksGreen; /*!< @brief Indices of cells that contain a probing sensor blocks */
std::vector<double> _absorptionValsBlocksGreen; /*!< @brief Avg Absorption value at the sampleing blocks of lineGreen */
std::vector<double> _absorptionValsBlocksGreenIntegrated; /*!< @brief Internal QoI-3 running values A_i(t) = |g_i|^{-1} \int_{g_i}\int_0^t sigma_a phi d\tau dxdy */

// Design parameters
std::vector<double> _cornerUpperLeftGreen; /*!< @brief Coord of corner of the green area (minus thickness/2 of it) relative to the green center */
Expand Down
13 changes: 10 additions & 3 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,18 +806,21 @@ void Config::SetPostprocessing() {
TOTAL_PARTICLE_ABSORPTION,
PROBE_MOMENT_TIME_TRACE,
VAR_ABSORPTION_GREEN,
AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED,
VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED,
};

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(
"Illegal output field <" + foundKey +
"Illegal output field <" + foundKey +
"> for option SCREEN_OUTPUT for this test case.\n"
"Supported fields are: ITER, SIM_TIME, WALL_TIME, 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"
"TOTAL_OUTFLOW, MAX_OUTFLOW, VAR_ABSORPTION_GREEN, AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED, "
"VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED \n"
"Please check your .cfg file.",
CURRENT_FUNCTION );
}
Expand Down Expand Up @@ -957,6 +960,8 @@ void Config::SetPostprocessing() {
PROBE_MOMENT_TIME_TRACE,
VAR_ABSORPTION_GREEN,
ABSORPTION_GREEN_BLOCK,
AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED,
VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED,
ABSORPTION_GREEN_LINE };

it = std::find( legalOutputs.begin(), legalOutputs.end(), _historyOutput[idx_historyOutput] );
Expand All @@ -968,7 +973,8 @@ void Config::SetPostprocessing() {
"> for option HISTORY_OUTPUT for this test case.\n"
"Supported fields are: ITER, SIM_TIME, WALL_TIME, 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, ABSORPTION_GREEN_BLOCK, ABSORPTION_GREEN_LINE \n"
"TOTAL_OUTFLOW, MAX_OUTFLOW , VAR_ABSORPTION_GREEN, ABSORPTION_GREEN_BLOCK, "
"AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED, VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED, ABSORPTION_GREEN_LINE \n"
"Please check your .cfg file.",
CURRENT_FUNCTION );
}
Expand Down Expand Up @@ -1043,6 +1049,7 @@ void Config::SetPostprocessing() {
_nHistoryOutput += 44 - 1; // extend the screen output by the number of probing points
for( unsigned i = 0; i < 44; i++ ) _historyOutput.push_back( ABSORPTION_GREEN_BLOCK );
}

}
}

Expand Down
43 changes: 40 additions & 3 deletions src/solvers/snsolver_hpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ SNSolverHPC::SNSolverHPC( Config* settings ) {
_curAbsorptionHohlraumVertical = 0;
_curAbsorptionHohlraumHorizontal = 0;
_varAbsorptionHohlraumGreen = 0;
_avgAbsorptionHohlraumGreenBlockIntegrated = 0;
_varAbsorptionHohlraumGreenBlockIntegrated = 0;
}

if( _settings->GetLoadRestartSolution() )
Expand Down Expand Up @@ -267,9 +269,10 @@ SNSolverHPC::SNSolverHPC( Config* settings ) {

_nProbingCellsLineGreen = _settings->GetNumProbingCellsLineHohlraum();

_nProbingCellsBlocksGreen = 44;
_absorptionValsBlocksGreen = std::vector<double>( _nProbingCellsBlocksGreen, 0. );
_absorptionValsLineSegment = std::vector<double>( _nProbingCellsLineGreen, 0.0 );
_nProbingCellsBlocksGreen = 44;
_absorptionValsBlocksGreen = std::vector<double>( _nProbingCellsBlocksGreen, 0. );
_absorptionValsBlocksGreenIntegrated = std::vector<double>( _nProbingCellsBlocksGreen, 0. );
_absorptionValsLineSegment = std::vector<double>( _nProbingCellsLineGreen, 0.0 );

SetProbingCellsLineGreen(); // ONLY FOR HOHLRAUM
}
Expand Down Expand Up @@ -825,6 +828,8 @@ void SNSolverHPC::IterPostprocessing() {
}
// Update time integral values on rank 0
if( _rank == 0 ) {
constexpr double greenBlockArea = 0.05 * 0.05;

_totalScalarOutflow += _curScalarOutflow * _dT;
_totalScalarOutflowPeri1 += _curScalarOutflowPeri1 * _dT;
_totalScalarOutflowPeri2 += _curScalarOutflowPeri2 * _dT;
Expand All @@ -833,6 +838,20 @@ void SNSolverHPC::IterPostprocessing() {
_totalAbsorptionHohlraumCenter += _curAbsorptionHohlraumCenter * _dT;
_totalAbsorptionHohlraumVertical += _curAbsorptionHohlraumVertical * _dT;
_totalAbsorptionHohlraumHorizontal += _curAbsorptionHohlraumHorizontal * _dT;
for( unsigned i = 0; i < _nProbingCellsBlocksGreen; ++i ) {
_absorptionValsBlocksGreenIntegrated[i] += _dT * _absorptionValsBlocksGreen[i] / greenBlockArea;
}
_avgAbsorptionHohlraumGreenBlockIntegrated = 0.0;
_varAbsorptionHohlraumGreenBlockIntegrated = 0.0;
for( unsigned i = 0; i < _nProbingCellsBlocksGreen; ++i ) {
_avgAbsorptionHohlraumGreenBlockIntegrated += _absorptionValsBlocksGreenIntegrated[i];
}
_avgAbsorptionHohlraumGreenBlockIntegrated /= static_cast<double>( _nProbingCellsBlocksGreen );
for( unsigned i = 0; i < _nProbingCellsBlocksGreen; ++i ) {
const double diff = _absorptionValsBlocksGreenIntegrated[i] - _avgAbsorptionHohlraumGreenBlockIntegrated;
_varAbsorptionHohlraumGreenBlockIntegrated += diff * diff;
}
_varAbsorptionHohlraumGreenBlockIntegrated /= static_cast<double>( _nProbingCellsBlocksGreen );

_rmsFlux = sqrt( _rmsFlux );
}
Expand Down Expand Up @@ -938,6 +957,8 @@ void SNSolverHPC::PrepareScreenOutput() {
}
break;
case VAR_ABSORPTION_GREEN: _screenOutputFieldNames[idx_field] = "Var. absorption green"; break;
case AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED: _screenOutputFieldNames[idx_field] = "A_G"; break;
case VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED: _screenOutputFieldNames[idx_field] = "V_G"; break;

default: ErrorMessages::Error( "Screen output field not defined!", CURRENT_FUNCTION ); break;
}
Expand Down Expand Up @@ -996,6 +1017,12 @@ void SNSolverHPC::WriteScalarOutput( unsigned idx_iter ) {
idx_field--;
break;
case VAR_ABSORPTION_GREEN: _screenOutputFields[idx_field] = _varAbsorptionHohlraumGreen; break;
case AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED:
_screenOutputFields[idx_field] = _avgAbsorptionHohlraumGreenBlockIntegrated;
break;
case VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED:
_screenOutputFields[idx_field] = _varAbsorptionHohlraumGreenBlockIntegrated;
break;
default: ErrorMessages::Error( "Screen output group not defined!", CURRENT_FUNCTION ); break;
}
}
Expand Down Expand Up @@ -1054,6 +1081,12 @@ void SNSolverHPC::WriteScalarOutput( unsigned idx_iter ) {
idx_field--;
break;
case VAR_ABSORPTION_GREEN: _historyOutputFields[idx_field] = _varAbsorptionHohlraumGreen; break;
case AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED:
_historyOutputFields[idx_field] = _avgAbsorptionHohlraumGreenBlockIntegrated;
break;
case VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED:
_historyOutputFields[idx_field] = _varAbsorptionHohlraumGreenBlockIntegrated;
break;
case ABSORPTION_GREEN_LINE:
for( unsigned i = 0; i < _settings->GetNumProbingCellsLineHohlraum(); i++ ) {
_historyOutputFields[idx_field] = _absorptionValsLineSegment[i];
Expand Down Expand Up @@ -1106,6 +1139,8 @@ void SNSolverHPC::PrintScreenOutput( unsigned idx_iter ) {
TOTAL_PARTICLE_ABSORPTION_HORIZONTAL,
PROBE_MOMENT_TIME_TRACE,
VAR_ABSORPTION_GREEN,
AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED,
VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED,
ABSORPTION_GREEN_BLOCK,
ABSORPTION_GREEN_LINE };
std::vector<SCALAR_OUTPUT> booleanFields = { VTK_OUTPUT, CSV_OUTPUT };
Expand Down Expand Up @@ -1187,6 +1222,8 @@ void SNSolverHPC::PrepareHistoryOutput() {
idx_field--;
break;
case VAR_ABSORPTION_GREEN: _historyOutputFieldNames[idx_field] = "Var. absorption green"; break;
case AVG_ABSORPTION_GREEN_BLOCK_INTEGRATED: _historyOutputFieldNames[idx_field] = "A_G"; break;
case VAR_ABSORPTION_GREEN_BLOCK_INTEGRATED: _historyOutputFieldNames[idx_field] = "V_G"; break;
case ABSORPTION_GREEN_BLOCK:
for( unsigned i = 0; i < 44; i++ ) {
_historyOutputFieldNames[idx_field] = "Probe Green Block " + std::to_string( i );
Expand Down
Loading
Loading