/[escript]/trunk/downunder/test/python/run_gravity.py
ViewVC logotype

Annotation of /trunk/downunder/test/python/run_gravity.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4079 - (hide annotations)
Fri Nov 16 07:59:01 2012 UTC (6 years, 11 months ago) by gross
File MIME type: text/x-python
File size: 2205 byte(s)
some modifications to scaling in downunder. still not perfect.
1 caltinay 3947
2 jfenwick 3981 ##############################################################################
3 caltinay 3947 #
4     # Copyright (c) 2003-2012 by University of Queensland
5 jfenwick 3981 # http://www.uq.edu.au
6 caltinay 3947 #
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 jfenwick 3981 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     # Development since 2012 by School of Earth Sciences
13     #
14     ##############################################################################
15 caltinay 3947
16     __copyright__="""Copyright (c) 2003-2012 by University of Queensland
17 jfenwick 3981 http://www.uq.edu.au
18 caltinay 3947 Primary Business: Queensland, Australia"""
19     __license__="""Licensed under the Open Software License version 3.0
20     http://www.opensource.org/licenses/osl-3.0.php"""
21     __url__="https://launchpad.net/escript-finley"
22    
23     import logging
24     import os
25 caltinay 4060 from esys.downunder import *
26 caltinay 3947 from esys.escript import unitsSI as U
27 caltinay 4060 from esys.weipa import saveSilo
28 caltinay 3947
29    
30     try:
31     WORKDIR=os.environ['DOWNUNDER_WORKDIR']
32     except KeyError:
33     WORKDIR='.'
34    
35 caltinay 4060 features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
36     x=8*U.km, y=3*U.km, depth=2.5*U.km, v_inner=200., v_outer=1e-6),\
37     SmoothAnomaly(lx=25*U.km, ly=20*U.km, lz=20*U.km,
38     x=30*U.km, y=1*U.km, depth=18*U.km, v_inner=-200., v_outer=1e-6),\
39     SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
40     x=68*U.km, y=3*U.km, depth=5*U.km, v_inner=200., v_outer=1e-6)]
41 caltinay 3947
42     logger=logging.getLogger('inv')
43 gross 4074 logger.setLevel(logging.DEBUG)
44 caltinay 3947 handler=logging.StreamHandler()
45 gross 4079 handler.setLevel(logging.DEBUG)
46 caltinay 3947 logger.addHandler(handler)
47 gross 4079 source=SyntheticData(DataSource.GRAVITY, DIM=2, NE=60, l=100*U.km, features=features)
48 caltinay 4060 domainbuilder=DomainBuilder(dim=2)
49     domainbuilder.addSource(source)
50     domainbuilder.setPadding(10)
51     domainbuilder.setVerticalExtents(depth=30*U.km, air_layer=10*U.km, num_cells=16)
52 gross 4033
53 caltinay 3947 inv=GravityInversion()
54 gross 4079 inv.setSolverTolerance(1e-4)
55     inv.setSolverMaxIterations(40)
56 caltinay 4060 inv.setSolverOptions(initialHessian=10)
57 gross 4079 inv.setWeights(mu_model=1e-3)
58 caltinay 4060 inv.setup(domainbuilder)
59 gross 4033
60 caltinay 3947 rho_new=inv.run()
61 caltinay 4060 g, chi = inv.getForwardModel().getSurvey(0)
62 gross 4079 saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceDensity(), g=g, chi=chi)
63 caltinay 3947

  ViewVC Help
Powered by ViewVC 1.1.26