Jellyfish, also known as "medusae", move by rhythmically contracting and expanding their bell-shaped bodies and are the earliest known animals to achieve locomotion through the muscle power. Development of a generalized dynamical model of medusan swimming is of interest to biologists as well as engineers. In this paper we present a new approach to modeling the swimming behavior of a jellyfish. Due to the axial symmetry of the creature we used a 2D cross-section for the calculation with the surface of the bell represented by two hemi-ellipsoidal curves. A simplified approach based on non-linear deformations of a geometric object is used to model the bell contraction-expansion cycle. We used a particle-gridless hybrid method for the analysis of incompressible flows, with averaging velocities field by the Shepard's method (partition of unity). To the best of our knowledge this is the first work where the optimal contraction and expansion parameters for the jellyfish movement were found by solving the optimization problem of maximizing the speed while minimizing the energy loss.