10#include "scaleFElib.h"
34 logical,
private :: lumpedmatflag
36 real(rp),
allocatable :: v(:,:)
37 real(rp),
allocatable :: invv(:,:)
38 real(rp),
allocatable :: m(:,:)
39 real(rp),
allocatable :: invm(:,:)
40 real(rp),
allocatable :: lift(:,:)
41 real(rp),
allocatable :: intweight_lgl(:)
43 procedure :: islumpedmatrix => elementbase_islumpedmatrix
54 integer,
allocatable :: fmask(:,:)
56 real(rp),
allocatable :: x1(:)
58 real(rp),
allocatable :: dx1(:,:)
60 real(rp),
allocatable :: sx1(:,:)
71 integer,
allocatable :: fmask(:,:)
73 real(rp),
allocatable :: x1(:)
74 real(rp),
allocatable :: x2(:)
76 real(rp),
allocatable :: dx1(:,:)
77 real(rp),
allocatable :: dx2(:,:)
79 real(rp),
allocatable :: sx1(:,:)
80 real(rp),
allocatable :: sx2(:,:)
88 intw_intrp, x_intrp, y_intrp )
result(IntrpMat)
93 integer,
intent(in) :: intrppolyorder
94 real(rp),
intent(out),
optional :: intw_intrp(intrppolyorder**2)
95 real(rp),
intent(out),
optional :: x_intrp(intrppolyorder**2)
96 real(rp),
intent(out),
optional :: y_intrp(intrppolyorder**2)
97 real(rp) :: intrpmat(intrppolyorder**2,this%np)
104 integer :: polyorder_h
108 integer,
allocatable :: fmask_h(:,:)
110 integer :: polyorder_v
114 integer,
allocatable :: fmask_v(:,:)
116 integer,
allocatable :: colmask(:,:)
117 integer,
allocatable :: hslice(:,:)
118 integer,
allocatable :: indexh2dto3d(:)
119 integer,
allocatable :: indexh2dto3d_bnd(:)
120 integer,
allocatable :: indexz1dto3d(:)
122 real(rp),
allocatable :: x1(:)
123 real(rp),
allocatable :: x2(:)
124 real(rp),
allocatable :: x3(:)
126 real(rp),
allocatable :: dx1(:,:)
127 real(rp),
allocatable :: dx2(:,:)
128 real(rp),
allocatable :: dx3(:,:)
130 real(rp),
allocatable :: sx1(:,:)
131 real(rp),
allocatable :: sx2(:,:)
132 real(rp),
allocatable :: sx3(:,:)
143 private :: elementbase_init
144 private :: elementbase_final
150 subroutine elementbase_init( elem, lumpedmat_flag )
154 logical,
intent(in) :: lumpedmat_flag
157 allocate( elem%M(elem%Np, elem%Np) )
158 allocate( elem%invM(elem%Np, elem%Np) )
159 allocate( elem%V(elem%Np, elem%Np) )
160 allocate( elem%invV(elem%Np, elem%Np) )
161 allocate( elem%Lift(elem%Np, elem%NfpTot) )
163 allocate( elem%IntWeight_lgl(elem%Np) )
165 elem%LumpedMatFlag = lumpedmat_flag
168 end subroutine elementbase_init
171 subroutine elementbase_final( elem )
177 if (
allocated(elem%M) )
then
179 deallocate( elem%invM )
181 deallocate( elem%invV )
182 deallocate( elem%Lift )
183 deallocate( elem%IntWeight_lgl )
187 end subroutine elementbase_final
190 function elementbase_islumpedmatrix( elem )
result(lumpedmat_flag)
193 logical :: lumpedmat_flag
196 lumpedmat_flag = elem%LumpedMatFlag
198 end function elementbase_islumpedmatrix
206 MassMat, invMassMat )
209 integer,
intent(in) :: np
210 real(rp),
intent(in) :: v(np,np)
211 real(rp),
intent(out) :: massmat(np,np)
212 real(rp),
intent(out),
optional :: invmassmat(np,np)
214 real(rp) :: tmpmat(np,np)
215 real(rp) :: invm(np,np)
218 tmpmat(:,:) = transpose(v)
219 invm(:,:) = matmul( v, tmpmat )
222 if (
present(invmassmat) ) invmassmat(:,:) = invm(:,:)
232 integer,
intent(in) :: np
233 real(rp),
intent(in) :: massmat(np,np)
234 real(rp),
intent(in) :: invmassmat(np,np)
235 real(rp),
intent(in) :: dmat(np,np)
236 real(rp),
intent(out) :: stiffmat(np,np)
238 real(rp) :: tmpmat1(np,np)
239 real(rp) :: tmpmat2(np,np)
242 tmpmat1(:,:) = matmul( massmat, dmat )
243 tmpmat2(:,:) = transpose( tmpmat1 )
244 stiffmat(:,:) = matmul( invmassmat, tmpmat2 )
255 integer,
intent(in) :: np
256 integer,
intent(in) :: nfptot
257 real(rp),
intent(in) :: invm(np,np)
258 real(rp),
intent(in) :: emat(np,nfptot)
259 real(rp),
intent(out) :: liftmat(np,nfptot)
262 liftmat(:,:) = matmul( invm, emat )
273 logical,
intent(in) :: lumpedmat_flag
276 call elementbase_init( elem, lumpedmat_flag )
278 allocate( elem%x1(elem%Np) )
279 allocate( elem%Fmask(elem%Nfp, elem%Nfaces) )
281 allocate( elem%Dx1(elem%Np, elem%Np) )
282 allocate( elem%Sx1(elem%Np, elem%Np) )
294 if (
allocated( elem%x1 ) )
then
295 deallocate( elem%x1 )
296 deallocate( elem%Dx1 )
297 deallocate( elem%Sx1 )
298 deallocate( elem%Fmask )
301 call elementbase_final( elem )
313 logical,
intent(in) :: lumpedmat_flag
316 call elementbase_init( elem, lumpedmat_flag )
318 allocate( elem%x1(elem%Np), elem%x2(elem%Np) )
319 allocate( elem%Fmask(elem%Nfp, elem%Nfaces) )
321 allocate( elem%Dx1(elem%Np, elem%Np), elem%Dx2(elem%Np, elem%Np) )
322 allocate( elem%Sx1(elem%Np, elem%Np), elem%Sx2(elem%Np, elem%Np) )
334 if (
allocated( elem%x1 ) )
then
335 deallocate( elem%x1, elem%x2 )
336 deallocate( elem%Fmask )
338 deallocate( elem%Dx1, elem%Dx2 )
339 deallocate( elem%Sx1, elem%Sx2 )
342 call elementbase_final( elem )
354 logical,
intent(in) :: lumpedmat_flag
357 call elementbase_init( elem, lumpedmat_flag )
359 allocate( elem%x1(elem%Np), elem%x2(elem%Np), elem%x3(elem%Np) )
360 allocate( elem%Dx1(elem%Np, elem%Np), elem%Dx2(elem%Np, elem%Np), elem%Dx3(elem%Np, elem%Np) )
361 allocate( elem%Sx1(elem%Np, elem%Np), elem%Sx2(elem%Np, elem%Np), elem%Sx3(elem%Np, elem%Np) )
362 allocate( elem%Fmask_h(elem%Nfp_h, elem%Nfaces_h), elem%Fmask_v(elem%Nfp_v, elem%Nfaces_v) )
363 allocate( elem%Colmask(elem%Nnode_v,elem%Nfp_v))
364 allocate( elem%Hslice(elem%Nfp_v,elem%Nnode_v) )
365 allocate( elem%IndexH2Dto3D(elem%Np) )
366 allocate( elem%IndexH2Dto3D_bnd(elem%NfpTot) )
367 allocate( elem%IndexZ1Dto3D(elem%Np) )
379 if (
allocated( elem%x1 ) )
then
380 deallocate( elem%x1, elem%x2, elem%x3 )
381 deallocate( elem%Dx1, elem%Dx2, elem%Dx3 )
382 deallocate( elem%Sx1, elem%Sx2, elem%Sx3 )
383 deallocate( elem%Fmask_h, elem%Fmask_v )
384 deallocate( elem%Colmask, elem%Hslice )
385 deallocate( elem%IndexH2Dto3D, elem%IndexH2Dto3D_bnd )
386 deallocate( elem%IndexZ1Dto3D )
389 call elementbase_final( elem )
module FElib / Element / Base
subroutine, public elementbase2d_final(elem)
subroutine, public elementbase3d_init(elem, lumpedmat_flag)
subroutine, public elementbase2d_init(elem, lumpedmat_flag)
subroutine, public elementbase_construct_massmat(v, np, massmat, invmassmat)
Construct mass matrix M^-1 = V V^T M = ( M^-1 )^-1.
subroutine, public elementbase_construct_stiffmat(massmat, invmassmat, dmat, np, stiffmat)
Construct stiffness matrix StiffMat_i = M^-1 ( M D_xi )^T.
subroutine, public elementbase_construct_liftmat(invm, emat, np, nfptot, liftmat)
Construct stiffness matrix StiffMat_i = M^-1 ( M D_xi )^T.
subroutine, public elementbase3d_final(elem)
subroutine, public elementbase1d_init(elem, lumpedmat_flag)
subroutine, public elementbase1d_final(elem)
module common / Linear algebra
real(rp) function, dimension(size(a, 1), size(a, 2)), public linalgebra_inv(a)