Function that returns the relative area of a surface minus 1.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in), | dimension(1:long,1:larg) | :: | tab_in |
surface array |
|
integer(kind=I4), | intent(in) | :: | long |
2D array length |
||
integer(kind=I4), | intent(in) | :: | larg |
2D array width |
||
real(kind=R8), | intent(in), | dimension(1:3) | :: | scale_xyz |
scale along x, y, z |
|
real(kind=R8), | intent(out) | :: | aire |
computed area |
subroutine surf_area(tab_in, long, larg, scale_xyz, aire) !================================================================================================ !! Function that returns the relative area of a surface minus 1. !------------------------------------------------------------------------------------------------ implicit none integer(kind=I4), intent(in ) :: long !! *2D array length* integer(kind=I4), intent(in ) :: larg !! *2D array width* real (kind=R8), intent(in ), dimension(1:3) :: scale_xyz !! *scale along x, y, z* real (kind=R8), intent(out) :: aire !! *computed area* real (kind=R8), intent(in ), dimension(1:long,1:larg) :: tab_in !! *surface array* integer(kind=I4) :: i, j real (kind=R8) :: z1, z2, z3, z4, hx, hy, hz hx = scale_xyz(1) hy = scale_xyz(2) hz = scale_xyz(3) ! Raisonnement sur chaque carré du domaine aire = 0. do j = 1, larg -1 do i = 1, long -1 z1 = tab_in(i , j )*hz z2 = tab_in(i , j +1)*hz z3 = tab_in(i +1, j +1)*hz z4 = tab_in(i +1, j )*hz aire = aire +0.5_R8*( sqrt( 1._R8 + ( (z1-z2)/hx )**2 + ( (z1-z4)/hy )**2 ) + & ! sqrt( 1._R8 + ( (z3-z2)/hy )**2 + ( (z3-z4)/hx )**2 ) ) ! enddo enddo aire = aire/( (long -1)*(larg -1) ) - 1._R8 return endsubroutine surf_area