Skip to content

Commit

Permalink
Add code for saving and plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
ckhroulev committed Oct 14, 2020
1 parent 4634727 commit 3fdc627
Showing 1 changed file with 40 additions and 11 deletions.
51 changes: 40 additions & 11 deletions test/regression/ssa/ssafem.py
Expand Up @@ -71,14 +71,43 @@

PISM.compute_node_types(geometry.ice_thickness, 1.0, node_type)

f = PISM.util.prepare_output(config.get_string("output.file_name"))

node_type.write(f)
v_mag.write(f)
ssa.velocity().write(f)
geometry.ice_thickness.write(f)
geometry.bed_elevation.write(f)
geometry.cell_type.write(f)
enthalpy.write(f)
tauc.write(f)
f.close()
def save_results(filename):

f = PISM.util.prepare_output(filename)

node_type.write(f)
v_mag.write(f)
ssa.velocity().write(f)
geometry.ice_thickness.write(f)
geometry.bed_elevation.write(f)
geometry.cell_type.write(f)
enthalpy.write(f)
tauc.write(f)
f.close()

save_results(config.get_string("output.file_name"))

def plot():
import pylab as plt
import numpy as np

x = np.array(grid.x())
dx = grid.dx()
y = np.array(grid.y())
dy = grid.dy()

v = ssa.velocity().numpy()

plt.figure(1)
plt.imshow(v[:,:,0])
plt.title("u")
plt.colorbar()

plt.figure(2)
plt.imshow(v[:,:,1])
plt.title("v")
plt.colorbar()

plt.show()

# plot()

0 comments on commit 3fdc627

Please sign in to comment.