Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MarliesA committed Jul 23, 2024
2 parents 6a3c622 + 902db69 commit f0e27b1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 38 deletions.
4 changes: 2 additions & 2 deletions xbTools/general/wave_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def wavecelerity(Tp, d, g=9.81):
'''

k = dispersion(2*np.pi/Tp, d, g)
n = 0.5 * (1 + 2 * k * d * np.sinh(2 * k * d))
k = dispersion(2*np.pi/Tp, d, max_error = 0.0001, g = g)
n = 0.5 * (1 + 2 * k * d / np.sinh(2 * k * d))
c = g * Tp/(2 * np.pi) * np.tanh(k * d)
cg = n * c
return cg, n
Expand Down
78 changes: 42 additions & 36 deletions xbTools/xbeachtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def set_params(self,input_par_dict):
self.input_par = {}
self.input_par['par'] = {}
## loop over input parameters
value_added = False

for input_par in input_par_dict:
value_added = False
## loop over categories
for par_category in par_dict:
## if input parameter is in category, add parameter
Expand Down Expand Up @@ -594,44 +595,49 @@ def _plotdomain(self,save_path=None):

plt.suptitle(self.fname)

if self.struct == 1 and not(self.ygr==None):
fig2 = plt.figure()

plt.pcolor(self.xgr,self.ygr,self.nebed)
plt.xlabel('x')
plt.ylabel('y')
plt.colorbar()
plt.title('ne_bed.dep (positive)')
plt.axis('scaled')
plt.grid('on')
if self.struct == 1:
if not self.fast1D == True:
fig2 = plt.figure()

plt.pcolor(self.xgr, self.ygr, self.nebed)
plt.xlabel("x")
plt.ylabel("y")
plt.colorbar()
plt.title("ne_bed.dep (positive)")
plt.axis("scaled")
plt.grid("on")

if self.friction_layer == 1:
fig3 = plt.figure()

plt.pcolor(self.xgr,self.ygr,self.friction)
plt.xlabel('x')
plt.ylabel('y')
plt.colorbar()
plt.title('friction.dep (positive)')#+self.input_par['Flow parameters']['bedfriction'])
plt.axis('scaled')
plt.grid('on')
if not self.fast1D == True:
fig3 = plt.figure()

plt.pcolor(self.xgr, self.ygr, self.friction)
plt.xlabel("x")
plt.ylabel("y")
plt.colorbar()
plt.title(
"friction.dep (positive)"
) # +self.input_par['Flow parameters']['bedfriction'])
plt.axis("scaled")
plt.grid("on")

if self.wavefriction_layer == 1:
fig4 = plt.figure()

plt.pcolor(self.xgr,self.ygr,self.wavefriction)
plt.xlabel('x')
plt.ylabel('y')
plt.colorbar()
plt.title('wavefriction.dep (positive) - fw')
plt.axis('scaled')
plt.grid('on')
if not self.fast1D == True:
fig4 = plt.figure()

plt.pcolor(self.xgr, self.ygr, self.wavefriction)
plt.xlabel("x")
plt.ylabel("y")
plt.colorbar()
plt.title("wavefriction.dep (positive) - fw")
plt.axis("scaled")
plt.grid("on")

if save_path!=None:
fig1.savefig(os.path.join(save_path,'domain.png'),dpi=250)
if self.struct == 1 and not(self.ygr==None):
fig2.savefig(os.path.join(save_path,'ne_bed.png'),dpi=250)
if self.friction_layer == 1:
fig3.savefig(os.path.join(save_path,'friction.png'),dpi=250)
if self.wavefriction_layer == 1:
fig4.savefig(os.path.join(save_path,'wavefriction.png'),dpi=250)
fig1.savefig(os.path.join(save_path, "domain.png"), dpi=250)
if self.struct == 1 and not self.fast1D == True:
fig2.savefig(os.path.join(save_path, "ne_bed.png"), dpi=250)
if self.friction_layer == 1 and not self.fast1D == True:
fig3.savefig(os.path.join(save_path, "friction.png"), dpi=250)
if self.wavefriction_layer == 1 and not self.fast1D == True:
fig4.savefig(os.path.join(save_path, "wavefriction.png"), dpi=250)

0 comments on commit f0e27b1

Please sign in to comment.