Two-dimensional physical-based inversion of confined and unconfined aquifers under unknown boundary conditions