Example #1
0
def test_point_gauge_output_2():
    filename = 'test_gauge_output_2.csv'
    silent_rm(filename)

    p = PointGauges(gauges=((('u0', ), ((0, 0, 0), (0.5, 0.5, 0.5), (1, 1,
                                                                     1))), ),
                    fileName=filename)
    time_list = [0.0, 1.0, 2.0]
    run_gauge(p, time_list)

    correct_gauge_names = [
        'u0 [        0         0         0]',
        'u0 [      0.5       0.5       0.5]',
        'u0 [        1         1         1]'
    ]
    correct_data = np.asarray([[0., 0., 55.5, 111.], [1., 0., 111., 222.],
                               [2., 0., 166.5, 333.]])

    # synchronize processes before attempting to read file
    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)

    eq_(correct_gauge_names, gauge_names)
    npt.assert_allclose(correct_data, data)
Example #2
0
def test_line_integral_gauge_output():
    filename = 'test_line_integral_gauge_output.csv'
    silent_rm(filename)

    lines = (((0, 0, 0), (1, 1, 1)), )
    fields = ('u0', )

    l = LineIntegralGauges(gauges=((fields, lines), ), fileName=filename)
    time_list = [0.0, 1.0, 2.0]
    run_gauge(l, time_list)

    correct_gauge_names = [
        'u0 [        0         0         0] - [        1         1         1]'
    ]
    correct_data = np.asarray([[0., 96.128819820072678],
                               [1., 192.25763964014536],
                               [2., 288.38645946021808]])

    # synchronize processes before attempting to read file
    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)
    eq_(correct_gauge_names, gauge_names)
    npt.assert_allclose(correct_data, data)
    delete_file(filename)
Example #3
0
def test_line_gauge_output():
    filename = 'test_line_output.csv'
    silent_rm(filename)

    lines = (((0, 0, 0), (1, 1, 1)), )
    fields = ('u0', )

    l = LineGauges(gauges=((fields, lines), ), fileName=filename)

    time_list = [0.0, 1.0, 2.0]
    # good hard-code for up to 1,024 processes or so, but slow (about 8 seconds on single process).
    run_gauge(l, time_list, total_nodes=2048)
    correct_gauge_names = [
        'u0 [        0         0         0]',
        'u0 [ 0.076923  0.076923  0.076923]',
        'u0 [  0.15385   0.15385   0.15385]',
        'u0 [  0.23077   0.23077   0.23077]',
        'u0 [  0.30769   0.30769   0.30769]',
        'u0 [  0.38462   0.38462   0.38462]',
        'u0 [  0.46154   0.46154   0.46154]',
        'u0 [  0.53846   0.53846   0.53846]',
        'u0 [  0.61538   0.61538   0.61538]',
        'u0 [  0.69231   0.69231   0.69231]',
        'u0 [  0.76923   0.76923   0.76923]',
        'u0 [  0.84615   0.84615   0.84615]',
        'u0 [  0.92308   0.92308   0.92308]',
        'u0 [        1         1         1]'
    ]
    correct_data = np.asarray(
        [[
            0., 0., 8.53846154, 17.07692308, 25.61538462, 34.15384615,
            42.69230769, 51.23076923, 59.76923077, 68.30769231, 76.84615385,
            85.38461538, 93.92307692, 102.46153846, 111.
        ],
         [
             1., 0., 17.07692308, 34.15384615, 51.23076923, 68.30769231,
             85.38461538, 102.46153846, 119.53846154, 136.61538462,
             153.69230769, 170.76923077, 187.84615385, 204.92307692, 222.
         ],
         [
             2., 0., 25.61538462, 51.23076923, 76.84615385, 102.46153846,
             128.07692308, 153.69230769, 179.30769231, 204.92307692,
             230.53846154, 256.15384615, 281.76923077, 307.38461538, 333.
         ]])

    # synchronize processes before attempting to read file

    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)

    eq_(correct_gauge_names, gauge_names)
    npt.assert_allclose(correct_data, data)
    delete_file(filename)
Example #4
0
def test_point_gauge_output():
    filename = 'test_gauge_output.csv'
    silent_rm(filename)

    p = PointGauges(gauges=((('u0',), ((0, 0, 0), (1, 1, 1))),),
                    fileName=filename)
    time_list=[0.0, 1.0, 2.0]
    run_gauge(p, time_list)

    correct_gauge_names = ['u0 [        0         0         0]', 'u0 [        1         1         1]']
    correct_data = np.asarray([[   0.,    0.,  111.],
                               [   1.,    0.,  222.],
                               [   2.,    0.,  333.]])

    # synchronize processes before attempting to read file

    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)

    eq_(correct_gauge_names, gauge_names)
    npt.assert_allclose(correct_data, data)
Example #5
0
def test_line_gauge_output():
    filename = 'test_line_output.csv'
    silent_rm(filename)

    lines = (((0, 0, 0), (1, 1, 1)),)
    fields = ('u0', )

    l = LineGauges(gauges=((fields, lines),),
                   fileName=filename)

    time_list=[0.0, 1.0, 2.0]
    # good hard-code for up to 1,024 processes or so, but slow (about 8 seconds on single process).
    run_gauge(l, time_list, total_nodes=2048)
    correct_gauge_names = ['u0 [        0         0         0]', 'u0 [ 0.076923  0.076923  0.076923]',
                           'u0 [  0.15385   0.15385   0.15385]', 'u0 [  0.23077   0.23077   0.23077]',
                           'u0 [  0.30769   0.30769   0.30769]', 'u0 [  0.38462   0.38462   0.38462]',
                           'u0 [  0.46154   0.46154   0.46154]', 'u0 [  0.53846   0.53846   0.53846]',
                           'u0 [  0.61538   0.61538   0.61538]', 'u0 [  0.69231   0.69231   0.69231]',
                           'u0 [  0.76923   0.76923   0.76923]', 'u0 [  0.84615   0.84615   0.84615]',
                           'u0 [  0.92308   0.92308   0.92308]', 'u0 [        1         1         1]']
    correct_data = np.asarray([[0., 0., 8.53846154, 17.07692308, 25.61538462,
                                34.15384615, 42.69230769, 51.23076923, 59.76923077, 68.30769231,
                                76.84615385, 85.38461538, 93.92307692, 102.46153846, 111.],
                               [1., 0., 17.07692308, 34.15384615, 51.23076923,
                                68.30769231, 85.38461538, 102.46153846, 119.53846154, 136.61538462,
                                153.69230769, 170.76923077, 187.84615385, 204.92307692, 222.],
                               [2., 0., 25.61538462, 51.23076923, 76.84615385,
                                102.46153846, 128.07692308, 153.69230769, 179.30769231, 204.92307692,
                                230.53846154, 256.15384615, 281.76923077, 307.38461538, 333.]])

    # synchronize processes before attempting to read file

    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)

    eq_(correct_gauge_names, gauge_names)
    npt.assert_allclose(correct_data, data)
    delete_file(filename)
Example #6
0
def test_2D_line_integral_gauge_output():
    filename = 'test_2D_line_integral_gauge_output.csv'
    silent_rm(filename)

    lines = (((0, 0, 0), (1, 1, 0)),
             ((0, 0, 0), (1, 0, 0)),
             ((0, 0, 0), (0, 1, 0)),
             ((0, 0.5, 0), (1, 0.5, 0)),
             ((0, 1, 0), (1, 1, 0)),
             ((0.5, 0, 0), (0.5, 1, 0)))
    fields = ('u0', )

    l = LineIntegralGauges(gauges=((fields, lines),),
                   fileName=filename)

    time_list=[0.0, 1.0, 2.0, 2.5]
    run_gauge(l, time_list)

    correct_gauge_names = ['u0 [        0         0         0] - [        1         1         0]',
                           'u0 [        0         0         0] - [        1         0         0]',
                           'u0 [        0         0         0] - [        0         1         0]',
                           'u0 [        0       0.5         0] - [        1       0.5         0]',
                           'u0 [        0         1         0] - [        1         1         0]',
                           'u0 [      0.5         0         0] - [      0.5         1         0]']

    correct_data = np.asarray([[0.,   7.77817459,  0.5,   5.,   5.5,  10.5,   5.5],
                               [1.,  15.55634919,  1.,   10.,  11.,   21.,   11.],
                               [2.,  23.33452378,  1.5,  15.,  16.5,  31.5,  16.5],
                               [2.5, 27.22361108,  1.75, 17.5, 19.25, 36.75, 19.25]])

    # synchronize processes before attempting to read file

    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)
    eq_(correct_gauge_names, gauge_names)

    npt.assert_allclose(correct_data, data)
    delete_file(filename)
Example #7
0
def test_2D_line_integral_gauge_output():
    filename = 'test_2D_line_integral_gauge_output.csv'
    silent_rm(filename)

    lines = (((0, 0, 0), (1, 1, 0)), ((0, 0, 0), (1, 0, 0)),
             ((0, 0, 0), (0, 1, 0)), ((0, 0.5, 0), (1, 0.5, 0)),
             ((0, 1, 0), (1, 1, 0)), ((0.5, 0, 0), (0.5, 1, 0)))
    fields = ('u0', )

    l = LineIntegralGauges(gauges=((fields, lines), ), fileName=filename)

    time_list = [0.0, 1.0, 2.0, 2.5]
    run_gauge(l, time_list)

    correct_gauge_names = [
        'u0 [        0         0         0] - [        1         1         0]',
        'u0 [        0         0         0] - [        1         0         0]',
        'u0 [        0         0         0] - [        0         1         0]',
        'u0 [        0       0.5         0] - [        1       0.5         0]',
        'u0 [        0         1         0] - [        1         1         0]',
        'u0 [      0.5         0         0] - [      0.5         1         0]'
    ]

    correct_data = np.asarray(
        [[0., 7.77817459, 0.5, 5., 5.5, 10.5, 5.5],
         [1., 15.55634919, 1., 10., 11., 21., 11.],
         [2., 23.33452378, 1.5, 15., 16.5, 31.5, 16.5],
         [2.5, 27.22361108, 1.75, 17.5, 19.25, 36.75, 19.25]])

    # synchronize processes before attempting to read file

    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)
    eq_(correct_gauge_names, gauge_names)

    npt.assert_allclose(correct_data, data)
    delete_file(filename)
Example #8
0
def test_line_integral_gauge_output():
    filename = 'test_line_integral_gauge_output.csv'
    silent_rm(filename)

    lines = (((0, 0, 0), (1, 1, 1)),)
    fields = ('u0', )

    l = LineIntegralGauges(gauges=((fields, lines),),
                   fileName=filename)
    time_list=[0.0, 1.0, 2.0]
    run_gauge(l, time_list)

    correct_gauge_names = ['u0 [        0         0         0] - [        1         1         1]']
    correct_data = np.asarray([[   0., 96.128819820072678],
                               [   1., 192.25763964014536],
                               [   2., 288.38645946021808]])

    # synchronize processes before attempting to read file
    Comm.get().barrier()

    gauge_names, data = parse_gauge_output(filename)
    eq_(correct_gauge_names, gauge_names)
    npt.assert_allclose(correct_data, data)