[cig-commits] [commit] devel: added Paul Cristini's Python script to generate a thermocline (3c39802)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Dec 4 07:15:13 PST 2014


Repository : https://github.com/geodynamics/specfem2d

On branch  : devel
Link       : https://github.com/geodynamics/specfem2d/compare/e708da96bb2c61716378726c552a1d28fa805244...0a478c593dcd280dcfd1e89d60fd9e3b510b5a30

>---------------------------------------------------------------

commit 3c39802c6440cf4c77e4d7510e18beb3c65e474e
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Thu Dec 4 16:11:12 2014 +0100

    added Paul Cristini's Python script to generate a thermocline


>---------------------------------------------------------------

3c39802c6440cf4c77e4d7510e18beb3c65e474e
 ...rated_by_the_Python_script_of_Paul_Cristini.png | Bin 0 -> 50098 bytes
 ...hallow_water_profile_script_by_Paul_Cristini.py |  46 +++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/EXAMPLES/thermocline/figure_1_of_sound_profile_generated_by_the_Python_script_of_Paul_Cristini.png b/EXAMPLES/thermocline/figure_1_of_sound_profile_generated_by_the_Python_script_of_Paul_Cristini.png
new file mode 100644
index 0000000..8740c54
Binary files /dev/null and b/EXAMPLES/thermocline/figure_1_of_sound_profile_generated_by_the_Python_script_of_Paul_Cristini.png differ
diff --git a/EXAMPLES/thermocline/generate_shallow_water_profile_script_by_Paul_Cristini.py b/EXAMPLES/thermocline/generate_shallow_water_profile_script_by_Paul_Cristini.py
new file mode 100755
index 0000000..1cf1d3d
--- /dev/null
+++ b/EXAMPLES/thermocline/generate_shallow_water_profile_script_by_Paul_Cristini.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Thu May 24 09:39:16 2012
+
+ at author: Paul Cristini, CNRS, LMA Marseille, France.
+
+This script creates the sound profile displayed in figure_1_of_sound_profile_generated_by_the_Python_script_of_Paul.png
+"""
+import numpy as np
+import pylab as pl
+
+
+zc = 30.   # position of 
+Cdeb = 1490.  # minimum sound speed
+Cinc = 40.
+cc = 5.
+ymax = 100.
+aa = 5.   # Add a linear variation with depth
+
+#------------------------------------------------------
+y = np.linspace(0., ymax,100)
+zz = cc * (np.abs(y) - zc) / zc
+# Analytical sound speed variation law
+vp = Cdeb + Cinc/2. * (1-np.tanh(zz)) + aa/ymax*y
+
+# save profile for future use
+y1, vp1, vp2 = y[:-1], vp[1:], vp[:-1]
+print np.shape(y1), np.shape(vp1), np.shape(vp2)
+np.savetxt('SW.out',np.transpose((y1,vp1,vp2)), fmt='%4.2f')
+
+pl.figure(figsize=(10,14))
+pl.plot(vp,y,lw=1.5)
+ax=pl.gca()
+ax.set_ylim(ax.get_ylim()[::-1])
+mm = np.array(ax.get_xlim())+[-20.,20]
+ax.set_xlim(mm)
+pl.ylabel('Depth (m)',fontsize=24)
+pl.xlabel('Sound speed (m/s)',fontsize=24)
+fontsize=20
+for tick in ax.xaxis.get_major_ticks():
+    tick.label1.set_fontsize(fontsize)
+for tick in ax.yaxis.get_major_ticks():
+    tick.label1.set_fontsize(fontsize)
+ax.set_xticks(ax.get_xticks()[::2])
+pl.grid()
+pl.show()



More information about the CIG-COMMITS mailing list