variation for perfect fluid