Smart structures based on the magnetic shape memory (MSM) effect feature giant magnetic field-induced strains and an ultra-fast response. MSM alloys could be used in a variety of applications such as digital hydraulics, microfluidic systems, soft robotics. However, practical implementation of the MSM effect is complicated by a lack of precise engineering simulation tools suitable for designing structures using the MSM alloys. Presented here is an approach to calculating the difference in free energy across twin boundaries, which is the driving force for structural transformations in MSM alloys. The approach, based on 3D finite element simulations, makes it possible to consider an entire specimen while accounting for complex inner and outer non-homogeneous magnetic fields. Based on the simulation results obtained, conclusions are offered regarding the effect of different modeling approaches and experimental setups on free energy differences across twin boundaries.