コード例 #1
0
ファイル: solid.py プロジェクト: BenjaminRodenberg/tutorials
u_n.rename("Displacement", "")
u_np1.rename("Displacement", "")
displacement_out << u_n

while precice.is_coupling_ongoing():

    if precice.is_action_required(
            precice.action_write_iteration_checkpoint()):  # write checkpoint
        precice.store_checkpoint(u_n, t, n)

    # read data from preCICE and get a new coupling expression
    read_data = precice.read_data()

    # Update the point sources on the coupling boundary with the new read data
    Forces_x, Forces_y = precice.get_point_sources(read_data)

    A, b = assemble_system(a_form, L_form, bc)

    b_forces = b.copy(
    )  # b is the same for every iteration, only forces change

    for ps in Forces_x:
        ps.apply(b_forces)
    for ps in Forces_y:
        ps.apply(b_forces)

    assert (b is not b_forces)
    solve(A, u_np1.vector(), b_forces)

    dt = Constant(np.min([precice_dt, fenics_dt]))
コード例 #2
0
ファイル: solid.py プロジェクト: BenjaminRodenberg/tutorials
u_n.rename("Displacement", "")
u_np1.rename("Displacement", "")
displacement_out << u_n

while precice.is_coupling_ongoing():

    if precice.is_action_required(
            precice.action_write_iteration_checkpoint()):  # write checkpoint
        precice.store_checkpoint(u_n, t, n)

    # read data from preCICE and get a new coupling expression
    read_data = precice.read_data()

    # Update the point sources on the coupling boundary with the new read data
    forces_x, forces_y, forces_z = precice.get_point_sources(read_data)

    A, b = assemble_system(a_form, L_form, bc)

    b_forces = b.copy(
    )  # b is the same for every iteration, only forces change

    for ps in forces_x:
        ps.apply(b_forces)
    for ps in forces_y:
        ps.apply(b_forces)
    for ps in forces_z:
        ps.apply(b_forces)

    assert (b is not b_forces)
    solve(A, u_np1.vector(), b_forces)