Changeset 913 for codes/icosagcm/devel/src/diagnostics/compute_pression.F90
- Timestamp:
- 06/17/19 17:38:58 (5 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/src/diagnostics/compute_pression.F90
r905 r913 1 MODULE pression_mod 1 MODULE compute_pression_mod 2 USE compute_diagnostics_mod 3 USE icosa 4 USE omp_para 5 USE disvert_mod, ONLY : ap, bp, ap_bp_present 6 IMPLICIT NONE 7 PRIVATE 8 9 #include "../unstructured/unstructured.h90" 10 11 PUBLIC :: pression, compute_pression_hex, compute_pression_unst, & 12 pression_mid, compute_pression_mid_hex, compute_pression_mid_unst 2 13 3 14 CONTAINS 4 15 16 #ifdef BEGIN_DYSL 17 18 {%- macro compute_pression(llmax)%} 19 {%- set inner_loop=caller() %} 20 {%- set llmax="'%s'"%llmax %} 21 IF(ap_bp_present) THEN 22 IF(offset>0) THEN 23 FORALL_CELLS_EXT('1',{{ llmax }}) 24 ON_PRIMAL 25 {{ inner_loop }} 26 END_BLOCK 27 END_BLOCK 28 ELSE 29 FORALL_CELLS('1',{{ llmax }}) 30 ON_PRIMAL 31 {{ inner_loop }} 32 END_BLOCK 33 END_BLOCK 34 END IF 35 END IF 36 {%- endmacro %} 37 38 KERNEL(compute_pression) 39 {% call compute_pression('llm+1') %} 40 p(CELL) = AP(CELL) + BP(CELL) * ps(HIDX(CELL)) 41 {% endcall %} 42 END_BLOCK 43 44 KERNEL(compute_pmid) 45 {% call compute_pression('llm') %} 46 pmid(CELL) = .5*(AP(CELL)+AP(UP(CELL)) + (BP(CELL)+BP(UP(CELL))) * ps(HIDX(CELL)) ) 47 {% endcall %} 48 END_BLOCK 49 50 #endif END_DYSL 51 5 52 SUBROUTINE pression(f_ps,f_p) 6 USE icosa7 IMPLICIT NONE8 53 TYPE(t_field), POINTER :: f_ps(:) 9 54 TYPE(t_field), POINTER :: f_p(:) … … 27 72 28 73 SUBROUTINE pression_mid(f_ps,f_pmid) 29 USE icosa30 IMPLICIT NONE31 74 TYPE(t_field), POINTER :: f_ps(:) 32 75 TYPE(t_field), POINTER :: f_pmid(:) … … 49 92 END SUBROUTINE pression_mid 50 93 51 SUBROUTINE compute_pression(ps,p,offset) 52 USE icosa 53 USE disvert_mod 54 USE omp_para 55 IMPLICIT NONE 94 !------------- hexagonal-mesh compute kernels -------- 95 96 #define AP(ij,l) ap(l) 97 #define BP(ij,l) bp(l) 98 99 SUBROUTINE compute_pression_hex(ps,p,offset) 56 100 REAL(rstd),INTENT(IN) :: ps(iim*jjm) 57 101 REAL(rstd),INTENT(OUT) :: p(iim*jjm,llm+1) 58 102 INTEGER,INTENT(IN) :: offset 59 INTEGER :: i,j,ij,l 60 61 IF(ap_bp_present) THEN 62 DO l = ll_begin, ll_endp1 63 ! DO l = 1, llm + 1 64 DO j=jj_begin-offset,jj_end+offset 65 DO i=ii_begin-offset,ii_end+offset 66 ij=(j-1)*iim+i 67 p(ij,l) = ap(l) + bp(l) * ps(ij) 68 ENDDO 69 ENDDO 70 ENDDO 71 END IF 72 73 END SUBROUTINE compute_pression 103 INTEGER :: ij,l 104 #include "../kernels_hex/compute_pression.k90" 105 END SUBROUTINE compute_pression_hex 74 106 75 SUBROUTINE compute_pression_mid(ps,pmid,offset) 76 USE icosa 77 USE disvert_mod 78 USE omp_para 79 IMPLICIT NONE 107 SUBROUTINE compute_pression_mid_hex(ps,pmid,offset) 80 108 REAL(rstd),INTENT(IN) :: ps(iim*jjm) 81 109 REAL(rstd),INTENT(OUT) :: pmid(iim*jjm,llm) 82 110 INTEGER,INTENT(IN) :: offset 83 INTEGER :: i,j,ij,l 111 INTEGER :: ij,l 112 #include "../kernels_hex/compute_pmid.k90" 113 END SUBROUTINE compute_pression_mid_hex 84 114 85 IF(ap_bp_present) THEN 86 DO l = ll_begin, ll_end 87 DO j=jj_begin-offset,jj_end+offset 88 DO i=ii_begin-offset,ii_end+offset 89 ij=(j-1)*iim+i 90 pmid(ij,l) = 0.5*(ap(l)+ap(l+1) + (bp(l)+bp(l+1)) * ps(ij)) 91 ENDDO 92 ENDDO 93 ENDDO 94 END IF 115 #undef AP 116 #undef BP 95 117 96 END SUBROUTINE compute_pression_mid 118 !----------- unstructured-mesh compute kernels -------- 97 119 98 END MODULE pression_mod 120 #define AP(l,ij) ap(l) 121 #define BP(l,ij) bp(l) 122 123 SUBROUTINE compute_pression_unst(ps, p, offset) 124 FIELD_PS, INTENT(IN) :: ps 125 FIELD_GEOPOT, INTENT(OUT) :: p 126 INTEGER, INTENT(IN) :: offset 127 DECLARE_INDICES 128 #include "../kernels_unst/compute_pression.k90" 129 END SUBROUTINE compute_pression_unst 130 131 SUBROUTINE compute_pression_mid_unst(ps, pmid, offset) 132 FIELD_PS, INTENT(IN) :: ps 133 FIELD_MASS, INTENT(OUT) :: pmid 134 INTEGER, INTENT(IN) :: offset 135 DECLARE_INDICES 136 #include "../kernels_unst/compute_pmid.k90" 137 END SUBROUTINE compute_pression_mid_unst 138 139 #undef AP 140 #undef BP 141 142 END MODULE compute_pression_mod
Note: See TracChangeset
for help on using the changeset viewer.