The research in this thesis is devoted to geometric numerical integration and thermostat methods for Hamiltonian ODEs and PDEs with applications in molecular dynamics and geophysical fluid dynamics.