Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Geodynamik-Übungen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wegener, Johannes
Geodynamik-Übungen
Commits
efd34843
Commit
efd34843
authored
3 years ago
by
Heck, Franziska
Browse files
Options
Downloads
Patches
Plain Diff
CMB
parent
8be20eed
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
AdamsWilliamsonCMB.py
+77
-0
77 additions, 0 deletions
AdamsWilliamsonCMB.py
with
77 additions
and
0 deletions
AdamsWilliamsonCMB.py
0 → 100644
+
77
−
0
View file @
efd34843
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
csv
import
scipy.integrate
as
integrate
import
os
# Einlesen der Daten
def
read_data
(
file
):
with
open
(
file
,
'
r
'
)
as
csvfile
:
csvreader
=
csv
.
reader
(
csvfile
,
delimiter
=
"
;
"
)
next
(
csvreader
)
depth
=
[]
rho
=
[]
vp
=
[]
vs
=
[]
for
row
in
csvreader
:
if
row
:
depth
.
append
(
float
(
row
[
0
]))
# km
rho
.
append
(
float
(
row
[
1
])
*
1000
)
# kg/m^3
vp
.
append
(
float
(
row
[
2
]))
# km/s
vs
.
append
(
float
(
row
[
3
]))
# km/s
return
np
.
column_stack
([
depth
]),
np
.
column_stack
([
rho
]),
np
.
column_stack
([
vp
]),
np
.
column_stack
([
vs
])
def
mass
(
r
,
rho_r
):
'''
Calculates mass of earth inside sphere of radius r.
'''
mass
=
(
4
/
3
)
*
np
.
pi
*
rho_r
*
r
**
3
return
mass
# Berechnung der Dichte
def
density_expansion
(
rho
,
vp
,
vs
,
r1
,
r2
):
'''
Returns Euler approximation for rho at r2.
Method:
rho(r+h) = rho(r) + h*d(rho)/dr(r)
'''
G
=
6.67
*
10
**
(
-
11
)
# Gravitationskonstante
phi
=
vp
**
2
-
(
4
/
3
)
*
vs
**
2
rho_r
=
rho
+
(
r2
-
r1
)
*
(
-
G
*
mass
(
r1
,
rho
)
*
rho
/
(
r1
**
2
*
phi
))
return
rho_r
file
=
os
.
getcwd
()
+
r
"
\VpVs-valuesak135.csv
"
# Einlesen der Daten
depth
,
density
,
vp
,
vs
=
read_data
(
file
)
# Tiefe, Dichte, vp, vs
# r geht vom Mittelpunkt nach außen
r
=
6371
-
depth
# Startbedingungen
rho_0
=
3000
# kg/m^3
M_0
=
5.973
*
10
**
24
# Masse in 18km Tiefe
rho
=
np
.
zeros
(
len
(
density
))
masse
=
np
.
zeros
(
len
(
density
))
masse
[
8
]
=
M_0
rho
[
8
]
=
rho_0
for
i
in
range
(
9
,
len
(
rho
)):
if
depth
[
i
]
==
2891.5
:
rho
[
i
]
=
9400
else
:
rho
[
i
]
=
density_expansion
(
rho
[
i
-
1
],
vp
[
i
-
1
],
vs
[
i
-
1
],
r
[
i
-
1
],
r
[
i
])
masse
[
i
]
=
mass
(
r
[
i
-
1
],
rho
[
i
-
1
])
print
(
rho
)
print
(
masse
)
# Berechnung von rho und M für jede Schicht
# for i in range(8, len(rho) - 1): # Die ersten Werte werden weg gelassen
# if r[i, 0] != r[i-1, 0]:
# M[i+1] = mass(r[i, 0], r[i-1, 0], rho[i])
# rho[i+1] = density(M[i+1], rho[i], vp[i, 0], vs[i, 0], r[i, 0], r[i-1, 0])
# else:
# M[i+1] = M[i]
# rho[i+1] = rho[i]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment