Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
gaugeLocations = tuple(map(tuple, PGL))
columnLines = tuple(map(tuple, LGL))

pointGauges = PointGauges(gauges=((('u', 'v'), gaugeLocations),
                                  (('p', ), gaugeLocations)),
                          activeTime=(0, 1000.0),
                          sampleRate=0,
                          fileName='combined_gauge_0_0.5_sample_all.txt')

print gaugeLocations
print columnLines

fields = ('vof', )

columnGauge = LineIntegralGauges(gauges=((fields, columnLines), ),
                                 fileName='column_gauge.csv')

#lineGauges  = LineGauges(gaugeEndpoints={'lineGauge_y=0':((0.0,0.0,0.0),(L[0],0.0,0.0))},linePoints=24)

#lineGauges_phi  = LineGauges_phi(lineGauges.endpoints,linePoints=20)

if useHex:
    nnx = ceil(L[0] / he) + 1
    nny = ceil(L[1] / he) + 1
    hex = True
    domain = Domain.RectangularDomain(L)
else:
    boundaries = ['left', 'right', 'bottom', 'top', 'front', 'back']
    boundaryTags = dict([(key, i + 1) for (i, key) in enumerate(boundaries)])
    if structured:
        nnx = ceil(L[0] / he) + 1