示例#1
0
    def test_define_constant_layer_velocity(self):
        """
        Should flood a layer with one velocity
        """
        vm = VM()

        vm.insert_interface(5)

        vm.define_constant_layer_velocity(0, vel=8.5)
        self.assertAlmostEqual(vm.sl[0, 0, 0], 1. / 8.5, 6)
        
        vm.define_constant_layer_velocity(1, vel=9.5)
        self.assertAlmostEqual(1. / np.min(vm.sl), 9.5, 6)
示例#2
0
    def test_define_constant_layer_velocity(self):
        """
        Should flood a layer with one velocity
        """
        vm = VM()

        vm.insert_interface(5)

        vm.define_constant_layer_velocity(0, vel=8.5)
        self.assertAlmostEqual(vm.sl[0, 0, 0], 1. / 8.5, 6)

        vm.define_constant_layer_velocity(1, vel=9.5)
        self.assertAlmostEqual(1. / np.min(vm.sl), 9.5, 6)
示例#3
0
"""
Build a simple VM model from scratch
"""
import numpy as np
from pyvm.models.vm import VM

# create a 2D model
vm = VM(shape=(512, 1, 256), spacing=(0.5, 1, 0.1), origin=(412, 412, -2))

# add interfaces
vm.insert_interface(0)
vm.insert_interface(3)
vm.insert_interface(5)
vm.insert_interface(12)

# add velocities
vm.define_constant_layer_velocity(0, 0.333)
vm.define_stretched_layer_velocities(1, vel=[1.49, 1.51])
vm.define_stretched_layer_velocities(2, vel=[None, 2.3])
vm.define_stretched_layer_velocities(3, vel=[4.4, 6.8, 6.9, 7.2])
vm.define_constant_layer_gradient(4, 0.1)

# plot
vm.plot(aspect=10)
示例#4
0
"""
Build a simple VM model from scratch
"""
import numpy as np
from pyvm.models.vm import VM

# create a 2D model
vm = VM(shape=(512, 1, 256), spacing=(0.5, 1, 0.1),
        origin=(412, 412, -2))

# add interfaces
vm.insert_interface(0)
vm.insert_interface(3)
vm.insert_interface(5)
vm.insert_interface(12)

# add velocities
vm.define_constant_layer_velocity(0, 0.333)
vm.define_stretched_layer_velocities(1, vel=[1.49, 1.51])
vm.define_stretched_layer_velocities(2, vel=[None, 2.3])
vm.define_stretched_layer_velocities(3, vel=[4.4, 6.8, 6.9, 7.2])
vm.define_constant_layer_gradient(4, 0.1)

# plot
vm.plot(aspect=10)
示例#5
0
    z[ix] = z0 + m * (x - x[0])
    z0 = z[ix[-1]]

# expand into 3D
n = np.ones((vm.nx, 1))
for i in range(0, ny):
    n[i] = z[i]

s = np.ones((vm.nx, vm.ny))
for i in range(0, ny):
    #s = np.hstack((n,n))
    s[i, :] = n[i]

z = np.array(s)

# add the boundary
vm.insert_interface(np.reshape(z, (vm.nx, vm.ny)))

##

# add some velocities
vm.define_constant_layer_velocity(0, 4.0)  #surface
vm.define_constant_layer_velocity(1, 6.0)  #ocean

print(vm)
# plot
vm.plot()

# write
vm.write('11.11.vm')