void GeneralizedPlaneStrainUserObject::finalize() { gatherSum(_residual); gatherSum(_reference_residual); gatherSum(_jacobian); }
// doco-final-start void AverageNodalVariableValue::finalize() { gatherSum(_sum); gatherSum(_n); }
Real AverageNodalVariableValue::getValue() { gatherSum(_avg); gatherSum(_n); return _avg / _n; }
void ConservedNoiseBase::finalize() { gatherSum(_integral); gatherSum(_volume); _offset = _integral / _volume; }
Real HomogenizedThermalConductivity::getValue() { gatherSum(_integral_value); gatherSum(_volume); return (_integral_value / _volume); }
void ConservedMaskedNoiseBase::finalize() { gatherSum(_integral); gatherSum(_volume); // TODO check that _volume is >0 _offset = _integral / _volume; }
void SphericalAverage::finalize() { gatherSum(_counts); for (auto j = beginIndex(_average); j < _nvals; ++j) { gatherSum(*_average[j]); for (auto i = beginIndex(_counts); i < _nbins; ++i) (*_average[j])[i] = _counts[i] > 0 ? (*_average[j])[i] / static_cast<Real>(_counts[i]) : _empty_bin_value; } }
void GlobalStrainUserObject::finalize() { std::vector<Real> residual(9); std::vector<Real> jacobian(81); std::copy(&_residual(0, 0), &_residual(0, 0) + 9, residual.begin()); std::copy(&_jacobian(0, 0, 0, 0), &_jacobian(0, 0, 0, 0) + 81, jacobian.begin()); gatherSum(residual); gatherSum(jacobian); std::copy(residual.begin(), residual.end(), &_residual(0, 0)); std::copy(jacobian.begin(), jacobian.end(), &_jacobian(0, 0, 0, 0)); }
Real NodalSum::getValue() { gatherSum(_sum); return _sum; }
Real SideAverageValue::getValue() { Real integral = SideIntegralVariablePostprocessor::getValue(); gatherSum(_volume); return integral / _volume; }
Real ZoneElementAverageValue::getValue() { Real integral = ZoneElementIntegralPostprocessor::getValue(); gatherSum(_volume); return integral / _volume; }
Real ElementAverageValue::getValue() { Real integral = ElementIntegralVariablePostprocessor::getValue(); gatherSum(_volume); return integral / _volume; }
Real AverageElementSize::getValue() { Real integral = ElementIntegralPostprocessor::getValue(); gatherSum(_elems); return integral / _elems; }
void FauxGrainTracker::finalize() { Moose::perf_log.push("finalize()", "FauxGrainTracker"); _communicator.set_union(_variables_used); _communicator.set_union(_entity_id_to_var_num); if (_is_elemental) for (MooseIndex(_vars) var_num = 0; var_num < _n_vars; ++var_num) { /** * Convert elements of the maps into simple values or vector of Real. * libMesh's _communicator.sum() does not work on std::maps */ unsigned int vol_count; std::vector<Real> grain_data(4); const auto count = _vol_count.find(var_num); if (count != _vol_count.end()) vol_count = count->second; const auto vol = _volume.find(var_num); if (vol != _volume.end()) grain_data[0] = vol->second; const auto centroid = _centroid.find(var_num); if (centroid != _centroid.end()) { grain_data[1] = centroid->second(0); grain_data[2] = centroid->second(1); grain_data[3] = centroid->second(2); } // combine centers & volumes from all MPI ranks gatherSum(vol_count); gatherSum(grain_data); _volume[var_num] = grain_data[0]; _centroid[var_num] = {grain_data[1], grain_data[2], grain_data[3]}; _centroid[var_num] /= vol_count; } Moose::perf_log.pop("finalize()", "FauxGrainTracker"); }
Real InteractionIntegral::getValue() { gatherSum(_integral_value); if (_t_stress && !_treat_as_2d) _integral_value += _poissons_ratio * _crack_front_definition->getCrackFrontTangentialStrain(_crack_front_point_index); return _K_factor*_integral_value; }
void VolumeHistogram::finalize() { gatherSum(_volume_tmp); // copy into the MOOSE administered vector postprocessor vector _volume.resize(_nbins); mooseAssert(_volume_tmp.size() == _nbins, "Inconsistent volume vector lengths."); for (auto i = beginIndex(_volume_tmp); i < _volume_tmp.size(); ++i) _volume[i] = _volume_tmp[i]; }
Real CrackFrontData::getValue() { Real value = 0; if (_crack_front_node->processor_id() == processor_id()) value = _subproblem.getVariable(_tid, _var_name).getNodalValue(*_crack_front_node); gatherSum(value); return _scale_factor * value; }
void ComputeExternalGrainForceAndTorque::finalize() { gatherSum(_force_torque_store); for (unsigned int i = 0; i < _grain_num; ++i) { _force_values[i](0) = _force_torque_store[6*i+0]; _force_values[i](1) = _force_torque_store[6*i+1]; _force_values[i](2) = _force_torque_store[6*i+2]; _torque_values[i](0) = _force_torque_store[6*i+3]; _torque_values[i](1) = _force_torque_store[6*i+4]; _torque_values[i](2) = _force_torque_store[6*i+5]; } if (_fe_problem.currentlyComputingJacobian()) { gatherSum(_force_torque_c_jacobian_store); for (unsigned int i = 0; i < _op_num; ++i) gatherSum(_force_torque_eta_jacobian_store[i]); } }
Real NodalVariableValue::getValue() { Real value = 0; if (_node_ptr->processor_id() == processor_id()) value = _subproblem.getVariable(_tid, _var_name).getNodalValue(*_node_ptr); gatherSum(value); return _scale_factor * value; }
void LayeredSideAverage::finalize() { LayeredSideIntegral::finalize(); gatherSum(_layer_volumes); // Compute the average for each layer for (unsigned int i=0; i<_layer_volumes.size(); i++) if (layerHasValue(i)) setLayerValue(i, getLayerValue(i) / _layer_volumes[i]); }
void ComputeGrainCenterUserObject::finalize() { gatherSum(_grain_data); for (unsigned int i = 0; i < _ncrys; ++i) { _grain_volumes[i] = _grain_data[4*i+0]; _grain_centers[i](0) = _grain_data[4*i+1] / _grain_volumes[i]; _grain_centers[i](1) = _grain_data[4*i+2] / _grain_volumes[i]; _grain_centers[i](2) = _grain_data[4*i+3] / _grain_volumes[i]; } }
Real JIntegral::getValue() { gatherSum(_integral_value); if (_symmetry_plane) _integral_value *= 2.0; Real sign = (_integral_value > 0.0) ? 1.0 : ((_integral_value < 0.0) ? -1.0: 0.0); if (_convert_J_to_K) _integral_value = sign * std::sqrt(std::abs(_integral_value) * _youngs_modulus / (1 - std::pow(_poissons_ratio,2))); return _integral_value; }
void ComputeGrainForceAndTorque::finalize() { gatherSum(_force_torque_store); gatherSum(_force_torque_derivative_store); for (unsigned int i = 0; i < _ncrys; ++i) { _force_values[i](0) = _force_torque_store[6*i+0]; _force_values[i](1) = _force_torque_store[6*i+1]; _force_values[i](2) = _force_torque_store[6*i+2]; _torque_values[i](0) = _force_torque_store[6*i+3]; _torque_values[i](1) = _force_torque_store[6*i+4]; _torque_values[i](2) = _force_torque_store[6*i+5]; _force_derivatives[i](0) = _force_torque_derivative_store[6*i+0]; _force_derivatives[i](1) = _force_torque_derivative_store[6*i+1]; _force_derivatives[i](2) = _force_torque_derivative_store[6*i+2]; _torque_derivatives[i](0) = _force_torque_derivative_store[6*i+3]; _torque_derivatives[i](1) = _force_torque_derivative_store[6*i+4]; _torque_derivatives[i](2) = _force_torque_derivative_store[6*i+5]; } }
void BlockAverageValue::finalize() { // Loop over the integral values and sum them up over the processors for(std::map<SubdomainID, Real>::iterator it = _integral_values.begin(); it != _integral_values.end(); ++it) gatherSum(it->second); // Loop over the volumes and sum them up over the processors for(std::map<SubdomainID, Real>::iterator it = _volume_values.begin(); it != _volume_values.end(); ++it) gatherSum(it->second); // Now everyone has the correct data so everyone can compute the averages properly: for(std::map<SubdomainID, Real>::iterator it = _average_values.begin(); it != _average_values.end(); ++it) { SubdomainID id = it->first; _average_values[id] = _integral_values[id] / _volume_values[id]; } }
void DiscreteNucleationInserter::finalize() { // add the _local_nucleus_list of thread zero _global_nucleus_list.insert( _global_nucleus_list.end(), _local_nucleus_list.begin(), _local_nucleus_list.end()); /** * Pack the _global_nucleus_list into a simple vector of Real. * libMesh's allgather does not portably work on the original * _global_nucleus_list data structure! */ std::vector<Real> comm_buffer(_global_nucleus_list.size() * 4); for (unsigned i = 0; i < _global_nucleus_list.size(); ++i) { comm_buffer[i * 4 + 0] = _global_nucleus_list[i].first; comm_buffer[i * 4 + 1] = _global_nucleus_list[i].second(0); comm_buffer[i * 4 + 2] = _global_nucleus_list[i].second(1); comm_buffer[i * 4 + 3] = _global_nucleus_list[i].second(2); } // combine _global_nucleus_lists from all MPI ranks _communicator.allgather(comm_buffer); // unpack the gathered _global_nucleus_list unsigned int n = comm_buffer.size() / 4; mooseAssert(comm_buffer.size() % 4 == 0, "Communication buffer has an unexpected size (not divisible by 4)"); _global_nucleus_list.resize(n); for (unsigned i = 0; i < n; ++i) { _global_nucleus_list[i].first = comm_buffer[i * 4 + 0]; _global_nucleus_list[i].second(0) = comm_buffer[i * 4 + 1]; _global_nucleus_list[i].second(1) = comm_buffer[i * 4 + 2]; _global_nucleus_list[i].second(2) = comm_buffer[i * 4 + 3]; } // get the global number of changes (i.e. changes to _global_nucleus_list) gatherSum(_changes_made); }
Real ElementalVariableValue::getValue() { Real value = 0; if (_element && (_element->processor_id() == processor_id())) { _subproblem.prepare(_element, _tid); _subproblem.reinitElem(_element, _tid); MooseVariable & var = _subproblem.getVariable(_tid, _var_name); const VariableValue & u = var.sln(); unsigned int n = u.size(); for (unsigned int i = 0; i < n; i++) value += u[i]; value /= n; } gatherSum(value); return value; }
void PorousFlowSumQuantity::finalize() { gatherSum(_total); }
void InsideUserObject::finalize() { gatherSum(_value); _value = std::sqrt(_value); }
Real PointValue::getValue() { gatherSum(_value); return _value; }
void RichardsSumQuantity::finalize() { gatherSum(_total); }