From 076466cd6ea1a9cbe000a3566525eaad6b287141 Mon Sep 17 00:00:00 2001 From: Rafael M Mudafort Date: Sat, 30 Sep 2017 09:38:24 -0600 Subject: [PATCH] Revert "add reference comments and cleanup code in diffmtc" This reverts commit abb0d0d634c191fdeafce1da047000b5b7479eea. --- modules-local/beamdyn/src/BeamDyn.f90 | 118 +++++++++++--------------- 1 file changed, 49 insertions(+), 69 deletions(-) diff --git a/modules-local/beamdyn/src/BeamDyn.f90 b/modules-local/beamdyn/src/BeamDyn.f90 index 058663ba0..9a4b81d68 100644 --- a/modules-local/beamdyn/src/BeamDyn.f90 +++ b/modules-local/beamdyn/src/BeamDyn.f90 @@ -2677,9 +2677,13 @@ SUBROUTINE BD_diffmtc( p,GLL_nodes,Shp,ShpDer ) REAL(BDKi), INTENT(INOUT) :: Shp(:,:) !< p%Shp (or another Shp array for when we add outputs at arbitrary locations) REAL(BDKi), INTENT(INOUT) :: ShpDer(:,:) !< p%ShpDer (or another Shp array for when we add outputs at arbitrary locations) - REAL(BDKi) :: dnum, den - REAL(BDKi), PARAMETER :: eps = SQRT(EPSILON(eps)) !1.0D-08 - INTEGER(IntKi) :: i, j, k, l + REAL(BDKi) :: dnum + REAL(BDKi) :: den + REAL(BDKi), PARAMETER:: eps = SQRT(EPSILON(eps)) !1.0D-08 + INTEGER(IntKi) :: l + INTEGER(IntKi) :: j + INTEGER(IntKi) :: i + INTEGER(IntKi) :: k ! initialize shape functions to 0 Shp(:,:) = 0.0_BDKi @@ -2688,77 +2692,53 @@ SUBROUTINE BD_diffmtc( p,GLL_nodes,Shp,ShpDer ) ! shape function derivative do j = 1,p%nqp do l = 1,p%nodes_per_elem - - ! if this quadrature point is located at 1/-1 AND there is exactly 1 node per element - if ( (abs(p%QPtN(j)-1.).le.eps).and.(p%nodes_per_elem.eq.1) ) then !adp: FIXME: do we want to compare to eps, or EqualRealNos??? - ShpDer(l,j) = REAL( p%nodes_per_elem * (p%nodes_per_elem-1), BDKi )/4.0_BDKi - - ! if this quadrature point is located at 1/-1 AND this is the first node of a few - elseif ( (abs(p%QPtN(j)+1.).le.eps).and.(l.eq.1) ) then - ShpDer(l,j) = -REAL((p%nodes_per_elem)*(p%nodes_per_elem-1), BDKi)/4.0_BDKi - - ! if this quadrature point is located at the GLL node - elseif ( abs(p%QPtN(j)-GLL_nodes(l)).le.eps ) then - ShpDer(l,j) = 0.0_BDKi - - ! otherwise, ... - else - ! initialize denominator to 1 - den = 1.0_BDKi - - ! loop over all nodes in this element - do i = 1,p%nodes_per_elem - - if (i.NE.l) then - den = den*(GLL_nodes(l)-GLL_nodes(i)) - end if - - ! initialize the numerator to 1 - dnum = 1.0_BDKi - - ! loop over all nodes in this element - do k = 1,p%nodes_per_elem - - if ( (k.NE.l).AND.(k.NE.i).AND.(i.NE.l) ) then - dnum = dnum*(p%QPtN(j)-GLL_nodes(k)) - elseif (i.EQ.l) then - dnum = 0.0_BDKi - endif - - enddo - - ShpDer(l,j) = ShpDer(l,j) + dnum - enddo - ShpDer(l,j) = ShpDer(l,j)/den - endif - enddo + + if ((abs(p%QPtN(j)-1.).LE.eps).AND.(l.EQ.p%nodes_per_elem)) then !adp: FIXME: do we want to compare to eps, or EqualRealNos??? + ShpDer(l,j) = REAL((p%nodes_per_elem)*(p%nodes_per_elem-1), BDKi)/4.0_BDKi + elseif ((abs(p%QPtN(j)+1.).LE.eps).AND.(l.EQ.1)) then + ShpDer(l,j) = -REAL((p%nodes_per_elem)*(p%nodes_per_elem-1), BDKi)/4.0_BDKi + elseif (abs(p%QPtN(j)-GLL_nodes(l)).LE.eps) then + ShpDer(l,j) = 0.0_BDKi + else + ShpDer(l,j) = 0.0_BDKi + den = 1.0_BDKi + do i = 1,p%nodes_per_elem + if (i.NE.l) then + den = den*(GLL_nodes(l)-GLL_nodes(i)) + endif + dnum = 1.0_BDKi + do k = 1,p%nodes_per_elem + if ((k.NE.l).AND.(k.NE.i).AND.(i.NE.l)) then + dnum = dnum*(p%QPtN(j)-GLL_nodes(k)) + elseif (i.EQ.l) then + dnum = 0.0_BDKi + endif + enddo + ShpDer(l,j) = ShpDer(l,j) + dnum + enddo + ShpDer(l,j) = ShpDer(l,j)/den + endif + enddo enddo ! shape function do j = 1,p%nqp do l = 1,p%nodes_per_elem - - ! if this quadrature point is located at the GLL node - if ( abs(p%QPtN(j)-GLL_nodes(l)).LE.eps ) then - Shp(l,j) = 1.0_BDKi - - else - dnum = 1.0_BDKi - den = 1.0_BDKi - - do k = 1,p%nodes_per_elem - - if (k.NE.l) then - den = den *(GLL_nodes(l) - GLL_nodes(k)) - dnum = dnum*(p%QPtN(j) - GLL_nodes(k)) - endif - - enddo - - Shp(l,j) = dnum/den - - endif - enddo + + if(abs(p%QPtN(j)-GLL_nodes(l)).LE.eps) then + Shp(l,j) = 1.0_BDKi + else + dnum = 1.0_BDKi + den = 1.0_BDKi + do k = 1,p%nodes_per_elem + if (k.NE.l) then + den = den *(GLL_nodes(l) - GLL_nodes(k)) + dnum = dnum*(p%QPtN(j) - GLL_nodes(k)) + endif + enddo + Shp(l,j) = dnum/den + endif + enddo enddo END SUBROUTINE BD_diffmtc