Thermodynamics of ferromagnetic crystals with a non-Euclidean structure as internal variable