MaterialModelsTesting
Documentation for MaterialModelsTesting.
MaterialModelsTesting.obtain_numerical_material_derivative!
MaterialModelsTesting.obtain_numerical_material_derivative!
MaterialModelsTesting.runstrain
MaterialModelsTesting.runstrain_diff
MaterialModelsTesting.runstresstate
MaterialModelsTesting.runstresstate_diff
MaterialModelsTesting.test_derivative
MaterialModelsTesting.obtain_numerical_material_derivative!
— Methodobtain_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
.
MaterialModelsTesting.obtain_numerical_material_derivative!
— Methodobtain_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
.
MaterialModelsTesting.runstrain
— Methodrunstrain(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.
MaterialModelsTesting.runstrain_diff
— Methodrunstrain_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
.
MaterialModelsTesting.runstresstate
— Methodrunstresstate(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.
MaterialModelsTesting.runstresstate_diff
— Methodrunstresstate_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
.
MaterialModelsTesting.test_derivative
— Methodtest_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 ofdiff.dsdp
is correctly accounted for.comparesettings::NamedTuple
are passed askwargs
toBase.isapprox
, which compares the two matrices. Please see its docstring for further details.numdiffsettings::NamedTuple
are passed askwargs
toobtain_numerical_material_derivative!
, please see its docstring for further details.