mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Address @paulromano comments
This commit is contained in:
parent
2931ebef9e
commit
d630746191
3 changed files with 24 additions and 26 deletions
|
|
@ -132,26 +132,26 @@ extern "C" {
|
|||
const double* y, const double* r);
|
||||
|
||||
//! Sets the mesh and energy grid for CMFD reweight
|
||||
//! \param[in] id of CMFD Mesh Tally
|
||||
//! \param[in] CMFD normalization factor
|
||||
//! \param[in] CMFD weight clipping factor
|
||||
//! \param[in] meshtyally_id id of CMFD Mesh Tally
|
||||
//! \param[in] cmfd_indices indices storing spatial and energy dimensions of CMFD problem
|
||||
//! \param[in] norm CMFD normalization factor
|
||||
extern "C" void openmc_initialize_mesh_egrid(const int meshtally_id, const int* cmfd_indices,
|
||||
const double norm);
|
||||
|
||||
//! Sets the mesh and energy grid for CMFD reweight
|
||||
//! \param[in] whether or not to run CMFD feedback
|
||||
//! \param[in] computed CMFD source
|
||||
//! \param[in] feedback whether or not to run CMFD feedback
|
||||
//! \param[in] cmfd_src computed CMFD source
|
||||
extern "C" void openmc_cmfd_reweight(const bool feedback, const double* cmfd_src);
|
||||
|
||||
//! Sets the fixed variables that are used for CMFD linear solver
|
||||
//! \param[in] CSR format index pointer array of loss matrix
|
||||
//! \param[in] length of indptr
|
||||
//! \param[in] CSR format index array of loss matrix
|
||||
//! \param[in] number of non-zero elements in CMFD loss matrix
|
||||
//! \param[in] dimension n of nxn CMFD loss matrix
|
||||
//! \param[in] spectral radius of CMFD matrices and tolerances
|
||||
//! \param[in] indices storing spatial and energy dimensions of CMFD problem
|
||||
//! \param[in] coremap for problem, storing accelerated regions
|
||||
//! \param[in] indptr CSR format index pointer array of loss matrix
|
||||
//! \param[in] len_indptr length of indptr
|
||||
//! \param[in] indices CSR format index array of loss matrix
|
||||
//! \param[in] n_elements number of non-zero elements in CMFD loss matrix
|
||||
//! \param[in] dim dimension n of nxn CMFD loss matrix
|
||||
//! \param[in] spectral spectral radius of CMFD matrices and tolerances
|
||||
//! \param[in] map coremap for problem, storing accelerated regions
|
||||
//! \param[in] use_all_threads whether to use all threads when running CMFD solver
|
||||
extern "C" void openmc_initialize_linsolver(const int* indptr, int len_indptr,
|
||||
const int* indices, int n_elements,
|
||||
int dim, double spectral,
|
||||
|
|
@ -159,10 +159,10 @@ extern "C" {
|
|||
|
||||
//! Runs a Gauss Seidel linear solver to solve CMFD matrix equations
|
||||
//! linear solver
|
||||
//! \param[in] CSR format data array of coefficient matrix
|
||||
//! \param[in] right hand side vector
|
||||
//! \param[out] unknown vector
|
||||
//! \param[in] tolerance on final error
|
||||
//! \param[in] A_data CSR format data array of coefficient matrix
|
||||
//! \param[in] b right hand side vector
|
||||
//! \param[out] x unknown vector
|
||||
//! \param[in] tol tolerance on final error
|
||||
//! \return number of inner iterations required to reach convergence
|
||||
extern "C" int openmc_run_linsolver(const double* A_data, const double* b,
|
||||
double* x, double tol);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ _dll.openmc_init.errcheck = _error_handler
|
|||
_dll.openmc_get_keff.argtypes = [POINTER(c_double*2)]
|
||||
_dll.openmc_get_keff.restype = c_int
|
||||
_dll.openmc_get_keff.errcheck = _error_handler
|
||||
_init_mesh_egrid_args = [c_int, _array_1d_int, c_double]
|
||||
_dll.openmc_initialize_mesh_egrid.argtypes = _init_mesh_egrid_args
|
||||
_dll.openmc_initialize_mesh_egrid.argtypes = [
|
||||
c_int, _array_1d_int, c_double
|
||||
]
|
||||
_dll.openmc_initialize_mesh_egrid.restype = None
|
||||
_init_linsolver_argtypes = [_array_1d_int, c_int, _array_1d_int, c_int, c_int,
|
||||
c_double, _array_1d_int, c_bool]
|
||||
|
|
|
|||
|
|
@ -170,9 +170,7 @@ void openmc_cmfd_reweight(const bool feedback, const double* cmfd_src)
|
|||
}
|
||||
}
|
||||
|
||||
if (!feedback) {
|
||||
return;
|
||||
}
|
||||
if (!feedback) return;
|
||||
|
||||
#ifdef OPENMC_MPI
|
||||
// Send weightfactors to all processors
|
||||
|
|
@ -211,7 +209,7 @@ void openmc_initialize_mesh_egrid(const int meshtally_id, const int* cmfd_indice
|
|||
openmc_get_tally_index(meshtally_id, &tally_index);
|
||||
|
||||
// Get filters assocaited with tally
|
||||
auto tally_filters = model::tallies[tally_index]->filters();
|
||||
const auto& tally_filters = model::tallies[tally_index]->filters();
|
||||
|
||||
// Get mesh filter index
|
||||
auto meshfilter_index = tally_filters[0];
|
||||
|
|
@ -220,15 +218,14 @@ void openmc_initialize_mesh_egrid(const int meshtally_id, const int* cmfd_indice
|
|||
auto energy_index = (tally_filters.size() == 2) ? tally_filters[1] : -1;
|
||||
|
||||
// Get mesh index from mesh filter index
|
||||
int32_t mesh_index;
|
||||
int32_t mesh_index;
|
||||
openmc_mesh_filter_get_mesh(meshfilter_index, &mesh_index);
|
||||
|
||||
// Get mesh from mesh index
|
||||
cmfd::mesh = get_regular_mesh(mesh_index);
|
||||
|
||||
// Get energy bins from energy index, otherwise use default
|
||||
if (energy_index != -1)
|
||||
{
|
||||
if (energy_index != -1) {
|
||||
auto efilt_base = model::tally_filters[energy_index].get();
|
||||
auto* efilt = dynamic_cast<EnergyFilter*>(efilt_base);
|
||||
cmfd::egrid = efilt->bins();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue