Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rckirby/getavec #6

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
95f4154
Add Dirichlet BC
rckirby Oct 14, 2022
62f01cb
No, really fix the comment
rckirby Oct 14, 2022
9f93b5f
Update vector_loss comments with to-dos
rckirby Oct 17, 2022
54b13c6
Adding differentiable residual loss
Re-GeorX Oct 19, 2022
c1319ad
Adding ML Framework
nguyenvanhaibk92 Oct 25, 2022
4e1efc4
Added the torchfire's residual function to the ML framework
Re-GeorX Oct 27, 2022
1343227
Checking Fenics - Fridrake
nguyenvanhaibk92 Nov 3, 2022
b2a9e3e
Change torchfire multiplication, change boundary conditions, add best…
Re-GeorX Nov 6, 2022
bea956b
Hai update results animation
nguyenvanhaibk92 Nov 9, 2022
f0e0a15
Fix adjoint use in torchfire and add new results
Re-GeorX Nov 11, 2022
2915c2e
updated the 1st problem
nguyenvanhaibk92 Nov 12, 2022
db359bb
Add SolverTorch a Firedrake solver Torch differentiable
Re-GeorX Nov 13, 2022
85444cb
Set up new experiment base on a Firedrake differentiable solver
Re-GeorX Nov 13, 2022
9efece0
Updating Inverse Framework
nguyenvanhaibk92 Nov 28, 2022
b7e14e5
Update inverse_heat_eq.py with tnet_inverse framework
Re-GeorX Nov 28, 2022
6d53e50
Done TNet
nguyenvanhaibk92 Dec 1, 2022
ee65d4d
Reorganize and clean repo. Add best results for tnet demo after 30K e…
Re-GeorX Dec 2, 2022
70ea137
PUSH
nguyenvanhaibk92 Dec 3, 2022
1f5aa3c
a
nguyenvanhaibk92 Dec 3, 2022
51b3daa
TNet figures and results
nguyenvanhaibk92 Dec 4, 2022
e56a0b4
WAITING FOR VMIN VMAX TO REPRODUCE FIGURES
nguyenvanhaibk92 Dec 4, 2022
935b97b
Add value range limits for colorbar
Re-GeorX Dec 5, 2022
9242de1
DONE animations for TNet and nFEM
nguyenvanhaibk92 Dec 8, 2022
c0167c9
Adding Readme front file
nguyenvanhaibk92 Dec 8, 2022
4a46c1a
Test readme
nguyenvanhaibk92 Dec 8, 2022
0177bdb
FInalize Readme.md
nguyenvanhaibk92 Dec 8, 2022
15e4f2f
Removing all Fenics stuff, update concise code
nguyenvanhaibk92 Dec 16, 2022
89d4c5d
Update final
nguyenvanhaibk92 Dec 16, 2022
5102791
Removing Fenics, make code concise
nguyenvanhaibk92 Dec 16, 2022
d388933
New Firedrake data, 2 files for each problem
nguyenvanhaibk92 Dec 16, 2022
c04d95a
Done,
nguyenvanhaibk92 Dec 16, 2022
33b2ab0
PEP8 refactor
Re-GeorX Dec 17, 2022
551c1ff
Add few more edits
Re-GeorX Dec 17, 2022
a2e4115
Add a few more style fixes. Add animation for tnet
Re-GeorX Dec 17, 2022
775f771
Add requiremts.txt for demos. Run flake8
Re-GeorX Dec 17, 2022
412b8ac
Change `math` to `numpy`
Re-GeorX Dec 17, 2022
b4b73f7
Fix README
Re-GeorX Dec 17, 2022
1af69ab
Add quick comment about data previously generated
Re-GeorX Dec 18, 2022
5d69a18
Update animation for TNet for final PR
nguyenvanhaibk92 Jan 14, 2023
f7e9d75
Adding comments to loading data
nguyenvanhaibk92 Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401, F405
max-line-length = 79
max-complexity = 18
select = B,C,E,F,W,T4,B9
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ tests/__pycache__/test.cpython-310-pytest-6.2.5.pyc
tests/__pycache__/test_fd_to_torch.cpython-310-pytest-6.2.5.pyc
src/torchfire/__pycache__/__init__.cpython-310.pyc
src/torchfire/__pycache__/torchfire.cpython-310.pyc

demos/VisualizingResults/
demos/*/torchfire.py
ml_templates/*
Convert_data_to_Firedrake/*
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# torchfire
Firedrake provides a high-level library for the automated solution of PDE by finite element methods.
In order to use Firedrake as a basis for scientific machine learning, we need to make it callable within a learning framework sy as PyTorch.
This package provides such bindings by means of extending PyTorch.Function, the base class for user-defined operations.
# Torchfire
Firedrake provides a high-level library for the automated solution of PDE by finite element methods. In order to use Firedrake as a basis for scientific machine learning, we need to make it callable within a learning framework sy as PyTorch. This package provides such bindings by means of extending PyTorch.Function, the base class for user-defined operations.

# Numerical problems
## Problem 1: Solving heat equation with nFEM-TorchFire

<p align="center">
<img width="800" height = "250" src="demos/nfem_heat_equation/results/animations.gif">
<figcaption><b>Figure 1:</b> (Left) Ground truth conductivity diffusion, (Middle) Temperature field obtained by Firedrake software, (Right) Temperature field obtained by nFEM, TorchFire</figcaption>
</p>


## Problem 2: Conductivity diffusion field inversion from sparse observations with TNet-TorchFire
<p align="center">
<img width="550" height = "250" src="demos/tnet_heat_equation/results/animations.gif">
<figcaption><b>Figure 2:</b> (Left) Ground truth conductivity diffusion, (Right) Predicted Conductivity diffusion obtained by TNet-TorchFire, reconstructed from 10 random observables over the domain</figcaption>
</p>


1 change: 1 addition & 0 deletions demos/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .torchfire import fd_to_torch
Binary file not shown.
211 changes: 211 additions & 0 deletions demos/nfem_heat_equation/data/Degree_of_Freedom_indices.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
0
3
6
7
10
11
12
15
16
17
18
21
22
23
24
25
28
29
30
31
32
33
36
37
38
39
40
41
42
45
46
47
48
49
50
51
52
55
56
57
58
59
60
61
62
63
66
67
68
69
70
71
72
73
74
75
78
79
80
81
82
83
84
85
86
87
88
91
92
93
94
95
96
97
98
99
100
101
102
105
106
107
108
109
110
111
112
113
114
115
116
117
120
121
122
123
124
125
126
127
128
129
130
131
132
133
137
138
139
140
141
142
143
144
145
146
147
148
149
150
152
153
154
155
156
157
158
159
160
161
162
163
164
166
167
168
169
170
171
172
173
174
175
176
177
179
180
181
182
183
184
185
186
187
188
189
191
192
193
194
195
196
197
198
199
200
202
203
204
205
206
207
208
209
210
212
213
214
215
216
217
218
219
221
222
223
224
225
226
227
229
230
231
232
233
234
236
237
238
239
240
242
243
244
245
247
248
249
251
252
254
Loading