Generation of Magmatism Under Active Continental Margins: A Thermodynamic Study of Subduction and Translithospheric Diapirs