Analytical model for solidification and melting in a finite PCM in steady periodic regime