calculate pressure gradient