26 "sdm_type",
"The spatial discretization type to be used");
29 "initial_value", 0.0,
"The initial value to assign to the field function");
34 "If supplied, will overwrite the default for the "
35 "specific discretization-coordinate system combination.");
39 "Coordinate system to apply to element mappings");
44 AllowableRangeList::New({
"FV",
"PWLC",
"PWLD",
"LagrangeC",
"LagrangeD"}));
47 AllowableRangeList::New({
"cartesian",
"cylindrical",
"spherical"}));
57 sdm_(MakeSpatialDiscretization(params)),
58 ghosted_field_vector_(MakeFieldVector(*sdm_, GetUnknownManager())),
59 local_grid_bounding_box_(
67 const std::string& text_name,
71 sdm_(discretization_ptr),
72 ghosted_field_vector_(MakeFieldVector(*sdm_, GetUnknownManager())),
73 local_grid_bounding_box_(sdm_->Grid().GetLocalBoundingBox())
79 const std::string& text_name,
82 const std::vector<double>& field_vector)
85 ghosted_field_vector_(MakeFieldVector(*sdm_, GetUnknownManager())),
86 local_grid_bounding_box_(sdm_->Grid().GetLocalBoundingBox())
90 "Constructor called with incompatible size field vector.");
102 ghosted_field_vector_(MakeFieldVector(*sdm_, GetUnknownManager())),
103 local_grid_bounding_box_(sdm_->Grid().GetLocalBoundingBox())
135 const auto sdm_type = params.
GetParamValue<std::string>(
"sdm_type");
143 if (sdm_type ==
"FV")
return FV::New(*grid_ptr);
147 std::string cs =
"cartesian";
148 if (user_params.Has(
"coordinate_system"))
153 if (cs ==
"cartesian") cs_type = CoordinateSystemType::CARTESIAN;
154 if (cs ==
"cylindrical") cs_type = CoordinateSystemType::CYLINDRICAL;
155 if (cs ==
"spherical") cs_type = CoordinateSystemType::SPHERICAL;
160 if (user_params.Has(
"quadrature_order"))
162 const uint32_t max_order =
164 const uint32_t q_order_int =
167 "Invalid quadrature point order " +
168 std::to_string(q_order_int));
178 if (sdm_type ==
"PWLC")
return PWLC::New(*grid_ptr, q_order, cs_type);
179 else if (sdm_type ==
"PWLD")
180 return PWLD::New(*grid_ptr, q_order, cs_type);
181 else if (sdm_type ==
"LagrangeC")
182 return LagC::New(*grid_ptr, q_order, cs_type);
183 else if (sdm_type ==
"LagrangeD")
184 return LagD::New(*grid_ptr, q_order, cs_type);
191std::unique_ptr<chi_math::GhostedParallelSTLVector>
196 auto field = std::make_unique<chi_math::GhostedParallelSTLVector>(
#define ChiInvalidArgumentIf(condition, message)
#define ChiInvalidArgument(message)
static chi::MPI_Info & mpi
const MPI_Comm & comm
MPI communicator.
T GetParamValue(const std::string ¶m_name) const
virtual std::vector< int64_t > GetGhostDOFIndices(const UnknownManager &unknown_manager) const =0
size_t GetNumGlobalDOFs(const UnknownManager &unknown_manager) const
size_t GetNumLocalDOFs(const UnknownManager &unknown_manager) const
chi_mesh::MeshContinuumPtr & GetGrid() const
static std::unique_ptr< chi_math::GhostedParallelSTLVector > MakeFieldVector(const chi_math::SpatialDiscretization &discretization, const chi_math::UnknownManager &uk_man)
const std::vector< double > & FieldVectorRead() const
FieldFunctionGridBased(const chi::InputParameters ¶ms)
static chi::InputParameters GetInputParameters()
const chi_math::SpatialDiscretization & GetSpatialDiscretization() const
std::unique_ptr< chi_math::GhostedParallelSTLVector > ghosted_field_vector_
std::vector< double > & FieldVector()
static chi_math::SDMPtr MakeSpatialDiscretization(const chi::InputParameters ¶ms)
static chi::InputParameters GetInputParameters()
std::shared_ptr< SpatialDiscretization > SDMPtr
MeshHandler & GetCurrentHandler()
RegisterChiObject(chi_physics, FieldFunctionGridBased)