bem_templates Module

平面/穴あき平面/円板/リング/箱/円柱/球テンプレートから三角形メッシュを生成するユーティリティ。


Uses

  • module~~bem_templates~~UsesGraph module~bem_templates bem_templates module~bem_kinds bem_kinds module~bem_templates->module~bem_kinds module~bem_mesh bem_mesh module~bem_templates->module~bem_mesh module~bem_types bem_types module~bem_templates->module~bem_types iso_fortran_env iso_fortran_env module~bem_kinds->iso_fortran_env module~bem_mesh->module~bem_kinds module~bem_mesh->module~bem_types module~bem_string_utils bem_string_utils module~bem_mesh->module~bem_string_utils module~bem_types->module~bem_kinds

Used by

  • module~~bem_templates~~UsedByGraph module~bem_templates bem_templates module~bem_app_config_runtime bem_app_config_runtime module~bem_app_config_runtime->module~bem_templates module~bem_app_config bem_app_config module~bem_app_config->module~bem_app_config_runtime module~bem_simulator bem_simulator module~bem_simulator->module~bem_app_config program~main main program~main->module~bem_app_config program~main->module~bem_simulator module~bem_simulator_io bem_simulator_io module~bem_simulator_io->module~bem_simulator module~bem_simulator_loop bem_simulator_loop module~bem_simulator_loop->module~bem_simulator module~bem_simulator_stats bem_simulator_stats module~bem_simulator_stats->module~bem_simulator

Functions

public function transition_corner_count(edge_from, edge_to) result(n_corner)

長方形外周を反時計回りに見たとき、辺遷移で通過するコーナー数を返す。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: edge_from
integer(kind=i32), intent(in) :: edge_to

Return Value integer(kind=i32)

public function edge_order_index(edge_id) result(idx)

境界辺の反時計回り順序インデックスを返す。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: edge_id

Return Value integer(kind=i32)

public function edge_next_ccw(edge_id) result(next_id)

境界辺の次(反時計回り)を返す。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: edge_id

Return Value integer(kind=i32)


Subroutines

public subroutine make_plane(mesh, size_x, size_y, nx, ny, center)

XY平面を nx*ny 分割し、各セルを2三角形へ分割したメッシュを生成する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成した平面三角形メッシュ。

real(kind=dp), intent(in), optional :: size_x

X方向の平面サイズ [m](省略時 1.0)。

real(kind=dp), intent(in), optional :: size_y

X方向の平面サイズ [m](省略時 1.0)。 Y方向の平面サイズ [m](省略時 1.0)。

integer(kind=i32), intent(in), optional :: nx

X方向分割数(省略時 1)。

integer(kind=i32), intent(in), optional :: ny

X方向分割数(省略時 1)。 Y方向分割数(省略時 1)。

real(kind=dp), intent(in), optional :: center(3)

public subroutine make_disk(mesh, radius, n_theta, n_r, center)

XY平面上の円板を極座標分割し、外周へ向かって三角形化したメッシュを生成する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成した円板メッシュ。

real(kind=dp), intent(in), optional :: radius

円板半径 [m](省略時 0.5)。

integer(kind=i32), intent(in), optional :: n_theta

周方向分割数(省略時 24)。

integer(kind=i32), intent(in), optional :: n_r

周方向分割数(省略時 24)。 半径方向分割数(省略時 8)。

real(kind=dp), intent(in), optional :: center(3)

円板半径 [m](省略時 0.5)。

public subroutine make_annulus(mesh, radius, inner_radius, n_theta, n_r, center)

XY平面上の同心リングを極座標分割し、三角形メッシュを生成する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成したリング(環状)メッシュ。

real(kind=dp), intent(in), optional :: radius

外半径 [m](省略時 0.5)。

real(kind=dp), intent(in), optional :: inner_radius

外半径 [m](省略時 0.5)。 内半径 [m](省略時 0.25)。

integer(kind=i32), intent(in), optional :: n_theta

周方向分割数(省略時 24)。

integer(kind=i32), intent(in), optional :: n_r

周方向分割数(省略時 24)。 半径方向分割数(省略時 4)。

real(kind=dp), intent(in), optional :: center(3)

外半径 [m](省略時 0.5)。 内半径 [m](省略時 0.25)。

public subroutine make_plate_hole(mesh, size_x, size_y, radius, n_theta, n_r, center)

XY平面の長方形プレートから円形穴を除いたメッシュを生成する。 穴境界は n_theta 分割の多角形近似で表し、外周は長方形境界に一致させる。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成した穴あきプレートメッシュ。

real(kind=dp), intent(in), optional :: size_x

X方向サイズ [m](省略時 1.0)。

real(kind=dp), intent(in), optional :: size_y

X方向サイズ [m](省略時 1.0)。 Y方向サイズ [m](省略時 1.0)。

real(kind=dp), intent(in), optional :: radius

X方向サイズ [m](省略時 1.0)。 Y方向サイズ [m](省略時 1.0)。 穴半径 [m](省略時 0.2)。

integer(kind=i32), intent(in), optional :: n_theta

穴の周方向分割数(省略時 48)。

integer(kind=i32), intent(in), optional :: n_r

穴の周方向分割数(省略時 48)。 穴縁から外周までの半径方向分割数(省略時 4)。

real(kind=dp), intent(in), optional :: center(3)

X方向サイズ [m](省略時 1.0)。 Y方向サイズ [m](省略時 1.0)。 穴半径 [m](省略時 0.2)。

public subroutine make_box(mesh, size, center, nx, ny, nz)

直方体6面を分割数に応じて三角形化し、外向き法線向きでメッシュを生成する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成した直方体表面メッシュ。

real(kind=dp), intent(in), optional :: size(3)
real(kind=dp), intent(in), optional :: center(3)
integer(kind=i32), intent(in), optional :: nx

X方向分割数(省略時 1)。

integer(kind=i32), intent(in), optional :: ny

X方向分割数(省略時 1)。 Y方向分割数(省略時 1)。

integer(kind=i32), intent(in), optional :: nz

X方向分割数(省略時 1)。 Y方向分割数(省略時 1)。 Z方向分割数(省略時 1)。

public subroutine make_cylinder(mesh, radius, height, n_theta, n_z, cap, center, cap_top, cap_bottom)

円柱側面を分割生成し、必要に応じて上下面キャップを追加したメッシュを生成する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成した円柱メッシュ。

real(kind=dp), intent(in), optional :: radius

円柱半径 [m](省略時 0.5)。

real(kind=dp), intent(in), optional :: height

円柱半径 [m](省略時 0.5)。 円柱高さ [m](省略時 1.0)。

integer(kind=i32), intent(in), optional :: n_theta

周方向分割数(省略時 24)。

integer(kind=i32), intent(in), optional :: n_z

周方向分割数(省略時 24)。 軸方向分割数(省略時 1)。

logical, intent(in), optional :: cap

上下面キャップをまとめて指定する後方互換フラグ(省略時 .true.)。

real(kind=dp), intent(in), optional :: center(3)

円柱半径 [m](省略時 0.5)。 円柱高さ [m](省略時 1.0)。

logical, intent(in), optional :: cap_top

上下面キャップをまとめて指定する後方互換フラグ(省略時 .true.)。 上面キャップを生成するか(省略時 .true.)。

logical, intent(in), optional :: cap_bottom

上下面キャップをまとめて指定する後方互換フラグ(省略時 .true.)。 上面キャップを生成するか(省略時 .true.)。 下面キャップを生成するか(省略時 .true.)。

public subroutine make_sphere(mesh, radius, n_lon, n_lat, center)

経度・緯度分割に基づき球面三角形メッシュを生成する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

生成した球面三角形メッシュ。

real(kind=dp), intent(in), optional :: radius

球半径 [m](省略時 0.5)。

integer(kind=i32), intent(in), optional :: n_lon

経度方向分割数(省略時 24)。

integer(kind=i32), intent(in), optional :: n_lat

経度方向分割数(省略時 24)。 緯度方向分割数(省略時 12)。

real(kind=dp), intent(in), optional :: center(3)

球半径 [m](省略時 0.5)。

public subroutine ray_to_rectangle(hx, hy, dx, dy, x_min, x_max, y_min, y_max, z_plane, p, edge_id)

XY平面上で、中心からのレイと長方形境界の最短交点を返す。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: hx
real(kind=dp), intent(in) :: hy
real(kind=dp), intent(in) :: dx
real(kind=dp), intent(in) :: dy
real(kind=dp), intent(in) :: x_min
real(kind=dp), intent(in) :: x_max
real(kind=dp), intent(in) :: y_min
real(kind=dp), intent(in) :: y_max
real(kind=dp), intent(in) :: z_plane
real(kind=dp), intent(out) :: p(3)
integer(kind=i32), intent(out) :: edge_id

public subroutine transition_corners(edge_from, edge_to, x_min, x_max, y_min, y_max, z_plane, corners, n_corner)

辺遷移時に通過するコーナー列(最大3点)を返す。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: edge_from
integer(kind=i32), intent(in) :: edge_to
real(kind=dp), intent(in) :: x_min
real(kind=dp), intent(in) :: x_max
real(kind=dp), intent(in) :: y_min
real(kind=dp), intent(in) :: y_max
real(kind=dp), intent(in) :: z_plane
real(kind=dp), intent(out) :: corners(3,3)
integer(kind=i32), intent(out) :: n_corner

public subroutine corner_between(edge_from, edge_to, x_min, x_max, y_min, y_max, z_plane, corner)

反時計回りに隣接する辺ペアに対し、対応する長方形コーナー座標を返す。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: edge_from
integer(kind=i32), intent(in) :: edge_to
real(kind=dp), intent(in) :: x_min
real(kind=dp), intent(in) :: x_max
real(kind=dp), intent(in) :: y_min
real(kind=dp), intent(in) :: y_max
real(kind=dp), intent(in) :: z_plane
real(kind=dp), intent(out) :: corner(3)

public pure subroutine sph(r, c, theta, phi, p)

球座標 (theta, phi) を中心 c・半径 r の直交座標へ変換する。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: r

球半径 [m]。

real(kind=dp), intent(in) :: c(3)

球半径 [m]。

real(kind=dp), intent(in) :: theta

球半径 [m]。 方位角 [rad]。

real(kind=dp), intent(in) :: phi

球半径 [m]。 方位角 [rad]。 極角(+Z軸基準) [rad]。

real(kind=dp), intent(out) :: p(3)

public pure subroutine push_tri(v0, v1, v2, itri, a, b, c)

三角形頂点 a,b,c を出力配列の次インデックスへ書き込む。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: v0(:,:)
real(kind=dp), intent(inout) :: v1(:,:)
real(kind=dp), intent(inout) :: v2(:,:)
integer(kind=i32), intent(inout) :: itri

現在までに書き込んだ三角形数(呼び出し内で1増加)。

real(kind=dp), intent(in) :: a(3)
real(kind=dp), intent(in) :: b(3)
real(kind=dp), intent(in) :: c(3)