A transient model for explosive and phreatomagmatic eruptions