翼型の最適化ライブラリ「CMPLXFOIL」のインストールを行う
環境はWindows10/Ubuntu 20.04.4LTS
はじめに
翼型の最適化ライブラリ「CMPLXFOIL」のインストールを行う
↓実際の使い方はこれ
インストールに関して分からないことがあれば気軽に記事下のコメントまで
実行環境の準備
今回の実行環境は以下の通り
Windows10 バージョン21H2
Ubuntu 20.04.4 LTS
- GNU Make 4.2.1
- gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
- GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
- Python 3.10.8
- f2py 1.23.4
↓それぞれのインストール方法はこちら
確認
次のコマンドで必要なものがインストールできていることを確認する
make --version
gcc --version
gfortran --version
python3.10 --version
f2py -v
:~$ make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
:~$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
:~$ gfortran --version
GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
:~$ python3.10 --version
Python 3.10.8
:~$ f2py -v
1.23.4
実行結果でそれぞれのバージョンが表示されれば,下準備は完了である
CMPLXFOILのダウンロード
↓公式のドキュメントはこれ
公式ドキュメントに従ってインストールを進めていく
Githubのリポジトリ(https://github.com/mdolab/CMPLXFOIL)にアクセスする
右上の「Code>Download ZIP」をクリックする
ダウンロードフォルダに.zipがダウンロードされる
.zipを右クリックして「すべて展開(T)...」をクリック
「完了時に展開されたファイルを表示する(H)」のチェックを外して「展開(E)」をクリックする
ダウンロードフォルダに「CMPLXFOIL-main」が展開される
デスクトップにCMPLXFOILというフォルダを作成し,その中に「CMPLXFOIL-main」を移動させる
(C:\Users\mtkbirdman\Desktop\CMPLXFOIL)
これでCMPLXFOILのダウンロードは完了である
ちなみに,ディレクトリ構成は次のようになっている
/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL
└── CMPLXFOIL-main
└── CMPLXFOIL-main
├── cmplxfoil
├── config
│ └── defaults
├── doc
│ └── assets
├── examples
├── src
│ ├── build
│ └── f2py
├── src_cs
│ ├── build
│ └── f2py
└── tests
仮想環境を構築する
CMPLXFOILを使うためのPythonの仮想環境を構築する
Ubuntuを開く
次のコマンドを実行して,先ほどデスクトップに作った「CMPLXOIL」のフォルダに仮想環境を構築する
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL
python3 -m venv .py310venv
. .py310venv/bin/activate
:~$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL
:/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ python3 -m venv .py310venv
:/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ . .py310venv/bin/activate
一番左に(.py310venv)
と表示されれば仮想環境の構築は完了である
インストールの準備
次のコマンドを実行して,CMPLXFOILのインストールに必要なものを準備する
sudo apt update
sudo apt -y install libopenmpi-dev
sudo apt -y install python3-dev
sudo apt -y install ffmpeg
sudo apt -y install fontconfig
pip install numpy mpi4py mdolab-baseclasses matplotlib niceplots
fontconfig
はいらないかもしれない
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ sudo apt update
[sudo] password for mtkbirdman:
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1818 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2191 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [11.2 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [16.0 kB]
Fetched 4373 kB in 8s (549 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
137 packages can be upgraded. Run 'apt list --upgradable' to see them.
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ sudo apt install libopenmpi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libopenmpi-dev is already the newest version (4.0.3-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 137 not upgraded.
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ sudo apt install python3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-dev is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 137 not upgraded.
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ sudo apt -y install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
:
Setting up ffmpeg (7:4.2.7-0ubuntu0.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.40.0+dfsg-3ubuntu0.4) ...
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ sudo apt install fontconfig
[sudo] password for mtkbirdman:
Reading package lists... Done
Building dependency tree
Reading state information... Done
:
Setting up font-manager-common:amd64 (0.7.7-0.3) ...
Setting up font-viewer (0.7.7-0.3) ...
Setting up font-manager (0.7.7-0.3) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ pip install numpy mpi4py mdolab-baseclasses matplotlib niceplots
Collecting numpy
Using cached numpy-1.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
Collecting mpi4py
Using cached mpi4py-3.1.3-cp310-cp310-linux_x86_64.whl
Collecting mdolab-baseclasses
Using cached mdolab_baseclasses-1.7.0-py3-none-any.whl (68 kB)
Collecting matplotlib
Using cached matplotlib-3.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.8 MB)
Collecting niceplots
Using cached niceplots-1.3.0-py3-none-any.whl (12 kB)
Collecting pyparsing>=2.2.1
Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting python-dateutil>=2.7
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pillow>=6.2.0
Using cached Pillow-9.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.2 MB)
Collecting kiwisolver>=1.0.1
Using cached kiwisolver-1.4.4-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.6 MB)
Collecting contourpy>=1.0.1
Using cached contourpy-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (295 kB)
Collecting packaging>=20.0
Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting cycler>=0.10
Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting fonttools>=4.22.0
Using cached fonttools-4.37.4-py3-none-any.whl (960 kB)
Collecting six>=1.5
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pyparsing, pillow, numpy, mpi4py, kiwisolver, fonttools, cycler, python-dateutil, packaging, mdolab-baseclasses, contourpy, matplotlib, niceplots
Successfully installed contourpy-1.0.5 cycler-0.11.0 fonttools-4.37.4 kiwisolver-1.4.4 matplotlib-3.6.1 mdolab-baseclasses-1.7.0 mpi4py-3.1.3 niceplots-1.3.0 numpy-1.23.4 packaging-21.3 pillow-9.2.0 pyparsing-3.0.9 python-dateutil-2.8.2 six-1.16.0
いよいよCMPLXFOILのインストールを行う
CMPLXFOILのインストール
次のコマンドを実行して,cmplxfoil
をインストールする
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main
make
pip install .
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main$ make
make[1]: Entering directory '/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main'
ln -sf config/config.mk config.mk;
(cd src/build/ && make)
:
mv libcmplxfoil_cs.*so ../../cmplxfoil/libcmplxfoil_cs.so
make[2]: Leaving directory '/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/src_cs/build'
make[1]: Leaving directory '/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main'
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main$ pip install .
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from cmplxfoil==2.0.1) (1.23.4)
Requirement already satisfied: mdolab-baseclasses in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from cmplxfoil==2.0.1) (1.7.0)
Installing collected packages: cmplxfoil
DEPRECATION: cmplxfoil is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for cmplxfoil ... done
Successfully installed cmplxfoil-2.0.1
さらに,CMPLXFOILを動かすための付属モジュールをインストールしていく
pysplineのインストール
↓公式ドキュメントはこれ
Githubのリポジトリ(https://github.com/mdolab/pyspline/)にアクセスして,先ほどと同様の手順でデスクトップの「CMPLXFOIL」に.zipを展開する
次のコマンドを実行して,pyspline
をインストールする
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main
cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk
make
pip install .
(.py310venv) :~$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main$ cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main$ make
make[1]: Entering directory '/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main'
mkdir -p obj
ln -sf config/config.mk config.mk
:
rm .f2py_f2cmap
make[2]: Leaving directory '/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main/src/f2py'
make[1]: Leaving directory '/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main'
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main$ pip install .
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyspline-main/pyspline-main
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pyspline==1.5.1) (1.23.4)
Collecting scipy>=1.2
Using cached scipy-1.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (33.7 MB)
Installing collected packages: scipy, pyspline
DEPRECATION: pyspline is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pyspline ... done
Successfully installed pyspline-1.5.1 scipy-1.9.3
pyGeoのインストール
↓公式ドキュメントはこれ
Githubのリポジトリ(https://github.com/mdolab/pygeo)にアクセスして,先ほどと同様の手順でデスクトップの「CMPLXFOIL」に.zipを展開する
次のコマンドを実行して,pygeo
をインストールする
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pygeo-main/pygeo-main
pip install .
pip install .[testing]
(.py310venv) :~$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pygeo-main/pygeo-main
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pygeo-main/pygeo-main$ pip install .
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pygeo-main/pygeo-main
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.23.4)
Requirement already satisfied: pyspline>=1.1 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.5.1)
Requirement already satisfied: scipy>=1.2 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.9.3)
Requirement already satisfied: mpi4py>=3.0 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (3.1.3)
Requirement already satisfied: mdolab-baseclasses in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.7.0)
Installing collected packages: pygeo
DEPRECATION: pygeo is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pygeo ... done
Successfully installed pygeo-1.12.2
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pygeo-main/pygeo-main$ pip install .[testing]
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pygeo-main/pygeo-main
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.23.4)
Requirement already satisfied: pyspline>=1.1 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.5.1)
Requirement already satisfied: scipy>=1.2 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.9.3)
Requirement already satisfied: mpi4py>=3.0 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (3.1.3)
Requirement already satisfied: mdolab-baseclasses in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pygeo==1.12.2) (1.7.0)
Collecting numpy-stl
Using cached numpy_stl-2.17.1-py3-none-any.whl (18 kB)
Collecting parameterized
Using cached parameterized-0.8.1-py2.py3-none-any.whl (26 kB)
Collecting testflo
Using cached testflo-1.4.9.tar.gz (24 kB)
Preparing metadata (setup.py) ... done
Collecting python-utils>=1.6.2
Using cached python_utils-3.3.3-py2.py3-none-any.whl (23 kB)
Collecting coverage<5.0
Using cached coverage-4.5.4.tar.gz (385 kB)
Preparing metadata (setup.py) ... done
Installing collected packages: parameterized, python-utils, coverage, testflo, numpy-stl, pygeo
DEPRECATION: coverage is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for coverage ... done
DEPRECATION: testflo is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for testflo ... done
Attempting uninstall: pygeo
Found existing installation: pygeo 1.12.2
Uninstalling pygeo-1.12.2:
Successfully uninstalled pygeo-1.12.2
DEPRECATION: pygeo is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pygeo ... done
Successfully installed coverage-4.5.4 numpy-stl-2.17.1 parameterized-0.8.1 pygeo-1.12.2 python-utils-3.3.3 testflo-1.4.9
pyOptSparseのインストール
↓公式ドキュメントはこれ
Githubのリポジトリ(https://github.com/mdolab/pyoptsparse)にアクセスして,先ほどと同様の手順でデスクトップの「CMPLXFOIL」に.zipを展開する
次のコマンドを実行して,pyoptsparse
をインストールする
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyoptsparse-main/pyoptsparse-main
pip install .
(.py310venv) :~$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyoptsparse-main/pyoptsparse-main
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyoptsparse-main/pyoptsparse-main$ pip install .
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/pyoptsparse-main/pyoptsparse-main
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: mdolab-baseclasses>=1.3.1 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pyoptsparse==2.9.1) (1.7.0)
Requirement already satisfied: scipy>1.2 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pyoptsparse==2.9.1) (1.9.3)
Requirement already satisfied: numpy>=1.16 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from pyoptsparse==2.9.1) (1.23.4)
Collecting sqlitedict>=1.6
Using cached sqlitedict-2.0.0.tar.gz (46 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyoptsparse
Building wheel for pyoptsparse (pyproject.toml) ... done
Created wheel for pyoptsparse: filename=pyoptsparse-2.9.1-py3-none-any.whl size=661713 sha256=0ba64eb7707944359804a28e53cac5631ea6b6c9fa594a88e15e449c7a182e3e
Stored in directory: /home/mtkbirdman/.cache/pip/wheels/76/de/c7/0acbd6f32e3a04736c6879d360d6adaf47b84b5231598fec35
Successfully built pyoptsparse
Installing collected packages: sqlitedict, pyoptsparse
DEPRECATION: sqlitedict is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for sqlitedict ... done
Successfully installed pyoptsparse-2.9.1 sqlitedict-2.0.0
multiPointのインストール
↓公式ドキュメントはこれ
Githubのリポジトリ(https://github.com/mdolab/multipoint)にアクセスして,先ほどと同様の手順でデスクトップの「CMPLXFOIL」に.zipを展開する
次のコマンドを実行して,multipoint
をインストールする
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/multipoint-main/multipoint-main
pip install .
(.py310venv) :$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/multipoint-main/multipoint-main
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/multipoint-main/multipoint-main$ pip install .
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/multipoint-main/multipoint-main
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from multipoint==1.4.0) (1.23.4)
Requirement already satisfied: mpi4py>=3.0 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from multipoint==1.4.0) (3.1.3)
Requirement already satisfied: mdolab-baseclasses>=1.2.4 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from multipoint==1.4.0) (1.7.0)
Installing collected packages: multipoint
DEPRECATION: multipoint is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for multipoint ... done
Successfully installed multipoint-1.4.0
preFoilのインストール
↓公式ドキュメントはこれ
CMPLXFOILのドキュメントでは必要だと言われていないが,しれっとpygeo
のプログラムから呼び出されている
Githubのリポジトリ(https://github.com/mdolab/prefoil)にアクセスして,先ほどと同様の手順でデスクトップの「CMPLXFOIL」に.zipを展開する
次のコマンドを実行して,prefoil
をインストールする
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/prefoil-main/prefoil-main
pip install .
(.py310venv) :~$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/prefoil-main/prefoil-main
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/prefoil-main/prefoil-main$ pip install .
Processing /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/prefoil-main/prefoil-main
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.16 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from prefoil==2.0.0) (1.23.4)
Requirement already satisfied: scipy>=1.2 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from prefoil==2.0.0) (1.9.3)
Requirement already satisfied: pyspline>=1.1.0 in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/.py310venv/lib/python3.10/site-packages (from prefoil==2.0.0) (1.5.1)
Installing collected packages: prefoil
DEPRECATION: prefoil is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for prefoil ... done
Successfully installed prefoil-2.0.0
これでだいたい完了である
CMU Brightのインストール
製作者こだわりのフォントをインストールする
なくても実行できるが,ひたすら警告文が出てくる
次のコマンドでフォントをインストールする
sudo apt update
sudo apt install fonts-cmu
rm ~/.cache/matplotlib -rf
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ sudo apt install fonts-cmu
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
fonts-cmu
0 upgraded, 1 newly installed, 0 to remove and 137 not upgraded.
Need to get 4888 kB of archives.
After this operation, 15.3 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 fonts-cmu all 0.7.0-4 [4888 kB]
Fetched 4888 kB in 18s (273 kB/s)
Selecting previously unselected package fonts-cmu.
(Reading database ... 58986 files and directories currently installed.)
Preparing to unpack .../fonts-cmu_0.7.0-4_all.deb ...
Unpacking fonts-cmu (0.7.0-4) ...
Setting up fonts-cmu (0.7.0-4) ...
Processing triggers for fontconfig (2.13.1-2ubuntu3) ...
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ rm ~/.cache/matplotlib -rf
インストール完了の確認
次のコマンドでインストールが正常に完了したことを確認する
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/tests
testflo -v .
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/tests
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/tests$ testflo -v .
./test_solver_class.py:TestPlotting.test_plotting ... OK (00:00:0.74, 91 MB)
./test_solver_class.py:TestTrip.test_trip ... OK (00:00:0.74, 94 MB)
./test_solver_class.py:TestNACA.test_function_values ... OK (00:00:1.75, 88 MB)
./test_solver_class.py:TestDerivativesCST.test_alpha_sens ... OK (00:00:4.76, 98 MB)
./test_solver_class.py:TestDerivativesCST.test_lower_shape_sens ... OK (00:00:4.88, 98 MB)
./test_solver_class.py:TestDerivativesCST.test_upper_shape_sens ... OK (00:00:4.98, 98 MB)
./test_solver_class.py:TestNACA.test_cl_solve_default ... OK (00:00:5.94, 88 MB)
./test_solver_class.py:TestNACA.test_cl_solve_CLalphaGuess ... OK (00:00:6.20, 88 MB)
./test_solver_class.py:TestNACA.test_cl_solve_Newton ... OK (00:00:28.09, 97 MB)
./test_solver_class.py:TestDerivativesFFD.test_alpha_sens ... OK (00:00:32.15, 98 MB)
./test_solver_class.py:TestDerivativesFFD.test_shape_sens_random ... OK (00:00:51.94, 98 MB)
OK
Passed: 11
Failed: 0
Skipped: 0
Ran 11 tests using 12 processes
Wall clock time: 00:00:54.55
サンプルコードの実行
いよいよサンプルコードを実行する
cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/examples
python single_point.py
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL$ cd /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/examples
(.py310venv) :/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/examples$ python single_point.py
######## Fitting CST coefficients to coordinates in /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/examples/naca0012.dat ########
Upper surface
L2 norm of coordinates in dat file versus fit coordinates: 0.0006144671581532052
Fit CST coefficients: [0.16952949 0.15603239 0.13368392 0.15635607]
Lower surface
L2 norm of coordinates in dat file versus fit coordinates: 0.000610445533182561
Fit CST coefficients: [-0.16940956 -0.15620869 -0.13350934 -0.15645874]
pyGeo Initialization Type is: liftingSurface
Interpolating missing sections ...
Symmetrizing Knot Vectors ...
Computing TE surfaces ...
Computing Tip surfaces ...
+-------------------------------------------------------------------------------+
| Sparsity structure of constraint Jacobian |
+-------------------------------------------------------------------------------+
alpha_fc (1) upper_shape (4) lower_shape (4)
+--------------------------------------------------+
DVCon1_volume_constraint_0 (1) | | X | X |
----------------------------------------------------
DVCon1_thickness_constraints_0 (200) | | X | X |
----------------------------------------------------
DVCon1_leradius_constraints_0 (2) | | X | X |
----------------------------------------------------
cl_con_fc (1) | X | X | X |
----------------------------------------------------
first_cst_coeff_match(L) (1) | | X | X |
+--------------------------------------------------+
### DESIGN VARIABLES ###
alpha_fc [1]
upper_shape [2, 5]
lower_shape [6, 9]
### CONSTRAINTS ###
DVCon1_volume_constraint_0 [1]
DVCon1_thickness_constraints_0 [2, 201]
DVCon1_leradius_constraints_0 [202, 203]
cl_con_fc [204]
first_cst_coeff_match [205]
OrderedDict([('alpha_fc', array(1.)), ('upper_shape', array([0.16952949, 0.15603239, 0.13368392, 0.15635607])), ('lower_shape', array([-0.16940956, -0.15620869, -0.13350934, -0.15645874]))])
+----------------------------------------------------------------------+
| Switching to Aero Problem: fc |
+----------------------------------------------------------------------+
functions:
DVCon1_volume_constraint_0: 1.0145608988766392
DVCon1_leradius_constraints_0: [0.97520522 0.97520522]
fc_cd: 0.0054833970044417205
fc_cl: 0.10484177677457536
fail: False
funcs in obj: {'fc_cd': 0.0054833970044417205, 'fc_cl': 0.10484177677457536, 'obj': 0.0054833970044417205, 'cl_con_fc': -0.39515822322542465}
function sensitivities:
fc_cd: {'upper_shape': array([ 0.01197693, 0.00292868, -0.00572934, -0.00026594]), 'lower_shape': array([-0.00950356, -0.01205129, 0.00015515, 0.00822842]), 'alpha_fc': array([-1.94322474e-06])}
fc_cl: {'upper_shape': array([0.24248425, 0.41796745, 0.62005122, 0.78299574]), 'lower_shape': array([0.18422114, 0.196865 , 0.58235026, 1.0350616 ]), 'alpha_fc': array([0.10696528])}
fail: False
OrderedDict([('alpha_fc', array(2.64154022)), ('upper_shape', array([ 0.16202668, -0.1 , 0.5 , 0.5 ])), ('lower_shape', array([-0.16202668, 0.1 , 0.1 , -0.5 ]))])
functions:
DVCon1_volume_constraint_0: 0.9328168871340279
DVCon1_leradius_constraints_0: [0.85545108 0.85545108]
fc_cd: 0.017820622584665834
fc_cl: 0.2859414528549044
fail: False
funcs in obj: {'fc_cd': 0.017820622584665834, 'fc_cl': 0.2859414528549044, 'obj': 0.017820622584665834, 'cl_con_fc': -0.2140585471450956}
:
OrderedDict([('alpha_fc', array(1.21477604)), ('upper_shape', array([0.15511894, 0.18058258, 0.14076696, 0.33808835])), ('lower_shape', array([-0.15511894, -0.02998765, -0.0511404 , -0.03074995]))])
functions:
DVCon1_volume_constraint_0: 0.8500000000000002
DVCon1_leradius_constraints_0: [0.85 0.85]
fc_cd: 0.00422941205852427
fc_cl: 0.5000000080690327
fail: False
funcs in obj: {'fc_cd': 0.00422941205852427, 'fc_cl': 0.5000000080690327, 'obj': 0.00422941205852427, 'cl_con_fc': 8.069032664259623e-09}
function sensitivities:
fc_cd: {'upper_shape': array([0.0038532 , 0.00155329, 0.00143791, 0.00107941]), 'lower_shape': array([-0.00415141, -0.00085947, -0.00037483, 0.00027546]), 'alpha_fc': array([8.98217321e-05])}
fc_cl: {'upper_shape': array([0.28082225, 0.45164283, 0.63108174, 0.65154076]), 'lower_shape': array([0.13493654, 0.36737974, 0.62123699, 0.94396726]), 'alpha_fc': array([0.10565531])}
fail: False
Optimization Problem -- opt
================================================================================
Objective Function: obj
Solution:
--------------------------------------------------------------------------------
Total Time: 329.7194
User Objective Time : 20.8925
User Sensitivity Time : 307.7920
Interface Time : 1.0158
Opt Solver Time: 0.0191
Calls to Objective Function : 77
Calls to Sens Function : 47
Objectives
Index Name Value
0 obj 4.229412E-03
Variables (c - continuous, i - integer, d - discrete)
Index Name Type Lower Bound Value Upper Bound Status
0 alpha_fc_0 c -1.000000E+01 1.214776E+00 1.000000E+01
1 upper_shape_0 c -1.000000E-01 1.551189E-01 5.000000E-01
2 upper_shape_1 c -1.000000E-01 1.805826E-01 5.000000E-01
3 upper_shape_2 c -1.000000E-01 1.407670E-01 5.000000E-01
4 upper_shape_3 c -1.000000E-01 3.380884E-01 5.000000E-01
5 lower_shape_0 c -5.000000E-01 -1.551189E-01 1.000000E-01
6 lower_shape_1 c -5.000000E-01 -2.998765E-02 1.000000E-01
7 lower_shape_2 c -5.000000E-01 -5.114040E-02 1.000000E-01
8 lower_shape_3 c -5.000000E-01 -3.074995E-02 1.000000E-01
Constraints (i - inequality, e - equality)
Index Name Type Lower Value Upper Status Lagrange Multiplier (N/A)
0 DVCon1_volume_constraint_0 i 8.500000E-01 8.500000E-01 3.000000E+00 l 9.00000E+100
1 DVCon1_thickness_constraints_0 i 2.500000E-01 9.034272E-01 3.000000E+00 9.00000E+100
2 DVCon1_thickness_constraints_0 i 2.500000E-01 8.938082E-01 3.000000E+00 9.00000E+100
:
203 cl_con_fc e 0.000000E+00 8.069033E-09 0.000000E+00 9.00000E+100
204 first_cst_coeff_match e 0.000000E+00 0.000000E+00 0.000000E+00 9.00000E+100
--------------------------------------------------------------------------------
Found dat and pkl files for 77 iterations
無事に最適化が終わると,output
というフォルダが作成され,その中に結果が出力される
/mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/examples
├── output
│ ├── OptFoil.mp4
│ ├── OptFoil.pdf
│ ├── SLSQP.out
│ ├── constraints.dat
│ ├── fc_001.dat
│ ├── fc_001.pkl
│ ├── :
│ ├── fc_077.dat
│ ├── fc_077.pkl
│ └── opt.hst
├── naca0012.dat
├── single_point.py
└── testflo_report.out
fc_077.dat
1.0 0.00126
0.99372 0.003345507194
0.9827658 0.006843821381
0.9699775 0.010712121545
0.9556484 0.014783797248
0.9402486 0.018867229829
0.9242123 0.022816762828
0.9078338 0.026552240962
0.8912799 0.030041874395
0.8746367 0.033280646631
0.8579464 0.036276279771
0.8412299 0.039041727103
0.8244974 0.041591837562
0.8077546 0.043941692268
0.7910046 0.046106037365
0.7742495 0.048098931362
0.757491 0.049933621616
0.7407304 0.051622523352
0.7239692 0.053177151776
0.7072086 0.054608175366
0.6904498 0.055925389108
0.6736942 0.057137709371
0.656943 0.058253214978
0.6401976 0.059279128923
0.6234593 0.060221851667
0.6067296 0.061086956779
0.5900098 0.06187922733
0.5733015 0.062602645776
0.5566061 0.063260434247
0.5399254 0.063855046608
0.5232609 0.064388213739
0.5066145 0.064860936638
0.4899881 0.065273520339
0.4733836 0.065625591544
0.4568033 0.065916109937
0.4402494 0.066143398907
0.4237245 0.066305156511
0.4072312 0.066398480858
0.3907728 0.066419885324
0.3743523 0.066365321612
0.3579737 0.066230197051
0.3416411 0.06600939274
0.3253592 0.065697280981
0.3091334 0.065287743499
0.29297 0.064774191658
0.2768762 0.064149579659
0.2608607 0.063406439094
0.2449337 0.0625368957
0.2291078 0.061532734559
0.2133984 0.060385460252
0.1978253 0.059086471161
0.182414 0.05762729223
0.1671985 0.056000064151
0.1522253 0.054198417009
0.1375585 0.052218912363
0.1232868 0.050063449697
0.10953 0.047742698447
0.0964404 0.045279995736
0.0841925 0.042714002634
0.07295464 0.040096974835
0.06284856 0.037486735825
0.05391754 0.03493491169
0.04612202 0.032477538467
0.03936201 0.030132366417
0.03350894 0.027901929849
0.02843159 0.025778833793
0.02401083 0.023750417777
0.02014561 0.021802003254
0.01675353 0.019918684228
0.01376927 0.018086291096
0.01114227 0.016291830938
0.00883452 0.014523751926
0.006818652 0.012772198003
0.005076404 0.011029478024
0.003597085 0.009290705403
0.002375947 0.007554870458
0.001411548 0.005825490622
0.0007030324 0.004112355892
0.0002448913 0.002427463382
2.616688e-05 0.000793511229
0.0 -0.0
2.616688e-05 -0.00079345076
0.0002448913 -0.002425733025
0.0007030324 -0.00410394852
0.001411548 -0.005801612482
0.002375947 -0.007502846394
0.003597085 -0.009194078389
0.005076404 -0.010868057212
0.006818652 -0.012521961978
0.00883452 -0.014156498699
0.01114227 -0.015774541639
0.01376927 -0.017380161512
0.01675353 -0.018977780729
0.02014561 -0.020571473632
0.02401083 -0.022164187556
0.02843159 -0.023756742564
0.03350894 -0.025346381334
0.03936201 -0.026924808987
0.04612202 -0.028475653707
0.05391754 -0.029972111642
0.06284856 -0.031376236294
0.07295464 -0.032642160607
0.0841925 -0.033724206486
0.0964404 -0.034587220147
0.10953 -0.035213683882
0.1232868 -0.035604289846
0.1375585 -0.035773413374
0.1522253 -0.035743198453
0.1671985 -0.035538797916
0.182414 -0.035185396439
0.1978253 -0.034706679883
0.2133984 -0.03412418072
0.2291078 -0.033457106955
0.2449337 -0.032722406116
0.2608607 -0.03193489674
0.2768762 -0.031107471223
0.29297 -0.030251263043
0.3091334 -0.029375841354
0.3253592 -0.028489352784
0.3416411 -0.027598685887
0.3579737 -0.026709592904
0.3743523 -0.025826812126
0.3907728 -0.024954175315
0.4072312 -0.02409472711
0.4237245 -0.023250762957
0.4402494 -0.022423975103
0.4568033 -0.021615472865
0.4733836 -0.020825884585
0.4899881 -0.020055399488
0.5066145 -0.019303848362
0.5232609 -0.018570733471
0.5399254 -0.01785529667
0.5566061 -0.017156565249
0.5733015 -0.016473378936
0.5900098 -0.015804460116
0.6067296 -0.015148423767
0.6234593 -0.014503838212
0.6401976 -0.013869240015
0.656943 -0.013243185998
0.6736942 -0.012624268961
0.6904498 -0.01201115838
0.7072086 -0.011402617239
0.7239692 -0.010797543113
0.7407304 -0.010194978711
0.757491 -0.009594142952
0.7742495 -0.008994464176
0.7910046 -0.008395583513
0.8077546 -0.007797396427
0.8244974 -0.007200071499
0.8412299 -0.006604089181
0.8579464 -0.006010313949
0.8746367 -0.005420072706
0.8912799 -0.00483537515
0.9078338 -0.00425926191
0.9242123 -0.003696504561
0.9402486 -0.003154640001
0.9556484 -0.00264505058
0.9699775 -0.00218252974
0.9827658 -0.00178104492
0.99372 -0.001446964
1.0 -0.00126
Optfoil.pdf
Optfoil.mp4
いいね pic.twitter.com/gSYzZpNbbD
— いーそー (@mtk_birdman) October 21, 2022
良い
おわりに
翼型の最適化ライブラリ「CMPLXFOIL」のインストールを行った
インストールに悪戦苦闘している間に170回くらい心が折れたが,なんとか動かすことができた
次の記事で実際にいろいろ遊んでみることにする
↓関連記事
コメント
二点教えていただけると嬉しいです.
「実行環境の準備」の項目は仮想環境下でブログと一致していたのですが,
CMPLXFOILのインストールの段階で2点気になる事がありました.
➀ CMPLXFOILのダウンロードの段階では
mnt/c/Users/XXX/Desktop/CMPLXFOIL/CMPLXFOIL-main
までディレクトリが作成されると思うのですが,
ブログではインストールの段階で
mnt/c/Users/XXX/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-mainと下に階層が拡張されています
これはmtk_birdmanさんがmkdir等で拡張したもので間違いないでしょうか.
②
CMPLXFOILのインストールで,
make: *** no targets specified and no makefile found. stop.と表示されてしまいました.
これはCMPLXFOIL/.py310venv 以下の仮想環境のデータが不足している事によるものでしょうか.
コメントいただきありがとうございます!
お役に立てれば幸いです。
➀の回答
≫これはmtk_birdmanさんがmkdir等で拡張したもので間違いないでしょうか.
.zipファイルを解凍した際の二重構造に起因するものです
CMPLXFOIL-main.zipを解凍した時点で,CMPLXFOIL-main>CMPLXFOIL-main>そのほかのファイル という二重構造になっていました.
私がmkdirで作成したmnt/c/Users/XXX/Desktop/CMPLXFOIL/に上記のフォルダを移動することで,mnt/c/Users/XXX/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-mainというディレクトリ構成になりました.
②の回答
≫make: *** no targets specified and no makefile found. stop.と表示されてしまいました.
≫これはCMPLXFOIL/.py310venv 以下の仮想環境のデータが不足している事によるものでしょうか.
makeを実行するディレクトリが間違っていたのではないかと思います.
makeはMakefileというファイルを読み込んで実行されますので,Makefileがあるディレクトリでmakeを実行してみてください.
今回の記事だと /mnt/c/Users/mtkbirdman/Desktop/CMPLXFOIL/CMPLXFOIL-main/CMPLXFOIL-main/Makefile を実行することになります.
CMPLXFOILのzipファイルをちゃんと展開できていなかったみたいで、再度ダウンロードしたところ,「サンプルコードの実行」まで無事にできました.
ブログにディレクトリ構成まで追記していただきありがとうございます.
早速,翼型を弄って遊んでみたいと思います.