Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me | |||
real(kind=rk), | intent(in) | :: | time |
velocity value |
||
integer, | intent(in) | :: | nPoint |
number of points to get value for |
||
real(kind=rk), | intent(in) | :: | coord(nPoint,3) |
points |
List of values of each point
function tem_polygon_material_movement_single(me, time, nPoint, coord) &
& result(res)
! ----------------------------------------------------------------------
type(tem_polygon_material_type), intent(in) :: me
!>velocity value
real(kind=rk), intent(in) :: time
!> number of points to get value for
integer, intent(in) :: nPoint
!> points
real(kind=rk), intent(in) :: coord(nPoint,3)
!> List of values of each point
real(kind=rk) :: res(nPoint*me%nComponents)
! ----------------------------------------------------------------------
real(kind=rk) :: alpha
integer :: iPoint
type(tem_polygon_material_type) :: loc_polygon
! ----------------------------------------------------------------------
loc_polygon = me
select case(me%moving%movement_kind)
case ('lin_movement_2d','lin_movement_3d')
loc_polygon%poly_list(1)%vertex(:,1) = me%poly_list(1)%vertex(:,1) &
& + me%moving%lin_parameter(1) * time
loc_polygon%poly_list(1)%vertex(:,2) = me%poly_list(1)%vertex(:,2) &
& + me%moving%lin_parameter(2) * time
case('sin_movement_2d','sin_movement_3d')
loc_polygon%poly_list(1)%vertex(:,1) = me%poly_list(1)%vertex(:,1) &
& + me%moving%sin_parameter(1) &
& *sin(2*PI*me%moving%sin_parameter(2)*time)
loc_polygon%poly_list(1)%vertex(:,2) = me%poly_list(1)%vertex(:,2) &
& + me%moving%sin_parameter(3) &
& *sin(2*PI*me%moving%sin_parameter(4)*time)
case('angleofAttack_2d','angleofAttack_3d' )
! rotation around y-axis
alpha = me%moving%angle_parameter(1) + me%moving%angle_parameter(2) &
& * sin( me%moving%angle_parameter(3) * time)
loc_polygon%poly_list(1)%vertex(:,1) = me%poly_list(1)%vertex(:,1) &
& * cos(alpha) + me%poly_list(1)%vertex(:,2) * sin(alpha)
loc_polygon%poly_list(1)%vertex(:,2) = me%poly_list(1)%vertex(:,2) &
& * cos(alpha) - me%poly_list(1)%vertex(:,1) * sin(alpha)
case('rot_movement_2d','rot_movement_3d')
loc_polygon%poly_list(1)%vertex(:,1) = &
& cos(me%moving%rot_parameter(3)*time)*(me%poly_list(1)%vertex(:,1) &
& - me%moving%rot_parameter(1)) &
& - sin(me%moving%rot_parameter(3)*time)*(me%poly_list(1)%vertex(:,2) &
& - me%moving%rot_parameter(2)) + me%moving%rot_parameter(1)
loc_polygon%poly_list(1)%vertex(:,2) = &
& sin(me%moving%rot_parameter(3)*time)*(me%poly_list(1)%vertex(:,1) &
& - me%moving%rot_parameter(1)) &
& + cos(me%moving%rot_parameter(3)*time)*(me%poly_list(1)%vertex(:,2) &
& - me%moving%rot_parameter(2)) + me%moving%rot_parameter(2)
case default
call tem_abort( 'ERROR in tem_polygon_material_module: UNKNOWN movement' &
& // ' for the polygon in 2D' )
end select
select case(me%moving%movement_kind)
case('lin_movement_2d', 'sin_movement_2d', 'rot_movement_2d', &
& 'angleofAttack_2d' )
do iPoint=1, nPoint
res((iPoint-1)*me%nComponents+1:iPoint*me%nComponents) &
& = tem_polygon_material_value( &
& me = loc_polygon%poly_list(1), &
& nComponents = loc_polygon%nComponents, &
& inVal = loc_polygon%inVal, &
& outVal = loc_polygon%outVal, &
& point = coord(iPoint,:2) )
end do
case('lin_movement_3d', 'sin_movement_3d', 'rot_movement_3d', &
& 'angleofAttack_3d' )
do iPoint=1, nPoint
if (coord(iPoint,3) >= me%zmin .and. coord(iPoint,3) <= me%zmax ) then
res((iPoint-1)*me%nComponents+1:iPoint*me%nComponents) &
& = tem_polygon_material_value( &
& me = loc_polygon%poly_list(1), &
& nComponents = loc_polygon%nComponents, &
& inVal = loc_polygon%inVal, &
& outVal = loc_polygon%outVal, &
& point = coord(iPoint,:2) )
else
res((iPoint-1)*me%nComponents+1:iPoint*me%nComponents) = me%outval
end if
end do
case default
call tem_abort( 'ERROR in tem_polygon_material_module: UNKNOWN movement' &
& // 'for the polygon in 3D' )
end select
end function tem_polygon_material_movement_single