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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4657 - (show annotations)
Thu Feb 6 06:12:20 2014 UTC (5 years, 10 months ago) by jfenwick
File MIME type: text/x-python
File size: 2219 byte(s)
I changed some files.
Updated copyright notices, added GeoComp.



1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
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 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 import os
25 from esys.downunder import *
26 from esys.escript import unitsSI as U
27 from esys.weipa import saveSilo
28
29
30 try:
31 WORKDIR=os.environ['DOWNUNDER_WORKDIR']
32 except KeyError:
33 WORKDIR='.'
34
35 features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
36 x=22*U.km, y=3*U.km, depth=10*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=40*U.km, y=1*U.km, depth=22*U.km, v_inner=-500., 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=13*U.km, v_inner=200., v_outer=1e-6)]
41
42 source=SyntheticFeatureData(DataSource.GRAVITY, DIM=2, number_of_elements=220, length=100*U.km, features=features)
43 domainbuilder=DomainBuilder(dim=2)
44 domainbuilder.addSource(source)
45 domainbuilder.setElementPadding(20)
46 domainbuilder.setVerticalExtents(depth=50*U.km, air_layer=20*U.km, num_cells=25)
47
48 inv=GravityInversion()
49 inv.setup(domainbuilder)
50 inv.setSolverTolerance(1e-4)
51 inv.setSolverMaxIterations(40)
52 inv.getCostFunction().setTradeOffFactorsModels(10)
53
54 rho_new=inv.run()
55 print("rho_new = %s"%rho_new)
56 print("rho = %s"%source.getReferenceProperty())
57 g, chi = inv.getCostFunction().getForwardModel().getSurvey(0)
58 saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceProperty(), g=g, chi=chi)
59

  ViewVC Help
Powered by ViewVC 1.1.26