PYTHON: Add pressure for the isothermal case.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2022-10-06 07:58:37 -03:00
parent 3ec21a59cb
commit 9190efe4a8

View File

@ -181,7 +181,7 @@ class Amun:
if 'dens' in self.variables:
self.variables['density'] = 'dens'
self.variables['logarithm of density'] = 'logd'
if 'pres' in self.variables:
if 'pres' in self.variables or self.attributes['eos'] == 'iso':
self.variables['pressure'] = 'pres'
self.variables['logarithm of pressure'] = 'logp'
if all(v in self.variables for v in ['velx','vely','velz']):
@ -258,8 +258,16 @@ class Amun:
dset[p,...] = self.chunks[chunk_number]['levels'][p]
elif dataset == 'logd':
dset = numpy.log10(self.__read_binary_data__('dens', chunk_number))
elif dataset == 'pres':
if self.attributes['eos'] == 'iso':
dset = self.__read_binary_data__('dens', chunk_number) * self.attributes['sound_speed']**2
else:
dset = self.__read_binary_data__('pres', chunk_number)
elif dataset == 'logp':
dset = numpy.log10(self.__read_binary_data__('pres', chunk_number))
if self.attributes['eos'] == 'iso':
dset = numpy.log10(self.__read_binary_data__('dens', chunk_number) * self.attributes['sound_speed']**2)
else:
dset = numpy.log10(self.__read_binary_data__('pres', chunk_number))
elif dataset == 'velo':
tmp = self.__read_binary_data__('velx', chunk_number)
dset = tmp**2