示例#1
0
# directory where XBeach files will be dumped and code will run - this needs to be changed to reflect name of folder
path_stem = '/rds/general/user/mc4117/home/MLMC_Code/slope_1d_mc/1/'

variable_name = 'bed_slope'  # name of uncertain variable

M = 2  # integer factor that meshsize is refined by at each level

t1 = time.time()

L_eps = 13  # fineness of grid

bathy = Bathymetry()

bathy.length_x = 1250
bathy.dx = bathy.length_x / M**L_eps

bathy.mc_slope(bathy.dx, 0.6, 0.15)

# interpolation function used to generate bed on new x and y grid
interp_orig_fn = interpolate.interp1d(bathy.x, bathy.z)

# run monte carlo algorithm
outputf, real_soln, file_name = mc_fn.monte_carlo_main(2000, M**L_eps,
                                                       build_output, path_stem,
                                                       sample, variable_name,
                                                       no_parallel_processes,
                                                       interp_orig_fn)

t2 = time.time()
示例#2
0

M = 2 # integer factor that meshsize is refined by at each level
Lmin = 2  # minimum refinement level
Lmax = 12  # maximum refinement level
L = 7

# list of all levels considered
l_element = []
for i in range(Lmin, Lmax+1):
    l_element.append(i)

bathy = Bathymetry()

bathy.length_x = 1250
bathy.dx = bathy.length_x/M**(Lmax+1)

bathy.mc_slope(bathy.dx, 0.6, 0.15)

# interpolation function used to generate bed on new x and y grid
interp_orig_fn = interpolate.interp1d(bathy.x, bathy.z)

# epsilon values - for CDF calculation this should be set to epsilon = [0.0002]
epsilon = [0.0002, 0.0005, 0.0008, 0.0012, 0.002, 0.003]
N0 = 750 # number of samples used in preliminary run

# set the function which builds XBeach inputs, runs XBeach and records output
build_output = bd_fns.build_xbeach
no_runs = 1
no_parallel_processes = 48 # should be equal to number of cores
示例#3
0
M = 2  # integer factor that meshsize is refined by at each level
Lmin = 2  # minimum refinement level
Lmax = 8  # maximum refinement level
L = 7

# list of all levels considered
l_element = []
for i in range(Lmin, Lmax + 1):
    l_element.append(i)

bathy = Bathymetry()

bathy.length_x = 1250
bathy.length_y = 1000
bathy.dx = bathy.length_x / M**Lmax
bathy.dy = bathy.length_y / M**Lmax
bathy.mc_slope_test(bathy.dx, bathy.dy, 0.6, 0.15, 0.15)

# interpolation function used to generate bed on new x and y grid
interp_orig_fn = interpolate.interp2d(bathy.x, bathy.y, bathy.z)

# epsilon values - for CDF calculation this should be set to epsilon = [0.001]
epsilon = [0.001, 0.0017, 0.0025, 0.0035, 0.005, 0.006]
N0 = 500  # number of samples used in preliminary run

# set the function which builds XBeach inputs, runs XBeach and records output
build_output = bd_fns.build_xbeach_2d
no_runs = 1
no_parallel_processes = 40  # should be equal to number of cores