From 9968b07c5d94479e86787e66bb1654e3f35ae4c9 Mon Sep 17 00:00:00 2001 From: Jan Mandel Date: Thu, 22 Feb 2024 13:04:17 -0700 Subject: [PATCH] fixing call hexa in test, prints --- femwind/fortran/hexa_test.f90 | 5 ++--- femwind/fortran/module_hexa.f90 | 8 +++++--- femwind/fortran/module_lin_alg.f90 | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/femwind/fortran/hexa_test.f90 b/femwind/fortran/hexa_test.f90 index 4d5764f..bf45232 100644 --- a/femwind/fortran/hexa_test.f90 +++ b/femwind/fortran/hexa_test.f90 @@ -31,12 +31,11 @@ call print_matrix('u0',u0(:,:,1)) write(*,*)'iflag=',iflag write(*,*)'calling hexa' -call hexa(A,X,u0,Kloc,Floc,Jg,vol,iflag) +call hexa(A(:,:,1),X(:,:,1),u0(:,:,1),Kloc(:,:,1),Floc(:,:,1),Jg(:,:,1),vol,iflag) write(*,*)'hexa output' call print_matrix('Kloc',Kloc(:,:,1)) -call print_matrix('X',X(:,:,1)) -call print_matrix('u0',u0(:,:,1)) +call print_matrix('Floc',Floc(:,:,1)) call print_matrix('Jg',Jg(:,:,1)) write(*,*)'vol=',vol diff --git a/femwind/fortran/module_hexa.f90 b/femwind/fortran/module_hexa.f90 index a828e6f..3219304 100644 --- a/femwind/fortran/module_hexa.f90 +++ b/femwind/fortran/module_hexa.f90 @@ -10,7 +10,9 @@ subroutine hexa(A,X,u0,Kloc,Floc,Jg,vol,iflag) ! A coefficient matrix size 3x3, symmetric positive definite ! X element nodes coordinates, size 3x8, one each column is one node ! u0 column vector of input wind at the center of the element -! iflag iflag = 1 compute Kloc, iflag = 2 compute Floc, Jg, vol, iflag = 3 compute Jg +! iflag ignored, compatibility only +! was iflag = 1 compute Kloc, iflag = 2 compute Floc, Jg, vol, iflag = 3 compute Jg +! ! out: ! Kloc local stiffness matrix ! Floc local divergence load vector @@ -77,7 +79,7 @@ do i=1,9 ! loop over i quadrature nodes + center ! from the chain rule Jg = matmul(gradf,Jx_inv) - if (i .le. 8 .and. iflag .eq. 1) then !contribution to stiffness + if (i .le. 8) then !contribution to stiffness do j = 1,8 do k = 1,3 Jg_tran(k,j) = Jg(j,k) @@ -89,7 +91,7 @@ do i=1,9 ! loop over i quadrature nodes + center Kloc = Kloc+(K_at_s*abs(detJx)) end if !end computing Kloc - if (i .eq. 9 .and. iflag .eq. 2) then !Calculate Floc + if (i .eq. 9) then !Calculate Floc ! volume = determinant at midpoint times the volume of reference element ! exact if the element is linear image of reference ! i.e. all sides planar, and opposite sides are parallel diff --git a/femwind/fortran/module_lin_alg.f90 b/femwind/fortran/module_lin_alg.f90 index 2cce552..c1e96ac 100644 --- a/femwind/fortran/module_lin_alg.f90 +++ b/femwind/fortran/module_lin_alg.f90 @@ -44,7 +44,7 @@ real :: detM end subroutine inv3 subroutine print_matrix(name,A) -character(len=1)::name +character(len=*)::name real :: A(:,:) integer i,j print *,'Matrix ',trim(name),lbound(A,1),':',ubound(A,1),' by ', & -- 2.11.4.GIT