# This Python program is used to create a plot displaying the sponge 
# function we use in the CASTRO hydrodynamics for the wdmerger problem.

import numpy as np
import matplotlib.pyplot as plt

def sponge(r):
    sp

rs = 0.75
rt = 0.85

r = np.linspace(0.0, 1.0, 1000)
f = np.zeros(len(r))

idx = np.where(r < rs)
f[idx] = 0.0

idx = np.where(r < rt)
idx = np.where(r[idx] >= rs)
f[idx] = 0.5 * (1.0 - np.cos(np.pi * (r[idx] - rs) / (rt - rs)))

idx = np.where(r >= rt)
f[idx] = 1.0

plt.plot(r, 1.0 - f, linewidth=4.0)
plt.xlabel('Radius', fontsize=20)
plt.ylabel(r'$1 - f_S$', fontsize=20)

plt.xlim([0.0, 1.0])
plt.ylim([-0.05, 1.05])

plt.tick_params(labelsize=16)

plt.tight_layout()

plt.savefig('sponge.eps')

[(13, 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.0)', '(1000)'], {}), True, 'import numpy as np\n'), (16, 'numpy.where', 'np.where', (['(r < rs)'], {}), True, 'import numpy as np\n'), (19, 'numpy.where', 'np.where', (['(r < rt)'], {}), True, 'import numpy as np\n'), (20, 'numpy.where', 'np.where', (['(r[idx] >= rs)'], {}), True, 'import numpy as np\n'), (23, 'numpy.where', 'np.where', (['(r >= rt)'], {}), True, 'import numpy as np\n'), (26, 'matplotlib.pyplot.plot', 'plt.plot', (['r', '(1.0 - f)'], {'linewidth': '(4.0)'}), True, 'import matplotlib.pyplot as plt\n'), (27, 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Radius"""'], {'fontsize': '(20)'}), True, 'import matplotlib.pyplot as plt\n'), (28, 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""$1 - f_S$"""'], {'fontsize': '(20)'}), True, 'import matplotlib.pyplot as plt\n'), (30, 'matplotlib.pyplot.xlim', 'plt.xlim', (['[0.0, 1.0]'], {}), True, 'import matplotlib.pyplot as plt\n'), (31, 'matplotlib.pyplot.ylim', 'plt.ylim', (['[-0.05, 1.05]'], {}), True, 'import matplotlib.pyplot as plt\n'), (33, 'matplotlib.pyplot.tick_params', 'plt.tick_params', ([], {'labelsize': '(16)'}), True, 'import matplotlib.pyplot as plt\n'), (35, 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), True, 'import matplotlib.pyplot as plt\n'), (37, 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""sponge.eps"""'], {}), True, 'import matplotlib.pyplot as plt\n'), (21, 'numpy.cos', 'np.cos', (['(np.pi * (r[idx] - rs) / (rt - rs))'], {}), True, 'import numpy as np\n')]