def slide_tsunami( length, depth, slope, width=None, thickness=None, x0=0.0, y0=0.0, alpha=0.0, gravity=9.8, gamma=1.85, massco=1, dragco=1, frictionco=0, psi=0, dx=None, kappa=3.0, kappad=0.8, zsmall=0.01, scale=None, domain=None, verbose=False, ): from math import sin, tan, radians, pi, sqrt, exp # Domain is an ANUGA domain object if domain is not None: xllcorner = domain.geo_reference.get_xllcorner() yllcorner = domain.geo_reference.get_yllcorner() x0 = x0 - xllcorner # slump origin (relative) y0 = y0 - yllcorner # if width not provided, set to typical value if width is None: width = 0.25 * length # if thickness not provided, set to typical value if thickness is None: thickness = 0.01 * length # calculate some parameters of the slide sint = sin(radians(slope)) tant = tan(radians(slope)) tanp = tan(radians(psi)) a0 = gravity * sint * ((gamma - 1) / (gamma + massco)) * (1 - (tanp / tant)) ut = sqrt((gravity * depth) * (length * sint / depth) * (pi * (gamma - 1) / (2 * dragco)) * (1 - (tanp / tant))) s0 = ut ** 2 / a0 t0 = ut / a0 # calculate some parameters of the water displacement produced by the slide w = t0 * sqrt(gravity * depth) a2D = ( s0 * (0.0574 - (0.0431 * sint)) * (thickness / length) * ((length * sint / depth) ** 1.25) * (1 - exp(-2.2 * (gamma - 1))) ) a3D = a2D / (1 + (15.5 * sqrt(depth / (length * sint)))) from math import sqrt, log, e dx = 2.0 * (w * sqrt(-log((zsmall / a3D), e))) / 5.0 # determine nmin for scaling of eta(x,y) nmin = find_min(x0, w, kappad, dx) if scale is None: scale = a3D / nmin # a few temporary print statements if verbose is True: lg.critical("\nThe slide ...") lg.critical("\tLength: %s" % str(length)) lg.critical("\tDepth: %s" % str(depth)) lg.critical("\tSlope: %s" % str(slope)) lg.critical("\tWidth: %s" % str(width)) lg.critical("\tThickness: %s" % str(thickness)) lg.critical("\tx0: %s" % str(x0)) lg.critical("\ty0: %s" % str(y0)) lg.critical("\tAlpha: %s" % str(alpha)) lg.critical("\tAcceleration: %s" % str(a0)) lg.critical("\tTerminal velocity: %s" % str(ut)) lg.critical("\tChar time: %s" % str(t0)) lg.critical("\tChar distance: %s" % str(s0)) lg.critical("\nThe tsunami ...") lg.critical("\tWavelength: %s" % str(w)) lg.critical("\t2D amplitude: %s" % str(a2D)) lg.critical("\t3D amplitude: %s" % str(a3D)) lg.critical("\tscale for eta(x,y): %s" % str(scale)) # keep an eye on some of the assumptions built into the maths if (slope < 5) or (slope > 30): if verbose is True: lg.critical("WARNING: slope out of range (5 - 30 degrees) %s" % str(slope)) if (depth / length < 0.06) or (depth / length > 1.5): if verbose is True: lg.critical("WARNING: d/b out of range (0.06 - 1.5) %s" % str(depth / length)) if (thickness / length < 0.008) or (thickness / length > 0.2): if verbose is True: lg.critical("WARNING: T/b out of range (0.008 - 0.2) %s" % str(thickness / length)) if (gamma < 1.46) or (gamma > 2.93): if verbose is True: lg.critical("WARNING: gamma out of range (1.46 - 2.93) %s" % str(gamma)) return Double_gaussian(a3D, w, width, x0, y0, alpha, kappa, kappad, zsmall, dx, scale)
def slump_tsunami( length, depth, slope, width=None, thickness=None, radius=None, dphi=0.48, x0=0.0, y0=0.0, alpha=0.0, gravity=9.8, gamma=1.85, massco=1, dragco=1, frictionco=0, dx=None, kappa=3.0, kappad=1.0, zsmall=0.01, scale=None, domain=None, verbose=False, ): from math import sin, radians, sqrt # Domain is an ANUGA domain object if domain is not None: xllcorner = domain.geo_reference.get_xllcorner() yllcorner = domain.geo_reference.get_yllcorner() x0 = x0 - xllcorner # slump origin (relative) y0 = y0 - yllcorner # if width not provided, set to typical value if width is None: width = length # if thickness not provided, set to typical value if thickness is None: thickness = 0.1 * length # if radius not provided, set to typical value if radius is None: radius = length ** 2 / (8.0 * thickness) # calculate some parameters of the slump sint = sin(radians(slope)) s0 = radius * dphi / 2 t0 = sqrt((radius * (gamma + massco)) / (gravity * (gamma - 1))) a0 = s0 / t0 ** 2 um = s0 / t0 # calculate some parameters of the water displacement produced by the slump w = t0 * sqrt(gravity * depth) a2D = ( s0 * (0.131 / sint) * (thickness / length) * (length * sint / depth) ** 1.25 * (length / radius) ** 0.63 * dphi ** 0.39 * (1.47 - (0.35 * (gamma - 1))) * (gamma - 1) ) a3D = a2D / (1 + (2.06 * sqrt(depth / length))) from math import sqrt, log, e dx = 2.0 * (w * sqrt(-log((zsmall / a3D), e))) / 5.0 # determine nmin for scaling of eta(x,y) nmin = find_min(x0, w, kappad, dx) if scale is None: scale = a3D / nmin # a few temporary print statements if verbose is True: lg.critical("\nThe slump ...") lg.critical("\tLength: %s" % str(length)) lg.critical("\tDepth: %s" % str(depth)) lg.critical("\tSlope: %s" % str(slope)) lg.critical("\tWidth: %s" % str(width)) lg.critical("\tThickness: %s" % str(thickness)) lg.critical("\tRadius: %s" % str(radius)) lg.critical("\tDphi: %s" % str(dphi)) lg.critical("\tx0: %s" % str(x0)) lg.critical("\ty0: %s" % str(y0)) lg.critical("\tAlpha: %s" % str(alpha)) lg.critical("\tAcceleration: %s" % str(a0)) lg.critical("\tMaximum velocity: %s" % str(um)) lg.critical("\tChar time: %s" % str(t0)) lg.critical("\tChar distance: %s" % str(s0)) lg.critical("\nThe tsunami ...") lg.critical("\tWavelength: %s" % str(w)) lg.critical("\t2D amplitude: %s" % str(a2D)) lg.critical("\t3D amplitude: %s" % str(a3D)) lg.critical("\tDelta x %s" % str(dx)) lg.critical("\tsmall %s" % str(zsmall)) lg.critical("\tKappa d %s" % str(kappad)) lg.critical("\tscale for eta(x,y): %s" % str(scale)) # keep an eye on some of the assumptions built into the maths if (slope < 10) or (slope > 30): if verbose is True: lg.critical("WARNING: slope out of range (10 - 30 degrees) %s" % str(slope)) if (depth / length < 0.34) or (depth / length > 0.5): if verbose is True: lg.critical("WARNING: d/b out of range (0.34 - 0.5) %s" % str(depth / length)) if (thickness / length < 0.10) or (thickness / length > 0.15): if verbose is True: lg.critical("WARNING: T/b out of range (0.10 - 0.15) %s" % str(thickness / length)) if (radius / length < 1.0) or (radius / length > 2.0): if verbose is True: lg.critical("WARNING: R/b out of range (1 - 2) %s" % str(radius / length)) if (dphi < 0.10) or (dphi > 0.52): if verbose is True: lg.critical("WARNING: del_phi out of range (0.10 - 0.52) %s" % str(dphi)) if (gamma < 1.46) or (gamma > 2.93): if verbose is True: lg.critical("WARNING: gamma out of range (1.46 - 2.93) %s" % str(gamma)) return Double_gaussian(a3D, w, width, x0, y0, alpha, kappa, kappad, zsmall, dx, scale)