{"id":44257426,"url":"https://github.com/berrieslab/mu-teg-sim","last_synced_at":"2026-02-10T16:35:22.087Z","repository":{"id":249817150,"uuid":"832667135","full_name":"BerriesLab/mu-teg-sim","owner":"BerriesLab","description":"An app to simulate the device physics of micro thermoelectric generators.","archived":false,"fork":false,"pushed_at":"2025-10-18T09:15:42.000Z","size":6286,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-05T04:03:56.051Z","etag":null,"topics":["engineering","physics","thermoelectricity"],"latest_commit_sha":null,"homepage":"","language":"Python","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/BerriesLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-23T13:33:51.000Z","updated_at":"2025-10-18T09:15:45.000Z","dependencies_parsed_at":"2025-04-11T15:37:38.880Z","dependency_job_id":null,"html_url":"https://github.com/BerriesLab/mu-teg-sim","commit_stats":null,"previous_names":["berrieslab/mu-teg-sim"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/BerriesLab/mu-teg-sim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerriesLab%2Fmu-teg-sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerriesLab%2Fmu-teg-sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerriesLab%2Fmu-teg-sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerriesLab%2Fmu-teg-sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BerriesLab","download_url":"https://codeload.github.com/BerriesLab/mu-teg-sim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerriesLab%2Fmu-teg-sim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29307915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T16:09:25.305Z","status":"ssl_error","status_checked_at":"2026-02-10T16:08:52.170Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["engineering","physics","thermoelectricity"],"created_at":"2026-02-10T16:35:21.369Z","updated_at":"2026-02-10T16:35:22.076Z","avatar_url":"https://github.com/BerriesLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mu-teg-sim\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12802052.svg)](https://doi.org/10.5281/zenodo.12802052)\n\nAn app to simulate the device physics of micro Thermoelectric Generators (μTEGs), based on the work by **D. Beretta et\nal.**, Sustainable Energy Fuels, 2017, 1, 174-190. The app calculates the power generated, the efficiency of conversion,\nthe electrical resistance, the open circuit voltage, the short circuit \ncurrent and the closed circuit current per unit area, given the device\ndesign and the physical properties of materials.\n\nThis app is designed for scientists, researchers, and engineers who want to simulate the device physics of μTEGs, to\nanalyze performance metrics and optimize designs for various applications. By providing a user-friendly GUI and robust\ncomputational tools, this app facilitates the study and development of energy conversion technologies using μTEGs.\n\n## Table of Contents\n\n* [Installation](#installation)\n* [How to use](#how-to-use)\n    * [Main window](#main-window)\n    * [Parameters Tabs](#parameters-tabs)\n    * [Solver](#solver)\n    * [Saving and loading](#saving-and-loading)\n* [Contributing](#contributing)\n* [Credits](#credits)\n* [License](#license)\n\n## Installation\n\nThe `mu-teg-sim` app can be installed either via pip or by cloning the repository.\n\nTo install the app via pip, use the following commands based on your operating system:\n\n- **On Unix/Mac**: Open a terminal and run:\n  ```bash \n  pip install mu-teg-sim\n- **On Windows**: Open Command Prompt or PowerShell and run:\n  ```bash\n  pip install mu-teg-sim\n\nTo install the app by cloning the repository to your local machine, follow these steps:\n\n- Clone the repository:\n  ```bash\n  git clone https://github.com/BerriesLab/mu-teg-sim.git\n- Navigate to the project directory:\n  ```bash\n  cd project-name\n- Install the required dependencies:\n  ```bash\n  pip install -r requirements.txt\n\n## How to use\n\nThe app is based on the device physics described in **D. Beretta et al.**, Sustainable Energy Fuels, 2017, 1,\n174-190. Readers are encouraged to consult the manuscript to understand the meaning of the parameters and equations\nreferenced in this application.\n\n### Launching the GUI from terminal\nThe app can be launched from terminal after installation by typing \n```bash \nmu_teg_sim\n``` \n\n### Main window\n\n\u003cdiv id=\"fig_gui\" align=\"center\"\u003e\n    \u003cimg src=\"images/gui_overview.png\" alt=\"\" width=\"700\"\u003e\n    \u003cp\u003e\u003cb\u003eFigure 1:\u003c/b\u003e GUI main window.\u003c/p\u003e\n\u003c/div\u003e\n\nThe main window of the app consists of three primary frames:\n\n- **Input Frame**: This frame allows users to enter the parameters to run the model. Refer to\n  the [Parameters Tabs](#Parameters-Tabs) section for information on data types and accepted value intervals. The input\n  frame includes the following buttons:\n    - **Reset**: Resets all parameters to their default values.\n    - **Save Params**: Saves the current set of parameters to a file in .json format.\n    - **Load Params**: Loads parameters from a .json file on disk. Note: the parameters are loaded only if the file and\n      all parameters it contains pass a validation check on data type and range.\n\n\n- **Simulation Frame**: This frame is used to run simulations and display results. It includes the following buttons\n  and check buttons:\n    - **Run**: Starts the simulation. Results are shown in a figure within this frame.\n    - **Clear**: Removes the current figure and results.\n    - **Save**: Saves the results of the current simulation to a .txt file, which includes the power generated, the\n      conversion efficiency, the resistance, the open circuit voltage, and the short circuit current as a function of\n      the thermocouple length, per unit area.\n    - **Normalize**: Normalizes the results with respect to their maximum value, allowing all results to be shown\n      simultaneously in the same figure.\n    - **Power**: Shows or hides the power per unit area vs. length.\n    - **Efficiency**: Shows or hides the efficiency vs. length.\n    - **Resistance**: Shows or hides the device resistance per unit area vs. length.\n    - **VOC**: Shows or hides the open circuit voltage per unit area vs. length.\n    - **SCC**: Shows or hides the short circuit current per unit area vs. length.\n    - **CSC**: Shows or hides the closed circuit current per unit area vs. \n      length.\n    - **LogX**: Switches the x-axis between linear and logarithmic scales.\n    - **LogY**: Switches the y-axis between linear and logarithmic scales.\n\n\n- **Status Bar Frame**: Provides real-time updates and status information, including errors or alerts related to the\n  simulation, loading, and saving of files.\n\n### Parameters Tabs\n\n\u003cdiv id=\"fig_params\" align=\"center\"\u003e \n    \u003cimg src=\"images/gui_params.png\" alt=\"\" width=\"400\"\u003e\n    \u003cp\u003e\u003cb\u003eFigure 2:\u003c/b\u003e Parameter tabs.\u003c/p\u003e\n\u003c/div\u003e\n\nThe parameters in the Input Frame are organized into two tabs. Each parameter has a specific data type (float, int, or\nboolean) and is restricted to a particular range. If an invalid value is entered, the background of the entry field\nturns red, and the simulation cannot be executed. The following tables list the parameters along with their\ndescriptions, units, data types, default values, and valid ranges.\n\nTab 1 - **Model Params**: Physical Properties\n\n| Parameter | Description                           | Units    | Type  | Default Value | Valid Values |\n|-----------|---------------------------------------|----------|-------|---------------|--------------|\n| a_p       | Seebeck coefficient of p-type         | V/K      | float | 100e-6        | [-∞, ∞]      |\n| a_n       | Seebeck coefficient of n-type         | V/K      | float | -100e-6       | [-∞, ∞]      |\n| s_p       | Electrical conductivity of p-type leg | S/m      | float | 1e5           | [0, ∞]       |\n| s_n       | Electrical conductivity of n-type leg | S/m      | float | 1e5           | [0, ∞]       |\n| k_p       | Thermal conductivity of p-type leg    | W/(m·K)  | float | 1             | [0, ∞]       |\n| k_n       | Thermal conductivity of n-type leg    | W/(m·K)  | float | 1             | [0, ∞]       |\n| k_i       | Thermal conductivity of insulator     | W/(m·K)  | float | 0.1           | [0, ∞]       |\n| h_rh      | Thermal conductance of hot reservoir  | W/(m²·K) | float | 1e5           | [0, ∞]       |\n| h_rc      | Thermal conductance of hot substrate  | W/(m²·K) | float | 1e3           | [0, ∞]       |\n| h_sh      | Thermal conductance of cold substrate | W/(m²·K) | float | 1e4           | [0, ∞]       |\n| h_sc      | Thermal conductance of cold reservoir | W/(m²·K) | float | 1e4           | [0, ∞]       |\n\nTab 1 - **Model Params**: Device Design\n\n| Parameter | Description                                    | Units | Type  | Default Value | Valid Values  |\n|-----------|------------------------------------------------|-------|-------|---------------|---------------|\n| area_p    | Area of p-type leg                             | m²    | float | 1e-8          | [1e-12, ∞]    |\n| area_n    | Area of n-type leg                             | m²    | float | 1e-8          | [1e-12, ∞]    |\n| teg_area  | Device area                                    | m²    | float | 25e-6         | [1e-12, ∞]    |\n| ff        | (area_p + area_n) / (area_p + area_n + area_i) |       | float | 0.5           | [1e-12, ∞]    |\n| l_min     | Minimum length of the thermoelectric legs      | m     | float | 1e-6          | [1e-12, ∞]    |\n| l_max     | Maximum length of the thermoelectric legs      | m     | float | 1e-2          | [0, ∞]        |\n| m         | Device to load resistance ratio (optimal = 1)  |       | float | 1             | [0, ∞]        |\n| t_rh      | Temperature of the hot reservoir               | K     | float | 305           | [0, ∞]        |\n| t_rc      | Temperature of the cold reservoir              | K     | float | 300           | [0, ∞]        |\n\nTab 2 - **Simulation Params**: Solver\n\n| Parameter | Description                         | Units | Type  | Default Value | Valid Values  |\n|-----------|-------------------------------------|-------|-------|---------------|---------------|\n| n_steps   | Number of steps in the simulation   |       | int   | 1000          | [1, ∞]        |\n| log_steps | Use logarithmic scaling for steps   |       | bool  | True          | [True, False] |\n| n_iter    | Number of iterations for the solver |       | int   | 0             | [0, ∞]        |\n| x_tol     | Solver tolerance                    |       | float | 1.49012e-8    | [0, ∞]        |\n\nTab 2 - **Simulation Params**: Initial Conditions\n\n| Parameter | Description                                                                   | Units | Type  | Default Value | Valid Values |\n|-----------|-------------------------------------------------------------------------------|-------|-------|---------------|--------------|\n| q_h       | Heat flux absorbed from the hot reservoir                                     | W/m²  | float | 1.0           | [0, ∞]       |\n| t_sh      | Temperature between the hot reservoir and the hot substrate                   | K     | float | 305.0         | [0, ∞]       |\n| t_h       | Temperature between the hot side of the thermocouples and the hot reservoir   | K     | float | 303.0         | [0, ∞]       |\n| t_c       | Temperature between the cold side of the thermocouples and the cold reservoir | K     | float | 302.0         | [0, ∞]       |\n| t_sc      | Temperature between the cold reservoir and the cold substrate                 | K     | float | 300.0         | [0, ∞]       |\n| q_c       | Heat flux released to the cold reservoir                                      | W/m²  | float | 1.0           | [0, ∞]       |\n\n### Solver\n\n\u003cdiv id=\"fig_eq\" align=\"center\"\u003e\n    \u003cimg src=\"images/gui_eq.png\" alt=\"\" width=\"500\"\u003e\n    \u003cp\u003e\u003cb\u003eFigure 3:\u003c/b\u003e System of non-linear equations to solve.\u003c/p\u003e\n\u003c/div\u003e\n\nThe model is formulated as a parametric optimization problem, resulting in the system of non-linear equations shown in\nin [Figure 3](#fig_eq). The solver uses the finite difference method for numerical differentiation and employs SciPy's\nfsolve to solve the system of equations, utilizing the initial conditions provided by the user. Note that fsolve is a\nlocal solver, which means it finds solutions based on the initial guess provided. Therefore, choosing appropriate\ninitial conditions is crucial to ensure that the solver converges to a correct and meaningful solution. If the initial\nguess is not close to the true solution, the solver may get trapped in local minima or fail to find a solution.\n\nFor example, it is good practice to choose the initial conditions on the temperatures such that t_rh \u003e= t_sh \u003e= t_h \u003e=\nt_c \u003e= t_sc \u003e= t_sc, and to set the initial conditions on the heat flux such that q_h = h_rh * (t_rh - t_sh) and q_c =\nh_rc * (t_sc - t_rc). Following these conventions can help in achieving a more accurate and stable solution.\n\nPlease note that the heat transfer coefficients of the reservoirs, namely h_rh and h_rc, depend on their temperatures\nand might include contributions from conduction, convection, and radiation. Details on the calculation of these\ncoefficients can be found in the ESI of **D. Beretta et al.**, Sustainable Energy Fuels, 2017, 1, 174-190.\n\n### Saving and loading\n\nThe **Save Params** button saves the model parameters to disk in .json format. Similarly, the **Load Params**\nbutton loads a .json file containing previously saved parameters.\n\nThe structure of the file to be loaded must adhere to the format shown below, which includes the default values for the\nparameters. A template file is available\nat [model_params_template.json](docs/model_params_template.json) for users to edit as needed.\nPlease note that all values are saved in SI units.\n\n```json\n{\n  \"Physical Properties\": {\n    \"a_p\": 100e-6,\n    \"a_n\": -100e-6,\n    \"s_p\": 1e5,\n    \"s_n\": 1e5,\n    \"k_p\": 1e0,\n    \"k_n\": 1e0,\n    \"k_i\": 1e-1,\n    \"h_rh\": 1e5,\n    \"h_rc\": 1e3,\n    \"h_sh\": 1e4,\n    \"h_sc\": 1e4\n  },\n  \"Device Design\": {\n    \"area_p\": 1e-08,\n    \"area_n\": 1e-08,\n    \"teg_area\": 25e-6,\n    \"ff\": 0.5,\n    \"l_min\": 1e-6,\n    \"l_max\": 1e-2,\n    \"m\": 1.0,\n    \"t_rh\": 305.0,\n    \"t_rc\": 300.0\n  },\n  \"Solver\": {\n    \"n_steps\": 1000,\n    \"log_steps\": true,\n    \"n_iter\": 0,\n    \"x_tol\": 1.49012e-08\n  },\n  \"Initial Conditions\": {\n    \"q_h\": 1.0,\n    \"t_sh\": 305.0,\n    \"t_s\": 303.0,\n    \"t_c\": 302.0,\n    \"t_sc\": 300.0,\n    \"q_c\": 1.0\n  }\n}\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull\nrequests.\n\n## Credits\n\nThis app has been developed by **D. Beretta**, building on the work by **D. Beretta et al.**, Sustainable Energy Fuels,\n2017, 1, 174-190. Please refer to [CREDITS.md](CREDITS.md) and [CITATION.md](CITATION.cff) for more details.\n\n## License\n\nThis project is licensed under the GNU License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrieslab%2Fmu-teg-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberrieslab%2Fmu-teg-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrieslab%2Fmu-teg-sim/lists"}