~fluidity-core/fluidity/sediment_restructure

« back to all changes in this revision

Viewing changes to tests/sw_fsphere/Williamson_RHwave.py

merge with branch including remap_surface_to_field but then removed this change and approached it a different way which seems to work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from math import pi, cos, sin
2
 
from fluidity.spheretools import cart2polar
3
 
 
4
 
a=6.37122e6
5
 
K=7.848e-6
6
 
R=4
7
 
omega=7.292e-5
8
 
w=K
9
 
h0=8e3
10
 
g=9.80616
11
 
 
12
 
def initial_velocity():
13
 
 
14
 
    def sol(X,t):
15
 
        theta=2*pi*X[0]/360.0
16
 
        phi=2*pi*X[1]/360.0
17
 
        
18
 
        u=a*w*cos(phi)+a*K*cos(phi)**(R-1)*(R*sin(phi)**2-cos(phi)**2)*cos(R*phi)
19
 
        v=-a*K*R*cos(phi)**(R-1)*sin(phi)*sin(R*phi)
20
 
        return ([u,v])
21
 
 
22
 
    return sol
23
 
 
24
 
def initial_height():
25
 
 
26
 
    def sol(X,t):
27
 
        ([theta,phi])=cart2polar(X)
28
 
 
29
 
        A=0.5*w*(2*omega+w)*cos(phi)**2+0.25*K**2*cos(phi)**(2*R)*((R+1)*cos(phi)**2+(2*R**2-R-2)-2*R**2*cos(phi)**-2)
30
 
        B=((2*(omega+w)*K)/((R+1)*(R+2)))*cos(phi)**R*((R**2+2*R+2)-(R+1)**2*cos(phi)**2)
31
 
        C=0.25*K**2*cos(phi)**(2*R)*((R+1)*cos(phi)**2-(R+2))
32
 
 
33
 
        return h0+(a**2/g)*(A+B*cos(R*phi)+C*cos(2*R*phi))
34
 
 
35
 
    return sol