/[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 4213 - (hide annotations)
Tue Feb 19 01:16:29 2013 UTC (6 years, 8 months ago) by caltinay
File MIME type: text/x-python
File size: 2151 byte(s)
Some cleanup and more consistent logging.

1 caltinay 3947
2 jfenwick 3981 ##############################################################################
3 caltinay 3947 #
4 jfenwick 4154 # Copyright (c) 2003-2013 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 jfenwick 4154 __copyright__="""Copyright (c) 2003-2013 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 os
24 caltinay 4060 from esys.downunder import *
25 caltinay 3947 from esys.escript import unitsSI as U
26 caltinay 4060 from esys.weipa import saveSilo
27 caltinay 3947
28    
29     try:
30     WORKDIR=os.environ['DOWNUNDER_WORKDIR']
31     except KeyError:
32     WORKDIR='.'
33    
34 caltinay 4060 features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
35 gross 4102 x=22*U.km, y=3*U.km, depth=10*U.km, v_inner=200., v_outer=1e-6),\
36 caltinay 4060 SmoothAnomaly(lx=25*U.km, ly=20*U.km, lz=20*U.km,
37 gross 4102 x=40*U.km, y=1*U.km, depth=22*U.km, v_inner=-500., v_outer=1e-6),\
38 caltinay 4060 SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
39 gross 4102 x=68*U.km, y=3*U.km, depth=13*U.km, v_inner=200., v_outer=1e-6)]
40 caltinay 3947
41 gross 4115 source=SyntheticFeatureData(DataSource.GRAVITY, DIM=2, number_of_elements=220, length=100*U.km, features=features)
42 caltinay 4060 domainbuilder=DomainBuilder(dim=2)
43     domainbuilder.addSource(source)
44 caltinay 4108 domainbuilder.setElementPadding(20)
45 gross 4102 domainbuilder.setVerticalExtents(depth=50*U.km, air_layer=20*U.km, num_cells=25)
46 gross 4033
47 caltinay 3947 inv=GravityInversion()
48 gross 4122 inv.setup(domainbuilder)
49 gross 4079 inv.setSolverTolerance(1e-4)
50 gross 4121 inv.setSolverMaxIterations(40)
51 gross 4122 inv.getCostFunction().setTradeOffFactorsModels(10)
52 gross 4033
53 caltinay 3947 rho_new=inv.run()
54 caltinay 4213 print("rho_new = %s"%rho_new)
55     print("rho = %s"%source.getReferenceProperty())
56 gross 4123 g, chi = inv.getCostFunction().getForwardModel().getSurvey(0)
57 gross 4115 saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceProperty(), g=g, chi=chi)
58 caltinay 3947

  ViewVC Help
Powered by ViewVC 1.1.26