{"id":15015738,"url":"https://github.com/ghonimo/heat-diffusion-grid-simulation-using-pthreads--ece588","last_synced_at":"2026-03-01T04:33:02.442Z","repository":{"id":225572560,"uuid":"752364305","full_name":"Ghonimo/Heat-Diffusion-Grid-Simulation-using-Pthreads--ECE588","owner":"Ghonimo","description":"This repository contains the code and documentation for a parallelized heat diffusion simulator implemented using Pthreads in C. It simulates the diffusion of heat across a 2D grid, using a finite difference method to calculate temperature changes over time. This program was designed for Portland State University ECE 588 Class","archived":false,"fork":false,"pushed_at":"2024-03-03T01:51:11.000Z","size":10093,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-23T19:39:22.168Z","etag":null,"topics":["c","heat-transfer","heatmap","parallel-computing","parallel-programming","perl","portland-state-university","pthreadjoin","pthreads"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ghonimo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-03T18:04:28.000Z","updated_at":"2024-03-02T23:36:35.000Z","dependencies_parsed_at":"2024-11-20T13:35:34.255Z","dependency_job_id":null,"html_url":"https://github.com/Ghonimo/Heat-Diffusion-Grid-Simulation-using-Pthreads--ECE588","commit_stats":null,"previous_names":["ghonimo/heat-diffusion-grid-simulation-using-pthreads--ece588"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ghonimo/Heat-Diffusion-Grid-Simulation-using-Pthreads--ECE588","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghonimo%2FHeat-Diffusion-Grid-Simulation-using-Pthreads--ECE588","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghonimo%2FHeat-Diffusion-Grid-Simulation-using-Pthreads--ECE588/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghonimo%2FHeat-Diffusion-Grid-Simulation-using-Pthreads--ECE588/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghonimo%2FHeat-Diffusion-Grid-Simulation-using-Pthreads--ECE588/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ghonimo","download_url":"https://codeload.github.com/Ghonimo/Heat-Diffusion-Grid-Simulation-using-Pthreads--ECE588/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ghonimo%2FHeat-Diffusion-Grid-Simulation-using-Pthreads--ECE588/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282713022,"owners_count":26714760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-04T02:00:05.887Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","heat-transfer","heatmap","parallel-computing","parallel-programming","perl","portland-state-university","pthreadjoin","pthreads"],"created_at":"2024-09-24T19:47:51.770Z","updated_at":"2025-11-04T21:02:00.258Z","avatar_url":"https://github.com/Ghonimo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heat Distribution Simulation using Pthreads\n\nThis repository contains a C program designed to simulate heat distribution across a 2D grid. The simulation is parallelized using POSIX threads (pthreads) to enhance performance and demonstrate the application of multithreading in computational physics problems.\n\n## Problem Description\n\nThe program models the temporal evolution of heat distribution on a 2D grid, representing a simplified scenario of heat conduction in a square plate. The simulation uses a finite difference method to approximate the heat equation, with specific initial and boundary conditions.\n\n### Initial and Boundary Conditions\n\n- **Grid Size**: The computational domain is a 2D grid of size 1000 x 1000 points.\n- **Initial Temperature Distribution**: \n  - All points within the central region defined by coordinates (200, 200) to (800, 800) are initialized to 500 degrees.\n  - The temperature of all other points is set to zero.\n- **Boundary Conditions**: Points on the boundary of the grid maintain a constant temperature of zero throughout the simulation.\n\n### Simulation Parameters\n\n- **Temperature Update Rule**: The temperature of a point at timestep `t` is computed based on its temperature and the temperatures of its immediate neighbors at timestep `t-1`, according to the formula:\nT(x,y)(t) = T(x,y)(t-1) + Cx * (T(x+1,y)(t-1) + T(x-1,y)(t-1) – 2 * T(x,y)(t-1)) \n                      + Cy * (T(x,y+1)(t-1) + T(x,y-1)(t-1) – 2 * T(x,y)(t-1))\n\n\nWhere `Cx` and `Cy` are constants that govern the rate of heat transfer along the x and y axes, respectively.\n\n- **Time Steps**: The simulation progresses through 4000 time steps.\n- **Reporting**: After every 200 time steps, the program prints the temperatures at specific grid points: (1, 1), (150,150), (400, 400), (500, 500), (750, 750), and (900,900).\n\n## Implementation Details\n\nThe program is implemented in C and utilizes pthreads to divide the computation across multiple processors, aiming for a high degree of parallel speedup. A barrier synchronization mechanism ensures that all threads have completed their calculations at each timestep before proceeding to the next, maintaining data consistency.\n\n## Building and Running\n\nTo compile the program, use:\n\n```bash\ncc -lpthread -lrt TempGrid_HW3.c -o TempGrid_HW3\n```\n\nTo run the compiled binary, specifying the number of threads:\n```bash\n./bin/HW3_updated \u003cnum_threads\u003e\n```\nTo run in batch more, comparing the performance of with different cores, you can execute the perl script below:\n```bash\n./automate/batch_run.pl\n```\n\n## Output\nThe program outputs the temperatures of specified grid points after every 200 timesteps and displays the total runtime in nanoseconds and seconds.\n\n## License\nThis project is open-sourced under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghonimo%2Fheat-diffusion-grid-simulation-using-pthreads--ece588","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghonimo%2Fheat-diffusion-grid-simulation-using-pthreads--ece588","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghonimo%2Fheat-diffusion-grid-simulation-using-pthreads--ece588/lists"}