Skip to content

Commit 0f4d837

Browse files
committed
add some code for chip heat
1 parent f60c742 commit 0f4d837

File tree

8 files changed

+300
-49
lines changed

8 files changed

+300
-49
lines changed

docs/zh/api/arch.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
- USCNN
2525
- NowcastNet
2626
- HEDeepONets
27-
- DGMR
2827
- ChipDeepONets
2928
- AutoEncoder
3029
show_root_heading: true

docs/zh/api/data/dataset.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
members:
77
- IterableNamedArrayDataset
88
- NamedArrayDataset
9-
- DeepONetArrayDataset
9+
- ChipHeatDataset
1010
- CSVDataset
1111
- IterableCSVDataset
1212
- ERA5Dataset
@@ -23,5 +23,4 @@
2323
- MeshCylinderDataset
2424
- RadarDataset
2525
- build_dataset
26-
- DGMRDataset
2726
show_root_heading: true

docs/zh/examples/chip_heat.md

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

examples/chip_heat_simulation/chip_heat_simulation.py renamed to examples/chip_heat/chip_heat.py

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def train(cfg: DictConfig):
198198
top_sup_constraint = ppsci.constraint.SupervisedConstraint(
199199
{
200200
"dataset": {
201-
"name": "DeepONetArrayDataset",
201+
"name": "ChipHeatDataset",
202202
"input": top_data,
203203
"label": label,
204204
"index": index,
@@ -238,7 +238,7 @@ def train(cfg: DictConfig):
238238
down_sup_constraint = ppsci.constraint.SupervisedConstraint(
239239
{
240240
"dataset": {
241-
"name": "DeepONetArrayDataset",
241+
"name": "ChipHeatDataset",
242242
"input": down_data,
243243
"label": label,
244244
"index": index,
@@ -278,7 +278,7 @@ def train(cfg: DictConfig):
278278
left_sup_constraint = ppsci.constraint.SupervisedConstraint(
279279
{
280280
"dataset": {
281-
"name": "DeepONetArrayDataset",
281+
"name": "ChipHeatDataset",
282282
"input": left_data,
283283
"label": label,
284284
"index": index,
@@ -318,7 +318,7 @@ def train(cfg: DictConfig):
318318
right_sup_constraint = ppsci.constraint.SupervisedConstraint(
319319
{
320320
"dataset": {
321-
"name": "DeepONetArrayDataset",
321+
"name": "ChipHeatDataset",
322322
"input": right_data,
323323
"label": label,
324324
"index": index,
@@ -358,7 +358,7 @@ def train(cfg: DictConfig):
358358
interior_sup_constraint = ppsci.constraint.SupervisedConstraint(
359359
{
360360
"dataset": {
361-
"name": "DeepONetArrayDataset",
361+
"name": "ChipHeatDataset",
362362
"input": interior_data,
363363
"label": label,
364364
"index": index,
@@ -389,7 +389,7 @@ def train(cfg: DictConfig):
389389
}
390390

391391
# set optimizer
392-
optimizer = ppsci.optimizer.Adam(cfg.TRAIN.learning_rate)((model,))
392+
optimizer = ppsci.optimizer.Adam(cfg.TRAIN.learning_rate)(model)
393393

394394
# set validator
395395
top_down_label = {"chip": np.zeros([cfg.NL, 1], dtype="float32")}
@@ -410,9 +410,6 @@ def train(cfg: DictConfig):
410410
},
411411
},
412412
"batch_size": cfg.NL,
413-
"sampler": {
414-
"name": "BatchSampler",
415-
},
416413
},
417414
ppsci.loss.MSELoss("mean"),
418415
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -430,9 +427,6 @@ def train(cfg: DictConfig):
430427
},
431428
},
432429
"batch_size": cfg.NL,
433-
"sampler": {
434-
"name": "BatchSampler",
435-
},
436430
},
437431
ppsci.loss.MSELoss("mean"),
438432
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -450,9 +444,6 @@ def train(cfg: DictConfig):
450444
},
451445
},
452446
"batch_size": (cfg.NL - 2),
453-
"sampler": {
454-
"name": "BatchSampler",
455-
},
456447
},
457448
ppsci.loss.MSELoss("mean"),
458449
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -470,9 +461,6 @@ def train(cfg: DictConfig):
470461
},
471462
},
472463
"batch_size": (cfg.NL - 2),
473-
"sampler": {
474-
"name": "BatchSampler",
475-
},
476464
},
477465
ppsci.loss.MSELoss("mean"),
478466
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -487,9 +475,6 @@ def train(cfg: DictConfig):
487475
"label": interior_label,
488476
},
489477
"batch_size": cfg.TRAIN.batch_size,
490-
"sampler": {
491-
"name": "BatchSampler",
492-
},
493478
},
494479
ppsci.loss.MSELoss("mean"),
495480
output_expr={
@@ -636,9 +621,6 @@ def evaluate(cfg: DictConfig):
636621
},
637622
},
638623
"batch_size": cfg.NL,
639-
"sampler": {
640-
"name": "BatchSampler",
641-
},
642624
},
643625
ppsci.loss.MSELoss("mean"),
644626
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -656,9 +638,6 @@ def evaluate(cfg: DictConfig):
656638
},
657639
},
658640
"batch_size": cfg.NL,
659-
"sampler": {
660-
"name": "BatchSampler",
661-
},
662641
},
663642
ppsci.loss.MSELoss("mean"),
664643
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -676,9 +655,6 @@ def evaluate(cfg: DictConfig):
676655
},
677656
},
678657
"batch_size": (cfg.NL - 2),
679-
"sampler": {
680-
"name": "BatchSampler",
681-
},
682658
},
683659
ppsci.loss.MSELoss("mean"),
684660
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -696,9 +672,6 @@ def evaluate(cfg: DictConfig):
696672
},
697673
},
698674
"batch_size": (cfg.NL - 2),
699-
"sampler": {
700-
"name": "BatchSampler",
701-
},
702675
},
703676
ppsci.loss.MSELoss("mean"),
704677
output_expr={"chip": lambda out: out["T"] - out["u_one"]},
@@ -713,9 +686,6 @@ def evaluate(cfg: DictConfig):
713686
"label": interior_label,
714687
},
715688
"batch_size": cfg.TRAIN.batch_size,
716-
"sampler": {
717-
"name": "BatchSampler",
718-
},
719689
},
720690
ppsci.loss.MSELoss("mean"),
721691
output_expr={

examples/chip_heat_simulation/conf/chip_heat_simulation.yaml renamed to examples/chip_heat/conf/chip_heat.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
hydra:
22
run:
33
# dynamic output directory according to running time and override name
4-
dir: outputs/${now:%Y-%m-%d}/${now:%H-%M-%S}/${hydra.job.override_dirname}
4+
dir: outputs_chip_heat/${now:%Y-%m-%d}/${now:%H-%M-%S}/${hydra.job.override_dirname}
55
job:
66
name: ${mode} # name of logfile
77
chdir: false # keep current working direcotry unchanged
@@ -45,7 +45,7 @@ MODEL:
4545
BC_input_keys: ['bc_data']
4646
trunk_input_keys: ["x", "y"]
4747
output_keys: ["T"]
48-
num_loc: 324 #18*18
48+
num_loc: 324 # 18*18
4949
bctype_loc: 1
5050
BC_num_loc: 76
5151
num_features: 400

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ nav:
7676
- Heat_Exchanger: zh/examples/heat_exchanger.md
7777
- Heat_PINN: zh/examples/heat_pinn.md
7878
- PhyGeoNet: zh/examples/phygeonet.md
79-
- Chip_heat_simulation: zh/examples/chip_heat_simulation.md
79+
- Chip_heat: zh/examples/chip_heat_simulation.md
8080
- 材料科学(AI for Material):
8181
- hPINNs: zh/examples/hpinns.md
8282
- 地球科学(AI for Earth Science):

ppsci/data/dataset/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
from typing import TYPE_CHECKING
1717

1818
from ppsci.data.dataset.airfoil_dataset import MeshAirfoilDataset
19-
from ppsci.data.dataset.array_dataset import DeepONetArrayDataset
19+
from ppsci.data.dataset.array_dataset import ChipHeatDataset
2020
from ppsci.data.dataset.array_dataset import IterableNamedArrayDataset
2121
from ppsci.data.dataset.array_dataset import NamedArrayDataset
2222
from ppsci.data.dataset.csv_dataset import CSVDataset
2323
from ppsci.data.dataset.csv_dataset import IterableCSVDataset
2424
from ppsci.data.dataset.cylinder_dataset import MeshCylinderDataset
25-
from ppsci.data.dataset.dgmr_dataset import DGMRDataset
2625
from ppsci.data.dataset.era5_dataset import ERA5Dataset
2726
from ppsci.data.dataset.era5_dataset import ERA5SampledDataset
2827
from ppsci.data.dataset.mat_dataset import IterableMatDataset
@@ -43,7 +42,7 @@
4342
__all__ = [
4443
"IterableNamedArrayDataset",
4544
"NamedArrayDataset",
46-
"DeepONetArrayDataset",
45+
"ChipHeatDataset",
4746
"CSVDataset",
4847
"IterableCSVDataset",
4948
"ERA5Dataset",
@@ -57,7 +56,6 @@
5756
"RadarDataset",
5857
"RosslerDataset",
5958
"VtuDataset",
60-
"DGMRDataset",
6159
"MeshAirfoilDataset",
6260
"MeshCylinderDataset",
6361
"build_dataset",

ppsci/data/dataset/array_dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ def __len__(self):
142142
return 1
143143

144144

145-
class DeepONetArrayDataset(io.Dataset):
146-
"""DeepONetArrayDataset for data loading of multi-branch DeepONet model.
145+
class ChipHeatDataset(io.Dataset):
146+
"""ChipHeatDataset for data loading of multi-branch DeepONet model.
147147
148148
Args:
149149
input (Dict[str, np.ndarray]): Input dict.
@@ -161,7 +161,7 @@ class DeepONetArrayDataset(io.Dataset):
161161
>>> index = ('x', 'u', 'bc', 'bc_data')
162162
>>> data_type = 'u'
163163
>>> weight = {"u": np.random.randn(100, 1)}
164-
>>> dataset = ppsci.data.dataset.DeepONetArrayDataset(input, label, index, data_type, weight)
164+
>>> dataset = ppsci.data.dataset.ChipHeatDataset(input, label, index, data_type, weight)
165165
"""
166166

167167
def __init__(

0 commit comments

Comments
 (0)