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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4125 - (show annotations)
Wed Jan 2 06:15:00 2013 UTC (6 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 2518 byte(s)
some fixes in the inversion set-up
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-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) 2003-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 logging
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 logger=logging.getLogger('inv')
35 logger.setLevel(logging.DEBUG)
36 handler=logging.StreamHandler()
37 handler.setLevel(logging.DEBUG)
38 logger.addHandler(handler)
39
40 # interesting parameter:
41 n_humbs_h= 3
42 n_humbs_v=1
43 mu=100
44 n_cells_in_data=100
45 # ignore:
46 full_knowledge=False
47 depth_offset=0.*U.km
48 #
49 n_cells_in_data=max(n_humbs_h*7,n_cells_in_data)
50 l_data = 100 * U.km
51 l_pad=40*U.km
52 THICKNESS=20.*U.km
53 l_air=20*U.km
54 n_cells_v=max(int((2*l_air+THICKNESS+depth_offset)/l_data*n_cells_in_data + 0.5), 25)
55
56
57 source=SyntheticData(DataSource.GRAVITY,n_length=n_humbs_h, n_depth=n_humbs_v, depth=THICKNESS+depth_offset, depth_offset=depth_offset,
58 DIM=2, number_of_elements =n_cells_in_data, length=l_data,
59 data_offset=0,full_knowledge=full_knowledge, spherical=False)
60
61
62 domainbuilder=DomainBuilder(dim=2)
63 domainbuilder.addSource(source)
64 domainbuilder.setVerticalExtents(depth=l_air+THICKNESS+depth_offset, air_layer=l_air, num_cells=n_cells_v)
65 domainbuilder.setPadding(l_pad)
66 domainbuilder.fixDensityBelow(depth=THICKNESS+depth_offset)
67
68 inv=GravityInversion()
69 inv.setSolverTolerance(1e-4)
70 inv.setSolverMaxIterations(50)
71 inv.setup(domainbuilder)
72 inv.getCostFunction().setTradeOffFactorsModels(mu)
73
74 rho_new=inv.run()
75 print "rho_new = ",rho_new
76 print "rho =", source.getReferenceProperty()
77 g, chi = inv.getCostFunction().getForwardModel().getSurvey(0)
78 saveSilo(os.path.join(WORKDIR, 'gravinv'), density=rho_new, density_ref=source.getReferenceProperty(), g=g, chi=chi)
79

  ViewVC Help
Powered by ViewVC 1.1.26