Esempio n. 1
0
def main():
    logger = logging.Logger("primary_driver", level=logging.INFO)

    sensor_watcher = SensorWatcher()
    point_cloud_generator = PointCloudGenerator(POINT_CLOUD_FILE_NAME)
    real_time_visualizer = RealTimeVisualizer()

    sensor_watcher.add_subscriber(point_cloud_generator)
    point_cloud_generator.add_subscriber(real_time_visualizer)

    sensor_watcher.begin()

    while not sensor_watcher.finished:
        time.sleep(1)

    data_filterer = DataFilterer()
    mesh_generator = MeshGenerator()

    data_filterer.begin()

    while not data_filterer.finished:
        time.sleep(1)

    mesh_generator.begin()

    while not mesh_generator.finished:
        time.sleep(1)

    logger.info("Completed all ATLAS software :)")
def main():
    file_dict = initialize.initialize()
    logger = logging.Logger("primary_driver", level=logging.INFO)

    mesh_generator = MeshGenerator(file_dict)

    mesh_generator.begin()

    while not mesh_generator.finished:
        time.sleep(1)
        logger.info("Completed all ATLAS software :)")
Esempio n. 3
0
def main():
    logger = logging.Logger("pipeline_test", level=logging.INFO)

    configuration_dictionary = initialize.initialize()

    # We need to fake out the data passed to PointCloudGenerator. This process does so.
    parser = BluetoothParser()
    gen = PointCloudGenerator(configuration_dictionary)
    real_time_visualizer = RealTimeVisualizer(POINT_CLOUD_FILE_NAME,
                                              PACKAGE_LOCATIONS_FILE_NAME)

    # The parser expects byte data like the serial passes.
    with open(RAW_DATA_PATH, "rb") as f:
        data = f.read()

    for c in data:
        r = parser.add_data(bytes((c, )))
        if r is not None:
            gen.signal(UpdateSignal.NEW_DATA, r)

    gen.mark_finished()

    data_filterer = DataFilterer(configuration_dictionary)

    data_filterer.begin()

    while not data_filterer.finished:
        time.sleep(1)

    mesh_generator = MeshGenerator(configuration_dictionary)
    mesh_generator.begin()

    while not mesh_generator.finished:
        time.sleep(1)

    point_cloud_visualizer = PointCloudVisualizer(UNCERTAINTY_PATH)
    point_cloud_visualizer.begin()

    logger.info("Completed all ATLAS software :)")
Esempio n. 4
0
u_field = (C.x**3) * (C.y**2) * (C.z) + C.x * sin(2 * pi * C.x * C.z) * sin(
    2 * pi * C.x * C.y) * sin(2 * pi * C.z)
grad_u = nabla(u_field, doit=True)
u_func = lambdify([C.x, C.y, C.z], u_field)

K_sym = Matrix(
    ([C.y**2 + C.z**2 + 1, -C.x * C.y,
      -C.x * C.z], [-C.x * C.y, C.x**2 + C.z**2 + 1,
                    -C.y * C.z], [-C.x * C.z, -C.y * C.z,
                                  C.x**2 + C.y**2 + 1]))
K_func = lambda x, y, z: np.array([y**2 + z**2 + 1, -x*y, -x*z, \
                                -x*y, x**2 + z**2 + 1, -y*z, \
                                -x*z, -y*z, x**2 + y**2 + 1])

print("Generating mesh...")
mesh_gen = MeshGenerator('61052_vols.h5m')
vertices = mesh_gen.mb.get_entities_by_dimension(0, 0)
mesh_gen.mtu.construct_aentities(vertices)
mesh_gen.set_centroids()
mesh_gen.set_heterogeneous_permeability(K_func)

grad_u_matrix = Matrix(
    [grad_u.coeff(C.i),
     grad_u.coeff(C.j),
     grad_u.coeff(C.k)])
F = K_sym * grad_u_matrix
div_F = F.diff(C.x)[0] + F.diff(C.y)[1] + F.diff(C.z)[2]
div_F_func = lambdify([C.x, C.y, C.z], div_F)
mesh_gen.set_source_term(div_F_func)

mesh_gen.set_dirichlet_boundary_conditions(u_func)
Esempio n. 5
0
M1 = np.array([100.0, 0.0, 0.0, \
                0.0, 10.0, 0.0, \
                0.0, 0.0, 1.0]).reshape(3, 3)
M2 = np.array([1.0, 0.0, 0.0, \
                0.0, 0.1, 0.0, \
                0.0, 0.0, 1.0]).reshape(3, 3)
theta = atan(0.2)
rot_z = np.array([np.cos(theta), np.sin(theta), 0.0, \
                -np.sin(theta), np.cos(theta), 0.0, \
                0.0, 0.0, 1.0]).reshape(3, 3)
rot_z_inv = inv(rot_z)
K1 = ((rot_z * M1) * rot_z_inv).reshape(9)
K2 = ((rot_z * M2) * rot_z_inv).reshape(9)

print("Generating mesh...")
mesh_gen = MeshGenerator('oblique_drain.h5m')
vertices = mesh_gen.mb.get_entities_by_dimension(0, 0)
mesh_gen.mtu.construct_aentities(vertices)
mesh_gen.set_centroids()

phi_1 = lambda x, y: y - 0.2 * (x - 0.5) - 0.475
phi_2 = lambda x, y: phi_1(x, y) - 0.05
omega_1, omega_2, omega_3 = [], [], []
volumes = mesh_gen.mb.get_entities_by_dimension(0, 3)
centroids = mesh_gen.mb.tag_get_data(mesh_gen.centroid_tag, volumes)
for vol, c in zip(volumes, centroids):
    if phi_1(c[0], c[1]) < 0:
        omega_1.append(vol)
    elif phi_1(c[0], c[1]) > 0 and phi_2(c[0], c[1]) < 0:
        omega_2.append(vol)
    elif phi_1(c[0], c[1]) > 0:
from sympy import sin, pi, lambdify, Matrix
from sympy.vector import CoordSys3D, Del
from math import atan
import numpy as np
from numpy.linalg import inv

C = CoordSys3D('C')
nabla = Del()
u_field = -C.x
grad_u = nabla(u_field, doit=True)
u_func = lambdify([C.x, C.y, C.z], u_field)

K = np.array([1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]).reshape(3, 3)

print("Generating mesh...")
mesh_gen = MeshGenerator('benchmark_test_case_5.h5m')
vertices = mesh_gen.mb.get_entities_by_dimension(0, 0)
mesh_gen.mtu.construct_aentities(vertices)
mesh_gen.set_centroids()
mesh_gen.set_homogeneous_permeability(K.reshape(9))

grad_u_matrix = Matrix(
    [grad_u.coeff(C.i),
     grad_u.coeff(C.j),
     grad_u.coeff(C.k)])
F = Matrix(K) * grad_u_matrix
div_F = F.diff(C.x)[0] + F.diff(C.y)[1] + F.diff(C.z)[2]
div_F_func = lambdify([C.x, C.y, C.z], div_F)
mesh_gen.set_source_term(div_F_func)

dirichlet_left_faces = []
M1 = np.array([100.0, 0.0, 0.0, \
                0.0, 10.0, 0.0, \
                0.0, 0.0, 1.0]).reshape(3, 3)
M2 = np.array([1.0, 0.0, 0.0, \
                0.0, 0.1, 0.0, \
                0.0, 0.0, 1.0]).reshape(3, 3)
theta = atan(0.2)
rot_z = np.array([np.cos(theta), np.sin(theta), 0.0, \
                -np.sin(theta), np.cos(theta), 0.0, \
                0.0, 0.0, 1.0]).reshape(3, 3)
rot_z_inv = inv(rot_z)
K1 = ((rot_z * M1) * rot_z_inv)
K2 = ((rot_z * M2) * rot_z_inv)

print("Generating mesh...")
mesh_gen = MeshGenerator('oblique_drain.h5m')
vertices = mesh_gen.mb.get_entities_by_dimension(0, 0)
mesh_gen.mtu.construct_aentities(vertices)
mesh_gen.set_centroids()

phi_1 = lambda x, y: y - 0.2 * (x - 0.5) - 0.475
phi_2 = lambda x, y: phi_1(x, y) - 0.05
omega_1, omega_2, omega_3 = [], [], []
volumes = mesh_gen.mb.get_entities_by_dimension(0, 3)
centroids = mesh_gen.mb.tag_get_data(mesh_gen.centroid_tag, volumes)
for vol, c in zip(volumes, centroids):
    if phi_1(c[0], c[1]) < 0:
        omega_1.append(vol)
    elif phi_1(c[0], c[1]) > 0 and phi_2(c[0], c[1]) < 0:
        omega_2.append(vol)
    elif phi_1(c[0], c[1]) > 0:
Esempio n. 8
0
from math import atan
import numpy as np
from numpy.linalg import inv

C = CoordSys3D('C')
nabla = Del()
u_field = sin(2 * pi * C.x) * sin(2 * pi * C.y) * sin(2 * pi * C.z)
grad_u = nabla(u_field, doit=True)
u_func = lambdify([C.x, C.y, C.z], u_field)

K = np.array([1.0, 0.0, 0.0, \
              0.0, 1.0, 0.0, \
              0.0, 0.0, 1000.0]).reshape(3, 3)

print("Generating mesh...")
mesh_gen = MeshGenerator('../geometrical_models/tet_8.h5m')
vertices = mesh_gen.mb.get_entities_by_dimension(0, 0)
mesh_gen.mtu.construct_aentities(vertices)
mesh_gen.set_centroids()
mesh_gen.set_homogeneous_permeability(K.reshape(9))

grad_u_matrix = Matrix(
    [grad_u.coeff(C.i),
     grad_u.coeff(C.j),
     grad_u.coeff(C.k)])
F = Matrix(K) * grad_u_matrix
div_F = F.diff(C.x)[0] + F.diff(C.y)[1] + F.diff(C.z)[2]
div_F_func = lambdify([C.x, C.y, C.z], div_F)
mesh_gen.set_source_term(div_F_func)

mesh_gen.set_dirichlet_boundary_conditions(u_func)