A thermal model for the ablation of polymers by lasers and high intensity ion pulses