Skip to content

Commit

Permalink
update TO/geos auto-test to also sample geos movies
Browse files Browse the repository at this point in the history
  • Loading branch information
tgastine committed Sep 13, 2024
1 parent 55231f3 commit bae6d2c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
5 changes: 5 additions & 0 deletions samples/testTOGeosOutputs/input.nml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ n_cheb_ic_max=15,
l_TOmovie =.true.,
n_TOmovie_step=5,
l_par =.true.,
l_movie =.true.,
n_movie_step=10,
movie(1) ="vs geos",
movie(2) ="vp geos",
movie(3) ="vortz geos",
/
&mantle
nRotMa =0
Expand Down
1 change: 1 addition & 0 deletions samples/testTOGeosOutputs/reference.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
-0.3877 6.4249 -4.0203 3.5230 -3903.9583 422.0722 0.0000
-4.7407 -32.4243 -1.1852 -343.3169
-0.0000 168.8861 -0.1324 0.3813
-9.5302 7.5466 2.4657
20 changes: 14 additions & 6 deletions samples/testTOGeosOutputs/unitTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ def readStack(file):


def generateEkinFile(fileName='e_kin.test'):
from magic import TOMovie, MagicTOHemi
from magic import TOMovie, MagicTOHemi, Movie

# Write output for TO_mov file
to = TOMovie(file='TO_mov.start', iplot=False)
out = 'tmp'
file = open(out, 'w')
st = '{:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f}'.format( to.asVphi[0, 13, 3],
to.rey[1, 21, 22], to.adv[1, 52, 11], to.visc[0, 12, 25],
st = '{:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f}'.format( to.asVphi[0, 13, 3],
to.rey[1, 21, 22], to.adv[1, 52, 11], to.visc[0, 12, 25],
to.lorentz[0, 73, 30], to.coriolis[1, 33, 3], to.dtVp[1, 88, 7] )

file.write(st+'\n')

# TOnhs.TAG
Expand All @@ -64,6 +63,15 @@ def generateEkinFile(fileName='e_kin.test'):
to.tay[4, 27], to.vpr[2, 21])
file.write(st+'\n')

# Geos movies
vs_geos = Movie(file='geosVS_mov.start', iplot=False)
vp_geos = Movie(file='geosVPHI_mov.start', iplot=False)
vortz_geos = Movie(file='geosVorZ_mov.start', iplot=False)

st = '{:.4f} {:.4f} {:.4f}'.format(vs_geos.data[0, -1, 24, 12],
vp_geos.data[0, -1, 37, 32],
vortz_geos.data[0, -1, 7, 5])
file.write(st+'\n')
file.close()

# Cat e_kin.test + misc
Expand Down Expand Up @@ -117,7 +125,7 @@ def tearDown(self):
else: # python 3.11+
result = self._outcome.result
else: # python 2.7-3.3
result = getattr(self, '_outcomeForDoCleanups',
result = getattr(self, '_outcomeForDoCleanups',
self._resultForDoCleanups)

error = self.list2reason(result.errors)
Expand All @@ -136,7 +144,7 @@ def tearDown(self):
print('\n')
print(result.failures[-1][-1])

@unittest.skipUnless('MAGIC_HOME' in os.environ,
@unittest.skipUnless('MAGIC_HOME' in os.environ,
'MAGIC_HOME is not defined! source sourceme.sh!')
def outputFileDiff(self):
generateEkinFile('e_kin.test')
Expand Down

0 comments on commit bae6d2c

Please sign in to comment.