13 if (verbose > 2)
Chi::log.
Log() <<
"\nAssemblying RHS for two-grid ";
19 for (
const auto& cell :
grid_ptr_->local_cells)
21 const auto &cell_mapping = sdm.GetCellMapping(cell);
22 const auto qp_data = cell_mapping.MakeVolumetricQuadraturePointData();
23 const size_t num_nodes = cell_mapping.NumNodes();
25 const auto &S =
matid_to_xs_map.at(cell.material_id_)->TransferMatrix(0);
29 for (
const auto &[row_g, gprime, sigma_sm]: S.Row(g)) {
33 const double *xlocal_old;
34 VecGetArrayRead(
x_[gprime], &xlocal);
35 VecGetArrayRead(
x_old_[gprime], &xlocal_old);
37 for (
size_t i = 0; i < num_nodes; ++i) {
38 const int64_t imap = sdm.MapDOF(cell, i);
39 double inscatter_g = 0.0;
41 for (
size_t j = 0; j < num_nodes; ++j) {
42 const int64_t jmap = sdm.MapDOFLocal(cell, j);
45 const double delta_flxj_gp = xlocal[jmap] - xlocal_old[jmap];
46 for (
size_t qp: qp_data.QuadraturePointIndices())
47 inscatter_g += sigma_sm * delta_flxj_gp *
48 qp_data.ShapeValue(i, qp) * qp_data.ShapeValue(j, qp) *
52 VecSetValue(
b_, imap, inscatter_g, ADD_VALUES);
54 VecRestoreArrayRead(
x_[gprime] , &xlocal);
55 VecRestoreArrayRead(
x_old_[gprime], &xlocal_old);
LogStream Log(LOG_LVL level=LOG_0)
void Assemble_RHS_TwoGrid(int64_t iverbose)
std::vector< Vec > x_old_
std::map< int, std::shared_ptr< chi_physics::MultiGroupXS > > matid_to_xs_map
chi_mesh::MeshContinuumPtr grid_ptr_
chi_math::SDMPtr sdm_ptr_