Changeset 5289
- Timestamp:
- May 7, 2008, 5:02:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/circular_island/simple_circular/circular.py
r5285 r5289 13 13 from anuga.shallow_water import Time_boundary 14 14 from anuga.pmesh.mesh_interface import create_mesh_from_regions 15 from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary 16 from math import tan, sqrt, sin, pi 15 17 16 18 #------------------------------------------------------------------------------ … … 19 21 length = 30. 20 22 width = 25. 23 Cx = 12.96 # centre of island on the x axis 24 Cy = 13.8 # centre of island on the y axis 21 25 dx = dy = 1 # Resolution: Length of subdivisions on both axes 26 water_depth = 0.32 22 27 23 #Define polygon so that 0,0 is the centre - unstructured mesh 24 ##poly_domain = [[-width/2,length/2],[width/2,length/2], 25 ## [width/2,-length/2],[-width/2,-length/2]] 28 #boundary 26 29 poly_domain = [[0,0],[length,0],[length,width],[0,width]] 27 30 meshname = 'test.msh' … … 29 32 30 33 #Create interior region 31 #Dome = [[-4,4],[4,4],[4,-4],[-4,-4]] 32 Dome = [[(length/2)-4,(width/2)-4],[(length/2)+4,(width/2)-4,], 33 [(length/2)+4,(width/2)+4],[(length/2)-4,(width/2)+4]] 34 remainder_res= 534 Dome = [[(Cx)-4,(Cy)-4],[(Cx)+4,(Cy)-4,], 35 [(Cx)+4,(Cy)+4],[(Cx)-4,(Cy)+4]] 36 37 remainder_res=1 35 38 Dome_res = .01 39 36 40 interior_dome = [[Dome, Dome_res]] 37 41 … … 43 47 filename=meshname, 44 48 interior_regions = interior_dome, 45 use_cache= False,49 use_cache=True, 46 50 verbose=True) 47 51 48 domain = Domain(meshname, use_cache= False, verbose = True)52 domain = Domain(meshname, use_cache=True, verbose = True) 49 53 domain.set_name('circular') # Output name 50 54 print domain.statistics() … … 57 61 """ 58 62 59 water_depth = 0.32 60 z= 0*x 63 64 z= 0*x # defining z for all values other than the if statements 65 r= 3.6 # radius, provided in document 66 angle = 14 # angle, provided in document 67 h= r*tan(angle/57.2957795) # finding height of cone if not truncated 68 61 69 62 70 N = len(x) 63 ## print 'Hello',N64 ## from Numeric import zeros65 ## z = zeros(N)66 71 for i in range(N): 67 68 """# Square 69 if (-2<x[i]-length/2<2) and (-2 <y[i]-width/2< 2): 70 z[i] += 2""" 71 #print 'Hello',i,x[i],y[i],z[i] 72 # dome 73 #if (x[i]-length/2)**2 + (y[i]-width/2)**2 <1.1**2: 74 if (x[i]-length/2)**2 + (y[i]-width/2)**2 <1.1**2: 72 73 #truncated top 74 if (x[i]-Cx)**2 + (y[i]-Cy)**2 <1.1**2: 75 75 z[i] += 0.625 76 76 77 ## if (x[i]-length/2)**2 + (y[i]-width/2)**2 >3.6**2: 78 ## z[i] += 0 79 80 if (x[i]-length/2)**2 + (y[i]-width/2)**2 <3.6**2 and (x[i]-length/2)**2 + (y[i]-width/2)**2 >1.1**2: 81 z[i] = (x[i])/4 + 15 82 77 # cone 78 if (x[i]-Cx)**2 + (y[i]-Cy)**2 <r**2 and (x[i]-Cx)**2 + (y[i]-Cy)**2 >1.1**2: 79 z[i] = -(sqrt(((x[i]-Cx)**2+(y[i]-Cy)**2)/((r/h)**2))-h) 83 80 return z 84 85 #The cone has a 1/4 slope and a 7.2 diameter this make the height 0.9m86 # to get the stage at 0 elevation + cone height and - water depth87 88 89 90 91 ## if z <0-water_depth:92 ## z[i] =0-water_depth93 ## if z > .625-water_depth:94 ## z[i] =0.625-water_depth95 ## z.append(z)96 97 98 99 81 100 82 domain.set_quantity('elevation', topography, verbose=True) # Use function for elevation 101 83 domain.set_quantity('friction', 0.01) # Constant friction 102 domain.set_quantity('stage', 103 expression='elevation') # Dry initial condition 84 domain.set_quantity('stage',water_depth) # Dry initial condition 104 85 105 86 … … 107 88 # Setup boundary conditions 108 89 #------------------------------------------------------------------------------ 109 Bi = Dirichlet_boundary([0.4, 0, 0]) # Inflow 110 Br = Reflective_boundary(domain) # Solid reflective wall 111 Bo = Dirichlet_boundary([-5, 0, 0]) # Outflow 90 # Create boundary function from timeseries provided in file 112 91 113 domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'wavemaker': Br}) 92 ##boundary_filename="ts2cnew1_input_20_80sec_new" 93 ##prepare_timeboundary(boundary_filename+'.txt') 94 ## 95 ##function = file_function(boundary_filename+'.tms', 96 ## domain, verbose=True) 97 def wave_form(t): 98 return 0.1*sin(2*pi*t/50.) 99 100 # Create and assign boundary objects 101 Bw = Dirichlet_boundary([water_depth, 0, 0]) #wall 102 Bt = Transmissive_Momentum_Set_Stage_boundary(domain, wave_form) #wavemaker 103 domain.set_boundary({'left': Bw, 'right': Bw, 'top': Bw, 'wavemaker': Bt}) 104 105 114 106 115 107 … … 117 109 # Evolve system through time 118 110 #------------------------------------------------------------------------------ 119 for t in domain.evolve(yieldstep = 0.2, finaltime = 1 6.0):111 for t in domain.evolve(yieldstep = 0.2, finaltime = 100.0): 120 112 print domain.timestepping_statistics() 121 113 122 114 123 if domain.get_quantity('stage').\ 124 get_values(interpolation_points=[[10, 2.5]]) > 0: 125 print 'Stage > 0: Changing to outflow boundary' 126 domain.set_boundary({'right': Bo}) 115
Note: See TracChangeset
for help on using the changeset viewer.