A variational principle and finite element analysis for thermo-polarization gradient theory