60 CHARACTER(LEN=32),
PARAMETER ::
mesh_name =
"midpoint" 76 CLASS(mesh_midpoint),
INTENT(INOUT) :: this
77 TYPE(Dict_TYP),
POINTER :: config,IO
83 CALL this%InitMesh(config, io, midpoint,
mesh_name)
87 this%dAx(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX,2), &
88 this%dAy(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX,2), &
89 this%dAz(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX,2), &
90 this%dAxdydz(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX,2), &
91 this%dAydzdx(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX,2), &
92 this%dAzdxdy(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX,2), &
95 CALL this%Error(
"InitMesh_midpoint",
"Unable to allocate memory.")
100 this%dAxdydz(:,:,:,1:2) = this%hy%faces(:,:,:,1:2)*this%hz%faces(:,:,:,1:2)
102 this%dAydzdx(:,:,:,1:2) = this%hz%faces(:,:,:,3:4)*this%hx%faces(:,:,:,3:4)
104 this%dAzdxdy(:,:,:,1:2) = this%hx%faces(:,:,:,5:6)*this%hy%faces(:,:,:,5:6)
107 this%dAx(:,:,:,:) = this%dAxdydz(:,:,:,:)*this%dy*this%dz
108 this%dAy(:,:,:,:) = this%dAydzdx(:,:,:,:)*this%dz*this%dx
109 this%dAz(:,:,:,:) = this%dAzdxdy(:,:,:,:)*this%dx*this%dy
112 this%volume%data3d(:,:,:) = this%sqrtg%center(:,:,:)*this%dx*this%dy*this%dz
115 this%dxdydV%data1d(:) = this%dx*this%dy/(this%volume%data1d(:)+tiny(this%dx))
116 this%dydzdV%data1d(:) = this%dy*this%dz/(this%volume%data1d(:)+tiny(this%dy))
117 this%dzdxdV%data1d(:) = this%dz*this%dx/(this%volume%data1d(:)+tiny(this%dz))
120 this%cyxy%center(:,:,:) = 0.5*(this%hz%faces(:,:,:,2)+this%hz%faces(:,:,:,1)) &
121 * (this%hy%faces(:,:,:,2)-this%hy%faces(:,:,:,1)) * this%dydzdV%data3d(:,:,:)
122 this%cyzy%center(:,:,:) = 0.5*(this%hx%faces(:,:,:,6)+this%hx%faces(:,:,:,5)) &
123 * (this%hy%faces(:,:,:,6)-this%hy%faces(:,:,:,5)) * this%dxdydV%data3d(:,:,:)
124 this%cxyx%center(:,:,:) = 0.5*(this%hz%faces(:,:,:,4)+this%hz%faces(:,:,:,3)) &
125 * (this%hx%faces(:,:,:,4)-this%hx%faces(:,:,:,3)) * this%dzdxdV%data3d(:,:,:)
126 this%cxzx%center(:,:,:) = 0.5*(this%hy%faces(:,:,:,6)+this%hy%faces(:,:,:,5)) &
127 * (this%hx%faces(:,:,:,6)-this%hx%faces(:,:,:,5)) * this%dxdydV%data3d(:,:,:)
128 this%czxz%center(:,:,:) = 0.5*(this%hy%faces(:,:,:,2)+this%hy%faces(:,:,:,1)) &
129 * (this%hz%faces(:,:,:,2)-this%hz%faces(:,:,:,1)) * this%dydzdV%data3d(:,:,:)
130 this%czyz%center(:,:,:) = 0.5*(this%hx%faces(:,:,:,4)+this%hx%faces(:,:,:,3)) &
131 * (this%hz%faces(:,:,:,4)-this%hz%faces(:,:,:,3)) * this%dzdxdV%data3d(:,:,:)
134 this%cyxy%bcenter(:,:,:) = this%cyxy%center(:,:,:)
135 this%cyzy%bcenter(:,:,:) = this%cyzy%center(:,:,:)
136 this%cxyx%bcenter(:,:,:) = this%cxyx%center(:,:,:)
137 this%cxzx%bcenter(:,:,:) = this%cxzx%center(:,:,:)
138 this%czxz%bcenter(:,:,:) = this%czxz%center(:,:,:)
139 this%czyz%bcenter(:,:,:) = this%czyz%center(:,:,:)
142 this%dlx%data3d(:,:,:) = this%hx%center(:,:,:)*this%dx
143 this%dly%data3d(:,:,:) = this%hy%center(:,:,:)*this%dy
144 this%dlz%data3d(:,:,:) = this%hz%center(:,:,:)*this%dz
159 REAL,
DIMENSION(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX) &
168 SELECT CASE(
this%VECTOR_COMPONENTS)
169 CASE(ior(vector_x,vector_y))
175 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
176 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
178 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),0.0, &
180 0.5*(vx(i-
this%IP1,j,k)+vx(i,j,k)),0.5*(vx(i+
this%IP1,j,k)+vx(i,j,k)), &
181 0.5*(vy(i,j-
this%JP1,k)+vy(i,j,k)),0.5*(vy(i,j+
this%JP1,k)+vy(i,j,k)), &
187 CASE(ior(vector_x,vector_z))
195 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
197 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
198 this%dydzdV%data3d(i,j,k),0.0,
this%dxdydV%data3d(i,j,k), &
200 0.5*(vx(i-
this%IP1,j,k)+vx(i,j,k)),0.5*(vx(i+
this%IP1,j,k)+vx(i,j,k)), &
202 0.5*(vy(i,j,k-
this%KP1)+vy(i,j,k)),0.5*(vy(i,j,k)+vy(i,j,k+
this%KP1)), &
207 CASE(ior(vector_y,vector_z))
216 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
217 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
218 0.0,
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
221 0.5*(vx(i,j-
this%JP1,k)+vx(i,j,k)),0.5*(vx(i,j+
this%JP1,k)+vx(i,j,k)), &
222 0.5*(vy(i,j,k-
this%KP1)+vy(i,j,k)),0.5*(vy(i,j,k)+vy(i,j,k+
this%KP1)), &
282 REAL,
DIMENSION(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX) &
283 :: txx,txy,tyx,tyy,divtx,divty
287 INTENT(IN) :: txx,txy,tyx,tyy
288 INTENT(OUT) :: divtx,divty
291 SELECT CASE(
this%VECTOR_COMPONENTS)
292 CASE(ior(vector_x,vector_y))
299 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
300 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
302 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),0.0, &
303 this%cxyx%center(i,j,k),0.0, &
304 this%cyxy%center(i,j,k),0.0, &
305 0.5*(txx(i-
this%IP1,j,k)+txx(i,j,k)),0.5*(txx(i+
this%IP1,j,k)+txx(i,j,k)), &
306 0.5*(txy(i,j-
this%JP1,k)+txy(i,j,k)),0.5*(txy(i,j+
this%JP1,k)+txy(i,j,k)), &
308 tyx(i,j,k),0.0,tyy(i,j,k),0.0)
313 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
314 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
316 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),0.0, &
317 -
this%cxyx%center(i,j,k),0.0, &
318 -
this%cyxy%center(i,j,k),0.0, &
319 0.5*(tyx(i-
this%IP1,j,k)+tyx(i,j,k)),0.5*(tyx(i+
this%IP1,j,k)+tyx(i,j,k)), &
320 0.5*(tyy(i,j-
this%JP1,k)+tyy(i,j,k)),0.5*(tyy(i,j+
this%JP1,k)+tyy(i,j,k)), &
322 txx(i,j,k),0.0,txy(i,j,k),0.0)
326 CASE(ior(vector_x,vector_z))
338 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
339 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
340 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
341 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
342 this%cxyx%center(i,j,k),
this%cxzx%center(i,j,k), &
343 this%cyxy%center(i,j,k),
this%czxz%center(i,j,k), &
344 0.5*(txx(i-
this%IP1,j,k)+txx(i,j,k)),0.5*(txx(i+
this%IP1,j,k)+txx(i,j,k)), &
346 0.5*(txy(i,j,k-
this%KP1)+txy(i,j,k)),0.5*(txy(i,j,k+
this%KP1)+txy(i,j,k)), &
347 0.0,tyx(i,j,k),0.0,tyy(i,j,k))
352 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
353 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
354 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
355 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
356 this%czyz%center(i,j,k),-
this%cxzx%center(i,j,k), &
357 this%cyzy%center(i,j,k),-
this%czxz%center(i,j,k), &
358 0.5*(tyx(i-
this%IP1,j,k)+tyx(i,j,k)),0.5*(tyx(i+
this%IP1,j,k)+tyx(i,j,k)), &
360 0.5*(tyy(i,j,k-
this%KP1)+tyy(i,j,k)),0.5*(tyy(i,j,k+
this%KP1)+tyy(i,j,k)), &
361 0.0,txx(i,j,k),0.0,txy(i,j,k))
365 CASE(ior(vector_y,vector_z))
381 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
382 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
383 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
384 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
385 -
this%cxyx%center(i,j,k),
this%cyzy%center(i,j,k), &
386 -
this%cyxy%center(i,j,k),
this%czyz%center(i,j,k), &
388 0.5*(txx(i,j-
this%JP1,k)+txx(i,j,k)),0.5*(txx(i,j+
this%JP1,k)+tyy(i,j,k)), &
389 0.5*(txy(i,j,k-
this%KP1)+txy(i,j,k)),0.5*(txy(i,j,k+
this%KP1)+txy(i,j,k)), &
390 0.0,tyx(i,j,k),0.0,tyy(i,j,k))
395 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
396 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
397 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
398 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
399 this%czyz%center(i,j,k),-
this%cxzx%center(i,j,k), &
400 this%cyzy%center(i,j,k),-
this%czxz%center(i,j,k), &
402 0.5*(tyx(i,j-
this%JP1,k)+tyx(i,j,k)),0.5*(tyx(i,j+
this%JP1,k)+tyx(i,j,k)), &
403 0.5*(tyy(i,j,k-
this%KP1)+tyy(i,j,k)),0.5*(tyy(i,j,k+
this%KP1)+tyy(i,j,k)), &
404 txy(i,j,k),0.0,txx(i,j,k),0.0)
477 REAL,
DIMENSION(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX) &
482 INTENT(IN) :: vx,vy,vz
492 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
493 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
494 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
495 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
497 0.5*(vx(i-
this%IP1,j,k)+vx(i,j,k)),0.5*(vx(i+
this%IP1,j,k)+vx(i,j,k)), &
498 0.5*(vy(i,j-
this%JP1,k)+vy(i,j,k)),0.5*(vy(i,j+
this%JP1,k)+vy(i,j,k)), &
499 0.5*(vz(i,j,k-
this%KP1)+vz(i,j,k)),0.5*(vz(i,j,k+
this%KP1)+vz(i,j,k)), &
516 PURE SUBROUTINE tensordivergence3d(this,Txx,Txy,Txz,Tyx,Tyy,Tyz,Tzx,Tzy,Tzz, &
521 REAL,
DIMENSION(this%IGMIN:this%IGMAX,this%JGMIN:this%JGMAX,this%KGMIN:this%KGMAX) &
522 :: txx,txy,txz,tyx,tyy,tyz,tzx,tzy,tzz,divtx,divty,divtz
526 INTENT(IN) :: txx,txy,txz,tyx,tyy,tyz,tzx,tzy,tzz
527 INTENT(OUT) :: divtx,divty,divtz
535 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
536 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
537 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
538 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
539 this%cxyx%center(i,j,k),
this%cxzx%center(i,j,k), &
540 this%cyxy%center(i,j,k),
this%czxz%center(i,j,k), &
541 0.5*(txx(i-
this%IP1,j,k)+txx(i,j,k)),0.5*(txx(i+
this%IP1,j,k)+txx(i,j,k)), &
542 0.5*(txy(i,j-
this%JP1,k)+txy(i,j,k)),0.5*(txy(i,j+
this%JP1,k)+txy(i,j,k)), &
543 0.5*(txz(i,j,k-
this%KP1)+txz(i,j,k)),0.5*(txz(i,j,k+
this%KP1)+txz(i,j,k)), &
544 tyx(i,j,k),tzx(i,j,k),tyy(i,j,k),tzz(i,j,k))
549 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
550 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
551 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
552 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
553 -
this%cxyx%center(i,j,k),
this%cyzy%center(i,j,k), &
554 -
this%cyxy%center(i,j,k),
this%czyz%center(i,j,k), &
555 0.5*(tyx(i-
this%IP1,j,k)+tyx(i,j,k)),0.5*(tyx(i+
this%IP1,j,k)+tyx(i,j,k)), &
556 0.5*(tyy(i,j-
this%JP1,k)+tyy(i,j,k)),0.5*(tyy(i,j+
this%JP1,k)+tyy(i,j,k)), &
557 0.5*(tyz(i,j,k-
this%KP1)+tyz(i,j,k)),0.5*(tyz(i,j,k+
this%KP1)+tyz(i,j,k)), &
558 txx(i,j,k),tzy(i,j,k),txy(i,j,k),tzz(i,j,k))
563 this%dAxdydz(i,j,k,1),
this%dAxdydz(i,j,k,2), &
564 this%dAydzdx(i,j,k,1),
this%dAydzdx(i,j,k,2), &
565 this%dAzdxdy(i,j,k,1),
this%dAzdxdy(i,j,k,2), &
566 this%dydzdV%data3d(i,j,k),
this%dzdxdV%data3d(i,j,k),
this%dxdydV%data3d(i,j,k), &
567 this%czyz%center(i,j,k),-
this%cxzx%center(i,j,k), &
568 this%cyzy%center(i,j,k),-
this%czxz%center(i,j,k), &
569 0.5*(tzx(i-
this%IP1,j,k)+tzx(i,j,k)),0.5*(tzx(i+
this%IP1,j,k)+tzx(i,j,k)), &
570 0.5*(tzy(i,j-
this%JP1,k)+tzy(i,j,k)),0.5*(tzy(i,j+
this%JP1,k)+tzy(i,j,k)), &
571 0.5*(tzz(i,j,k-
this%KP1)+tzz(i,j,k)),0.5*(tzz(i,j,k+
this%KP1)+tzz(i,j,k)), &
572 tyz(i,j,k),txx(i,j,k),tyy(i,j,k),txz(i,j,k))
585 ELEMENTAL FUNCTION divergence3d(dAxdydzWest,dAxdydzEast,dAydxdzSouth,dAydxdzNorth,dAzdxdyBottom,dAzdxdyTop, &
586 dydzdV,dxdzdV,dxdydV,cxyx,cxzx,cyxy,czxz, &
587 TxxWest,TxxEast,TxySouth,TxyNorth,TxzBottom,TxzTop, &
588 TyxCent,TzxCent,TyyCent,TzzCent)
RESULT(div)
591 REAL,
INTENT(IN) :: daxdydzwest,daxdydzeast, &
592 daydxdzsouth,daydxdznorth, &
593 dazdxdybottom,dazdxdytop, &
594 dxdydv,dxdzdv,dydzdv, &
595 cxyx,cyxy,czxz,cxzx, &
599 tyxcent,tyycent,tzzcent,tzxcent
625 div = dydzdv*(daxdydzeast*txxeast-daxdydzwest*txxwest) &
626 + dxdzdv*(daydxdznorth*txynorth-daydxdzsouth*txysouth) &
627 + dxdydv*(dazdxdytop*txztop-dazdxdybottom*txzbottom) &
628 + cxyx*tyxcent + cxzx*tzxcent - cyxy*tyycent - czxz*tzzcent
636 CLASS(mesh_midpoint),
INTENT(INOUT) :: this
638 DEALLOCATE(this%dAx,this%dAy,this%dAz,this%dAxdydz,this%dAydzdx,this%dAzdxdy)
639 CALL this%Finalize_base()
subroutine finalize(this)
Destructor of common class.
mesh module for midpoint quadrature rule
pure subroutine vectordivergence2d_1(this, vx, vy, divv)
compute the cell centered 2D vector divergence
integer, save default_mpi_real
default real type for MPI
type(logging_base), save this
real, save nan_default_real
NaN real constant.
character(len=32), parameter mesh_name
pure subroutine tensordivergence2d_1(this, Txx, Txy, Tyx, Tyy, divTx, divTy)
compute the cell centered 2D rank 2 tensor divergence
Dictionary for generic data types.
subroutine initmesh_midpoint(this, config, IO)
elemental real function divergence3d(dAxdydzWest, dAxdydzEast, dAydxdzSouth, dAydxdzNorth, dAzdxdyBottom, dAzdxdyTop, dydzdV, dxdzdV, dxdydV, cxyx, cxzx, cyxy, czxz, TxxWest, TxxEast, TxySouth, TxyNorth, TxzBottom, TxzTop, TyxCent, TzxCent, TyyCent, TzzCent)
elemental workhorse to compute divergence
pure subroutine vectordivergence3d(this, vx, vy, vz, divv)
compute the cell centered 3D vector divergence
pure subroutine tensordivergence3d(this, Txx, Txy, Txz, Tyx, Tyy, Tyz, Tzx, Tzy, Tzz, divTx, divTy, divTz)
compute the cell centered 3D rank 2 tensor divergence