pyfemtet 0.4.9__py3-none-any.whl → 0.4.10__py3-none-any.whl

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.

Potentially problematic release.


This version of pyfemtet might be problematic. Click here for more details.

pyfemtet/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.9"
1
+ __version__ = "0.4.10"
@@ -0,0 +1,66 @@
1
+ """Multi-objective optimization: heating element on substrate.
2
+
3
+ Using Femtet's heat conduction analysis solver, we will design
4
+ to reduce the chip temperature and shrink the board size.
5
+
6
+ Corresponding project: wat_ex14_parametric.femprj
7
+ """
8
+ from pyfemtet.opt import FEMOpt
9
+
10
+
11
+ def chip_temp(Femtet, chip_name):
12
+ """Obtain the maximum temperature of the chip.
13
+
14
+ Note:
15
+ The objective or constraint function should take Femtet
16
+ as its first argument and return a float as the output.
17
+
18
+ Params:
19
+ Femtet: An instance for manipulating Femtet with macros. For detailed information, please refer to "Femtet Macro Help".
20
+ chip_name (str): The body attribute name defined in femprj. Valid values are 'MAINCHIP' or 'SUBCHIP'.
21
+
22
+ Returns:
23
+ float: The maximum temperature of the body with the specified body attribute name.
24
+ """
25
+ Gogh = Femtet.Gogh
26
+
27
+ max_temperature, min_temperature, mean_temperature = Gogh.Watt.GetTemp(chip_name)
28
+
29
+ return max_temperature # unit: degree
30
+
31
+
32
+ def substrate_size(Femtet):
33
+ """Calculate the occupied area on the XY plane of the substrate."""
34
+ substrate_w = Femtet.GetVariableValue('substrate_w')
35
+ substrate_d = Femtet.GetVariableValue('substrate_d')
36
+ return substrate_w * substrate_d # unit: mm2
37
+
38
+
39
+ if __name__ == '__main__':
40
+
41
+ # Initialize the FEMOpt object.
42
+ # (establish connection between the optimization problem and Femtet)
43
+ femopt = FEMOpt()
44
+
45
+ # Add design variables to the optimization problem.
46
+ # (Specify the variables registered in the femprj file.)
47
+ femopt.add_parameter("substrate_w", 40, lower_bound=22, upper_bound=40)
48
+ femopt.add_parameter("substrate_d", 60, lower_bound=33, upper_bound=60)
49
+
50
+ # Add the objective function to the optimization problem.
51
+ # The target bending angle is 90 degrees.
52
+ femopt.add_objective(chip_temp, name='max temp. of<br>MAINCHIP (degree)', direction='minimize', args=('MAINCHIP',))
53
+ femopt.add_objective(chip_temp, name='max temp. of<br>SUBCHIP (degree)', direction='minimize', args=('SUBCHIP',))
54
+ femopt.add_objective(substrate_size, name='substrate size')
55
+
56
+ # Run optimization.
57
+ femopt.set_random_seed(42)
58
+ femopt.optimize(n_trials=15, n_parallel=3) # This line is the only difference with no parallel pattern.
59
+
60
+ # Stop script to keep process alive
61
+ # while you check the result in process monitor.
62
+ print('================================')
63
+ print('Finished. Press Enter to quit...')
64
+ print('================================')
65
+ input()
66
+ femopt.terminate_all()
@@ -0,0 +1,64 @@
1
+ """多目的最適化: プリント基板上ICの発熱
2
+
3
+ Femtetの熱伝導解析ソルバを使用して、ICチップの発熱を抑えつつ
4
+ 基板サイズを小さくする設計を行います。
5
+
6
+ 対応プロジェクト: wat_ex14_parametric_jp.femprj
7
+ """
8
+ from pyfemtet.opt import FEMOpt
9
+
10
+
11
+ def chip_temp(Femtet, chip_name):
12
+ """チップの最高温度を取得します。
13
+
14
+ Note:
15
+ 目的関数または制約関数は、
16
+ 第一引数としてFemtetを受け取り、
17
+ 戻り値としてfloat型を返す必要があります。
18
+
19
+ Params:
20
+ Femtet: Femtet をマクロで操作するためのインスタンスです。詳細な情報については、「Femtet マクロヘルプ」をご覧ください。
21
+ chip_name (str): femprj 内で定義されているボディ属性名です。有効な値は 'MAINCHIP' 又は 'SUBCHIP' です。
22
+
23
+ Returns:
24
+ float: 指定されたボディ属性名のボディの最高温度です。
25
+ """
26
+ Gogh = Femtet.Gogh
27
+
28
+ max_temperature, min_temperature, mean_temperature = Gogh.Watt.GetTemp(chip_name)
29
+
30
+ return max_temperature # 単位: 度
31
+
32
+
33
+ def substrate_size(Femtet):
34
+ """基板のXY平面上での専有面積を計算します。"""
35
+ substrate_w = Femtet.GetVariableValue('substrate_w')
36
+ substrate_d = Femtet.GetVariableValue('substrate_d')
37
+ return substrate_w * substrate_d # 単位: mm2
38
+
39
+
40
+ if __name__ == '__main__':
41
+
42
+ # FEMOpt オブジェクトの初期化 (最適化問題とFemtetとの接続を行います)
43
+ femopt = FEMOpt()
44
+
45
+ # 設計変数を最適化問題に追加 (femprj ファイルに登録されている変数を指定してください)
46
+ femopt.add_parameter("substrate_w", 40, lower_bound=22, upper_bound=60)
47
+ femopt.add_parameter("substrate_d", 60, lower_bound=34, upper_bound=60)
48
+
49
+ # 目的関数を最適化問題に追加
50
+ femopt.add_objective(chip_temp, name='MAINCHIP<br>最高温度(度)', direction='minimize', args=('MAINCHIP',))
51
+ femopt.add_objective(chip_temp, name='SUBCHIP<br>最高温度(度)', direction='minimize', args=('SUBCHIP',))
52
+ femopt.add_objective(substrate_size, name='基板サイズ(mm2)')
53
+
54
+ # 最適化を実行
55
+ femopt.set_random_seed(42)
56
+ femopt.optimize(n_trials=15, n_parallel=3) # この部分のみ変更します
57
+
58
+ # プロセスモニタで結果を確認するために
59
+ # Enter キーが押されるまで処理を停止します。
60
+ print('================================')
61
+ print('Finished. Press Enter to quit...')
62
+ print('================================')
63
+ input()
64
+ femopt.terminate_all()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyfemtet
3
- Version: 0.4.9
3
+ Version: 0.4.10
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  Home-page: https://github.com/pyfemtet/pyfemtet
6
6
  License: BSD-3-Clause
@@ -12,7 +12,7 @@ pyfemtet/FemtetPJTSample/her_ex40_parametric.py,sha256=B5PQoh71Q3KN2CyLU1gP_Yh9g
12
12
  pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py,sha256=UfhJffuXyhzdIWNpOrpV6xLTK1fuVvgyhlyg4Rp-628,2148
13
13
  pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj,sha256=pxacKe0NPNUPAcxqo2cATFApsMKiVt2g2e_FOk4fpjA,172895
14
14
  pyfemtet/FemtetPJTSample/wat_ex14_parametric.py,sha256=LGbWxCek0Ad2YrDCKykiQkE3aIypM4g8P3mLd_2anEE,2052
15
- pyfemtet/__init__.py,sha256=Awjzp7R_3igiNhiHUO_Jzt5iqhYXj8NZfpCn857chhM,21
15
+ pyfemtet/__init__.py,sha256=Gdbi_VjQzRTBSuTZ9qvNXnaj23vcJGy84tsQvXY5yYU,22
16
16
  pyfemtet/_test_util.py,sha256=cxSPWvYbvAMAEoY_H3XpWlhhdS0MijwZEQgZ7aa4Fy8,3727
17
17
  pyfemtet/core.py,sha256=3lqfBGJ5IuKz2Nqj5pRo7YQqKwx_0ZDL72u95Ur_1p0,1386
18
18
  pyfemtet/dispatch_extensions.py,sha256=MhWiUXVt2Cq8vDeajMK4SrajjiAmb4m2fK8gXwHLrWA,16177
@@ -43,6 +43,7 @@ pyfemtet/opt/femprj_sample/paswat_ex1_parametric_parallel.py,sha256=Px8fS_WrQ0N3
43
43
  pyfemtet/opt/femprj_sample/paswat_ex1_parametric_test_result.reccsv,sha256=RjENlloyx71dkZJ_fIY6FVWKnSBCT_RmV1dO98eJxyY,3303
44
44
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.femprj,sha256=F-yu2dGrsbrIA1Lhizu2aHTjQFTohyBmOuJv-Iyl8jk,179596
45
45
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.py,sha256=o_LeUpo779a8vCBjxqS6NNF5zS7ID4mBfFjHsYvI1vs,2484
46
+ pyfemtet/opt/femprj_sample/wat_ex14_parametric_parallel.py,sha256=_kZVa4zSxY9UAa_CA1V_tFeTpjf4F8BHAJpYLZzF-r4,2560
46
47
  pyfemtet/opt/femprj_sample/wat_ex14_parametric_test_result.reccsv,sha256=92IkN7HdHBatyacO6aU3MVhOG6rkXlodlw34oF91BSM,3056
47
48
  pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.femprj,sha256=0RBhOGhtiFAp0QSCTBYEaDY9EZymn9hJYchAOJ6PaBA,143533
48
49
  pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.py,sha256=sqhOskvRn84e1xET5rTfvbu5WG0kXvLoNfdAJ3e_XqA,5205
@@ -59,6 +60,7 @@ pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_jp.py,sha256=HwLhd1xIq_wdQch
59
60
  pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py,sha256=utOjKYFSXqvrgPtphHMeYUQpDT20K7Iw2GBLG80ga5M,2911
60
61
  pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.femprj,sha256=dMwQMt6yok_PbZLyxPYdmg5wJQwgQDZ4RhS76zdGLGk,177944
61
62
  pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.py,sha256=W30jobW1eEYuAsJJR14-EifQ1fxeXlS-gRSFqgCP4BM,2590
63
+ pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py,sha256=ul2JUwlM5jfjNRELHkT7ZDuyMOq5RAHO32vAweEhCwg,2641
62
64
  pyfemtet/opt/interface/__init__.py,sha256=qz5BszPuU3jZIoDnPjkPDAgvgHLlx1sYhuqh5ID798k,480
63
65
  pyfemtet/opt/interface/_base.py,sha256=Ti2wCicyeofAZ0DzQLYoj9PBj1lyM5_lbLa0LBoypLM,2228
64
66
  pyfemtet/opt/interface/_femtet.py,sha256=PSy1AldNK7Yg7tmxzqEmwCb5oYXouh_Y6p2vrxtwnDY,33151
@@ -74,8 +76,8 @@ pyfemtet/opt/visualization/__init__.py,sha256=PUCHoZnuZrHjTd0QQQBgzWkCpKY2noBPTv
74
76
  pyfemtet/opt/visualization/_graphs.py,sha256=eovw8ShTGGWaDNr-nZuQZd3aa_gcYr-zziB0ZSI8JPg,5436
75
77
  pyfemtet/opt/visualization/_monitor.py,sha256=VxR1RutF_bfV37IETsUSIqjPdOPnm4OwrGVJi4eA9ag,45431
76
78
  pyfemtet/opt/visualization/result_viewer.py,sha256=n3yToETPO4eDrqBtbmkB1rg0BjRQjCLbdgR84PVLAjk,379
77
- pyfemtet-0.4.9.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
78
- pyfemtet-0.4.9.dist-info/METADATA,sha256=py3VvCY5zKdeATTFUj6rQ10lZUczWBjepZUqk_d4pTo,3381
79
- pyfemtet-0.4.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
80
- pyfemtet-0.4.9.dist-info/entry_points.txt,sha256=gnfw44Hr_FcEOXVCJDSlvFzmJtmmV59gnPYChcKXem0,92
81
- pyfemtet-0.4.9.dist-info/RECORD,,
79
+ pyfemtet-0.4.10.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
80
+ pyfemtet-0.4.10.dist-info/METADATA,sha256=-jkT7ZoiDefmGX-FIEZZkEYLYVZgrqNfWk72emhtcjA,3382
81
+ pyfemtet-0.4.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
82
+ pyfemtet-0.4.10.dist-info/entry_points.txt,sha256=gnfw44Hr_FcEOXVCJDSlvFzmJtmmV59gnPYChcKXem0,92
83
+ pyfemtet-0.4.10.dist-info/RECORD,,