length_width_elem Subroutine

private subroutine length_width_elem(spdx, spdy, x, y, length, width)

Arguments

Type IntentOptional AttributesName
real(kind=R8), intent(in) :: spdx

fluid velocity along axis

real(kind=R8), intent(in) :: spdy

fluid velocity along axis

real(kind=R8), intent(in), dimension(4):: x

corner abscissae

real(kind=R8), intent(in), dimension(4):: y

corner ordinates

real(kind=R8), intent(out) :: length

fluid element length

real(kind=R8), intent(out) :: width

fluid element width


Called by

proc~~length_width_elem~~CalledByGraph proc~length_width_elem length_width_elem proc~compute_prc_tables_reynolds_supg compute_prc_tables_reynolds_supg proc~compute_prc_tables_reynolds_supg->proc~length_width_elem proc~fz fz proc~fz->proc~compute_prc_tables_reynolds_supg proc~elementary_assembly_fe_film_reynolds elementary_assembly_FE_film_reynolds proc~elementary_assembly_fe_film_reynolds->proc~compute_prc_tables_reynolds_supg proc~fx fx proc~fx->proc~compute_prc_tables_reynolds_supg proc~fy fy proc~fy->proc~compute_prc_tables_reynolds_supg proc~assembly_fe_film_reynolds assembly_FE_film_reynolds proc~assembly_fe_film_reynolds->proc~elementary_assembly_fe_film_reynolds proc~solve_fe_film solve_FE_film proc~solve_fe_film->proc~assembly_fe_film_reynolds proc~compute_corner_fluxes compute_corner_fluxes proc~compute_corner_fluxes->proc~assembly_fe_film_reynolds proc~elementary_full_domain_fe_film_reynolds elementary_full_domain_FE_film_reynolds proc~elementary_full_domain_fe_film_reynolds->proc~solve_fe_film proc~elementary_full_domain_fe_film_reynolds->proc~compute_corner_fluxes proc~multi_scale_solve_fe_film multi_scale_solve_fe_film proc~multi_scale_solve_fe_film->proc~solve_fe_film proc~solve_fe_prob solve_fe_prob proc~solve_fe_prob->proc~solve_fe_film proc~solve_fe_prob->proc~compute_corner_fluxes proc~solve_ms_prob solve_ms_prob proc~solve_ms_prob->proc~multi_scale_solve_fe_film proc~test_rough_fe test_rough_fe proc~test_rough_fe->proc~solve_fe_prob proc~test_bearing_x_fe test_bearing_x_fe proc~test_bearing_x_fe->proc~solve_fe_prob proc~test_pocket_fe test_pocket_fe proc~test_pocket_fe->proc~solve_fe_prob proc~test_bearing_y_fe test_bearing_y_fe proc~test_bearing_y_fe->proc~solve_fe_prob proc~test_slider_fe test_slider_fe proc~test_slider_fe->proc~solve_fe_prob proc~run_test run_test proc~run_test->proc~test_rough_fe proc~run_test->proc~test_bearing_x_fe proc~run_test->proc~test_pocket_fe proc~run_test->proc~test_bearing_y_fe proc~run_test->proc~test_slider_fe proc~test_slider_ms test_slider_ms proc~run_test->proc~test_slider_ms proc~test_rough_ms test_rough_ms proc~run_test->proc~test_rough_ms proc~test_slider_ms->proc~solve_ms_prob proc~test_rough_ms->proc~solve_ms_prob program~main main program~main->proc~run_test

Contents

Source Code


Source Code

   subroutine length_width_elem(spdx, spdy, x, y, length, width)
   implicit none
   real(kind=R8), intent(in )               :: spdx   !! *fluid velocity along \(x\) axis*
   real(kind=R8), intent(in )               :: spdy   !! *fluid velocity along \(y\) axis*
   real(kind=R8), intent(in ), dimension(4) :: x      !! *corner abscissae*
   real(kind=R8), intent(in ), dimension(4) :: y      !! *corner ordinates*
   real(kind=R8), intent(out)               :: length !! *fluid element length*
   real(kind=R8), intent(out)               :: width  !! *fluid element width*

      real(kind=R8) ::  abx, adx, cbx, cdx,               &
                        aby, ady, cby, cdy,               &
                        acx, bdx, acy, bdy,               &
                        el_S, px, py, pm, spd,            &
                        ac_dot_p, bd_dot_p, ab_dot_p,     &
                        ad_dot_p, cb_dot_p, cd_dot_p,     &
                        x1, x2, x3, x4, y1, y2, y3, y4

      length = 0.
      width  = 0.

      spd = sqrt(spdx**2 +spdy**2)
      if (spd > EPS_R8) then

         px = -spdy  ! direction perpendicular to vector v
         py = +spdx
         pm =  spd

         x1 = x(1) ; y1 = y(1)
         x2 = x(2) ; y2 = y(2)
         x3 = x(3) ; y3 = y(3)
         x4 = x(4) ; y4 = y(4)

         acx = x3 -x1 ; acy = y3 -y1
         bdx = x4 -x2 ; bdy = y4 -y2
         abx = x2 -x1 ; aby = y2 -y1
         adx = x4 -x1 ; ady = y4 -y1
         cbx = x2 -x3 ; cby = y2 -y3
         cdx = x4 -x3 ; cdy = y4 -y3

         ac_dot_p = abs( px*acx +py*acy )
         bd_dot_p = abs( px*bdx +py*bdy )
         ab_dot_p = abs( px*abx +py*aby )
         ad_dot_p = abs( px*adx +py*ady )
         cb_dot_p = abs( px*cbx +py*cby )
         cd_dot_p = abs( px*cdx +py*cdy )

         ! quadrangle projection on the perpendicular to v
         width = max(ac_dot_p, bd_dot_p, ab_dot_p, &
                     ad_dot_p, cb_dot_p, cd_dot_p)/pm

         ! quadrangle area
         el_S = 0.5*( abs(cbx*cdy -cdx*cby) +abs(abx*ady -adx*aby) )

         ! element length
         length = el_S/width

      endif
   return
   endsubroutine length_width_elem