The photodissociation of interstellar and cometary CH2