def process_matrix(idx):
    # Run simulation and dump matrix.
    #subprocess.call(['../foam/sim/Allrun'])
    l_matrix = is_positive_definite(
        '/home/zulinx/Projects/Ayano/code/tgsl/projects/quasistatic_FEM/build/output/matrix_'
        + str(idx) + '.csv')
    save_npz('./data/L' + str(idx).zfill(3) + '.npz', l_matrix)
Ejemplo n.º 2
0
def _baffle():
    """Simulating baffles with different height and position in tank."""
    parameters = dict(xmin=[2., 2.5, 3., 3.5, 4., 4.5],
                      height=[1., 1.5, 2., 2.5, 3.])

    param_values = [v for v in parameters.values()]

    for idx, (xmin, height) in enumerate(product(*param_values)):
        # Open Dict template.
        with open('../foam/sim/system/snappyHexMeshDict.org', 'r') as file_:
            data = file_.readlines()

        # Baffle min point.
        data[26] = data[26].replace('xx', str(xmin))\
            .replace('yy', '-'+str(height))\
            .replace('zz', '-0.25')
        # Baffle max point.
        data[27] = data[27].replace('xx', str(xmin+.5))\
            .replace('yy', '0')\
            .replace('zz', '0')

        # Write actual Dict file used for simulation.
        with open('../foam/sim/system/snappyHexMeshDict', 'w') as file_:
            file_.writelines(data)

        # Run simulation and dump matrix.
        subprocess.call(['../foam/sim/Allrun'])
        l_matrix = is_positive_definite('L.csv')
        save_npz('./data/L' + str(idx).zfill(3) + '.npz', l_matrix)
    return True
Ejemplo n.º 3
0
def _sludge():
    """Simulating random sluge patterns."""
    np.random.seed(CFG['SEED'])
    for idx in range(CFG['DATA_COUNT']):
        _sludge_pattern()

        # Run simulation and dump matrix.
        subprocess.call(['../foam/sim/Allrun'])
        l_matrix = is_positive_definite('L.csv')
        save_npz('./data/L' + str(idx).zfill(3) + '.npz', l_matrix)
    return True
Ejemplo n.º 4
0
def process_matrix(idx):
    # Run simulation and dump matrix.
    #subprocess.call(['../foam/sim/Allrun'])
    l_matrix = is_positive_definite('/home/dabh/tgsl/projects/lagrangian_fem/output/matrix_'+str(idx)+'.csv')
    save_npz('./data/L'+str(idx).zfill(3)+'.npz', l_matrix)