MaterialModelsTesting

Documentation for MaterialModelsTesting.

MaterialModelsTesting.obtain_numerical_material_derivative!Method
obtain_numerical_material_derivative!(deriv, m, ϵ, old, Δt; fdtype = Val{:forward}, kwargs...)

Obtain the numerical derivative of the material m at the strain ϵ and old state variables, old, for a time step Δt. fdtype and kwargs... are passed to FiniteDiff.finite_difference_jacobian.

source
MaterialModelsTesting.obtain_numerical_material_derivative!Method
obtain_numerical_material_derivative!(ssd, stress_state, m, ϵ, old, Δt; fdtype = Val{:forward}, kwargs...)

Obtain the numerical derivative of the material m considering the stress_state iterations at the strain ϵ and old state variables, old, for a time step Δt. fdtype and kwargs... are passed to FiniteDiff.finite_difference_jacobian.

source
MaterialModelsTesting.runstrainMethod
runstrain(m, ϵ_end::Union{Number, AbstractTensor}, ij::NTuple{2, Int}, t_end, num_steps)

Simulate fully strain-controlled loading from zero to ϵ_end strain, and return σ[i,j]. If ϵ_end::Number is passed, loading is applied to the strain ϵ_end eᵢ⊗eⱼ.

Returns the vector of stresses as well as the final state.

source
MaterialModelsTesting.runstrain_diffMethod
runstrain_diff(m, ϵ_end::Union{Number, AbstractTensor}, ij::NTuple{2, Int}, t_end, num_steps)

Simulate fully strain-controlled loading from zero to ϵ_end strain, and return σ[i,j] and its derivatives wrt. to the material parameters. If ϵ_end::Number is passed, loading is applied to the strain ϵ_end eᵢ⊗eⱼ.

Returns the vector of stresses, the final state, the derivatives dσᵢⱼ/dp for all time steps, and the final derivatives diff::MaterialDerivatives.

source
MaterialModelsTesting.runstresstateMethod
runstresstate(stress_state, m, ϵ_end::Union{Number, AbstractTensor}, ij::NTuple{2, Int}, t_end, num_steps)

Simulate the stress_state from zero to ϵ_end strain, and return σ[i,j]. If ϵ_end::Number is passed, loading is applied to the strain ϵ_end eᵢ⊗eⱼ.

Returns the vector of stresses and the final state variables.

source
MaterialModelsTesting.runstresstate_diffMethod
runstresstate_diff(stress_state, m, ϵ_end::Union{Number, AbstractTensor}, ij::NTuple{2, Int}, t_end, num_steps)

Simulate the stress_state from zero to ϵ_end strain, and return σ[i,j] and its derivatives wrt. to the material parameters. If ϵ_end::Number is passed, loading is applied to the strain ϵ_end eᵢ⊗eⱼ.

Returns the vector of stresses, the final state, the derivatives dσᵢⱼ/dp for all time steps, and the final derivatives diff::StressStateDerivatives.

source
MaterialModelsTesting.test_derivativeMethod
test_derivative(m, ϵ, state, Δt; comparesettings = (), numdiffsettings = (), diff = MaterialDerivatives(m))

This function is used to compare the analytically implemented derivative (calling differentiate_material!(diff, m, ϵ, args...)) with the result from obtain_numerical_material_derivative!(diff, m, ϵ, args...; numdiffsettings...).

  • diff::MaterialDerivatives can be passed to check that the old value of diff.dsdp is correctly accounted for.
  • comparesettings::NamedTuple are passed as kwargs to Base.isapprox, which compares the two matrices. Please see its docstring for further details.
  • numdiffsettings::NamedTuple are passed as kwargs to obtain_numerical_material_derivative!, please see its docstring for further details.
source