Adding a homogenization scheme
MeanFieldHom.Schemes ships Voigt/Reuss, dilute (direct and dual), Mori-Tanaka, Maxwell, Ponte-Castañeda–Willis, self-consistent (symmetric and asymmetric) and differential, each in an elastic and an ageing-viscoelastic flavour. A new scheme slots in beside them:
- Create
src/Schemes/<scheme_name>.jlandincludeit fromsrc/Schemes/Schemes.jl. - Declare the scheme type (
struct MyScheme <: HomogenizationScheme) insrc/Schemes/scheme_types.jl, and register its symbol alias inSCHEME_ALIAS(src/Schemes/homogenize.jl) if you wanthomogenize(rve, :myscheme, :C)to work. - Implement
_evaluate(rve, ::MyScheme, ::Val{p}; kw...). Provide one method per tensor order — dispatch on the order ofmatrix_property(rve, p)— so the scheme serves elasticity and transport from one implementation, as_mt_dispatchdoes inmori_tanaka.jl. - Go through
contribution_helpers.jl. Never callstiffness_contributionand friends directly on a phase geometry: the_phase_*helpers apply the amount, honour thesymmetrizesetting, hand the kernel the correctly pre-projected reference medium, and branch onis_homogeneous_inclusion. Two invariants stated in that file's header must hold in your kernel too — all helpers of a given evaluation must share the same projectedP₀, and orientation averaging must never be folded into a tensor product. - Prefer the bundled seams (
_phase_dilute_and_contribution,_phase_dilute_and_stress_average,_phase_compliance_and_contribution) when you need two objects per phase: they share the single expensive solve. - Consider what your kernel requires of an inclusion. Needing only the contribution tensors keeps the scheme usable with inclusions entered through gate C of the inclusion contract; needing the concentration tensor restricts it.
- Export through
src/Schemes/Schemes.jland re-export fromsrc/MeanFieldHom.jl. - Add a unit test under
test/Schemes/and a section indocs/src/manual/schemes.md.