https://mooseframework.inl.gov
MaterialPropertyInterface.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #ifdef MOOSE_KOKKOS_ENABLED
14 #endif
15 
16 // MOOSE includes
17 #include "MaterialProperty.h"
18 #include "MooseTypes.h"
19 #include "MaterialData.h"
20 #include "MathUtils.h"
21 #include "MooseObjectName.h"
22 #include "InputParameters.h"
23 
24 #include <unordered_map>
25 
26 #define usingMaterialPropertyInterfaceMembers \
27  using MaterialPropertyInterface::_material_data_type; \
28  using MaterialPropertyInterface::_material_data
29 
30 // Forward declarations
31 class MooseObject;
32 class FEProblemBase;
33 class SubProblem;
34 
43 template <class M>
45 {
46 public:
47  OptionalMaterialPropertyProxyBase(const std::string & name, const unsigned int state)
48  : _name(name), _state(state)
49  {
50  }
52  virtual void resolve(M & material) = 0;
53 
54 protected:
55  const std::string _name;
56  const unsigned int _state;
57 };
58 
70 {
71 public:
72  MaterialPropertyInterface(const MooseObject * moose_object,
73  const std::set<SubdomainID> & block_ids,
74  const std::set<BoundaryID> & boundary_ids);
75 
76 #ifdef MOOSE_KOKKOS_ENABLED
77 
81  const Moose::Kokkos::FunctorCopy & key);
82 #endif
83 
85 
91 
93 
102  template <typename T, bool is_ad>
104  const unsigned int state = 0)
105  {
106  return getGenericMaterialProperty<T, is_ad>(name, _material_data, state);
107  }
108  template <typename T>
109  const MaterialProperty<T> & getMaterialProperty(const std::string & name,
110  const unsigned int state = 0)
111  {
112  return getGenericMaterialProperty<T, false>(name, state);
113  }
114  template <typename T>
115  const ADMaterialProperty<T> & getADMaterialProperty(const std::string & name)
116  {
117  return getGenericMaterialProperty<T, true>(name, 0);
118  }
119  template <typename T>
120  const MaterialProperty<T> & getMaterialPropertyOld(const std::string & name)
121  {
122  return getMaterialProperty<T>(name, 1);
123  }
124  template <typename T>
125  const MaterialProperty<T> & getMaterialPropertyOlder(const std::string & name)
126  {
127  return getMaterialProperty<T>(name, 2);
128  }
130 
132 
139  template <typename T, bool is_ad>
141  getGenericMaterialPropertyByName(const MaterialPropertyName & name, const unsigned int state = 0)
142  {
143  return getGenericMaterialPropertyByName<T, is_ad>(name, _material_data, state);
144  }
145  template <typename T>
146  const MaterialProperty<T> & getMaterialPropertyByName(const MaterialPropertyName & name,
147  const unsigned int state = 0)
148  {
149  return getGenericMaterialPropertyByName<T, false>(name, state);
150  }
151  template <typename T>
152  const ADMaterialProperty<T> & getADMaterialPropertyByName(const MaterialPropertyName & name)
153  {
154  return getGenericMaterialPropertyByName<T, true>(name, 0);
155  }
156  template <typename T>
157  const MaterialProperty<T> & getMaterialPropertyOldByName(const MaterialPropertyName & name)
158  {
159  return getMaterialPropertyByName<T>(name, 1);
160  }
161  template <typename T>
162  const MaterialProperty<T> & getMaterialPropertyOlderByName(const MaterialPropertyName & name)
163  {
164  return getMaterialPropertyByName<T>(name, 2);
165  }
167 
168 #ifdef MOOSE_KOKKOS_SCOPE
169 
177  template <typename T, unsigned int dimension = 0, unsigned int state = 0>
179  getKokkosMaterialPropertyByName(const std::string & prop_name_in);
187  template <typename T, unsigned int dimension = 0>
189  getKokkosMaterialPropertyOldByName(const std::string & prop_name)
190  {
191  return getKokkosMaterialPropertyByName<T, dimension, 1>(prop_name);
192  }
200  template <typename T, unsigned int dimension = 0>
202  getKokkosMaterialPropertyOlderByName(const std::string & prop_name)
203  {
204  return getKokkosMaterialPropertyByName<T, dimension, 2>(prop_name);
205  }
214  template <typename T, unsigned int dimension = 0, unsigned int state = 0>
216  {
217  return getKokkosMaterialPropertyByName<T, dimension, state>(getMaterialPropertyName(name));
218  }
226  template <typename T, unsigned int dimension = 0>
228  getKokkosMaterialPropertyOld(const std::string & name)
229  {
230  return getKokkosMaterialPropertyByName<T, dimension, 1>(getMaterialPropertyName(name));
231  }
239  template <typename T, unsigned int dimension = 0>
241  getKokkosMaterialPropertyOlder(const std::string & name)
242  {
243  return getKokkosMaterialPropertyByName<T, dimension, 2>(getMaterialPropertyName(name));
244  }
245 #endif
246 
249  template <typename T, bool is_ad>
251  getGenericOptionalMaterialProperty(const std::string & name, const unsigned int state = 0);
252 
253  template <typename T>
255  const unsigned int state = 0)
256  {
257  return getGenericOptionalMaterialProperty<T, false>(name, state);
258  }
259  template <typename T>
261  {
262  return getGenericOptionalMaterialProperty<T, true>(name);
263  }
264 
265  template <typename T>
267  {
268  return getOptionalMaterialProperty<T>(name, 1);
269  }
270  template <typename T>
272  {
273  return getOptionalMaterialProperty<T>(name, 2);
274  }
276 
287  template <typename T>
288  std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>
289  getBlockMaterialProperty(const MaterialPropertyName & name);
290 
295  template <typename T, bool is_ad>
297  getGenericZeroMaterialProperty(const std::string & name);
298  template <typename T, bool is_ad>
300  getGenericZeroMaterialPropertyByName(const std::string & prop_name);
301 
305  template <typename T, bool is_ad>
307 
309  template <typename T, typename... Ts>
311  {
312  return getGenericZeroMaterialProperty<T, false>(args...);
313  }
314 
320  std::set<SubdomainID> getMaterialPropertyBlocks(const std::string & name);
321 
327  std::vector<SubdomainName> getMaterialPropertyBlockNames(const std::string & name);
328 
334  std::set<BoundaryID> getMaterialPropertyBoundaryIDs(const std::string & name);
335 
341  std::vector<BoundaryName> getMaterialPropertyBoundaryNames(const std::string & name);
342 
347  void checkBlockAndBoundaryCompatibility(std::shared_ptr<MaterialBase> discrete);
348 
350 
358  MaterialBase & getMaterial(const std::string & name);
359  MaterialBase & getMaterialByName(const std::string & name, bool no_warn = false);
361 
363  std::unordered_map<SubdomainID, std::vector<MaterialBase *>>
364  buildRequiredMaterials(bool allow_stateful = true);
365 
367 
372  template <typename T>
373  bool hasMaterialProperty(const std::string & name);
374  template <typename T>
375  bool hasMaterialPropertyByName(const std::string & name);
376  template <typename T>
377  bool hasADMaterialProperty(const std::string & name);
378  template <typename T>
379  bool hasADMaterialPropertyByName(const std::string & name);
380 #ifdef MOOSE_KOKKOS_SCOPE
381  template <typename T, unsigned int dimension = 0>
382  bool hasKokkosMaterialProperty(const std::string & name);
383  template <typename T, unsigned int dimension = 0>
384  bool hasKokkosMaterialPropertyByName(const std::string & name);
385 #endif
386 
389  template <typename T, bool is_ad>
390  bool hasGenericMaterialProperty(const std::string & name)
391  {
392  if constexpr (is_ad)
393  return hasADMaterialProperty<T>(name);
394  else
395  return hasMaterialProperty<T>(name);
396  }
397  template <typename T, bool is_ad>
398  bool hasGenericMaterialPropertyByName(const std::string & name)
399  {
400  if constexpr (is_ad)
401  return hasADMaterialPropertyByName<T>(name);
402  else
403  return hasMaterialPropertyByName<T>(name);
404  }
406 
412  void statefulPropertiesAllowed(bool);
413 
418 
425  virtual const std::unordered_set<unsigned int> & getMatPropDependencies() const
426  {
428  }
429 
431  virtual void resolveOptionalProperties();
432 
436  template <typename T, bool is_ad>
438  const std::string & name, MaterialData & material_data, const unsigned int state = 0);
439 
445  template <typename T>
446  const MaterialProperty<T> & getMaterialProperty(const std::string & name,
447  MaterialData & material_data,
448  const unsigned int state = 0)
449  {
450  return getGenericMaterialProperty<T, false>(name, material_data, state);
451  }
452 
458  template <typename T>
459  const ADMaterialProperty<T> & getADMaterialProperty(const std::string & name,
460  MaterialData & material_data)
461  {
462  return getGenericMaterialProperty<T, true>(name, material_data, 0);
463  }
464 
469  template <typename T, bool is_ad>
471  const MaterialPropertyName & name, MaterialData & material_data, const unsigned int state);
472 
478  template <typename T, bool is_ad>
480  getPossiblyConstantGenericMaterialPropertyByName(const MaterialPropertyName & prop_name,
481  MaterialData & material_data,
482  const unsigned int state);
483 
489  template <typename T>
490  const MaterialProperty<T> & getMaterialPropertyByName(const MaterialPropertyName & name,
491  MaterialData & material_data,
492  const unsigned int state = 0)
493  {
494  return getGenericMaterialPropertyByName<T, false>(name, material_data, state);
495  }
496 
501  template <typename T>
502  const ADMaterialProperty<T> & getADMaterialPropertyByName(const MaterialPropertyName & name,
503  MaterialData & material_data)
504  {
505  return getGenericMaterialPropertyByName<T, true>(name, material_data, 0);
506  }
507 
511  template <typename T>
512  const MaterialProperty<T> & getMaterialPropertyOld(const std::string & name,
513  MaterialData & material_data)
514  {
515  return getMaterialProperty<T>(name, material_data, 1);
516  }
517 
522  template <typename T>
523  const MaterialProperty<T> & getMaterialPropertyOlder(const std::string & name,
524  MaterialData & material_data)
525  {
526  return getMaterialProperty<T>(name, material_data, 2);
527  }
528 
533  template <typename T>
534  const MaterialProperty<T> & getMaterialPropertyOldByName(const MaterialPropertyName & name,
535  MaterialData & material_data)
536  {
537  return getMaterialPropertyByName<T>(name, material_data, 1);
538  }
539 
544  template <typename T>
545  const MaterialProperty<T> & getMaterialPropertyOlderByName(const MaterialPropertyName & name,
546  MaterialData & material_data)
547  {
548  return getMaterialPropertyByName<T>(name, material_data, 2);
549  }
550 
551 private:
554 
555 protected:
558 
560  const std::string _mi_name;
561 
564 
567 
570 
573 
575  const bool _is_kokkos_object;
576 
579 
582 
588  virtual void checkMaterialProperty(const std::string & name, const unsigned int state);
589 
590 #ifdef MOOSE_KOKKOS_ENABLED
591 
597  virtual void getKokkosMaterialPropertyHook(const std::string & /* prop_name_in */,
598  const unsigned int /* state */)
599  {
600  }
601 #endif
602 
606  void markMatPropRequested(const std::string &);
607 
615  MaterialPropertyName getMaterialPropertyName(const std::string & name) const;
616 
624  template <typename T, bool is_ad>
627  defaultGenericMaterialProperty(const std::string & name);
628  template <typename T>
629  const MaterialProperty<T> * defaultMaterialProperty(const std::string & name)
630  {
631  return defaultGenericMaterialProperty<T, false>(name);
632  }
633  template <typename T>
634  const ADMaterialProperty<T> * defaultADMaterialProperty(const std::string & name)
635  {
636  return defaultGenericMaterialProperty<T, true>(name);
637  }
639 
643  void checkExecutionStage();
644 
650 
657 
659  std::vector<std::unique_ptr<PropertyValue>> _default_properties;
660 
662  std::unordered_set<unsigned int> _material_property_dependencies;
663 
664  const MaterialPropertyName _get_suffix;
665 
668 
670  static const std::string _interpolated_old;
671  static const std::string _interpolated_older;
673 
674 private:
678  Moose::MaterialDataType getMaterialDataType(const std::set<BoundaryID> & boundary_ids) const;
679 
680  /*
681  * A proxy method for _mi_feproblem.getMaxQps()
682  */
683  unsigned int getMaxQps() const;
684 
685  /*
686  * A proxy method for _mi_feproblem.addConsumedPropertyName()
687  */
688  void addConsumedPropertyName(const MooseObjectName & obj_name, const std::string & prop_name);
689 
692 
694  const std::set<SubdomainID> & _mi_block_ids;
695 
697  const std::set<BoundaryID> & _mi_boundary_ids;
698 
700  std::vector<std::unique_ptr<OptionalMaterialPropertyProxyBase<MaterialPropertyInterface>>>
702 };
703 
704 template <class M, typename T, bool is_ad>
706 {
707 public:
708  OptionalMaterialPropertyProxy(const std::string & name, const unsigned int state)
710  {
711  }
713  void resolve(M & mpi) override
714  {
715  if (mpi.template hasGenericMaterialProperty<T, is_ad>(this->_name))
716  {
717  if constexpr (is_ad)
718  if (this->_state > 0)
719  mooseError("Non-current (state > 0) material properties are not available as AD");
720 
721  _value.set(&mpi.template getGenericMaterialProperty<T, is_ad>(this->_name, this->_state));
722  }
723  }
724 
725 private:
727 };
728 
729 template <typename T, bool is_ad>
732 {
733  if constexpr (std::is_same_v<T, Real> || std::is_same_v<T, RealVectorValue>)
734  {
735  std::istringstream ss(name);
736  Real real_value;
737 
738  // check if the string parsed cleanly into a Real number
739  if (ss >> real_value && ss.eof())
740  {
741  using prop_type = GenericMaterialProperty<T, is_ad>;
742 
743  const auto nqp = Moose::constMaxQpsPerElem;
744  auto & property =
745  _default_properties.emplace_back(std::make_unique<prop_type>(default_property_id));
746  auto & T_property = static_cast<prop_type &>(*property);
747 
748  T_property.resize(nqp);
749  for (const auto qp : make_range(nqp))
750  T_property[qp] = real_value;
751 
752  return &T_property;
753  }
754  }
755 
756  return nullptr;
757 }
758 
759 template <typename T>
760 std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>
761 MaterialPropertyInterface::getBlockMaterialProperty(const MaterialPropertyName & name_in)
762 {
763  const auto name = _get_suffix.empty()
764  ? static_cast<const std::string &>(name_in)
765  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
766 
767  if (_mi_block_ids.empty())
768  mooseError("getBlockMaterialProperty must be called by a block restrictable object");
769 
770  using pair_type = std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>;
771 
772  if (!hasMaterialPropertyByName<T>(name))
773  return pair_type(nullptr, {});
774 
775  // Call first so that the ID gets registered
776  const auto & prop = _material_data.getProperty<T, false>(name, 0, _mi_moose_object);
778  auto prop_blocks_pair = pair_type(&prop, std::move(blocks));
779 
781 
782  // Update consumed properties in MaterialPropertyDebugOutput
784 
785  return prop_blocks_pair;
786 }
787 
788 template <typename T>
789 bool
791 {
792  // Check if the supplied parameter is a valid input parameter key
793  const auto prop_name = getMaterialPropertyName(name);
794  return hasMaterialPropertyByName<T>(prop_name);
795 }
796 
797 template <typename T>
798 bool
800 {
801  const auto name = _get_suffix.empty()
802  ? name_in
803  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
804  return _material_data.haveProperty<T>(name);
805 }
806 
807 template <typename T, bool is_ad>
810 {
811  const auto prop_name = getMaterialPropertyName(name);
812  return getGenericZeroMaterialPropertyByName<T, is_ad>(prop_name);
813 }
814 
815 template <typename T, bool is_ad>
818 {
819  // if found return the requested property
820  if (hasGenericMaterialPropertyByName<T, is_ad>(prop_name))
821  return getGenericMaterialPropertyByName<T, is_ad>(prop_name);
822 
823  return getGenericZeroMaterialProperty<T, is_ad>();
824 }
825 
826 template <typename T, bool is_ad>
829 {
830  // static zero property storage
832 
833  // resize to accomodate maximum number of qpoints
834  // (in multiapp scenarios getMaxQps can return different values in each app; we need the max)
835  unsigned int nqp = getMaxQps();
836  if (nqp > zero.size())
837  zero.resize(nqp);
838 
839  // set values for all qpoints to zero
840  for (unsigned int qp = 0; qp < nqp; ++qp)
842 
843  return zero;
844 }
845 
846 template <typename T>
847 bool
849 {
850  // Check if the supplied parameter is a valid input parameter key
851  const auto prop_name = getMaterialPropertyName(name);
852  return hasADMaterialPropertyByName<T>(prop_name);
853 }
854 
855 template <typename T>
856 bool
858 {
859  const auto name = _get_suffix.empty()
860  ? name_in
861  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
863 }
864 
865 template <typename T, bool is_ad>
868  const unsigned int state)
869 {
870  auto proxy = std::make_unique<OptionalMaterialPropertyProxy<MaterialPropertyInterface, T, is_ad>>(
871  name, state);
872  auto & optional_property = proxy->value();
873  _optional_property_proxies.push_back(std::move(proxy));
874  return optional_property;
875 }
876 
877 template <typename T, bool is_ad>
880  const MaterialPropertyName & prop_name, MaterialData & material_data, const unsigned int state)
881 {
882  // Check if it's just a constant
883  if (const auto * default_property = defaultGenericMaterialProperty<T, is_ad>(prop_name))
884  {
886  return *default_property;
887  }
888 
889  if (state > 0 && !_stateful_allowed)
890  mooseError("Stateful material properties not allowed for this object."
891  " State ",
892  state,
893  " property for \"",
894  prop_name,
895  "\" was requested.");
896 
897  return this->getGenericMaterialPropertyByName<T, is_ad>(prop_name, material_data, state);
898 }
899 
900 template <typename T, bool is_ad>
903  MaterialData & material_data,
904  const unsigned int state)
905 {
906  // Check if the supplied parameter is a valid input parameter key
907  const auto prop_name = getMaterialPropertyName(name);
908 
909  return getPossiblyConstantGenericMaterialPropertyByName<T, is_ad>(
910  prop_name, material_data, state);
911 }
912 
913 template <typename T, bool is_ad>
916  MaterialData & material_data,
917  const unsigned int state)
918 {
919  if (_is_kokkos_object)
920  mooseError("Attempted to retrieve a standard MOOSE material property from a Kokkos object.");
921 
923  {
924  if (state == 1)
925  return getGenericMaterialPropertyByName<T, is_ad>(
926  name_in + _interpolated_old, material_data, 0);
927  if (state == 2)
928  return getGenericMaterialPropertyByName<T, is_ad>(
929  name_in + _interpolated_older, material_data, 0);
930  }
931 
932  const auto name = _get_suffix.empty()
933  ? static_cast<const std::string &>(name_in)
934  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
935 
937  checkMaterialProperty(name, state);
938 
939  // mark property as requested
941 
942  // Update the boolean flag.
944 
945  // Call first so that the ID gets registered
946  auto & prop = material_data.getProperty<T, is_ad>(name, state, _mi_moose_object);
947 
948  // Does the material data used here matter?
949  _material_property_dependencies.insert(material_data.getPropertyId(name));
950 
951  if (state == 0)
953 
954  return prop;
955 }
956 
957 #ifdef MOOSE_KOKKOS_SCOPE
958 template <typename T, unsigned int dimension>
959 bool
961 {
962  // Check if the supplied parameter is a valid input parameter key
963  const auto prop_name = getMaterialPropertyName(name);
964  return hasKokkosMaterialPropertyByName<T, dimension>(prop_name);
965 }
966 
967 template <typename T, unsigned int dimension>
968 bool
970 {
971  const auto name = _get_suffix.empty()
972  ? name_in
973  : MooseUtils::join(std::vector<std::string>({name_in, _get_suffix}), "_");
974  return _material_data.haveKokkosProperty<T, dimension>(name);
975 }
976 
977 template <typename T, unsigned int dimension, unsigned int state>
980 {
981  if (!_is_kokkos_object)
982  mooseError("Attempted to retrieve a Kokkos material property from a standard MOOSE object.");
983 
984  if constexpr (std::is_same_v<T, Real>)
985  {
986  std::istringstream ss(prop_name_in);
987  Real value;
988 
989  // Check if the string parsed cleanly into a Real number
990  if (ss >> value && ss.eof())
992  }
993 
994  const auto prop_name =
995  _get_suffix.empty()
996  ? static_cast<const std::string &>(prop_name_in)
997  : MooseUtils::join(std::vector<std::string>({prop_name_in, _get_suffix}), "_");
998 
1000  checkMaterialProperty(prop_name, state);
1001 
1002  // Mark property as requested
1003  markMatPropRequested(prop_name);
1004 
1005  // Update the boolean flag
1007 
1008  // Call first so that the ID gets registered
1009  auto prop = _material_data.getKokkosProperty<T, dimension, state>(prop_name);
1010 
1011  // Does the material data used here matter?
1013 
1014  if constexpr (state == 0)
1016 
1017  getKokkosMaterialPropertyHook(prop_name_in, state);
1018 
1019  return prop;
1020 }
1021 #endif
virtual const std::unordered_set< unsigned int > & getMatPropDependencies() const
Retrieve the set of material properties that this object depends on.
std::string name(const ElemQuality q)
FEProblemBase & _mi_feproblem
Reference to the FEProblemBase class.
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosProperty(const std::string &prop_name)
Get a Kokkos material property.
Definition: MaterialData.h:455
const THREAD_ID _mi_tid
Current threaded it.
const OptionalMaterialProperty< T > & getOptionalMaterialProperty(const std::string &name, const unsigned int state=0)
const MaterialProperty< T > * defaultMaterialProperty(const std::string &name)
virtual void resolveOptionalProperties()
resolve all optional properties
static const std::string _interpolated_old
name suffixes for interpolated old and older properties
std::string join(Iterator begin, Iterator end, const std::string &delimiter)
Python-like join function for strings over an iterator range.
Definition: MooseUtils.h:144
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOlderByName(const std::string &prop_name)
Get an older Kokkos material property by property name.
virtual void checkMaterialProperty(const std::string &name, const unsigned int state)
A helper method for checking material properties This method was required to avoid a compiler problem...
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition: MathUtils.h:372
const MooseObjectName _mi_moose_object_name
The "complete" name of the object that this interface belongs for material property output...
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyByName(const std::string &prop_name_in)
Get a Kokkos material property by property name for any state.
static constexpr PropertyValue::id_type default_property_id
The material property ID for a default (parsed from input) property.
const bool _is_kokkos_object
Whether the MOOSE object is a Kokkos object.
const std::set< SubdomainID > & _mi_block_ids
Storage for the block ids created by BlockRestrictable.
std::vector< BoundaryName > getMaterialPropertyBoundaryNames(const std::string &name)
Retrieve the boundary namess that the material property is defined.
bool haveProperty(const std::string &prop_name) const
Returns true if the regular material property exists - defined by any material.
Definition: MaterialData.h:93
virtual bool getMaterialPropertyCalled() const
Returns true if getMaterialProperty() has been called, false otherwise.
bool hasKokkosMaterialPropertyByName(const std::string &name)
const ADMaterialProperty< T > & getADMaterialProperty(const std::string &name)
char ** blocks
bool hasMaterialPropertyByName(const std::string &name)
MaterialPropertyInterface(const MooseObject *moose_object, const std::set< SubdomainID > &block_ids, const std::set< BoundaryID > &boundary_ids)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName(const std::string &prop_name)
const MaterialProperty< T > & getMaterialPropertyOlderByName(const MaterialPropertyName &name)
constexpr std::size_t constMaxQpsPerElem
This is used for places where we initialize some qp-sized data structures that would end up being siz...
Definition: MooseTypes.h:230
const MaterialProperty< T > & getMaterialPropertyByName(const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
Retrieve the property named "name" without any deduction for the specified material_data.
static const std::string _interpolated_older
bool hasGenericMaterialPropertyByName(const std::string &name)
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty(const MaterialPropertyName &name)
Retrieve pointer to a material property with the mesh blocks where it is defined The name required by...
MaterialDataType
MaterialData types.
Definition: MooseTypes.h:692
std::vector< SubdomainName > getMaterialPropertyBlockNames(const std::string &name)
Retrieve the block names that the material property is defined.
std::vector< std::unique_ptr< PropertyValue > > _default_properties
Storage vector for default properties.
unsigned int getPropertyId(const std::string &prop_name) const
Wrapper for MaterialStorage::getPropertyId.
Definition: MaterialData.C:80
const MaterialProperty< T > & getMaterialPropertyOld(const std::string &name, MaterialData &material_data)
Retrieve the old property deduced from the name name for the specified material_data.
const bool _mi_boundary_restricted
BoundaryRestricted flag.
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty(const std::string &name, const unsigned int state=0)
Retrieve reference to material property or one of it&#39;s old or older values.
std::set< BoundaryID > getMaterialPropertyBoundaryIDs(const std::string &name)
Retrieve the boundary ids that the material property is defined.
unsigned int id_type
The type for a material property ID.
const MaterialProperty< T > & getMaterialPropertyOldByName(const MaterialPropertyName &name)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
SubProblem & _mi_subproblem
Reference to the subproblem.
const std::set< BoundaryID > & _mi_boundary_ids
Storage for the boundary ids created by BoundaryRestrictable.
const std::string _mi_name
The name of the object that this interface belongs to.
const Number zero
const MaterialProperty< T > & getMaterialPropertyOldByName(const MaterialPropertyName &name, MaterialData &material_data)
Retrieve the old property named name without any deduction for the specified material_data.
const ADMaterialProperty< T > & getADMaterialProperty(const std::string &name, MaterialData &material_data)
Retrieve the AD property named "name" for the specified material_data.
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOld(const std::string &name)
Get an old Kokkos material property.
MaterialPropertyName getMaterialPropertyName(const std::string &name) const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const MaterialProperty< T > & getMaterialPropertyOld(const std::string &name)
void markMatPropRequested(const std::string &)
A proxy method for _mi_feproblem.markMatPropRequested(name)
Helper class for deferred getting of material properties after the construction phase for materials...
MaterialData & _material_data
The material data class that stores properties.
bool hasADMaterialPropertyByName(const std::string &name)
const GenericOptionalMaterialProperty< T, is_ad > & value() const
std::set< SubdomainID > getMaterialPropertyBlocks(const std::string &name)
Retrieve the block ids that the material property is defined.
const MaterialProperty< T > & getMaterialPropertyOlder(const std::string &name)
virtual void resolve(M &material)=0
Wrapper around a material property pointer.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
Moose::MaterialDataType getMaterialDataType(const std::set< BoundaryID > &boundary_ids) const
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty(const std::string &name, const unsigned int state=0)
const ADMaterialProperty< T > & getADMaterialPropertyByName(const MaterialPropertyName &name)
const MaterialProperty< T > & getMaterialPropertyOlderByName(const MaterialPropertyName &name, MaterialData &material_data)
Retrieve the older property named name without any deduction for the specified material_data.
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
const MaterialProperty< T > & getMaterialPropertyOlder(const std::string &name, MaterialData &material_data)
Retrieve the older property deduced from the name name for the specified material_data.
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName(const MaterialPropertyName &name, const unsigned int state=0)
Retrieve reference to material property or its old or older value The name required by this method is...
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOldByName(const std::string &prop_name)
Get an old Kokkos material property by property name.
const MaterialPropertyName _get_suffix
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty()
Return a constant zero anonymous material property.
const MaterialProperty< T > & getZeroMaterialProperty(Ts... args)
for backwards compatibility
const InputParameters & _mi_params
Parameters of the object with this interface.
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder(const std::string &name)
const ADMaterialProperty< T > & getADMaterialPropertyByName(const MaterialPropertyName &name, MaterialData &material_data)
Retrieve the AD property named "name" without any deduction for the specified material_data.
bool hasKokkosMaterialProperty(const std::string &name)
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty(const std::string &name)
bool hasMaterialProperty(const std::string &name)
Check if the material property exists.
static constexpr PropertyValue::id_type zero_property_id
The material property ID for a zero property.
MaterialBase & getMaterialByName(const std::string &name, bool no_warn=false)
void statefulPropertiesAllowed(bool)
Derived classes can declare whether or not they work with stateful material properties.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool haveADProperty(const std::string &prop_name) const
Returns true if the AD material property exists - defined by any material.
Definition: MaterialData.h:100
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty(const std::string &name)
An interface for accessing Materials.
const MaterialProperty< T > & getMaterialProperty(const std::string &name, MaterialData &material_data, const unsigned int state=0)
Retrieve the property named "name" for the specified material_data.
GenericMaterialProperty< T, is_ad > & getProperty(const std::string &prop_name, const unsigned int state, const MooseObject &requestor)
Retrieves a material property.
Definition: MaterialData.h:127
bool haveKokkosProperty(const std::string &prop_name) const
Get whether a Kokkos material property exists.
Definition: MaterialData.h:444
IntRange< T > make_range(T beg, T end)
const bool _use_interpolated_state
Use the interpolated state set up through the ProjectedStatefulMaterialStorageAction.
void addConsumedPropertyName(const MooseObjectName &obj_name, const std::string &prop_name)
GenericOptionalMaterialProperty< T, is_ad > _value
static constexpr id_type invalid_property_id
The material property ID for an invalid property We only have this because there are a few cases wher...
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOlder(const std::string &name)
Get an older Kokkos material property.
Proxy for accessing MaterialPropertyStorage.
Definition: MaterialData.h:37
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName(const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
Retrieve the generic property named "prop_name" without any deduction for the specified material_data...
std::vector< std::unique_ptr< OptionalMaterialPropertyProxyBase< MaterialPropertyInterface > > > _optional_property_proxies
optional material properties
void checkBlockAndBoundaryCompatibility(std::shared_ptr< MaterialBase > discrete)
Check if block and boundary restrictions of a given material are compatible with the current material...
bool _get_material_property_called
Initialized to false.
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialProperty(const std::string &name)
Get a Kokkos material property for any state.
OptionalMaterialPropertyProxyBase(const std::string &name, const unsigned int state)
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
const Moose::MaterialDataType _material_data_type
The type of data.
bool _stateful_allowed
True by default.
The Kokkos material property class.
A class for storing the names of MooseObject by tag and object name.
MaterialBase & getMaterial(const std::string &name)
Return a MaterialBase reference - usable for computing directly.
const MooseObject & _mi_moose_object
The MooseObject creating the MaterialPropertyInterface.
const ADMaterialProperty< T > * defaultADMaterialProperty(const std::string &name)
const MaterialProperty< T > & getMaterialPropertyByName(const MaterialPropertyName &name, const unsigned int state=0)
bool hasGenericMaterialProperty(const std::string &name)
generic hasMaterialProperty helper
MaterialBases compute MaterialProperties.
Definition: MaterialBase.h:62
bool hasADMaterialProperty(const std::string &name)
std::unordered_set< unsigned int > _material_property_dependencies
The set of material properties (as given by their IDs) that this object depends on.
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld(const std::string &name)
const MaterialProperty< T > & getMaterialProperty(const std::string &name, const unsigned int state=0)
unsigned int THREAD_ID
Definition: MooseTypes.h:209
std::unordered_map< SubdomainID, std::vector< MaterialBase * > > buildRequiredMaterials(bool allow_stateful=true)
get a map of MaterialBase pointers for all material objects that this object depends on for each bloc...
OptionalMaterialPropertyProxy(const std::string &name, const unsigned int state)
virtual void getKokkosMaterialPropertyHook(const std::string &, const unsigned int)
A virtual method that can be overriden by Kokkos objects to insert additional operations in getKokkos...