/[escript]/trunk/doc/examples/inversion/gravityinversion.py
ViewVC logotype

Contents of /trunk/doc/examples/inversion/gravityinversion.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4122 - (show annotations)
Thu Dec 20 05:42:35 2012 UTC (7 years, 11 months ago) by gross
File MIME type: text/x-python
File size: 1625 byte(s)
More work towards joint inversion. There is now one class for inversion cost function which can handle all relevant cases 
for a single model inversion, cross gradient case and functional dependence of physical parameters.


1
2 ##############################################################################
3 #
4 # Copyright (c) 2009-2012 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 since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 __copyright__="""Copyright (c) 2009-2012 by University of Queensland
17 http://www.uq.edu.au
18 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 required modules
24 from esys.downunder import NetCdfData, DomainBuilder, GravityInversion
25 from esys.escript import unitsSI as U
26 from esys.weipa import saveSilo
27
28 # Set parameters
29 PAD_X=0.2
30 PAD_Y=0.2
31 DATASET='bouguer_anomaly.nc'
32 DEPTH=40 * U.km
33 AIR=6 * U.km
34 NE_Z=25
35
36 # Setup and run the inversion
37 source=NetCdfData(NetCdfData.GRAVITY, DATASET)
38 db=DomainBuilder()
39 db.addSource(source)
40 db.setVerticalExtents(depth=DEPTH, air_layer=AIR, num_cells=NE_Z)
41 db.setFractionalPadding(PAD_X, PAD_Y)
42 db.fixDensityBelow(depth=DEPTH)
43
44
45
46
47 inv=GravityInversion()
48 inv.setup(db)
49 inv.getCostFunction().setTradeOffFactorsModels(10.)
50
51 density=inv.run()
52
53 # Save results
54 g, w = inv.getCostFunction().getForwardModels()[0].getSurvey(0)
55 saveSilo("result.silo", density=density, gravity_anomaly=g[2], gravity_weight=w[2])
56

  ViewVC Help
Powered by ViewVC 1.1.26