本文整理汇总了Python中anuga.Domain.set_name方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.set_name方法的具体用法?Python Domain.set_name怎么用?Python Domain.set_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类anuga.Domain
的用法示例。
在下文中一共展示了Domain.set_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_name
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
def set_name(self, name):
"""Assign name based on processor number
"""
if name.endswith('.sww'):
name = name[:-4]
self.global_name = name
# Call parents method with processor number attached.
Domain.set_name(self, name + '_P%d_%d' %(self.numproc, self.processor))
示例2: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
from anuga import Time_boundary
from anuga import indent
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 24.
width = 5.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name() # Output name based on script
print domain.statistics()
#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
def topography(x,y):
"""Complex topography defined by a function of vectors x and y."""
z = -x/100
N = len(x)
for i in range(N):
# Step
if 2 < x[i] < 4:
示例3: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
# Pole 2
#id = (x - 14)**2 + (y - 3.5)**2 < 0.4**2
#z[id] += 1.0
return z
#----------------------------------------------------------------------------
# Setup initial domain
#----------------------------------------------------------------------------
if anuga.myid == 0:
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name() # Output name
print domain.statistics()
domain.set_quantity('elevation', topography) # elevation is a function
domain.set_quantity('friction', 0.01) # Constant friction
domain.set_quantity('stage', expression='elevation') # Dry initial condition
else:
domain = None
domain = anuga.distribute(domain)
#------------------------------------------------------------------------------
# Setup boundary conditions
#------------------------------------------------------------------------------
示例4: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 15.
width = 4.
dx = dy = 0.25 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
evolved_quantities = ['stage', 'xmomentum', 'ymomentum', 'elevation']
domain = Domain(points, vertices, boundary, evolved_quantities=evolved_quantities)
domain.set_flow_algorithm('DE0')
domain.set_name('veg') # Output name
# domain.set_store_vertices_uniquely(True)
# print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2,
'xmomentum': 2,
'ymomentum': 2})
domain.set_quantity('elevation', topography) # elevation is a function
domain.set_quantity('friction', 0.01) # Constant friction
domain.set_quantity('stage', topography) # Dry initial condition
#------------------------------------------------------------------------------
示例5: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
from anuga import Domain
from anuga import Reflective_boundary
from anuga import Dirichlet_boundary
from anuga import Time_boundary
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 24.
width = 5.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name('channel_variable_bed_0.2_newviewer') # Output name
print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2})
#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
def topography(x,y):
"""Complex topography defined by a function of vectors x and y."""
z = -x/100
N = len(x)
for i in range(N):
# Step
示例6: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
#===============================================================================
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
print ' Set up Domain first...'
length = 24.
width = 5.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_flow_algorithm('DE1')
domain.set_name('flat_fill_slice_erosion') # Output name
print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2,
'xmomentum': 2,
'ymomentum': 2})
domain.set_quantity('elevation', topography) # elevation is a function
domain.set_quantity('friction', 0.01) # Constant friction
domain.set_quantity('stage', expression='elevation') # Dry initial condition
#------------------------------------------------------------------------------
# Setup boundary conditions
示例7: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
from anuga import Domain
from anuga import Reflective_boundary
from anuga import Dirichlet_boundary
from anuga import Time_boundary
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 24.
width = 5.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name('set_elevation') # Output name
print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2})
#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
def topography_dam(x,y):
"""Complex topography defined by a function of vectors x and y."""
z = -x/100
N = len(x)
for i in range(N):
# Step
示例8: len
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
# Print some stats about mesh and domain
print 'Number of triangles = ', len(domain)
print 'The extent is ', domain.get_extent()
print domain.statistics()
domain.set_quantity('elevation',
filename = filename_root + '.pts',
use_cache = False,
verbose = True,
alpha = 0.1)
domain.set_flow_algorithm('DE0')
domain.set_name('run_raster_sed_transport') # Output name
domain.set_store_vertices_uniquely(True)
domain.set_quantity('stage', expression='elevation') # Dry initial condition
"""
Store process-specific quantities with same functions
"""
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2,
'xmomentum': 2,
'ymomentum': 2,
'concentration': 2})
#------------------------------------------------------------------------------
# Setup boundary conditions
示例9: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
uana= ( mann**(-2.)*abs(bedslope)*fluxin**(4./3.) )**(3./10.) # Velocity
dana= fluxin/uana # Depth
args = anuga.get_args()
alg = args.alg
verbose = args.verbose
#------------------------------------------------------------------------------
# Setup sequential computational domain
#------------------------------------------------------------------------------
if myid == 0:
points, vertices, boundary = rectangular_cross(40, 10, len1=400.0, len2=100.0)
domain = Domain(points, vertices, boundary) # Create domain
domain.set_name('channel') # Output name
domain.set_flow_algorithm(alg)
#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
def topography(x, y):
return -x/10. # linear bed slope
def init_stage(x,y):
stg= -x/10.+0.004 # Constant depth: 10 cm.
return stg
示例10: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 15.
width = 4.
dx = dy = 0.25 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
evolved_quantities = ['stage', 'xmomentum', 'ymomentum', 'elevation','concentration']
domain = Domain(points, vertices, boundary, evolved_quantities=evolved_quantities)
domain.set_flow_algorithm('DE0')
domain.set_name('veg_sed') # Output name
# domain.set_store_vertices_uniquely(True)
# print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2,
'xmomentum': 2,
'ymomentum': 2,
'concentration': 2})
domain.set_quantity('elevation', topography) # elevation is a function
domain.set_quantity('friction', 0.01) # Constant friction
domain.set_quantity('stage', topography) # Dry initial condition
示例11: setup_domain
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
def setup_domain(simulation):
args = simulation.args
verbose = args.verbose
alg = args.alg
N = args.N
S = args.S
E = args.E
W = args.W
from catchment_info import create_catchment_list
from catchment_info import create_manning_list
CatchmentList = create_catchment_list(simulation)
ManningList = create_manning_list(simulation)
#------------------------------------------------------------------------------
# CREATING MESH
#------------------------------------------------------------------------------
bounding_polygon = [[W, S], [E, S], [E, N], [W, N]]
#interior_regions = read_polygon_dir(CatchmentDictionary, join('Model', 'Bdy'))
interior_regions = read_polygon_list(CatchmentList)
# FIXME: Have these in a shapefile / other file and read them in
breaklines=[[[306612.336559443,6193708.75358065],
[306604.441364239,6193693.17994946]],
[[306977.886673843,6193753.44134088],
[306978.027867398,6193710.94208076]],
[[306956.001672788,6193750.89985688],
[306956.707640564,6193706.14149989]],
[[306627.303076293,6193697.45809624],
[306620.525785644,6193683.62112783]],
[[307236.83565407,6193741.01630802],
[307231.682089306,6193721.03741996]],
[[307224.975395434,6193742.71063068],
[307220.880782334,6193723.36711362]],
[[307624.764946969,6193615.98941489],
[307617.98765632,6193601.44647871]],
[[307613.328268998,6193623.19028621],
[307607.751123568,6193610.97704368]]]
# Make the mesh
create_mesh_from_regions(bounding_polygon,
boundary_tags={'south': [0], 'east': [1], 'north': [2], 'west': [3]},
maximum_triangle_area=args.maximum_triangle_area,
interior_regions=interior_regions,
filename=args.meshname,
breaklines=breaklines,
use_cache=False,
verbose=True)
#------------------------------------------------------------------------------
# SETUP COMPUTATIONAL DOMAIN
#------------------------------------------------------------------------------
domain = Domain(args.meshname, use_cache=False, verbose=True)
domain.set_flow_algorithm(alg)
if(not domain.get_using_discontinuous_elevation()):
raise Exception, 'This model run relies on a discontinuous elevation solver (because of how topography is set up)'
domain.set_datadir(args.model_output_dir)
domain.set_name(args.outname)
print domain.statistics()
#------------------------------------------------------------------------------
# APPLY MANNING'S ROUGHNESSES
#------------------------------------------------------------------------------
if verbose: print 'Calculating complicated polygon friction function'
friction_list = read_polygon_list(ManningList)
domain.set_quantity('friction', Polygon_function(friction_list, default=args.base_friction, geo_reference=domain.geo_reference))
# Set a Initial Water Level over the Domain
domain.set_quantity('stage', 0)
# Decompress the zip file to make a csv for reading
zipfile.ZipFile('DEM_bridges/towradgi_cleaner.zip').extract('towradgi.csv',path='DEM_bridges/')
if verbose: print 'Setting up elevation interpolation function'
from anuga.utilities.quantity_setting_functions import make_nearestNeighbour_quantity_function
elev_xyz=numpy.genfromtxt(fname=args.basename+'.csv',delimiter=',')
# Use nearest-neighbour interpolation of elevation
elev_fun_wrapper=make_nearestNeighbour_quantity_function(elev_xyz,domain)
if verbose: print 'Applying elevation interpolation function'
domain.set_quantity('elevation', elev_fun_wrapper, location='centroids')
os.remove('DEM_bridges/towradgi.csv') # Clean up csv file
return domain
示例12: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
print ' Set up Domain first...'
length = 15.
width = 4.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
evolved_quantities = ['stage', 'xmomentum', 'ymomentum', 'elevation', 'concentration']
domain = Domain(points, vertices, boundary, evolved_quantities=evolved_quantities)
domain.set_flow_algorithm('DE0')
domain.set_name('low_pole') # Output name
# domain.set_store_vertices_uniquely(True)
print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2,#
# 'xmomentum': 2,
# 'ymomentum': 2,
'concentration': 2})
domain.set_quantity('concentration', 0.01)
domain.set_quantity('elevation', topography) # elevation is a function
domain.set_quantity('friction', 0.01) # Constant friction
domain.set_quantity('stage', expression='elevation') # Dry initial condition
示例13: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
from anuga import Domain
from anuga import Reflective_boundary
from anuga import Dirichlet_boundary
from anuga import Time_boundary
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 24.
width = 5.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name()
print domain.statistics()
domain.set_quantities_to_be_stored({'elevation': 2,
'stage': 2,
'xmomentum': 2,
'ymomentum': 2})
#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
def topography_dam(x,y):
"""Complex topography defined by a function of vectors x and y."""
z = -x/100
# Step
示例14: Domain
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
from math import sin, pi, exp
from anuga import Domain
from anuga import myid, finalize, distribute
args = anuga.get_args()
alg = args.alg
verbose = args.verbose
if myid == 0:
# ---------
# Setup computational domain
# ---------
points, vertices, boundary = anuga.rectangular_cross(100, 3, len1=1.0, len2=0.03)
domain = Domain(points, vertices, boundary) # Create Domain
domain.set_name("runup") # Output to file runup.sww
domain.set_datadir(".") # Use current folder
domain.set_quantities_to_be_stored({"stage": 2, "xmomentum": 2, "ymomentum": 2, "elevation": 1})
domain.set_flow_algorithm(alg)
# ------------------
# Define topography
# ------------------
def topography(x, y):
return -x / 2 # Linear bed slope
def stagefun(x, y):
return -0.45 # Stage
domain.set_quantity("elevation", topography) # Use function for elevation
domain.get_quantity(
示例15: rectangular_cross
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import set_name [as 别名]
from anuga import Dirichlet_boundary
from anuga import Time_boundary
import os
#------------------------------------------------------------------------------
# Setup computational domain
#------------------------------------------------------------------------------
length = 24.
width = 5.
dx = dy = 0.2 #.1 # Resolution: Length of subdivisions on both axes
points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),
len1=length, len2=width)
domain = Domain(points, vertices, boundary)
domain.set_name() # Output name based on script name. You can add timestamp=True
print domain.statistics()
#------------------------------------------------------------------------------
# Setup initial conditions
#------------------------------------------------------------------------------
def topography(x,y):
"""Complex topography defined by a function of vectors x and y."""
z = -x/100
# Step
id = (2 < x) & (x < 4)
z[id] += 0.4 - 0.05*y[id]