Port Hamiltonian formulation of infinite dimensional systems I. Modeling