# Initialize the fluid solver u = Fluid(dt = dt, N = [N,N], dims = [1., 1.]) # The simulation loop Time.StartTimer() while Time.t < Time.T: Time.PrintStepInfo() X.CheckForExplosion() # The FE/BE method # First calculate the fiber force F (stored in X.F) X.CalcForceDistribution() # Spread F to the Eulerian grid, storing the result in the force field u.f X.ToGrid(u) # Evolve the fluid forward one time step u.UpdateFluid(u.f, CalcPressure = True) # Interpolate the fluid velocity to the fiber (stored in X.U) X.FromGrid(u) # Update the fiber position X.X += dt * X.U # Update the time Time.Incr() Time.PrintTimeInfo() # Plot the fluid/fiber and save to file