LoginSignup
2
1

More than 1 year has passed since last update.

plantFEMとImageJで葉っぱの3D有限要素メッシュを作る.

Last updated at Posted at 2021-08-25

今道端で見かけた植物の葉っぱでシミュレーションやりたいそこのあなたへ!

plantFEMでは,こんな葉っぱのメッシュをすぐに作れます.

7178ad19-5dbf-4836-a5e7-a729a0497630--concord-grape-leaves.jpg

さらに増やせます!
grape.png

やりかた

環境:Ubuntu 20.04

(1) ImageJをインストール

(2) 画像をImageJで開き,"Multi-Point"アイコンをクリックした後で,輪郭に点を打つ(どこからでもok)

Screenshot from 2021-08-25 13-56-31.png

(3) File > Save As > XY-Coordinates でleafshape.txtなどとして保存

 以下,plantFEMの作業になります.

(4) 以下のコマンドでplantFEMをインストール


git clone https://github.com/kazulagi/plantFEM
cd plantFEM
python3 install.py

(5) 以下のコードをserver.f90に書き,plantfem buildでビルド

use LeafClass

implicit none

type(Leaf_) :: leaf

call leaf%create(filename="path/to/leafshape.txt")
call leaf%vtk("leaf")

end

(※path/to/leafshape.txtの部分は先ほどファイルを保存した先のパスを指定してください.)

(6) ./server.outを実行

(7) 仕上がったvtkファイルをparaviewなどで閲覧

mesh.png

(8) 分割数を上げたい場合は,以下のように引数を追加.


use LeafClass

implicit none

type(Leaf_) :: leaf

call leaf%create(filename="path/to/leafshape.txt",x_num=30,y_num=30)
call leaf%vtk("grape")

end

すると細かくなります.
mesh_high.png

 おまけ:

個葉の熱拡散シミュレーションそのうち加筆します.

ではこのあたりで.

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1