pyfemtet 0.1.12__py3-none-any.whl → 0.2.1__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.

Files changed (33) hide show
  1. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj +0 -0
  2. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt +0 -0
  3. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +69 -32
  4. pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj +0 -0
  5. pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +37 -25
  6. pyfemtet/FemtetPJTSample/her_ex40_parametric.py +57 -35
  7. pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +62 -0
  8. pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
  9. pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +61 -0
  10. pyfemtet/__init__.py +1 -1
  11. pyfemtet/opt/_FemtetWithNX/update_model.py +6 -2
  12. pyfemtet/opt/__init__.py +1 -1
  13. pyfemtet/opt/base.py +457 -86
  14. pyfemtet/opt/core.py +77 -17
  15. pyfemtet/opt/interface.py +217 -137
  16. pyfemtet/opt/monitor.py +181 -98
  17. pyfemtet/opt/{_optuna.py → optimizer.py} +70 -30
  18. pyfemtet/tools/DispatchUtils.py +46 -44
  19. {pyfemtet-0.1.12.dist-info → pyfemtet-0.2.1.dist-info}/LICENSE +1 -1
  20. pyfemtet-0.2.1.dist-info/METADATA +42 -0
  21. pyfemtet-0.2.1.dist-info/RECORD +31 -0
  22. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01 - original.x_t +0 -359
  23. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.x_t +0 -359
  24. pyfemtet/FemtetPJTSample/fem4 = Femtet(femprj_path=None, model_name=None, connect_method='catch').femprj +0 -0
  25. pyfemtet/FemtetPJTSample/gal_ex11_parametric.femprj +0 -0
  26. pyfemtet/FemtetPJTSample/gal_ex11_parametric.py +0 -54
  27. pyfemtet/FemtetPJTSample/pas_ex1_parametric.femprj +0 -0
  28. pyfemtet/FemtetPJTSample/pas_ex1_parametric.py +0 -66
  29. pyfemtet/FemtetPJTSample/pas_ex1_parametric2.py +0 -68
  30. pyfemtet/tools/FemtetClassConst.py +0 -9
  31. pyfemtet-0.1.12.dist-info/METADATA +0 -205
  32. pyfemtet-0.1.12.dist-info/RECORD +0 -37
  33. {pyfemtet-0.1.12.dist-info → pyfemtet-0.2.1.dist-info}/WHEEL +0 -0
@@ -1,205 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: pyfemtet
3
- Version: 0.1.12
4
- Summary: Design parameter optimization using Femtet.
5
- Home-page: https://github.com/pyfemtet/pyfemtet
6
- License: BSD-3-Clause
7
- Author: kazuma.naito
8
- Author-email: kazuma.naito@murata.com
9
- Requires-Python: >=3.11,<4.0
10
- Classifier: License :: OSI Approved :: BSD License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Dist: dash (>=2.14.2,<3.0.0)
15
- Requires-Dist: femtetutils (>=1.0.0,<2.0.0)
16
- Requires-Dist: numpy (>=1.26.2,<2.0.0)
17
- Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
18
- Requires-Dist: optuna (>=3.4.0,<4.0.0)
19
- Requires-Dist: pandas (>=2.1.3,<3.0.0)
20
- Requires-Dist: plotly (>=5.18.0,<6.0.0)
21
- Requires-Dist: psutil (>=5.9.6,<6.0.0)
22
- Requires-Dist: pywin32 (>=306,<307)
23
- Requires-Dist: ray (>=2.8.1,<3.0.0)
24
- Requires-Dist: scipy (>=1.11.4,<2.0.0)
25
- Requires-Dist: tqdm (>=4.66.1,<5.0.0)
26
- Project-URL: Repository, https://github.com/pyfemtet/pyfemtet
27
- Description-Content-Type: text/markdown
28
-
29
- # Welcome To PyFemtet !
30
- pyfemtet.opt は、Femtet を用いてパラメータ最適化を行うことのできる Python パッケージです。
31
-
32
- ## 機能
33
-
34
- Femtet を使ったシミュレーションによって、パラメータの最適化を行うことができます。
35
- 連続変数の単目的・多目的最適化に対応しています。
36
- いくつかの最適化結果可視化機能を備えており、最適化結果の分析が可能です。
37
-
38
- ***注意:現在、本ライブラリは beta 版です!***
39
-
40
- ## Install
41
-
42
- インストール方法は以下の通りです。
43
-
44
- 1. Femtet のインストール
45
-
46
- [https://www.muratasoftware.com/](https://www.muratasoftware.com/)
47
-
48
- 初めての方は、試用版または個人版のご利用もご検討ください。
49
-
50
-
51
- 1. Femtet のマクロ有効化
52
-
53
- Femtet インストール後にスタートメニューから「マクロ機能を有効化する」を実行してください。
54
-
55
- 1. Python のインストール
56
-
57
- [https://www.python.org/](https://www.python.org/)
58
-
59
- 1. PyFemtet のインストール
60
-
61
- ターミナルで下記コマンドを実行してください。
62
- ```
63
- py -m pip install pyfemtet
64
- ```
65
-
66
- 1. Femtet マクロ定数の設定
67
-
68
- ターミナルで下記コマンドを実行してください。詳しくは Femtet マクロヘルプをご覧ください。
69
- ```
70
- py -m win32com.client.makepy FemtetMacro
71
- ```
72
-
73
-
74
-
75
- ## 動作するサンプルコード・サンプル解析モデル
76
- pyfemtet プロジェクトの以下の相対パスに .py ファイルと、それと同名の .femprj ファイルが含まれています。
77
- ```
78
- .\pyfemtet\FemtetPJTSample
79
- ```
80
- このフォルダに含まれる ```.femprj``` ファイルは、変数設定済みの単純な解析モデルです。対応する同名の ```.py``` ファイルは、そのパラメータを PyFemtet を用いて最適化するサンプルコードです。
81
-
82
- Femtet でいずれかの ```.femprj``` ファイルを開き、その後対応する ```.py``` ファイルを実行してください。
83
-
84
-
85
-
86
- ## 使い方
87
-
88
- 基本的な使い方は以下の通りです。
89
-
90
- 1. Femtet プロジェクトの作成
91
-
92
- Femtet 上で解析モデルを作成します。最適化したいパラメータを変数として登録してください。
93
-
94
- 1. 評価指標の設定
95
-
96
- 解析結果やモデル形状から評価したい指標を出力する処理を Femtet Python マクロを用いて記述してください。
97
- 以下に例を示します。
98
- ```python
99
- """Femtet の解析結果から評価指標を計算する例です."""
100
- from win32com.client import constants
101
- from win32com.client import Dispatch
102
-
103
- # Femtet の操作のためのオブジェクトを取得
104
- Femtet = Dispatch("FemtetMacro.Femtet")
105
-
106
- # Femtet で解析結果を開く
107
- Femtet.OpenCurrentResult(True)
108
- Gogh = Femtet.Gogh
109
-
110
- # 流速を取得するための設定
111
- Gogh.Pascal.Vector = constants.PASCAL_VELOCITY_C
112
-
113
- # 目的の面で流速を積分し流量を取得
114
- _, ret = Gogh.SimpleIntegralVectorAtFace_py([2], [0], constants.PART_VEC_Y_PART_C)
115
-
116
- # 流量(次のステップでこれを評価指標にする)
117
- print(ret.Real)
118
- ```
119
-
120
- 1. メインスクリプトの作成
121
-
122
- 上記で定義した評価指標を含むスクリプトを書いてください。以下に例を示します。前のステップで記述した評価指標が ```get_flow``` 関数の中に記述されています。
123
-
124
- ```python
125
- """pyfemtet を用いてパラメータ最適化を行う最小限のコードの例です.
126
-
127
- h, r という変数を有する解析モデルで簡易流体解析を行い, ある面の流量を 0.3 にしたい場合を想定しています.
128
- """
129
-
130
- from pyfemtet.opt import FemtetInterface, OptimizerOptuna
131
- from win32com.client import constants
132
-
133
-
134
- def get_flow(Femtet):
135
- """解析結果から流量を取得します.
136
-
137
- pyfemtet で定義する評価関数は、
138
- 第一引数に Femtet の COM オブジェクトを
139
- 設定する必要があります.
140
- """
141
- Gogh = Femtet.Gogh
142
- Gogh.Pascal.Vector = constants.PASCAL_VELOCITY_C
143
- _, ret = Gogh.SimpleIntegralVectorAtFace_py([2], [0], constants.PART_VEC_Y_PART_C)
144
- flow = ret.Real
145
- return flow
146
-
147
-
148
- if __name__ == '__main__':
149
-
150
- # Femtet 制御オブジェクトを用意
151
- fem = FemtetInterface('example.femprj')
152
-
153
- # 最適化処理を行うオブジェクトを用意
154
- femopt = OptimizerOptuna(fem)
155
-
156
- # 解析モデルで登録された変数
157
- femopt.add_parameter("h", 10, lower_bound=1, upper_bound=20, memo='高さ')
158
- femopt.add_parameter("r", 5, lower_bound=1, upper_bound=10, memo='半径')
159
-
160
- # 流量が 0.3 に近づくようにゴールを設定する
161
- femopt.add_objective(get_flow, name='流量', direction=0.3)
162
-
163
- # 最適化の実行(csv ファイルに最適化計算の過程が保存されます)
164
- femopt.main(n_trial=30)
165
-
166
- # 最適化結果の表示(最適化終了時点での csv ファイルの内容と同じです)
167
- print(femopt.history.data)
168
- ```
169
- 注意:Femtet 内で数式を設定した変数に対し ```add_parameter()``` を行わないでください。数式が失われます。
170
-
171
- 1. スクリプトを実行します。
172
-
173
- 1. 出力された最適化過程の一覧を csv ファイルで確認します。
174
-
175
- csv ファイルの各行は一回の解析試行結果を示しています。各列の形式は以下の通りです。
176
-
177
- 列名 | 説明
178
- --- | ---
179
- n_trial | 解析を行った回数
180
- [param] | スクリプト中で設定した変数。変数の数だけ列が増える。
181
- [objective] | スクリプト中で設定した評価関数。評価関数の数だけ列が増える。
182
- [constraint] | スクリプト中で設定した拘束関数。拘束関数の数だけ列が増える。
183
- non_domi | 非劣解であるかどうか。
184
- fit | 拘束関数を満たすかどうか。
185
- optimization_message | 最適化アルゴリズムによる注記。
186
- hypervolume | その試行時点でのハイパーボリューム。
187
- time | その試行が完了した日時。
188
-
189
- - 拘束:ある数式が任意の範囲内にあるようにすることです。具体的な記述方法は**動作するサンプルコード**も参考にしてください。
190
- - 非劣解:劣解とは、解集合の中で、その解よりも全ての評価指標が好ましい解が存在する解のことです。非劣解とは、劣解ではない解のことです。単一の評価指標のみを持つ最適化問題の場合、非劣解は最適解です。
191
-
192
-
193
- ## API reference
194
- 作成中です。
195
-
196
-
197
- ---
198
-
199
- ## English version of this document
200
- We're sorry, this section is under constructing.
201
-
202
- ---
203
- Copyright (C) 2023 Murata Manufacturing Co., Ltd. All Rights Reserved.
204
-
205
- Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
@@ -1,37 +0,0 @@
1
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01 - original.x_t,sha256=a4RC9WfyxAD3bUSCqDgwHYy1pqg5yZHYFugpE_QEBYE,27931
2
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj,sha256=7ujLlW_2fnKU-Vfs-ePOBjiu-7QLCYO02BYQj6xSajk,140563
3
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt,sha256=r_FmtVFa8rvKkb2PAQu3QIAD3kPXLwNBLTLO0a4WoqM,216656
4
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py,sha256=A7S0I1Yj0BxtTdK7dWgWDvtzhKIKc3tW12JfQxzgBfw,1682
5
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.x_t,sha256=a4RC9WfyxAD3bUSCqDgwHYy1pqg5yZHYFugpE_QEBYE,27931
6
- "pyfemtet/FemtetPJTSample/fem4 = Femtet(femprj_path=None, model_name=None, connect_method='catch').femprj",sha256=fMw-kDr3rufxyQTvYdJkGz48ljI5ZDylY8JOOe6BXLQ,24821
7
- pyfemtet/FemtetPJTSample/gal_ex11_parametric.femprj,sha256=TCd8ny1srgZATG--lwlX0SrtEbM5OGKYXEnxY0jFS9Y,60372
8
- pyfemtet/FemtetPJTSample/gal_ex11_parametric.py,sha256=3NWshL3hvVryULSalC1s3dXmkq7mJVxZDe316mcuuSI,1597
9
- pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj,sha256=Oduz7QjlAhCntV8Juwvnf15ElLlspDOeX6EvQYu_v8w,245654
10
- pyfemtet/FemtetPJTSample/gau_ex08_parametric.py,sha256=71HY7f46WvNeo5ysCSxJOmC2p-Zs7Q0rHYfiDmONoJE,1072
11
- pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj,sha256=M0SP02stL2_Kb1e3tH_1YyFIg0JuYLIYTfPyvGw9jVY,129599
12
- pyfemtet/FemtetPJTSample/her_ex40_parametric.py,sha256=fdSg9AKnnyuy566dNRvXM2Ctvk719-uLN13Yb3k3n5g,3569
13
- pyfemtet/FemtetPJTSample/pas_ex1_parametric.femprj,sha256=UxAM3oCUuV1cIpKMDybrHwXcVWpoK5qmxOR3Qk-P0T4,101778
14
- pyfemtet/FemtetPJTSample/pas_ex1_parametric.py,sha256=G9BRIajsaSbGD2NDmDngoXSP_t_k4ATpRByCE3YFDGg,2080
15
- pyfemtet/FemtetPJTSample/pas_ex1_parametric2.py,sha256=QeUHxrB5dIc07PJmuH0ocaZh8Rq3Wm6gqNwyrgrIIJo,2085
16
- pyfemtet/__init__.py,sha256=ZGJWon5BPg7IX-fnSdx6RMr581_2tdAH9hwLP6y7MFU,22
17
- pyfemtet/_opt/_NX_Femtet.py,sha256=o0xEgc1D254thpJ2Lv3PCS7IuoRo36zVZUgMu3VNB3o,1751
18
- pyfemtet/_opt/_SW_Femtet.py,sha256=555NBjpiEw89uAVWGDgDz_veIGtRv3tIJlVrL3Fz8zk,6044
19
- pyfemtet/_opt/_SimplestUI.py,sha256=aA-wrShqQKE4BSECJjIIqO20CWfZLelBNAxSxS8vdjs,2681
20
- pyfemtet/_opt/visualization/ProcessMonitor.py,sha256=JpvjEMfJcjAkHEBjZLfHG-SsAYl2-1SAIaClVhmi3MY,4022
21
- pyfemtet/_opt/visualization/_dash.py,sha256=EM1-vDMojzeKKE-4acSfQgeaue_9jn_w1GCkURxvmNY,6203
22
- pyfemtet/_opt/visualization/_visualization.py,sha256=mu34vAcZy5uq-sWzdcilpVxfGQX7U15u0niFjRReBoU,10681
23
- pyfemtet/_opt/visualization/_visualizationNameSpace.py,sha256=fUGYMR-oT7ryzkTcf6eu8lW91Zjc-NQ6ajtbJ37KDx8,9432
24
- pyfemtet/opt/_FemtetWithNX/update_model.py,sha256=iXq9RQkiErD7sL0w3ayFXiKkonfO7WvZbObawqj_DWg,2443
25
- pyfemtet/opt/__init__.py,sha256=d6-Er90MZq2FrLOu9lctbdIlsNq7e9dL16pP4IdvtIw,123
26
- pyfemtet/opt/_optuna.py,sha256=8eRH20024dJmOG1wKYA1Y87MM5gvY8JfDYKkcdJ0w8Y,6467
27
- pyfemtet/opt/base.py,sha256=bnoxPJuHjUZMAKADdUIAUtygRgeR851DcCJ5XkPpx74,21795
28
- pyfemtet/opt/core.py,sha256=S031P5qXvrLLNLyCQSUDbeZ_v_15cfKHoOFQLewN29o,1480
29
- pyfemtet/opt/interface.py,sha256=8UYVQYZj35X5DYvziWNZuvJp8eVj2DOsvvfXayN4LYg,24235
30
- pyfemtet/opt/monitor.py,sha256=V4rnyrLFwXxlLnb6-ek2pdT_utcI4c56vk1FLd-timU,8499
31
- pyfemtet/tools/DispatchUtils.py,sha256=ZvTKJGMl0_13HDxYffeH883v22Ip7CZLUwlc1OV97dw,8322
32
- pyfemtet/tools/FemtetClassConst.py,sha256=CHKcw5nEMnZiYFlGrDSihzZ_uaIm7uZJR1I0S0IL1E8,273
33
- pyfemtet/tools/__init__.py,sha256=jZYlCnY3B5WjwKfpRJ05Sht41ymtWOKnU8mXY1RnnT4,1626
34
- pyfemtet-0.1.12.dist-info/LICENSE,sha256=LngVydbpgtwcYxwOunoGim0JHC_G1S-Ae78IVI3AEAw,1503
35
- pyfemtet-0.1.12.dist-info/METADATA,sha256=J-ExDHo2Yy9iD-ACQFfmuRht82BsoLa68L7Hn7Oijds,8181
36
- pyfemtet-0.1.12.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
37
- pyfemtet-0.1.12.dist-info/RECORD,,