Solitary waves in self-gravitating molecular clouds