/[escript]/trunk/finley/test/python/generate_dumps.py
ViewVC logotype

Contents of /trunk/finley/test/python/generate_dumps.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2189 - (show annotations)
Tue Dec 23 04:24:37 2008 UTC (10 years, 7 months ago) by caltinay
File MIME type: text/x-python
File size: 3491 byte(s)
Changed generate_dumps script to use saveESD().


1 ########################################################
2 #
3 # Copyright (c) 2003-2008 by University of Queensland
4 # Earth Systems Science Computational Center (ESSCC)
5 # http://www.uq.edu.au/esscc
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 ########################################################
12
13 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
14 Earth Systems Science Computational Center (ESSCC)
15 http://www.uq.edu.au/esscc
16 Primary Business: Queensland, Australia"""
17 __license__="""Licensed under the Open Software License version 3.0
18 http://www.opensource.org/licenses/osl-3.0.php"""
19 __url__="http://www.uq.edu.au/esscc/escript-finley"
20 """
21 this script generates dump files of various data type (scalar, vector, tensor)
22 on various function spaces.
23
24 The meshes are read from the MESH_DIRECTORY. filenames need to start with "mesh_" and
25 have the extension ".fly". Besides the mesh dump files (extension ".nc") and the
26 coresponding data files with extensions (_<fs_name>_s.nc, _<fs_name>_v.nc and _<fs_name>_t.nc where
27 <fs_name> is the name of the function space)
28
29 This script can run under MPI.
30
31 """
32
33 MESH_DIRECTORY="./tmp_meshes"
34 from esys.escript import *
35 from esys.finley import ReadMesh
36 import os
37
38 for root, dirs, files in os.walk(MESH_DIRECTORY, topdown=False):
39 for name in files:
40 f=name.split(".")
41 if f[0].startswith("mesh_") and f[-1]=="fly":
42 print "Reading "+os.path.join(MESH_DIRECTORY,name)
43 dom=ReadMesh(os.path.join(MESH_DIRECTORY,name),optimize=True)
44 for fs_name in ["ContinuousFunction", "Solution", "Function", "FunctionOnBoundary", "FunctionOnContactZero", "FunctionOnContactOne",
45 "ReducedContinuousFunction", "ReducedSolution", "ReducedFunction", "ReducedFunctionOnBoundary", "ReducedFunctionOnContactZero", "ReducedFunctionOnContactOne"]:
46 if fs_name == "ContinuousFunction":
47 fs = ContinuousFunction(dom)
48 if fs_name == "Solution":
49 fs = Solution(dom)
50 if fs_name == "Function":
51 fs = Function(dom)
52 if fs_name == "FunctionOnBoundary":
53 fs = FunctionOnBoundary(dom)
54 if fs_name == "FunctionOnContactZero":
55 fs = FunctionOnContactZero(dom)
56 if fs_name == "FunctionOnContactOne":
57 fs = FunctionOnContactOne(dom)
58 if fs_name == "ReducedContinuousFunction":
59 fs = ReducedContinuousFunction(dom)
60 if fs_name == "ReducedSolution":
61 fs = ReducedSolution(dom)
62 if fs_name == "ReducedFunction":
63 fs = ReducedFunction(dom)
64 if fs_name == "ReducedFunctionOnBoundary":
65 fs = ReducedFunctionOnBoundary(dom)
66 if fs_name == "ReducedFunctionOnContactZero":
67 fs = ReducedFunctionOnContactZero(dom)
68 if fs_name == "ReducedFunctionOnContactOne":
69 fs = ReducedFunctionOnContactOne(dom)
70 x=fs.getX()
71 v=normalize(x)/clip(length(x-Vector(0.5,fs)), 1.e-8)
72 t=outer(v,x)
73 s=length(x-Vector(0.5,fs))
74 datasetName=f[0]+"_"+fs_name
75 try:
76 saveESD(datasetName, MESH_DIRECTORY, s=s, v=v, t=t)
77 except:
78 print "Could not save ESD file "+datasetName
79

  ViewVC Help
Powered by ViewVC 1.1.26