FE-Project
Loading...
Searching...
No Matches
scale_atm_dyn_dgm_hydrostatic::hydrostatic_build_rho_xyz Interface Reference

Public Member Functions

subroutine hydrostatic_build_rho_xyz_dry (ddens, dens_hyd, pres_hyd, pot, x, y, z, lcmesh, elem, bnd_sfc_pres)
 Build density in hydrostatic balance state of dry atmosphere.
subroutine hydrostatic_build_rho_xyz_moist (ddens, dens_hyd, pres_hyd, pot, rtot, cptot_ov_cvtot, x, y, z, lcmesh, elem, bnd_sfc_pres)
 Build density in hydrostatic balance state of moist atmosphere.

Detailed Description

Definition at line 54 of file scale_atm_dyn_dgm_hydrostatic.F90.

Member Function/Subroutine Documentation

◆ hydrostatic_build_rho_xyz_dry()

subroutine scale_atm_dyn_dgm_hydrostatic::hydrostatic_build_rho_xyz::hydrostatic_build_rho_xyz_dry ( real(rp), dimension(elem%np,lcmesh%nea), intent(out) ddens,
real(rp), dimension(elem%np,lcmesh%nea), intent(in) dens_hyd,
real(rp), dimension(elem%np,lcmesh%nea), intent(in) pres_hyd,
real(rp), dimension(elem%np,lcmesh%nez,lcmesh%nex,lcmesh%ney), intent(in) pot,
real(rp), dimension(elem%np,lcmesh%ne), intent(in) x,
real(rp), dimension(elem%np,lcmesh%ne), intent(in) y,
real(rp), dimension(elem%np,lcmesh%ne), intent(in) z,
class(localmesh3d), intent(in) lcmesh,
class(elementbase3d), intent(in) elem,
real(rp), dimension(lcmesh%lcmesh2d%refelem2d%np,lcmesh%ne2da), intent(in), optional bnd_sfc_pres )

Build density in hydrostatic balance state of dry atmosphere.

Parameters
DDENSDensity deviation satisfing a discrete hydrostatic balance state of dry atmosphere [kg/m3]
DENS_hydhydrostatic density [kg/m3]
PRES_hydhydrostatic pressure [Pa]
POTPotentital temperature [K]
xx-coordinate
yy-coordinate
zmodel vertical coordinate
lcmeshA object to manage a local 3D mesh
elemA object to manage a 3D finite element
bnd_SFC_PRESSurface pressure which is given as surface boundary condition [Pa]

Definition at line 366 of file scale_atm_dyn_dgm_hydrostatic.F90.

372
373 implicit none
374
375 class(LocalMesh3D), intent(in) :: lcmesh
376 class(ElementBase3D), intent(in) :: elem
377 real(RP), intent(out) :: DDENS(elem%Np,lcmesh%NeA)
378 real(RP), intent(in) :: DENS_hyd(elem%Np,lcmesh%NeA)
379 real(RP), intent(in) :: PRES_hyd(elem%Np,lcmesh%NeA)
380 real(RP), intent(in) :: x(elem%Np,lcmesh%Ne)
381 real(RP), intent(in) :: y(elem%Np,lcmesh%Ne)
382 real(RP), intent(in) :: z(elem%Np,lcmesh%Ne)
383 real(RP), intent(in) :: POT(elem%Np,lcmesh%NeZ,lcmesh%NeX,lcmesh%NeY)
384 real(RP), intent(in), optional :: bnd_SFC_PRES(lcmesh%lcmesh2D%refElem2D%Np,lcmesh%Ne2DA)
385
386 real(RP) :: Rtot (elem%Np,lcmesh%NeZ,lcmesh%NeX,lcmesh%NeY)
387 real(RP) :: CPtot_ov_CVtot(elem%Np,lcmesh%NeZ,lcmesh%NeX,lcmesh%NeY)
388
389 !-----------------------------------------------
390
391 !$omp parallel
392 !$omp workshare
393 rtot(:,:,:,:) = rdry
394 cptot_ov_cvtot(:,:,:,:) = cpdry / cvdry
395 !$omp end workshare
396 !$omp end parallel
397
398 call hydrostatic_build_rho_xyz_moist( &
399 ddens, &
400 dens_hyd, pres_hyd, &
401 pot, rtot, cptot_ov_cvtot, &
402 x, y, z, lcmesh, elem, &
403 bnd_sfc_pres )
404
405 return

◆ hydrostatic_build_rho_xyz_moist()

subroutine scale_atm_dyn_dgm_hydrostatic::hydrostatic_build_rho_xyz::hydrostatic_build_rho_xyz_moist ( real(rp), dimension(elem%np,lcmesh%nea), intent(out) ddens,
real(rp), dimension(elem%np,lcmesh%nea), intent(in) dens_hyd,
real(rp), dimension(elem%np,lcmesh%nea), intent(in) pres_hyd,
real(rp), dimension(elem%np,lcmesh%nez,lcmesh%nex,lcmesh%ney), intent(in) pot,
real(rp), dimension(elem%np,lcmesh%nez,lcmesh%nex,lcmesh%ney), intent(in) rtot,
real(rp), dimension(elem%np,lcmesh%nez,lcmesh%nex,lcmesh%ney), intent(in) cptot_ov_cvtot,
real(rp), dimension(elem%np,lcmesh%ne), intent(in) x,
real(rp), dimension(elem%np,lcmesh%ne), intent(in) y,
real(rp), dimension(elem%np,lcmesh%ne), intent(in) z,
class(localmesh3d), intent(in) lcmesh,
class(elementbase3d), intent(in) elem,
real(rp), dimension(lcmesh%lcmesh2d%refelem2d%np,lcmesh%ne2da), intent(in), optional bnd_sfc_pres )

Build density in hydrostatic balance state of moist atmosphere.

Parameters
DDENSDensity deviation satisfing a discrete hydrostatic balance state of dry atmosphere [kg/m3]
DENS_hydhydrostatic density [kg/m3]
PRES_hydhydrostatic pressure [Pa]
POTPotentital temperature [K]
RtotSpecific gas constant of moist atmosphere [J/kg/K]
CPtot_ov_CVtotSpecific heat ratio of moist atmosphere
xx-coordinate
yy-coordinate
zmodel vertical coordinate
lcmeshA object to manage a local 3D mesh
elemA object to manage a 3D finite element
bnd_SFC_PRESSurface pressure which is given as surface boundary condition [Pa]

Definition at line 423 of file scale_atm_dyn_dgm_hydrostatic.F90.

429
430 use scale_const, only: &
431 eps0 => const_eps
434 implicit none
435
436 class(LocalMesh3D), intent(in) :: lcmesh
437 class(ElementBase3D), intent(in) :: elem
438 real(RP), intent(out) :: DDENS(elem%Np,lcmesh%NeA)
439 real(RP), intent(in) :: DENS_hyd(elem%Np,lcmesh%NeA)
440 real(RP), intent(in) :: PRES_hyd(elem%Np,lcmesh%NeA)
441 real(RP), intent(in) :: x(elem%Np,lcmesh%Ne)
442 real(RP), intent(in) :: y(elem%Np,lcmesh%Ne)
443 real(RP), intent(in) :: z(elem%Np,lcmesh%Ne)
444 real(RP), intent(in) :: POT(elem%Np,lcmesh%NeZ,lcmesh%NeX,lcmesh%NeY)
445 real(RP), intent(in) :: Rtot(elem%Np,lcmesh%NeZ,lcmesh%NeX,lcmesh%NeY)
446 real(RP), intent(in) :: CPtot_ov_CVtot(elem%Np,lcmesh%NeZ,lcmesh%NeX,lcmesh%NeY)
447 real(RP), intent(in), optional :: bnd_SFC_PRES(lcmesh%lcmesh2D%refElem2D%Np,lcmesh%Ne2DA)
448
449 integer :: ke, ke2D
450 integer :: ke_x, ke_y, ke_z
451 integer :: itr_lin
452 integer :: itr_nlin
453
454 real(RP), parameter :: EPS = 1.0e-12_rp
455
456 type(SparseMat) :: Dz, Lift
457
458 type(GMRES) :: gmres_hydro
459 real(RP), allocatable :: wj(:)
460 real(RP), allocatable :: pinv_v(:)
461 integer :: N, m
462 integer :: vmapM_z1D(elem%NfpTot,lcmesh%NeZ)
463 integer :: vmapP_z1D(elem%NfpTot,lcmesh%NeZ)
464 real(RP) :: VARS (elem%Np,lcmesh%NeZ)
465 real(RP) :: VARS0 (elem%Np,lcmesh%NeZ)
466 real(RP) :: VAR_DEL(elem%Np,lcmesh%NeZ)
467 real(RP) :: b(elem%Np,lcmesh%NeZ)
468 real(RP) :: Ax(elem%Np,lcmesh%NeZ)
469 real(RP) :: nz(elem%NfpTot,lcmesh%NeZ)
470 real(RP) :: DENS_hyd_z(elem%Np,lcmesh%NeZ)
471 real(RP) :: PRES_hyd_z(elem%Np,lcmesh%NeZ)
472 real(RP) :: PmatDlu(elem%Np,elem%Np,lcmesh%NeZ)
473 integer :: PmatDlu_ipiv(elem%Np,lcmesh%NeZ)
474 real(RP) :: PmatL(elem%Np,elem%Np,lcmesh%NeZ)
475 real(RP) :: PmatU(elem%Np,elem%Np,lcmesh%NeZ)
476 real(RP) :: GsqrtV_z(elem%Np,lcmesh%NeZ)
477
478 logical :: is_converged
479
480 real(RP) :: IntrpMat_VPOrdM1(elem%Np,elem%Np)
481
482 real(RP) :: bnd_SFC_PRES_tmp(lcmesh%lcmesh2D%refElem2D%Np,lcmesh%Ne2DA)
483 !-----------------------------------------------
484
485
486 if ( present(bnd_sfc_pres) ) then
487 !$omp parallel do
488 do ke2d=lcmesh%lcmesh2D%NeS, lcmesh%lcmesh2D%NeE
489 bnd_sfc_pres_tmp(:,ke2d) = bnd_sfc_pres(:,ke2d)
490 end do
491 else
492 !$omp parallel do
493 do ke2d=lcmesh%lcmesh2D%NeS, lcmesh%lcmesh2D%NeE
494 bnd_sfc_pres_tmp(:,ke2d) = pres_hyd(elem%Hslice(:,1),ke2d)
495 end do
496 end if
497
498 !--
499
500 n = elem%Np * lcmesh%NeZ
501 m = min(n / elem%Nnode_h1D**2, 30)
502! m = min(N / elem%Nnode_h1D**2, 256)
503
504 call gmres_hydro%Init( n, m, eps, eps0 )
505 allocate( wj(n), pinv_v(n) )
506
507 call dz%Init( elem%Dx3, storage_format='ELL' )
508 call lift%Init( elem%Lift, storage_format='ELL' )
509
510 call lcmesh%GetVmapZ1D( vmapm_z1d, vmapp_z1d ) ! (out)
511
512 call elementoperationgeneral_generate_vpordm1( intrpmat_vpordm1, & ! (out)
513 elem )
514
515 !-----------
516 do ke_y=1, lcmesh%NeY
517 do ke_x=1, lcmesh%NeX
518 ke2d = ke_x + (ke_y-1)*lcmesh%NeX
519 do ke_z=1, lcmesh%NeZ
520 ke = ke2d + (ke_z-1)*lcmesh%NeX*lcmesh%NeY
521 vars(:,ke_z) = 0.0_rp
522
523 vars0(:,ke_z) = vars(:,ke_z)
524 nz(:,ke_z) = lcmesh%normal_fn(:,ke,3)
525
526 dens_hyd_z(:,ke_z) = dens_hyd(:,ke)
527 pres_hyd_z(:,ke_z) = pres_hyd(:,ke)
528 gsqrtv_z(:,ke_z) = lcmesh%Gsqrt(:,ke) / lcmesh%GsqrtH(elem%IndexH2Dto3D(:),ke2d)
529 end do
530
531 do itr_nlin=1, 10
532
533 do ke_z=1, lcmesh%NeZ
534 var_del(:,ke_z) = 0.0_rp
535 end do
536
537 call eval_ax( ax(:,:), &
538 vars, vars0, pot(:,:,ke_x,ke_y), rtot(:,:,ke_x,ke_y), &
539 cptot_ov_cvtot(:,:,ke_x,ke_y), dens_hyd_z, pres_hyd_z, &
540 bnd_sfc_pres_tmp(:,ke2d), &
541 dz, lift, intrpmat_vpordm1, lcmesh, elem, &
542 nz, vmapm_z1d, vmapp_z1d, ke_x, ke_y )
543
544 do ke_z=1, lcmesh%NeZ
545 b(:,ke_z) = - ax(:,ke_z)
546 end do
547 if (lcmesh%tileID==1) then
548 if (itr_nlin > 1) then
549 log_progress(*) ke_x, ke_y, "itr_lin=", itr_lin
550 log_progress(*) "-------------------------------------"
551 end if
552 log_progress(*) ke_x, ke_y, "itr_nlin:", itr_nlin, 0, ": VAR", vars(elem%Colmask(:,1),1)
553 log_progress(*) ke_x, ke_y, "itr_nlin:", itr_nlin, 0, ": b", b(elem%Colmask(:,1),1)
554 if( io_l ) call flush(io_fid_log)
555 end if
556
557 if ( maxval(abs(b(:,:))) < 1.0e-10_rp ) exit
558
559 call construct_pmatinv( pmatdlu, pmatdlu_ipiv, pmatl, pmatu, & ! (out)
560 vars0, pot(:,:,ke_x,ke_y), rtot(:,:,ke_x,ke_y), & ! (in)
561 cptot_ov_cvtot(:,:,ke_x,ke_y), dens_hyd_z, pres_hyd_z, & ! (in)
562 dz, lift, intrpmat_vpordm1, gsqrtv_z, lcmesh, elem, & ! (in)
563 nz, vmapm_z1d, vmapp_z1d, ke_x, ke_y )
564
565 do itr_lin=1, 2*int(n/m)
566 !
567 call gmres_hydro_core( gmres_hydro, var_del, wj, is_converged, & ! (out)
568 vars, b, n, m, & ! (in)
569 pmatdlu, pmatdlu_ipiv, pmatl, pmatu, pinv_v, & ! (in)
570 pot(:,:,ke_x,ke_y), rtot(:,:,ke_x,ke_y), & ! (in)
571 cptot_ov_cvtot(:,:,ke_x,ke_y), dens_hyd_z, pres_hyd_z, & ! (in)
572 dz, lift, intrpmat_vpordm1, lcmesh, elem, & ! (in)
573 nz, vmapm_z1d, vmapp_z1d, ke_x, ke_y )
574
575 ! LOG_PROGRESS(*) ke_x, ke_y, "itr_lin:", itr_lin, ": VAR_DEL", VAR_DEL(elem%Colmask(:,1),1)
576 ! if( IO_L ) call flush(IO_FID_LOG)
577 if (is_converged) exit
578 end do ! itr_lin
579 do ke_z=1, lcmesh%NeZ
580 vars(:,ke_z) = vars(:,ke_z) + var_del(:,ke_z)
581 vars0(:,ke_z) = vars(:,ke_z)
582 end do
583 end do ! itr_nlin
584
585 do ke_z=1, lcmesh%NeZ
586 ke = ke_x + (ke_y-1)*lcmesh%NeX + (ke_z-1)*lcmesh%NeX*lcmesh%NeY
587 ddens(:,ke) = vars(:,ke_z)
588 end do
589 end do
590 end do
591
592 !
593 call gmres_hydro%Final()
594 call dz%Final()
595 call lift%Final()
596
597 return
module FElib / Element / Operation with arbitary elements

References get_pmatd_lu(), and scale_linalgebra::linalgebra_lu().


The documentation for this interface was generated from the following file: