コード例 #1
0
ファイル: FluidSolver.py プロジェクト: precice/elastictube1d
    # When an implicit coupling scheme is used, checkpointing is required
    if interface.is_action_required(action_write_iteration_checkpoint()):
        interface.fulfilled_action(action_write_iteration_checkpoint())

    velocity, pressure, success = perform_partitioned_implicit_euler_step(velocity_n, pressure_n, crossSectionLength_n, crossSectionLength, dx, precice_tau, config.velocity_in(t + precice_tau), custom_coupling=False)
    interface.write_block_scalar_data(pressureID, N+1, vertexIDs, pressure)
    interface.advance(precice_tau)
    interface.read_block_scalar_data(crossSectionLengthID, N+1, vertexIDs, crossSectionLength)

    if interface.is_action_required(action_read_iteration_checkpoint()): # i.e. not yet converged
        interface.fulfilled_action(action_read_iteration_checkpoint())
    else: # converged, timestep complete
        t += precice_tau
        if plotting_mode is config.PlottingModes.VIDEO:
            tubePlotting.doPlotting(ax, crossSectionLength_n, velocity_n, pressure_n, dx, t)
            if writeVideoToFile:            
                writer.grab_frame()
            ax.cla()
        velocity_n = np.copy(velocity)
        pressure_n = np.copy(pressure)
        crossSectionLength_n = np.copy(crossSectionLength)
        if output_mode is config.OutputModes.VTK:
            writeOutputToVTK(t, "fluid", dx, N+1, datanames=["velocity", "pressure", "crossSection"], data=[velocity_n, pressure_n, crossSectionLength_n])

print("Exiting FluidSolver")

if plotting_mode is config.PlottingModes.VIDEO and writeVideoToFile:
    writer.finish()

interface.finalize()
コード例 #2
0
ファイル: FluidSolver.py プロジェクト: Eder-K/elastictube1d
    # When an implicit coupling scheme is used, checkpointing is required
    if interface.is_action_required(action_write_iteration_checkpoint()):
        interface.fulfilled_action(action_write_iteration_checkpoint())

    velocity, pressure, success = perform_partitioned_implicit_euler_step(velocity_n, pressure_n, crossSectionLength_n, crossSectionLength, dx, precice_tau, config.velocity_in(t + precice_tau), custom_coupling=False)
    interface.write_block_scalar_data(pressureID, N+1, vertexIDs, pressure)
    interface.advance(precice_tau)
    interface.read_block_scalar_data(crossSectionLengthID, N+1, vertexIDs, crossSectionLength)

    if interface.is_action_required(action_read_iteration_checkpoint()): # i.e. not yet converged
        interface.fulfilled_action(action_read_iteration_checkpoint())
    else: # converged, timestep complete
        t += precice_tau
        if plotting_mode is config.PlottingModes.VIDEO:
            tubePlotting.doPlotting(ax, crossSectionLength_n, velocity_n, pressure_n, dx, t)
            if writeVideoToFile:
                writer.grab_frame()
            ax.cla()
        velocity_n = np.copy(velocity)
        pressure_n = np.copy(pressure)
        crossSectionLength_n = np.copy(crossSectionLength)
        if output_mode is config.OutputModes.VTK:
            writeOutputToVTK(t, "fluid", dx, N+1, datanames=["velocity", "pressure", "crossSection"], data=[velocity_n, pressure_n, crossSectionLength_n])

print("Exiting FluidSolver")

if plotting_mode is config.PlottingModes.VIDEO and writeVideoToFile:
    writer.finish()

interface.finalize()
コード例 #3
0
            t + precice_dt), custom_coupling=True)
    interface.write_block_scalar_data(pressureID, vertexIDs, pressure)
    interface.advance(precice_dt)
    crossSectionLength = interface.read_block_scalar_data(
        crossSectionLengthID, vertexIDs)

    # i.e. not yet converged
    if interface.is_action_required(action_read_iteration_checkpoint()):
        interface.mark_action_fulfilled(action_read_iteration_checkpoint())
    else:  # converged, timestep complete
        t += precice_dt
        if plotting_mode is config.PlottingModes.VIDEO:
            tubePlotting.doPlotting(
                ax, crossSectionLength_old, velocity_old, pressure_old, dx, t)
            if writeVideoToFile:
                writer.grab_frame()
            ax.cla()
        velocity_old = np.copy(velocity)
        pressure_old = np.copy(pressure)
        crossSectionLength_old = np.copy(crossSectionLength)
        writeOutputToVTK(time_it, "out_fluid_", dx, datanames=["velocity", "pressure", "diameter"], data=[
            velocity_old, pressure_old, crossSectionLength_old])
        time_it += 1

print("Exiting FluidSolver")

if plotting_mode is config.PlottingModes.VIDEO and writeVideoToFile:
    writer.finish()

interface.finalize()