pinnstudio 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Asfandyar Khan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,345 @@
1
+ Metadata-Version: 2.4
2
+ Name: pinnstudio
3
+ Version: 1.1.0
4
+ Summary: No-code GUI for Physics-Informed Neural Networks using DeepXDE
5
+ Home-page: https://github.com/AsfandyarKhan72/PINNStudio
6
+ Author: AsfandyarKhan72
7
+ License: MIT
8
+ Project-URL: Source, https://github.com/AsfandyarKhan72/PINNStudio
9
+ Project-URL: Issues, https://github.com/AsfandyarKhan72/PINNStudio/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Topic :: Scientific/Engineering :: Physics
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: deepxde>=1.10.0
18
+ Requires-Dist: torch>=2.0
19
+ Requires-Dist: PyQt6>=6.4
20
+ Requires-Dist: PyQt6==6.6.1; sys_platform == "win32"
21
+ Requires-Dist: PyQt6-Qt6==6.6.1; sys_platform == "win32"
22
+ Requires-Dist: numpy
23
+ Requires-Dist: matplotlib
24
+ Requires-Dist: pandas
25
+ Dynamic: author
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: description-content-type
29
+ Dynamic: home-page
30
+ Dynamic: license
31
+ Dynamic: license-file
32
+ Dynamic: project-url
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
36
+
37
+ # PINNStudio
38
+
39
+ *A no-code desktop GUI for building, training, and visualizing Physics-Informed Neural Networks (PINNs) — built on [DeepXDE](https://github.com/lululxvi/deepxde).*
40
+
41
+ ---
42
+
43
+ ## Overview
44
+
45
+ Setting up a Physics-Informed Neural Network usually means writing a new DeepXDE script for every problem: defining the PDE residual, wiring up boundary and initial conditions, picking collocation points, choosing an optimizer schedule, and writing your own plotting/error-analysis code afterward.
46
+
47
+ PINNStudio replaces that boilerplate with a form. You describe the problem — the PDE, the domain, the boundary and initial conditions, the network architecture, the training schedule — through the interface, and PINNStudio generates a standalone DeepXDE/PyTorch script, runs it, and streams the training log, loss curves, and solution plots back into the GUI.
48
+
49
+ It supports both **forward problems** (solve a known PDE) and **inverse problems** (estimate unknown PDE parameters from observation data), in 1D `(x, t)` and 2D `(x, y, t)`, including coupled, multi-output PDE systems.
50
+
51
+ The goal is to make physics-informed machine learning accessible to researchers who need it but don't want to become deep learning engineers first. Setting up a PINN by hand touches autograd-based residuals, collocation sampling, loss weighting, and optimizer scheduling all at once — details that are easy to get subtly wrong and can cost hours of debugging before a single result can be trusted. PINNStudio lets researchers across science and engineering — materials science, mechanics, chemistry, biology, and beyond — set up and run both forward and inverse PINN problems for their own equations without building that infrastructure from scratch, on a framework that has been thoroughly tested so results are trustworthy from the first run.
52
+
53
+ ## Demo Video
54
+
55
+ [![PINNStudio demo - setting up a PDE](https://img.youtube.com/vi/Ap-0VRwFbgE/maxresdefault.jpg)](https://youtu.be/Ap-0VRwFbgE)
56
+
57
+ *Click to watch a full walkthrough of the PDE setup panel on YouTube.*
58
+
59
+ ## Screenshots
60
+
61
+ <p align="center">
62
+ <img src="assets/screenshots/pde_builder.png" alt="PINNStudio — PDE, domain, and collocation point setup" width="800">
63
+ </p>
64
+ <p align="center"><em>Problem setup: PDE residual, domain, and collocation points.</em></p>
65
+
66
+ <p align="center">
67
+ <img src="assets/screenshots/training_panel.png" alt="PINNStudio — network, training schedule, and adaptive training controls" width="800">
68
+ </p>
69
+ <p align="center"><em>Network architecture, multi-phase optimizer schedule, loss weights, and adaptive training.</em></p>
70
+
71
+ <p align="center">
72
+ <img src="assets/results/restored_animation.gif" alt="Animated PINN solution — time evolution predicted by a restored PINNStudio model" width="500">
73
+ </p>
74
+ <p align="center"><em>Time evolution of a PINN solution, reconstructed from a saved checkpoint via Model Restore.</em></p>
75
+
76
+ ## Example Solutions
77
+
78
+ <p align="center">
79
+ <img src="assets/results/1d_heat_solution.png" alt="PINNStudio — 1D Heat PINN solution" width="700">
80
+ </p>
81
+ <p align="center"><em>1D Heat: PINN-predicted solution against the bundled FEM reference data.</em></p>
82
+
83
+ <p align="center">
84
+ <img src="assets/results/1d_allen_cahn_solution.png" alt="PINNStudio — 1D Allen-Cahn PINN solution" width="700">
85
+ </p>
86
+ <p align="center"><em>1D Allen-Cahn: PINN-predicted solution against the bundled FEM reference data.</em></p>
87
+
88
+ <p align="center">
89
+ <img src="assets/results/1d_allen_cahn_inverse.png" alt="PINNStudio — 1D Allen-Cahn Inverse parameter estimation result" width="700">
90
+ </p>
91
+ <p align="center"><em>1D Allen-Cahn (Inverse): the unknown diffusion parameter recovered from observation data, converging to its true value during training.</em></p>
92
+
93
+ ## Features
94
+
95
+ **Problem setup**
96
+ - 1D `(x, t)` and 2D `(x, y, t)` problem definitions
97
+ - Forward problems and inverse (parameter-estimation) problems
98
+ - Free-form PDE residual editor — supports multi-output, coupled PDE systems, not just single equations
99
+ - Boundary conditions per side, per output (Dirichlet, Neumann, Periodic), and initial conditions from an expression or a data file
100
+ - Collocation point controls (domain / boundary / initial / test point counts, point distribution) with a 2D domain preview
101
+ - For inverse problems, the built-in templates auto-load their end-time reference file as the observed-data source and default the observed-data loss weight to 100, so estimating a parameter needs no manual file browsing to get started (still overridable)
102
+
103
+ **Training**
104
+ - Configurable network architecture (hidden layers, neurons per layer, activation)
105
+ - Two-stage optimization (Adam + L-BFGS) with detailed L-BFGS settings and configurable float precision
106
+ - Multi-phase optimizer scheduling and optional IC-guided pre-training
107
+ - Residual-based adaptive refinement (RAR)
108
+ - Time-adaptive stepping with transfer learning between time windows
109
+ - Mini-batch training
110
+ - Live parameter convergence during inverse training — the estimated parameter's value prints and saves periodically throughout training, including during L-BFGS phases, not just at the end
111
+
112
+ **Templates**
113
+ - Seven built-in Quick Example templates covering common phase-field and diffusion problems (see [Built-in Templates](#built-in-templates))
114
+
115
+ **Analysis & output**
116
+ - Live training log streaming, with a Stop control
117
+ - Error analysis against reference/ground-truth data (L2, MSE, max error; line and surface comparison plots)
118
+ - Configurable result plotting (colormap, resolution, DPI, colorbar, snapshot count)
119
+ - Solution data export
120
+ - Model restore — reload a saved checkpoint to regenerate plots and re-run error analysis without retraining
121
+
122
+ ## Repository Structure
123
+
124
+ ```text
125
+ pinnstudio/
126
+ ├── pinnstudio/
127
+ │ ├── main.py # Entry point
128
+ │ ├── ui/
129
+ │ │ └── main_window.py # PyQt6 interface — every tab, dialog, and control
130
+ │ └── core/
131
+ │ ├── config.py # PINNConfig — the full problem definition
132
+ │ ├── codegen.py # PINNConfig -> standalone DeepXDE/PyTorch script
133
+ │ └── runner.py # Runs the generated script, streams output to the GUI
134
+ ├── assets/
135
+ │ ├── screenshots/ # README screenshots
136
+ │ └── results/ # Example output (restored_animation.gif, solution images)
137
+ ├── reference_data/ # Bundled FEM ground truth for the built-in templates
138
+ │ ├── 1D/
139
+ │ └── 2D/
140
+ ├── requirements.txt
141
+ ├── setup.py
142
+ ├── install.sh # One-command setup (macOS/Linux)
143
+ ├── install.bat # One-command setup (Windows)
144
+ └── README.md
145
+ ```
146
+
147
+ ## Quick Start
148
+
149
+ ### Step 1: Open a terminal
150
+
151
+ - **Windows:** click the Start menu, type `PowerShell`, and open **Windows PowerShell**.
152
+ - **macOS:** press `Cmd + Space` to open Spotlight, type `Terminal`, and press Enter (or find it under Applications -> Utilities -> Terminal).
153
+ - **Linux:** open your terminal application (commonly `Ctrl + Alt + T`, or search "Terminal" in your application menu).
154
+
155
+ ### Step 2: Check you have git and Python 3.9+
156
+
157
+ Paste these one at a time:
158
+
159
+ ```bash
160
+ git --version
161
+ python3 --version
162
+ ```
163
+
164
+ (On Windows, use `python --version` instead of `python3 --version`.)
165
+
166
+ If either command isn't recognized:
167
+
168
+ - **git missing?** Install it from [git-scm.com/downloads](https://git-scm.com/downloads). Default options are fine. On macOS, running `git --version` for the first time may itself prompt you to install Apple's Command Line Tools — accept and let it finish, then try again.
169
+ - **Python missing, or older than 3.9?** Install it from [python.org/downloads](https://www.python.org/downloads/). **On Windows, check "Add python.exe to PATH"** on the installer's first screen — this is the single most common thing people miss.
170
+
171
+ After installing either one, close your terminal window completely and open a new one before continuing, so the change takes effect.
172
+
173
+ ### Step 3: Clone and install
174
+
175
+ ```bash
176
+ git clone https://github.com/AsfandyarKhan72/PINNStudio.git
177
+ cd PINNStudio
178
+ ```
179
+
180
+ **macOS / Linux:**
181
+ ```bash
182
+ bash install.sh
183
+ ./venv/bin/pinnstudio
184
+ ```
185
+
186
+ **Windows:**
187
+ ```
188
+ install.bat
189
+ .\venv\Scripts\pinnstudio.exe
190
+ ```
191
+
192
+ The install script creates an isolated virtual environment inside the `PINNStudio` folder and installs PINNStudio and its dependencies into it — nothing is installed system-wide, and deleting the folder removes it completely. If it detects an NVIDIA GPU that the default PyTorch build can't use (an older driver, most commonly), it automatically installs a more compatible PyTorch build instead, so GPU support works out of the box on more machines. This step needs an internet connection and can take a few minutes.
193
+
194
+ > **Already have a working PyTorch + CUDA setup, or no GPU at all?** You can also install with `pip install pinnstudio` - just be aware it skips the GPU compatibility check above, so if you hit a GPU-related error afterward, re-run `install.sh` / `install.bat` instead.
195
+
196
+ ### Step 4: Take the 60-second tour
197
+
198
+ Maximize the window for the best view — PINNStudio packs a lot of controls into the left panel. With the app open, leave the dimension on **1D**, pick **1D Heat** from the *Quick Examples* dropdown, and click **Solve**. The Training Log panel will stream progress, and the loss/solution plots will populate once the run finishes.
199
+
200
+ ### Something not working?
201
+
202
+ Open an issue on GitHub with the exact command you ran and the full error message — see [Contributing](#contributing).
203
+
204
+ ## Running PINNStudio Again
205
+
206
+ You only need to run the install steps above once. After that, launch PINNStudio again anytime with:
207
+
208
+ **macOS / Linux**, from inside the `PINNStudio` folder:
209
+ ```bash
210
+ ./venv/bin/pinnstudio
211
+ ```
212
+
213
+ **Windows**, from inside the `PINNStudio` folder:
214
+ ```
215
+ .\venv\Scripts\pinnstudio.exe
216
+ ```
217
+
218
+ That's it - no need to reinstall or recreate the virtual environment.
219
+
220
+ ## What Gets Installed
221
+
222
+ `install.sh` / `install.bat` (used in Quick Start above) set up an isolated Python virtual environment and install:
223
+
224
+ - [DeepXDE](https://github.com/lululxvi/deepxde) (PyTorch backend)
225
+ - PyTorch
226
+ - PyQt6
227
+ - NumPy
228
+ - Matplotlib
229
+ - Pandas
230
+
231
+ A CUDA-capable GPU is optional but recommended for larger 2D problems and inverse runs.
232
+
233
+ ## Built-in Templates
234
+
235
+ Each template preconfigures the PDE, domain, boundary/initial conditions, network size, and training schedule — pick one from *Quick Examples*, then adjust as needed.
236
+
237
+ All seven templates ship with bundled FEM reference data (see [`reference_data/`](reference_data)), generated independently of the PINN, so Error Analysis auto-configures against real ground truth the moment you load them — no setup, no external download.
238
+
239
+ | Template | Dimension | System | Reference data |
240
+ |---|---|---|---|
241
+ | 1D Heat | 1D | Single PDE | ✅ bundled |
242
+ | 1D Allen-Cahn | 1D | Single PDE | ✅ bundled |
243
+ | 1D Cahn-Hilliard | 1D | Coupled (2 outputs) | ✅ bundled |
244
+ | 2D Heat (Dirichlet/Neumann) | 2D | Single PDE | ✅ bundled |
245
+ | 2D Allen-Cahn (Mattey) | 2D | Single PDE | ✅ bundled |
246
+ | 2D Allen-Cahn (Wight) | 2D | Single PDE | ✅ bundled |
247
+ | 2D Cahn-Hilliard (Wight) | 2D | Coupled (2 outputs) | ✅ bundled |
248
+
249
+ ### 1D Heat
250
+
251
+ $$\frac{\partial u}{\partial t} = 0.4\frac{\partial^2 u}{\partial x^2}, \qquad x \in [0, 1],\ t \in [0, 1]$$
252
+
253
+ Initial condition: $u(x, 0) = \sin(\pi x)$. Dirichlet boundaries.
254
+
255
+ ### 1D Allen-Cahn
256
+
257
+ $$\frac{\partial u}{\partial t} = 0.0001\frac{\partial^2 u}{\partial x^2} - 5u^3 + 5u, \qquad x \in [-1, 1],\ t \in [0, 1]$$
258
+
259
+ Initial condition: $u(x, 0) = x^2\cos(\pi x)$. Periodic boundaries.
260
+
261
+ ### 1D Cahn-Hilliard
262
+
263
+ Fourth-order phase separation, split into two coupled second-order equations:
264
+
265
+ $$\frac{\partial u}{\partial t} = \frac{\partial^2 v}{\partial x^2}, \qquad v = 0.01(u^3 - u) - 10^{-6}\frac{\partial^2 u}{\partial x^2}, \qquad x \in [-1, 1],\ t \in [0, 1]$$
266
+
267
+ Initial condition: $u(x, 0) = -\cos(2\pi x)$. Periodic boundaries.
268
+
269
+ ### 2D Heat (Dirichlet/Neumann)
270
+
271
+ $$\frac{\partial u}{\partial t} = 0.4\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}\right), \qquad (x, y) \in [0, 1]^2,\ t \in [0, 1]$$
272
+
273
+ Initial condition: $u(x, y, 0) = 0$. Mixed Dirichlet/Neumann boundaries.
274
+
275
+ ### 2D Allen-Cahn (Mattey)
276
+
277
+ Benchmark problem after Mattey & Ghosh (2022) — see [References](#references).
278
+
279
+ $$\frac{\partial u}{\partial t} = 0.0001\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}\right) - 5(u^3 - u), \qquad (x, y) \in [0, 1]^2,\ t \in [0, 1]$$
280
+
281
+ Initial condition: $u(x, y, 0) = \sin(4\pi x)\cos(4\pi y)$. Periodic boundaries.
282
+
283
+ ### 2D Allen-Cahn (Wight)
284
+
285
+ Benchmark problem after Wight & Zhao (2021) — see [References](#references).
286
+
287
+ $$\frac{\partial u}{\partial t} = 0.00625\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}\right) - 10(u^3 - u), \qquad (x, y) \in [0, 1]^2,\ t \in [0, 10]$$
288
+
289
+ Initial condition: a smooth circular interface, $u(x, y, 0) = \tanh\left(\dfrac{0.35 - \sqrt{(x-0.5)^2 + (y-0.5)^2}}{0.05}\right)$. Periodic boundaries.
290
+
291
+ ### 2D Cahn-Hilliard (Wight)
292
+
293
+ Benchmark problem after Wight & Zhao (2021) — see [References](#references). Two-phase separation, split into a composition field $u$ and a chemical potential $\mu$:
294
+
295
+ $$\frac{\partial u}{\partial t} = \frac{\partial^2 \mu}{\partial x^2} + \frac{\partial^2 \mu}{\partial y^2}, \qquad \mu = (u^3 - u) - 0.1\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}\right), \qquad (x, y) \in [-0.5, 0.5]^2$$
296
+
297
+ Initial condition: two circular domains of opposite phase. Periodic boundaries.
298
+
299
+ ## How It Works
300
+
301
+ PINNStudio doesn't wrap DeepXDE at runtime — it **generates code**. Every setting in the GUI maps to a field on a `PINNConfig` dataclass ([`pinnstudio/core/config.py`](pinnstudio/core/config.py)); clicking **Solve** passes that config to [`codegen.py`](pinnstudio/core/codegen.py), which writes out a complete, standalone DeepXDE/PyTorch script, and [`runner.py`](pinnstudio/core/runner.py) executes it as a subprocess, streaming stdout back into the Training Log panel in real time.
302
+
303
+ Because the output of every run is an ordinary Python script, you can take it and run it outside the GUI, hand it to a cluster job, or use it as a starting point for a hand-written DeepXDE project.
304
+
305
+ ## Citation
306
+
307
+ If PINNStudio is useful in your work, please cite it — see [`CITATION.cff`](CITATION.cff):
308
+
309
+ ```bibtex
310
+ @software{khan2026pinnstudio,
311
+ author = {Khan, Asfandyar},
312
+ title = {PINNStudio: A No-Code GUI for Physics-Informed Neural Networks},
313
+ year = {2026},
314
+ url = {https://github.com/AsfandyarKhan72/PINNStudio}
315
+ }
316
+ ```
317
+
318
+ ## References
319
+
320
+ - Lu, L., Meng, X., Mao, Z., & Karniadakis, G. E. (2021). DeepXDE: A deep learning library for solving differential equations. *SIAM Review*, 63(1), 208–228. https://doi.org/10.1137/19M1274067
321
+ - Mattey, R., & Ghosh, S. (2022). A novel sequential method to train physics informed neural networks for Allen-Cahn and Cahn-Hilliard equations. *Computer Methods in Applied Mechanics and Engineering*, 390, 114474. https://doi.org/10.1016/j.cma.2021.114474
322
+ - Wight, C. L., & Zhao, J. (2021). Solving Allen-Cahn and Cahn-Hilliard equations using the adaptive physics informed neural networks. *Communications in Computational Physics*, 29(3), 930–954. https://doi.org/10.4208/cicp.OA-2020-0086
323
+
324
+ ## Acknowledgment
325
+
326
+ PINNStudio is built on [DeepXDE](https://github.com/lululxvi/deepxde) (Lu et al., 2021) and PyQt6. The 2D Allen-Cahn and Cahn-Hilliard Quick Example templates follow the problem setups described in Mattey & Ghosh (2022) and Wight & Zhao (2021) — see [References](#references).
327
+
328
+ Developed under the supervision of Prof. Mahmood Mamivand, Computational Materials Design Lab, Boise State University.
329
+
330
+ The authors appreciate the support of the National Science Foundation grant DMR-2142935. We would like to acknowledge the high-performance computing support of the Borah compute cluster (DOI: 10.18122/oit/3/boisestate) provided by Boise State University's Research Computing Department.
331
+
332
+ ## Contributing
333
+
334
+ Bug reports, feature requests, and pull requests are welcome — see [`CONTRIBUTING.md`](CONTRIBUTING.md).
335
+
336
+ ## Contact
337
+
338
+ Asfandyar Khan
339
+ PhD Candidate, Materials Science and Engineering
340
+ Boise State University
341
+ Email: [asfandyarkhan@u.boisestate.edu](mailto:asfandyarkhan@u.boisestate.edu)
342
+
343
+ ## License
344
+
345
+ Released under the MIT License. See [`LICENSE`](LICENSE) for details.