Git Product home page Git Product logo

pde-solver's Introduction

pde-solver

Solve the elliptic Poisson partial differential equation using finite difference methods.

.
└── main.py                   				# Main program which contains all the code run for the project. These might take a while
└── main_plots.py              				# Generates all the plots used in the report from stored data
└── modules                   				# Contains main classes
│   ├── ceramic_cooling.py                 	# Class which sets up the ceramic-microprocessor structure
│   ├── heat_structure.py           		# Class which sets up the microprocessor with heat sink structure
│   ├── simulated_annealing.py         		# Simulated annealing method to perform discrete optimisation
│	├── automated_runs						# Folder containing all the automated runs such as sweeps
│	│	├── forced_convection_runs.py 		# Sweep performed for forced convection to try to find parameters to cool below 80 degrees
│	│	├── natural_convection_runs.py 		# Sweep performed for natural convection to find best params to cool microprocessor
│	│	└── scale_runs.py 					# Sweep performed to see how microprocessor convergence temperature varied with step size and scale
│	├── plots 								# Folder containing the modules which generate all the plots for the report
│	│	├── forced_convection_sweep.py 		# Generates plots from the forced convection sweeps
│	│	├── natural_convection_sweep.py 	# Generates plots from the natural convection sweeps
│	│	├── microprocessor_ceramic_plots.py # Generates plots for microprocessor-ceramic natural convection cooling
│	│	└── simulated_annealing_analysis.py # Generates plots from the natural convection simulated annealing run
│  	└── utils
│		└── solvers.py 						# Contains the functions for different iterative solvers - Jacobi, Gauss-Seidel, SOR, Red-Black SOR
├── tests
│	└── test_solvers.py 					# Unit tests which validates the solver works as expected
└── data 									# Contains data files used to generate plots to cut down wait time

Set up

  1. Ensure that Python version: 3.7.0 is installed
  2. Install project requirements:
$ pip install -r requirements.txt
  1. Run unit tests
$ cd into project folder
$ pytest
  1. Generate plots
$ python main_plots.py
  1. Run code (will take about 10 hours to run everything, including sweeps and simulated annealing optimiser)
$ python main.py

Usage of classes

  1. HeatStructure - class which sets up a heat sink structure atop the microprocessor Accepts 9 parameters:
    • scale (scale of 1 means each mesh point is 1mm)
    • b (fin separation)
    • c (fin thickness)
    • f_h (fin height)
    • n_fins (number of fins)
    • conv_ratio = 1E-6
    • convection_type = "forced"
    • solver = jacobi_solver
    • wind_speed = 20

Example usage:

hs = HeatStructure(2, 5, 1, 30, 5, conv_ratio=1E-6, convection_type="natural", solver=solv.red_black_SOR)
T, n = hs.solve_mesh()
  1. Microprocessor - class which sets up a lone microprocessor with a ceramic case Accepts 3 parameters:
    • scale
    • conv_ratio
    • solver

Example usage:

mp = Microprocessor(5, conv_ratio=1E-8, solver=solv.jacobi_solver)
T, n = mp.solve_mesh()

Simulated Annealing

  1. Specify start parameters, e.g. x0 = [2, 2, 30, 30]
  2. Specify start annealing temperature, e.g. T = 1.0
  3. Specify minimum annealing temperature, e.g. T_min = 0.00001
  4. Specify the factor alpha which determines how fast T falls
simulate_annealing(x0, T, T_min, alpha)	

pde-solver's People

Contributors

ricktjwong avatar

Stargazers

 avatar  avatar  avatar  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.