Changeset 9265
- Timestamp:
- Jul 14, 2014, 4:48:21 PM (11 years ago)
- Location:
- trunk/anuga_core
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/config.py
r9148 r9265 34 34 # Major revision number for use with create_distribution 35 35 # and update_anuga_user_guide 36 major_revision = '1.3. 0-beta'36 major_revision = '1.3.1' 37 37 38 38 ################################################################################ -
trunk/anuga_core/user_manual/source/anuga_user_manual.tex
r9090 r9265 29 29 \usepackage{graphicx} 30 30 \usepackage{hyperref} 31 \usepackage[ english]{babel}31 \usepackage[australian]{babel} 32 32 \usepackage{datetime} 33 33 \usepackage[hang,small,bf]{caption} … … 246 246 \item All spatial coordinates are assumed to be UTM (meters). As such, 247 247 \anuga is unsuitable for modelling flows in areas larger than one UTM zone 248 (6 degrees wide). 248 (6 degrees wide), though we have run over 2 zones by projecting onto one zone and 249 living with the distortion. 249 250 \item Fluid is assumed to be inviscid -- i.e.\ no kinematic viscosity included. 250 251 \item The finite volume is a very robust and flexible numerical technique, … … 275 276 276 277 What follows is a discussion of the structure and operation of a 277 script called \file{runup.py}. 278 script called \file{runup.py} (which is available in the \file{demos} directory 279 of \file{anuga_core}. 278 280 279 281 This example carries out the solution of the shallow-water wave … … 331 333 332 334 \label{ref:runup_py_code} 333 \verbatiminput{demos/runup.py} 335 \verbatiminput{../../demos/runup.py} 336 334 337 335 338 \subsection{Establishing the Domain}\index{domain, establishing} 336 339 337 The first task is to set up the triangular mesh to be used for the 340 The very first thing to do is import the various modules, of which the 341 \anuga{} module is the most important. 342 % 343 \begin{verbatim} 344 import anuga 345 \end{verbatim} 346 % 347 Then we need to set up the triangular mesh to be used for the 338 348 scenario. This is carried out through the statement: 339 349 … … 341 351 domain = anuga.rectangular_cross_domain(10, 5, len1=10.0, len2=5.0) 342 352 \end{verbatim} 343 353 % 344 354 The above assignment sets up a $10 \times 345 355 5$ rectangular mesh, triangulated in a regular way with boundary tags \code{'left'}, \code{'right'}, … … 350 360 domain = anuga.Domain(points, vertices, boundary) 351 361 \end{verbatim} 352 %353 362 where 354 363 \begin{itemize} … … 909 918 Here is the code for \file{runcairns.py}: 910 919 911 \verbatiminput{ demos/cairns/runcairns.py}920 \verbatiminput{../../demos/cairns/runcairns.py} 912 921 913 922 In discussing the details of this example, we follow the outline … … 970 979 \file{project.py}: 971 980 972 \verbatiminput{ demos/cairns/project.py}981 \verbatiminput{../../demos/cairns/project.py} 973 982 974 983 Figure \ref{fig:cairns3d} illustrates the landscape of the region … … 1326 1335 \end{figure} 1327 1336 1337 1338 \section{A Parallel Simulation} 1339 1340 The previous examples were run just using one processor. \anuga also has the option of running in parallel using \mpi. 1341 1342 Such jobs are run using the command 1343 1344 \begin{verbatim} 1345 mpirun -np n python runParallelCairns.py 1346 \end{verbatim} 1347 where \code{n} is the total number of processors being used for the parallel run. 1348 1349 Essentially we can expect speedups comparable to the number of cores available. This is measured via scalablity. We can expect scalability of 70\% when using up to the number of processors so that the local partitioned domains contain around 2000 triangles. 1350 1351 \subsection{The Code} 1352 1353 Here is the code for \file{runParallelCairns.py}: 1354 1355 \verbatiminput{../../demos/cairns/runParallelCairns.py} 1356 1357 \subsection{Structure of the Code} 1358 1359 The code is very similar to the sequential code. The same procedures are used to setup the domain, setup the inital conditions, boundary conditions and evolve. 1360 1361 1362 We first import a few procedures need forthe parallel code. 1363 \begin{verbatim} 1364 from anuga import distribute, myid, numprocs, finalize, barrier 1365 \end{verbatim} 1366 1367 \code{myid} returns the id of the current processor running the code. 1368 1369 \code{numprocs} returns the total number of processors involved in this parallel jobs (the \code{n} in the original \code{mpirun} command. 1370 1371 \code{finalize} is called at the end of a script to close down the parallel job. 1372 1373 \code{distribute} is used to partition and setup the parallel domains. 1374 1375 \code{barrier} is a command for processors to wait as all the other processor to catchup to this point. 1376 1377 1378 1379 1380 The creation of the \code{domain} is only done on processor 0. Hence we have the structure: 1381 1382 \begin{verbatim} 1383 #------------------------------------- 1384 # Do the domain creation on processor 0 1385 #------------------------------------- 1386 if myid == 0: 1387 .... 1388 domain = ... 1389 1390 else: 1391 domain = None 1392 \end{verbatim} 1393 1394 We only need to create the original domain on one processor, otherwise we will have multiple copies of the full domain (which will easily eat up our memory). 1395 1396 Once we have our code{domain} setup we partition it and send the partitions to each of the other processors, via the command 1397 1398 \begin{verbatim} 1399 #------------------------------------- 1400 # Now produce paralle domain 1401 #------------------------------------- 1402 domain = distribute(domain) 1403 \end{verbatim} 1404 1405 This takes the \code{domain} on processor 0 and distributes that domain to each of the processors, (it overwrites the full domain on processor 0). From this point of the code, there is a different domain on each processor, with each domain comunicating with the other domains to ensure required transfer of inforation to allow flow over the combined domains. 1406 1407 It is important to apply the boundary conditions after the \code{distribute} 1408 1409 1410 1411 As the partitoined domain evolve, they will store their data to individual sww files, named as \code{domain_name_Pn_m.sww}, where \code{n} is the total number of processors being used and \code{m} is the specific processor id. 1412 1413 We have a procedure to merge these individual sww files via the command 1414 1415 \begin{verbatim} 1416 domain.sww_merge() 1417 \end{verbatim} 1418 1419 And we close down the parallel job by issuing the command 1420 1421 \begin{verbatim} 1422 finalize() 1423 \end{verbatim} 1424 1425 1426 1427 \section{Validation Tests} 1428 1429 We have an extensive suite of validation tests, ranging from simple analytical tests to large scale case studies. These can be found in the \file{validation_tests} directory in the \file{anuga_core} directory. 1430 1431 All these tests can be run in parallel or in sequential mode, and they also provide the mechanism to produce a report detailing the results of the test. (pdfLatex needs to be available to produce the reports). 1432 1433 1434 1328 1435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1329 1436 … … 1396 1503 use in Python code. For example, suppose we wish to specify that the 1397 1504 function \function{create\_mesh\_from\_regions} is in a module called 1398 \module{mesh\_interface} in a subfolder of \module{ inundation} called1505 \module{mesh\_interface} in a subfolder of \module{anuga} called 1399 1506 \code{pmesh}. In Linux or Unix syntax, the pathname of the file 1400 containing the function, relative to \file{ inundation}, would be:1507 containing the function, relative to \file{anuga}, would be: 1401 1508 1402 1509 \begin{verbatim} … … 4217 4324 %\begin{center} 4218 4325 %\pgfplotstableset{% could be used in preamble 4219 %empty cells with={--}, % replace empty cells with --4326 %empty cells with={--}, % replace empty cells with ᅵ--ᅵ 4220 4327 %every head row/.style={% 4221 4328 % before row={% -
trunk/anuga_core/user_manual/source/manual_example.tex
r9090 r9265 7 7 8 8 \documentclass{manual} 9 10 11 \usepackage{graphicx} 12 \usepackage{hyperref} 13 %\usepackage[english]{babel} 14 \usepackage{datetime} 15 \usepackage[hang,small,bf]{caption} 16 \usepackage{amsbsy,enumerate} 17 18 \usepackage{amsmath, amssymb, amsthm} 9 19 10 20 \title{Big Python Manual} -
trunk/anuga_core/validation_tests/case_studies/towradgi/Compare_results_with_fieldObs.py
r9238 r9265 64 64 CellSize=CellSize,EPSG_CODE=32756,output_dir=tif_outdir) 65 65 print 'Made tifs' 66 # Plot depth raster with discrepency between model and data67 depthFile=tif_outdir+'/Towradgi_historic_flood_depth_max_max.tif'68 myDepth=scipy.misc.imread(depthFile)69 X=scipy.arange(p.xllcorner, p.xllcorner+myDepth.shape[1]*CellSize, CellSize)70 Y=scipy.arange(p.yllcorner, p.yllcorner+myDepth.shape[0]*CellSize, CellSize)71 X,Y=scipy.meshgrid(X,Y)72 pyplot.clf()73 pyplot.figure(figsize=(12,6))74 pyplot.plot([X.min(),X.max()],[Y.min(),Y.max()],' ')75 pyplot.imshow(scipy.flipud(myDepth),extent=[X.min(),X.max(),Y.min(),Y.max()],origin='lower',cmap=pyplot.get_cmap('Greys'))76 pyplot.gca().set_aspect('equal')77 pyplot.colorbar(orientation='horizontal').set_label('Peak Depth in model (m)')78 er1=floodLevels[:,3]-modelled_level79 pyplot.scatter(floodLevels[:,0], floodLevels[:,1], c=er1,s=20,cmap=pyplot.get_cmap('spectral'))80 pyplot.colorbar().set_label(label='Field observation - Modelled Peak Stage (m)')81 pyplot.xlim([p.x.min()+p.xllcorner,p.x.max()+p.xllcorner])82 pyplot.ylim([p.y.min()+p.yllcorner,p.y.max()+p.yllcorner])83 pyplot.savefig('Spatial_Depth_and_Error.png')84 66 except: 85 67 print 'Cannot make GIS plot -- perhaps GDAL etc are not installed?' 68 69 70 # Plot depth raster with discrepency between model and data 71 depthFile=tif_outdir+'/Towradgi_historic_flood_depth_max.tif' 72 myDepth=scipy.misc.imread(depthFile) 73 X=scipy.arange(p.xllcorner, p.xllcorner+myDepth.shape[1]*CellSize, CellSize) 74 Y=scipy.arange(p.yllcorner, p.yllcorner+myDepth.shape[0]*CellSize, CellSize) 75 X,Y=scipy.meshgrid(X,Y) 76 pyplot.clf() 77 pyplot.figure(figsize=(12,6)) 78 pyplot.plot([X.min(),X.max()],[Y.min(),Y.max()],' ') 79 pyplot.imshow(scipy.flipud(myDepth),extent=[X.min(),X.max(),Y.min(),Y.max()],origin='lower',cmap=pyplot.get_cmap('Greys')) 80 pyplot.gca().set_aspect('equal') 81 pyplot.colorbar(orientation='horizontal').set_label('Peak Depth in model (m)') 82 er1=floodLevels[:,3]-modelled_level 83 pyplot.scatter(floodLevels[:,0], floodLevels[:,1], c=er1,s=20,cmap=pyplot.get_cmap('spectral')) 84 pyplot.colorbar().set_label(label='Field observation - Modelled Peak Stage (m)') 85 pyplot.xlim([p.x.min()+p.xllcorner,p.x.max()+p.xllcorner]) 86 pyplot.ylim([p.y.min()+p.yllcorner,p.y.max()+p.yllcorner]) 87 pyplot.savefig('Spatial_Depth_and_Error.png') 88
Note: See TracChangeset
for help on using the changeset viewer.