test_AmrexCastro.jl 2.74 KB
Newer Older
William F Godoy's avatar
William F Godoy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

"""
workaround function to update counter if scalar
Julia doesn't pass values by reference "address"
"""
function test_value(
    counter,
    parameters::Dict{String,String},
    key::String,
    test_value::String,
)
    value = parameters[key]
    @test value == test_value
    counter += 1
    return counter
end

function test_AmrexCastro()
    exio = Exio.exio_init("AmrexCastro", ".")

    @test typeof(exio) == Exio.ExioH

    println("Current directory: ", Filesystem.pwd())
    inputFile = string(
        Filesystem.pwd(),
        "/test/data/amrexCastro/test_data_AmrexCastro_inputs.2d.cyl_in_cartcoords",
    )
    println("Input file: ", inputFile)

    parameters = Exio.input_parser(exio.extractor, inputFile)

    # keys counter
    counter = 0
    counter = test_value(counter, parameters, "max_step", "20")
    counter = test_value(counter, parameters, "stop_time", "0.1")
    counter = test_value(counter, parameters, "geometry.is_periodic", "0 0")
    counter = test_value(counter, parameters, "geometry.coord_sys", "0")
    counter = test_value(counter, parameters, "geometry.prob_lo", "0    0")
    counter = test_value(counter, parameters, "geometry.prob_hi", "1    1")
    counter = test_value(counter, parameters, "amr.n_cell", "16   16")
    counter = test_value(counter, parameters, "castro.lo_bc", "2   2")
    counter = test_value(counter, parameters, "castro.hi_bc", "2   2")
    counter = test_value(counter, parameters, "castro.do_hydro", "1")
    counter = test_value(counter, parameters, "castro.do_react", "0")
    counter = test_value(counter, parameters, "castro.cfl", "0.5")
    counter = test_value(counter, parameters, "castro.init_shrink", "0.01")
    counter = test_value(counter, parameters, "castro.change_max", "1.1")
    counter = test_value(counter, parameters, "castro.sum_interval", "1")
    counter = test_value(counter, parameters, "castro.v", "1")
    counter = test_value(counter, parameters, "amr.v", "1")
    counter = test_value(counter, parameters, "amr.max_level", "2")
    counter = test_value(counter, parameters, "amr.ref_ratio", "2 2 2 2")
    counter = test_value(counter, parameters, "amr.regrid_int", "2")
    counter = test_value(counter, parameters, "amr.blocking_factor", "8")
    counter = test_value(counter, parameters, "amr.max_grid_size", "128")
    counter = test_value(counter, parameters, "amr.check_file", "sedov_2d_cyl_in_cart_chk")
    counter = test_value(counter, parameters, "amr.check_int", "20")
    counter = test_value(counter, parameters, "amr.plot_file", "sedov_2d_cyl_in_cart_plt")
    counter = test_value(counter, parameters, "amr.derive_plot_vars", "ALL")
    counter =
        test_value(counter, parameters, "amr.probin_file", "probin.2d.cyl_in_cartcoords")

    @test counter == 27
end


test_AmrexCastro()