Local distortion energy and coarse-grained elasticity of the twist-bend nematic phase.