Esempio n. 1
0
def PrintDrag(drag_list, drag_file_output_list, fluid_model_part, time):
    i = 0
    for it in drag_list:
        print(it[0])
        nodes = fluid_model_part.GetNodes(it[0])
        drag = Vector(3);
        drag[0] = 0.0
        drag[1] = 0.0
        drag[2] = 0.0
        for node in nodes:
            reaction = node.GetSolutionStepValue(REACTION, 0)
            drag[0] += reaction[0]
            drag[1] += reaction[1]
            drag[2] += reaction[2]

        if (benchmarking.InBenchmarkingMode()):
            benchmarking.Output(drag[0], "drag X", 1e-9, 1e-3)
            benchmarking.Output(drag[1], "drag Y", 1e-9, 1e-3)
            benchmarking.Output(drag[2], "drag Z", 1e-9, 1e-3)

        output = str(time) + " " + str(drag[0]) + " " + str(drag[1]) + " " + str(drag[2]) + "\n"
        # print drag_file_output_list[i]
        # print output
        drag_file_output_list[i].write(output)
        drag_file_output_list[i].flush()
        i = i + 1
Esempio n. 2
0
def BenchmarkCheck(time, model_part):
    # find the largest displacement
    local_max_disp = 0.0
    for node in model_part.Nodes:
        disp = node.GetSolutionStepValue(DISPLACEMENT, 0)
        disp_value = disp[0] ** 2 + disp[1] ** 2 + disp[2] ** 2
        if(disp_value > local_max_disp):
            local_max_disp = disp_value

    max_values = mpi.gather(mpi.world, local_max_disp, 0)  # all_gather would gather to all process .. this only gathers to the root
    mpi.world.barrier()

    if(mpi.rank == 0):
        tot_max = 0.0
        for i in range(0, len(max_values)):
            if(max_values[i] > tot_max):
                tot_max = max_values[i]

        tot_max = math.sqrt(tot_max)
        print(tot_max)

        if (benchmarking.InBenchmarkingMode()):
            benchmarking.Output(time, "Time")
            benchmarking.Output(tot_max, "maximum displacement in the model", 0.00001)

    mpi.world.barrier()
Esempio n. 3
0
def WriteBenchmarkResults(model_part):

    [dx_min, dy_min, dz_min] = FindMinDispY(model_part.Nodes)
    print([dx_min, dy_min, dz_min])

    if (benchmarking.InBenchmarkingMode()):
        abs_tol = 1e-9
        rel_tol = 1e-5
        benchmarking.Output(dx_min, "min dx", abs_tol, rel_tol)
        benchmarking.Output(dy_min, "min dy", abs_tol, rel_tol)
        benchmarking.Output(dz_min, "min dz", abs_tol, rel_tol)
def WriteBenchmarkResults(model_part):

    if (benchmarking.InBenchmarkingMode()):
        # find max Y rotation
        r_max = 0.0
        for node in model_part.Nodes:
            ir = node.GetSolutionStepValue(ROTATION_Z)
            if (ir > r_max):
                r_max = ir
        # write
        abs_tol = 1e-9
        rel_tol = 1e-5
        benchmarking.Output(r_max, "Z Rotation", abs_tol, rel_tol)
def WriteBenchmarkResults(model_part):

    # write
    abs_tol = 1e-9
    rel_tol = 1e-5

    [dx_min, dy_min, dz_min] = FindMinDisp(model_part.Nodes)
    print([dx_min, dy_min, dz_min])

    if (benchmarking.InBenchmarkingMode()):
        # write
        abs_tol = 1e-9
        rel_tol = 1e-5
        benchmarking.Output(dx_min, "min dx", abs_tol, rel_tol)
        benchmarking.Output(dy_min, "min dy", abs_tol, rel_tol)
        benchmarking.Output(dz_min, "min dz", abs_tol, rel_tol)

    [dx_max, dy_max, dz_max] = FindMaxDisp(model_part.Nodes)
    print([dx_max, dy_max, dz_max])

    if (benchmarking.InBenchmarkingMode()):
        benchmarking.Output(dx_max, "max dx", abs_tol, rel_tol)
        benchmarking.Output(dy_max, "max dy", abs_tol, rel_tol)
        benchmarking.Output(dz_max, "max dz", abs_tol, rel_tol)