19 std::vector<double>& diffCoeff,
20 std::vector<double>& sourceQ,
21 std::vector<double>& sigmaa,
33 <<
"Cell encountered with no material id. ";
40 <<
"Cell encountered with material id pointing to "
41 "non-existing material.";
45 auto property_map_D =
basic_options_(
"property_map_D").IntegerValue();
46 auto property_map_q =
basic_options_(
"property_map_q").IntegerValue();
47 auto property_map_sigma =
basic_options_(
"property_map_sigma").IntegerValue();
53 diffCoeff.resize(cell_dofs,1.0);
54 sourceQ.resize(cell_dofs,0.0);
55 sigmaa.resize(cell_dofs,0.0);
61 if ((property_map_D < 0) || (property_map_D >= material->properties_.size()))
64 <<
"Solver diffusion coefficient mapped to property index "
65 << property_map_D <<
" is not a valid index for material \""
66 << material->name_ <<
"\" id " << mat_id;
71 if (std::dynamic_pointer_cast<chi_physics::ScalarValue>
72 (material->properties_[property_map_D]))
74 diffCoeff.assign(cell_dofs,
75 material->properties_[property_map_D]->GetScalarValue());
80 <<
"Solver diffusion coefficient mapped to property index "
81 << property_map_D <<
" is not a valid property type"
83 << material->name_ <<
"\" id " << mat_id
84 <<
". Currently SCALAR_VALUE and THERMAL_CONDUCTIVITY are the "
85 <<
"only supported types.";
90 if ((property_map_q < material->properties_.size()) &&
91 (property_map_q >= 0))
93 if (std::dynamic_pointer_cast<chi_physics::ScalarValue>
94 (material->properties_[property_map_q]))
96 sourceQ.assign(cell_dofs,
97 material->properties_[property_map_q]->GetScalarValue());
102 <<
"Source value mapped to property index "
103 << property_map_q <<
" is not a valid property type"
104 <<
" for material \""
105 << material->name_ <<
"\" id " << mat_id
106 <<
". Currently SCALAR_VALUE is the "
107 <<
"only supported type.";
112 if (not ((property_map_sigma < 0) ||
113 (property_map_sigma >= material->properties_.size())))
115 sigmaa.assign(cell_dofs,
116 material->properties_[property_map_sigma]->GetScalarValue());
126 bool transportxs_found =
false;
127 for (
int p=0; p<material->properties_.size(); p++)
129 if (std::dynamic_pointer_cast<chi_physics::MultiGroupXS>
130 (material->properties_[p]))
132 auto xs = std::static_pointer_cast<
135 diffCoeff.assign(cell_dofs, xs->DiffusionCoefficient()[group]);
136 sigmaa.assign(cell_dofs, xs->SigmaRemoval()[group]);
137 transportxs_found =
true;
141 if (!transportxs_found)
144 <<
"Diffusion Solver: Material encountered with no tranport xs"
145 " yet material mode is DIFFUSION_MATERIALS_FROM_TRANSPORTXS.";
150 if ((property_map_q < material->properties_.size()) &&
151 (property_map_q >= 0))
153 if (std::dynamic_pointer_cast<chi_physics::ScalarValue>
154 (material->properties_[property_map_q]))
156 sourceQ.assign(cell_dofs,
157 material->properties_[property_map_q]->GetScalarValue());
162 <<
"Source value mapped to property index "
163 << property_map_q <<
" is not a valid property type"
164 <<
" for material \""
165 << material->name_ <<
"\" id " << mat_id
166 <<
". Currently SCALAR_VALUE is the "
167 <<
"only supported type.";
175 <<
"Diffusion Solver: Invalid material mode.";
188 auto& ff = *field_functions_.front();
189 const auto& OneDofPerNode = discretization_->UNITARY_UNKNOWN_MANAGER;
191 std::vector<double> data_vector;
192 discretization_->LocalizePETScVector(x_, data_vector, OneDofPerNode);
194 ff.UpdateFieldVector(data_vector);
static std::vector< chi_physics::MaterialPtr > material_stack
static void Exit(int error_code)
static std::shared_ptr< T > & GetStackItemPtr(std::vector< std::shared_ptr< T > > &stack, const size_t handle, const std::string &calling_function_name="Unknown")
static chi::MPI_Info & mpi
const int & location_id
Current process rank.
void UpdateFieldFunctions()
void GetMaterialProperties(const chi_mesh::Cell &cell, int cell_dofs, std::vector< double > &diffCoeff, std::vector< double > &sourceQ, std::vector< double > &sigmaa, int group=0, int moment=0)
BasicOptions basic_options_
#define DIFFUSION_MATERIALS_REGULAR
#define DIFFUSION_MATERIALS_FROM_TRANSPORTXS_TTR