Giter Club home page Giter Club logo

homework's Introduction

HomeWork

Simulation Parameters:

grid_size: Size of the 2D grid. dx: Grid spacing. dt: Time step. duration: Total simulation time. Initialization:

u, v: Arrays representing the x and y components of velocity, respectively. h: Array representing the height of the water column. Initial condition: A simple disturbance is introduced by setting a region in the center of the grid (h[40:60, 40:60]) to a height of 1.0. Simulation Loop:

The simulation iterates over time steps from 0 to duration with a time step of dt. In each iteration: Gradients of velocity (du_dx, du_dy, dv_dx, dv_dy) and water height (dh_dx, dh_dy) are computed using NumPy's gradient function. The shallow-water equations are then used to update the velocity (u and v) and water height (h) arrays. These equations are simplified for a 2D shallow-water system. Visualization:

After the simulation is complete, the final state of the water height (h) is visualized using Matplotlib. plt.imshow is used to create a 2D image plot of the water height with a blue colormap ('Blues'). plt.colorbar adds a colorbar to the plot, indicating the height values. Title, labels, and axis extents are set for better understanding of the visualization. plt.show() displays the final plot. The simulation represents the evolution of a disturbance in the water column over time due to the application of the shallow-water equations. The visualization shows how the disturbance propagates and interacts with the surrounding environment.

homework's People

Contributors

shrvan93 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.