13#include "nlohmann/json.h"
72 const unsigned int total_it)
override;
77 const Real reference_residual)
override;
108 const unsigned int partition,
109 const unsigned out_index,
110 const bool derivative =
false);
118 bool checkInTile(
const unsigned int p,
const unsigned int t)
const;
129 const unsigned int t,
130 const unsigned int tt,
131 const unsigned int in_index);
145 const Real transform_coef,
146 const std::vector<Real> & transformed_limits,
147 const bool derivative =
false);
161 const bool derivative =
false);
173 const std::vector<Real> & coefs,
195 const bool derivative =
false);
209 const std::vector<Real> & old_input_values,
211 const unsigned out_index,
213 const bool derivative =
false);
223 const unsigned int degree,
224 const bool derivative =
false);
237 const bool derivative =
false);
249 const unsigned int in_index,
250 const bool derivative =
false);
261 mooseError(
"Internal error: If number of partitions is not one, then computePartitionWeights "
264 dweights_dstress[0] = 0.0;
274 template <
typename T>
278 const bool derivative =
false)
280 using std::exp, std::log;
284 mooseAssert(coef != 0,
"Coefficient must not be zero.");
286 x = exp(
x / coef) / coef;
292 mooseAssert(
x + coef > 0,
"Sum must be greater than 0.");
294 x = 1.0 / (
x + coef);
300 mooseAssert(coef == 0.0,
"Coefficient cannot be supplied with linear transformation");
331 std::vector<std::vector<std::vector<std::vector<Real>>>>
333 const std::vector<std::vector<std::vector<Real>>> limits);
351 virtual std::vector<std::vector<std::vector<std::vector<ROMInputTransform>>>>
getTransform()
354 return _json[
"transform"]
355 .template get<std::vector<std::vector<std::vector<std::vector<ROMInputTransform>>>>>();
377 return _json[
"transform_coefs"]
378 .template get<std::vector<std::vector<std::vector<std::vector<Real>>>>>();
395 if (
_json.contains(
"normalization_limits"))
396 return _json[
"normalization_limits"]
397 .template get<std::vector<std::vector<std::vector<std::vector<Real>>>>>();
413 virtual std::vector<std::vector<std::vector<std::vector<Real>>>>
getInputLimits()
416 return _json[
"input_limits"]
417 .template get<std::vector<std::vector<std::vector<std::vector<Real>>>>>();
425 virtual std::vector<std::vector<std::vector<std::vector<Real>>>>
getCoefs()
428 return _json[
"coefs"].template get<std::vector<std::vector<std::vector<std::vector<Real>>>>>();
438 if (
_json.contains(
"tiling"))
439 return _json[
"tiling"].template get<std::vector<std::vector<unsigned int>>>();
442 return {{1, 1, 1, 1, 1, 1}};
443 return {{1, 1, 1, 1, 1}};
454 return _json[
"cutoff"].template get<std::vector<Real>>();
552 std::vector<std::vector<std::vector<std::vector<ROMInputTransform>>>>
_transform;
564 std::vector<std::vector<std::vector<std::vector<Real>>>>
_coefs;
567 std::vector<std::vector<std::vector<std::vector<std::vector<Real>>>>>
598 std::vector<std::vector<std::vector<GenericReal<is_ad>>>>
_rom_inputs;
613 std::vector<std::vector<GenericReal<is_ad>>>
_weights;
622 std::vector<std::vector<unsigned int>>
_tiling;
const std::vector< double > x
LAROMANCEStressUpdateBaseTempl< true > ADLAROMANCEStressUpdateBase
LAROMANCEStressUpdateBaseTempl< false > LAROMANCEStressUpdateBase
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
Moose::GenericType< VariableValue, is_ad > GenericVariableValue
Moose::GenericType< RankFourTensor, is_ad > GenericRankFourTensor
Moose::GenericType< Real, is_ad > GenericReal
Moose::GenericType< RankTwoTensor, is_ad > GenericRankTwoTensor
const GenericVariableValue< is_ad > & coupledGenericValue(const std::string &var_name, unsigned int comp=0) const
virtual std::vector< std::vector< std::vector< std::vector< Real > > > > getInputLimits()
virtual std::vector< std::vector< std::vector< std::vector< Real > > > > getNormalizationLimits()
Real _stress_ucf
Unit conversion factors required to convert from the specified unit to MPa.
const MaterialProperty< Real > & _cell_dislocations_old
virtual std::vector< Real > getStrainCutoff()
std::vector< std::vector< std::vector< std::vector< Real > > > > _normalization_limits
Normalization limits defined by the ROM data set for each partition.
GenericMaterialProperty< Real, is_ad > & _cell_dislocations
Material properties for cell (glissile) dislocation densities (1/m^2)
void checkJSONKey(const std::string &key)
check if a JSON file was loaded and if the specified key exists
GenericMaterialProperty< Real, is_ad > & _wall_rate
Wall dislocations rate of change.
void computeTileWeight(std::vector< std::vector< GenericReal< is_ad > > > &weights, GenericReal< is_ad > &input, const unsigned int in_index, const bool derivative=false)
Compute the contribution (weight) of each tile in each partition, based on the input and tile boundar...
const unsigned int _cell_output_index
Index corresponding to the position for cell dislocations increment in the output vector.
virtual GenericReal< is_ad > maximumPermissibleValue(const GenericReal< is_ad > &effective_trial_stress) const override
Compute the maximum permissible value of the scalar.
virtual void exportJSON()
std::vector< std::vector< std::vector< std::vector< Real > > > > getTransformedLimits(const unsigned int p, const std::vector< std::vector< std::vector< Real > > > limits)
virtual void outputIterationStep(std::stringstream *iter_output, const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar, const Real reference_residual) override
Output information for a single iteration step to build the convergence history of the model.
virtual std::vector< std::vector< std::vector< std::vector< ROMInputTransform > > > > getTransform()
usingTransientInterfaceMembers
GenericMaterialProperty< Real, is_ad > & _cell_dislocations_step
virtual Real computeTimeStepLimit() override
Compute the limiting value of the time step for this material.
std::vector< unsigned int > _degree
Legendre polynomial degree for the ROM data set for each partition.
void buildPolynomials(const unsigned int p, const GenericReal< is_ad > &rom_input, std::vector< GenericReal< is_ad > > &polynomial_inputs, const GenericReal< is_ad > &drom_input=0, const bool derivative=false)
Assemble the array of Legendre polynomials to be multiplied by the ROM coefficients.
std::vector< std::string > _index_name
index names for error output
const Function *const _wall_function
Optional wall dislocation forcing function.
std::vector< Real > _cutoff
Container for strain cutoff.
virtual void resetIncrementalMaterialProperties() override
Reset material properties.
virtual void initialSetup() override
MaterialProperty< Real > & _number_of_substeps
Material property capturing number of substeps for output purposes (defaults to one if substepping is...
virtual void storeIncrementalMaterialProperties(const unsigned int total_number_substeps) override
Properly set up the incremental calculation storage of the stateful material properties in the inheri...
std::vector< std::vector< GenericReal< is_ad > > > _non_stress_weights
Container for weights for each tile as computed for all input values beside stress.
std::vector< GenericReal< is_ad > > _partition_weights
Container for weights for each tile as computed for all input values beside stress.
bool areTilesNotIdentical(const unsigned int p, const unsigned int t, const unsigned int tt, const unsigned int in_index)
Checks if two tile domains are equal.
RankTwoTensor _plastic_strain_increment
Total plastic strain increment in step (summing substep contributions)
unsigned int _num_inputs
Number of inputs for the ROM data set.
virtual std::vector< std::vector< unsigned int > > getTilings()
GenericReal< is_ad > computePolynomial(const GenericReal< is_ad > &value, const unsigned int degree, const bool derivative=false)
Calculate the value or derivative of Legendre polynomial up to 3rd order.
std::vector< std::pair< Real, Real > > _global_limits
Container for global limits.
const Function *const _creep_strain_old_forcing_function
Optional old creep strain forcing function.
static InputParameters validParams()
void precomputeROM(const unsigned out_index)
Precompute the ROM strain rate information for all inputs except for strain.
const unsigned int _wall_input_index
Index corresponding to the position for the dislocations within the cell wall in the input vector.
std::vector< GenericReal< is_ad > > _input_values
Container for input values.
GenericReal< is_ad > _derivative
Container for derivative of creep increment with respect to strain.
virtual bool substeppingCapabilityEnabled() override
Does the model include the infrastructure for substep decomposition of the elastic strain initially u...
const unsigned int _stress_input_index
Index corresponding to the position for the stress in the input vector.
virtual GenericReal< is_ad > computeResidual(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar) override
Compute the residual for a predicted value of the scalar.
std::vector< std::vector< std::vector< std::vector< GenericReal< is_ad > > > > > _polynomial_inputs
Container for ROM polynomial inputs.
std::vector< GenericReal< is_ad > > _dpartition_weight_dstress
Container for d_parition_weights d_stress.
const unsigned int _strain_output_index
Index corresponding to the position for strain increment in the output vector.
GenericReal< is_ad > sigmoid(const Real lower, const Real upper, const GenericReal< is_ad > &val, const bool derivative=false)
Calculate the sigmoid function weighting for the input based on the limits.
std::vector< std::vector< std::vector< GenericReal< is_ad > > > > _rom_inputs
Container for converted rom_inputs.
std::vector< std::vector< std::vector< std::vector< Real > > > > _transform_coefs
Transform coefficients defined by the ROM data set for each partition.
GenericReal< is_ad > computeValues(const unsigned int p, const std::vector< GenericReal< is_ad > > &precomputed, const std::vector< std::vector< GenericReal< is_ad > > > &polynomial_inputs, const std::vector< GenericReal< is_ad > > &dpolynomial_inputs={}, const bool derivative=false)
Arranges the calculated Legendre polynomials into the proper oder and multiplies the Legendre polynom...
std::vector< std::vector< std::vector< std::vector< Real > > > > _input_limits
Input limits defined by the ROM data set for each partition.
const unsigned int _cell_input_index
Index corresponding to the position for the dislocations with in the cell in the input vector.
virtual GenericReal< is_ad > computeDerivative(const GenericReal< is_ad > &, const GenericReal< is_ad > &) override
Compute the derivative of the residual as a function of the scalar variable.
virtual void computeStressFinalize(const GenericRankTwoTensor< is_ad > &plastic_strain_increment) override
Perform any necessary steps to finalize state after return mapping iterations.
const bool _verbose
Flag to output verbose infromation.
GenericMaterialProperty< Real, is_ad > & _cell_rate
Cell dislocations rate of change.
GenericReal< is_ad > normalizeInput(const GenericReal< is_ad > &input, const ROMInputTransform transform, const Real transform_coef, const std::vector< Real > &transformed_limits, const bool derivative=false)
Convert the input variables into the form expected by the ROM Legendre polynomials to have a normaliz...
WindowFailure
Enum to error, warn, ignore, or extrapolate if input is outside of window of applicability.
GenericReal< is_ad > computeROM(const unsigned int tile, const unsigned int partition, const unsigned out_index, const bool derivative=false)
Computes the ROM calculated increment for a given output and tile.
const Real _max_wall_increment
Maximum wall dislocation increment.
const unsigned int _old_strain_input_index
Index corresponding to the position for the old strain in the input vector.
virtual void setupUnitConversionFactors(const InputParameters ¶meters)
std::vector< unsigned int > getMakeFrameHelper(const unsigned int p) const
virtual void initQpStatefulProperties() override
GenericReal< is_ad > _cell_dislocation_increment
Container for cell dislocation increment.
unsigned int _num_outputs
Number of inputs to the ROM data set.
std::vector< std::vector< std::vector< GenericReal< is_ad > > > > _precomputed_vals
Container for ROM precomputed values.
const MaterialProperty< Real > & _wall_dislocations_old
std::vector< std::vector< std::vector< std::vector< std::vector< Real > > > > > _transformed_normalization_limits
Limits transformed from readabile input to ROM readable limits for normalization.
std::vector< unsigned int > _num_coefs
Total number of Legendre polynomial coefficients for the ROM data set in each parition.
virtual GenericReal< is_ad > convertOutput(const unsigned int p, const std::vector< Real > &old_input_values, const GenericReal< is_ad > &rom_output, const unsigned out_index, const GenericReal< is_ad > &drom_output=0.0, const bool derivative=false)
Computes the output variable increments from the ROM predictions by bringing out of the normalized ma...
const GenericMaterialProperty< Real, is_ad > * _environmental
Optionally coupled environmental factor.
const Real _max_cell_increment
Maximum cell dislocation increment.
std::vector< std::vector< unsigned int > > _tiling
Container for tiling orientations.
GenericMaterialProperty< Real, is_ad > & _wall_dislocations
Material properties for wall (locked) dislocation densities (1/m^2)
const Function *const _stress_function
Optiontal effective stress forcing function.
void convertValue(T &x, const ROMInputTransform transform, const Real coef, const bool derivative=false)
Convert input based on the transform type.
std::vector< std::vector< unsigned int > > _makeframe_helper
Helper container defined by the ROM data set.
virtual void computeStressInitialize(const GenericReal< is_ad > &effective_trial_stress, const GenericRankFourTensor< is_ad > &elasticity_tensor) override
Perform any necessary initialization before return mapping iterations.
const unsigned int _environmental_input_index
Index corresponding to the position for the environmental factor in the input vector.
virtual void computePartitionWeights(std::vector< GenericReal< is_ad > > &weights, std::vector< GenericReal< is_ad > > &dweights_dstress)
Compute the weight of the different partitions.
virtual std::vector< std::vector< std::vector< std::vector< Real > > > > getTransformCoefs()
MaterialProperty< Real > & _extrapolation
Material property to hold smootherstep applied in order to extrapolate.
const unsigned int _temperature_input_index
Index corresponding to the position for the tempeature in the input vector.
const GenericVariableValue< is_ad > & _temperature
Coupled temperature variable.
bool checkInTile(const unsigned int p, const unsigned int t) const
Checks if the input combination is in a specific tile.
GenericMaterialProperty< Real, is_ad > & _second_partition_weight
Material property to store partition weight.
GenericReal< is_ad > _wall_dislocation_increment
Container for wall dislocation increment.
nlohmann::json _json
JSON object constructed from the datafile.
std::vector< Real > _old_input_values
Container for old input values.
std::vector< std::vector< std::vector< std::vector< ROMInputTransform > > > > _transform
Transform rules defined by the ROM data set for each partition.
std::vector< std::pair< WindowFailure, WindowFailure > > _window_failure
const Function *const _cell_function
Optional cell dislocation forcing function.
GenericMaterialProperty< Real, is_ad > & _wall_dislocations_step
Material properties accumulated at substeps.
virtual std::vector< std::vector< std::vector< std::vector< Real > > > > getCoefs()
unsigned int _num_partitions
Number of partitions.
std::vector< std::vector< std::vector< std::vector< Real > > > > _coefs
Coefficients used with Legendre polynomials defined by the ROM data set for each partition.
void precomputeValues(const unsigned int p, const std::vector< Real > &coefs, const std::vector< std::vector< GenericReal< is_ad > > > &polynomial_inputs, std::vector< GenericReal< is_ad > > &precomputed)
Arranges the calculated Legendre polynomials into the proper oder and multiplies the Legendre polynom...
std::vector< std::vector< GenericReal< is_ad > > > _weights
Container for weights for each tile as computed for all input values beside stress.
std::vector< unsigned int > _num_tiles
Number of ROM tiles per partition.
void outputIterationSummary(std::stringstream *iter_output, const unsigned int total_it) override
Output summary information for the convergence history of the model.
const unsigned int _wall_output_index
Index corresponding to the position for wall dislocations increment in the output vector.
GenericMaterialProperty< Real, is_ad > & _creep_rate
Creep rate material property.
const MooseArray< Point > & _q_point
const InputParameters & parameters() const
void mooseError(Args &&... args) const
const std::string & _name
This class provides baseline functionallity for creep models based on the stress update material in a...
const bool _apply_strain
Debugging option to enable specifying instead of calculating strain.