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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4106 - (show annotations)
Thu Dec 13 05:08:44 2012 UTC (6 years, 11 months ago) by gross
File MIME type: text/x-python
File size: 2238 byte(s)
some clarification on how to handle back ground magnetic field plus renaming of SyntheticData
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 try:
30 WORKDIR=os.environ['DOWNUNDER_WORKDIR']
31 except KeyError:
32 WORKDIR='.'
33
34 features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
35 x=8*U.km, y=3*U.km, depth=2.5*U.km, v_inner=2., v_outer=1e-6),\
36 SmoothAnomaly(lx=25*U.km, ly=20*U.km, lz=20*U.km,
37 x=30*U.km, y=1*U.km, depth=18*U.km, v_inner=-1., v_outer=1e-6),\
38 SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \
39 x=68*U.km, y=3*U.km, depth=5*U.km, v_inner=20., v_outer=1e-6)]
40
41 B_b=simpleBackgroundMagneticField(latitude=-28.5)
42
43 logger=logging.getLogger('inv')
44 logger.setLevel(logging.INFO)
45 handler=logging.StreamHandler()
46 handler.setLevel(logging.INFO)
47 logger.addHandler(handler)
48 source=SyntheticFeatureData(DataSource.MAGNETIC, DIM=2, NE=30, l=100*U.km, features=features, B_b=B_b)
49
50 domainbuilder=DomainBuilder(dim=2)
51 domainbuilder.addSource(source)
52 domainbuilder.setPadding(10)
53 domainbuilder.setVerticalExtents(depth=30*U.km, air_layer=10*U.km, num_cells=16)
54 domainbuilder.setBackgroundMagneticField(B_b)
55
56 inv=MagneticInversion()
57 inv.setSolverTolerance(1e-4)
58 inv.setSolverMaxIterations(10)
59 inv.setup(domainbuilder)
60 k_new = inv.run()
61 B, chi = inv.getForwardModel().getSurvey(0)
62 saveSilo(os.path.join(WORKDIR, 'maginv'), sus=k_new, sus_ref=source.getReferenceSusceptibility(), B=B, chi=chi)
63

  ViewVC Help
Powered by ViewVC 1.1.26