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

Revision 4433 - (show annotations)
Fri May 31 12:09:58 2013 UTC (5 years, 10 months ago) by gross
File MIME type: text/x-python
File size: 2143 byte(s)
```some clarifications on geodetic coordinates.
order of background magnetic flux density component has been corrected: input is now B_east, B_north, B_vertical.

```
 1 2 ############################################################################## 3 # 4 # Copyright (c) 2003-2013 by University of Queensland 5 6 # 7 # Primary Business: Queensland, Australia 8 # Licensed under the Open Software License version 3.0 9 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-2013 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 21 __url__= 22 23 import os 24 from esys.downunder import * 25 from esys.escript import unitsSI as U 26 from esys.weipa import saveSilo 27 28 try: 29 WORKDIR=os.environ['DOWNUNDER_WORKDIR'] 30 except KeyError: 31 WORKDIR='.' 32 33 features=[SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \ 34 x=8*U.km, y=3*U.km, depth=2.5*U.km, v_inner=2., v_outer=1e-6),\ 35 SmoothAnomaly(lx=25*U.km, ly=20*U.km, lz=20*U.km, 36 x=30*U.km, y=1*U.km, depth=18*U.km, v_inner=-1., v_outer=1e-6),\ 37 SmoothAnomaly(lx=30*U.km, ly=20*U.km, lz=18.*U.km, \ 38 x=68*U.km, y=3*U.km, depth=5*U.km, v_inner=20., v_outer=1e-6)] 39 40 B_b = [2201.*U.Nano*U.Tesla, 31232.*U.Nano*U.Tesla, -41405.*U.Nano*U.Tesla] 41 42 source=SyntheticFeatureData(DataSource.MAGNETIC, DIM=2, number_of_elements=30, length=100*U.km, features=features, B_b=B_b) 43 44 domainbuilder=DomainBuilder(dim=2) 45 domainbuilder.addSource(source) 46 domainbuilder.setElementPadding(10) 47 domainbuilder.setVerticalExtents(depth=30*U.km, air_layer=10*U.km, num_cells=16) 48 domainbuilder.setBackgroundMagneticFluxDensity(B_b) 49 50 inv=MagneticInversion() 51 inv.setSolverTolerance(1e-4) 52 inv.setSolverMaxIterations(10) 53 inv.setup(domainbuilder) 54 k_new = inv.run() 55 B, chi = inv.getCostFunction().getForwardModel().getSurvey(0) 56 saveSilo(os.path.join(WORKDIR, 'maginv'), sus=k_new, sus_ref=source.getReferenceProperty(), B=B, chi=chi) 57

 ViewVC Help Powered by ViewVC 1.1.26