1 | MODULE compute_vorticity_mod |
---|
2 | USE grid_param |
---|
3 | USE prec, ONLY : rstd |
---|
4 | IMPLICIT NONE |
---|
5 | PRIVATE |
---|
6 | |
---|
7 | #include "../unstructured/unstructured.h90" |
---|
8 | |
---|
9 | PUBLIC :: vorticity, compute_vorticity_manual, compute_vorticity_hex, compute_vorticity_unst |
---|
10 | |
---|
11 | CONTAINS |
---|
12 | |
---|
13 | #ifdef BEGIN_DYSL |
---|
14 | |
---|
15 | KERNEL(compute_vorticity) |
---|
16 | |
---|
17 | FORALL_CELLS_EXT() |
---|
18 | ON_DUAL |
---|
19 | etav = 0.d0 |
---|
20 | FORALL_EDGES |
---|
21 | etav = etav + SIGN*ue(EDGE)*DE |
---|
22 | END_BLOCK |
---|
23 | vort(DUAL_CELL) = etav / AV |
---|
24 | END_BLOCK |
---|
25 | |
---|
26 | END_BLOCK |
---|
27 | |
---|
28 | END_BLOCK |
---|
29 | |
---|
30 | #endif END_DYSL |
---|
31 | |
---|
32 | SUBROUTINE vorticity(f_ue,f_vort) |
---|
33 | USE icosa |
---|
34 | USE compute_diagnostics_mod, ONLY : compute_vorticity |
---|
35 | TYPE(t_field), POINTER :: f_ue(:) |
---|
36 | TYPE(t_field), POINTER :: f_vort(:) |
---|
37 | |
---|
38 | REAL(rstd), POINTER :: ue(:,:) |
---|
39 | REAL(rstd), POINTER :: vort(:,:) |
---|
40 | INTEGER :: ind |
---|
41 | |
---|
42 | CALL transfert_request(f_ue,req_e1_vect) |
---|
43 | |
---|
44 | DO ind=1,ndomain |
---|
45 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
46 | CALL swap_dimensions(ind) |
---|
47 | CALL swap_geometry(ind) |
---|
48 | ue=f_ue(ind) |
---|
49 | vort=f_vort(ind) |
---|
50 | CALL compute_vorticity(ue, vort) |
---|
51 | ENDDO |
---|
52 | |
---|
53 | END SUBROUTINE vorticity |
---|
54 | |
---|
55 | !-------------- Wrappers for F2008 conformity ----------------- |
---|
56 | |
---|
57 | SUBROUTINE compute_vorticity_unst(ue,vort) |
---|
58 | REAL(rstd),INTENT(IN) :: ue(:,:) |
---|
59 | REAL(rstd),INTENT(OUT) :: vort(:,:) |
---|
60 | CALL compute_vorticity_unst_(ue,vort) |
---|
61 | END SUBROUTINE compute_vorticity_unst |
---|
62 | |
---|
63 | SUBROUTINE compute_vorticity_hex(ue,vort) |
---|
64 | REAL(rstd),INTENT(IN) :: ue(:,:) |
---|
65 | REAL(rstd),INTENT(OUT) :: vort(:,:) |
---|
66 | CALL compute_vorticity_hex_(ue,vort) |
---|
67 | END SUBROUTINE compute_vorticity_hex |
---|
68 | |
---|
69 | !-------------------------------------------------------------- |
---|
70 | |
---|
71 | SUBROUTINE compute_vorticity_unst_(ue,vort) |
---|
72 | USE ISO_C_BINDING, only : C_DOUBLE, C_FLOAT |
---|
73 | USE geometry, ONLY : de, Av |
---|
74 | USE data_unstructured_mod, ONLY : dual_deg, dual_edge, dual_ne |
---|
75 | FIELD_U :: ue |
---|
76 | FIELD_Z :: vort |
---|
77 | DECLARE_INDICES |
---|
78 | DECLARE_EDGES |
---|
79 | DECLARE_VERTICES |
---|
80 | NUM :: etav |
---|
81 | #include "../kernels_unst/compute_vorticity.k90" |
---|
82 | END SUBROUTINE compute_vorticity_unst_ |
---|
83 | |
---|
84 | SUBROUTINE compute_vorticity_hex_(ue,vort) |
---|
85 | USE icosa |
---|
86 | USE omp_para |
---|
87 | REAL(rstd),INTENT(IN) :: ue(3*iim*jjm,llm) |
---|
88 | REAL(rstd),INTENT(OUT) :: vort(2*iim*jjm,llm) |
---|
89 | REAL(rstd) :: etav |
---|
90 | INTEGER :: ij,l |
---|
91 | |
---|
92 | #include "../kernels_hex/compute_vorticity.k90" |
---|
93 | END SUBROUTINE compute_vorticity_hex_ |
---|
94 | |
---|
95 | SUBROUTINE compute_vorticity_manual(ue,vort) |
---|
96 | USE icosa |
---|
97 | USE disvert_mod |
---|
98 | USE omp_para |
---|
99 | IMPLICIT NONE |
---|
100 | REAL(rstd),INTENT(IN) :: ue(3*iim*jjm,llm) |
---|
101 | REAL(rstd),INTENT(OUT) :: vort(2*iim*jjm,llm) |
---|
102 | INTEGER :: i,j,ij,l |
---|
103 | |
---|
104 | DO l = ll_begin,ll_end |
---|
105 | DO j=jj_begin-1,jj_end+1 |
---|
106 | DO i=ii_begin-1,ii_end+1 |
---|
107 | ij=(j-1)*iim+i |
---|
108 | |
---|
109 | vort(ij+z_up,l) = 1./Av(ij+z_up)*( ne(ij,rup) * ue(ij+u_rup,l) * de(ij+u_rup) & |
---|
110 | + ne(ij+t_rup,left) * ue(ij+t_rup+u_left,l) * de(ij+t_rup+u_left) & |
---|
111 | - ne(ij,lup) * ue(ij+u_lup,l) * de(ij+u_lup) ) |
---|
112 | |
---|
113 | vort(ij+z_down,l) = 1./Av(ij+z_down)*( ne(ij,ldown) * ue(ij+u_ldown,l) * de(ij+u_ldown) & |
---|
114 | + ne(ij+t_ldown,right) * ue(ij+t_ldown+u_right,l) * de(ij+t_ldown+u_right) & |
---|
115 | - ne(ij,rdown) * ue(ij+u_rdown,l) * de(ij+u_rdown) ) |
---|
116 | |
---|
117 | ENDDO |
---|
118 | ENDDO |
---|
119 | ENDDO |
---|
120 | |
---|
121 | END SUBROUTINE compute_vorticity_manual |
---|
122 | |
---|
123 | END MODULE compute_vorticity_mod |
---|