1 | MODULE compute_divergence_mod |
---|
2 | USE grid_param |
---|
3 | USE prec, ONLY : rstd |
---|
4 | IMPLICIT NONE |
---|
5 | PRIVATE |
---|
6 | |
---|
7 | #include "../unstructured/unstructured.h90" |
---|
8 | |
---|
9 | PUBLIC :: divergence, compute_divergence_hex, compute_divergence_unst |
---|
10 | |
---|
11 | CONTAINS |
---|
12 | |
---|
13 | #ifdef BEGIN_DYSL |
---|
14 | |
---|
15 | KERNEL(compute_divergence) |
---|
16 | |
---|
17 | FORALL_CELLS_EXT() |
---|
18 | ON_PRIMAL |
---|
19 | div_ij = 0.d0 |
---|
20 | FORALL_EDGES |
---|
21 | div_ij = div_ij + SIGN*ue(EDGE)*LE |
---|
22 | END_BLOCK |
---|
23 | div(CELL) = div_ij / AI |
---|
24 | END_BLOCK |
---|
25 | END_BLOCK |
---|
26 | |
---|
27 | END_BLOCK |
---|
28 | |
---|
29 | #endif END_DYSL |
---|
30 | |
---|
31 | SUBROUTINE divergence(f_ue,f_div) |
---|
32 | USE icosa |
---|
33 | USE compute_diagnostics_mod, ONLY : compute_divergence |
---|
34 | TYPE(t_field), POINTER :: f_ue(:) |
---|
35 | TYPE(t_field), POINTER :: f_div(:) |
---|
36 | |
---|
37 | REAL(rstd), POINTER :: ue(:,:) |
---|
38 | REAL(rstd), POINTER :: div(:,:) |
---|
39 | INTEGER :: ind |
---|
40 | |
---|
41 | CALL transfert_request(f_ue,req_e1_vect) |
---|
42 | |
---|
43 | DO ind=1,ndomain |
---|
44 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
45 | CALL swap_dimensions(ind) |
---|
46 | CALL swap_geometry(ind) |
---|
47 | ue=f_ue(ind) |
---|
48 | div=f_div(ind) |
---|
49 | CALL compute_divergence(ue, div) |
---|
50 | ENDDO |
---|
51 | |
---|
52 | END SUBROUTINE divergence |
---|
53 | |
---|
54 | !-------------- Wrappers for F2008 conformity ----------------- |
---|
55 | |
---|
56 | SUBROUTINE compute_divergence_unst(ue,div) |
---|
57 | REAL(rstd),INTENT(IN) :: ue(:,:) |
---|
58 | REAL(rstd),INTENT(OUT) :: div(:,:) |
---|
59 | CALL compute_divergence_unst_(ue,div) |
---|
60 | END SUBROUTINE compute_divergence_unst |
---|
61 | |
---|
62 | SUBROUTINE compute_divergence_hex(ue,div) |
---|
63 | REAL(rstd),INTENT(IN) :: ue(:,:) |
---|
64 | REAL(rstd),INTENT(OUT) :: div(:,:) |
---|
65 | CALL compute_divergence_hex_(ue,div) |
---|
66 | END SUBROUTINE compute_divergence_hex |
---|
67 | |
---|
68 | !-------------------------------------------------------------- |
---|
69 | |
---|
70 | SUBROUTINE compute_divergence_unst_(ue,div) |
---|
71 | USE ISO_C_BINDING, only : C_DOUBLE, C_FLOAT |
---|
72 | USE geometry, ONLY : le, Ai |
---|
73 | USE data_unstructured_mod, ONLY : primal_deg, primal_edge, primal_ne |
---|
74 | FIELD_U :: ue |
---|
75 | FIELD_MASS :: div |
---|
76 | DECLARE_INDICES |
---|
77 | DECLARE_EDGES |
---|
78 | DECLARE_VERTICES |
---|
79 | NUM :: div_ij |
---|
80 | #include "../kernels_unst/compute_divergence.k90" |
---|
81 | END SUBROUTINE compute_divergence_unst_ |
---|
82 | |
---|
83 | SUBROUTINE compute_divergence_hex_(ue,div) |
---|
84 | USE icosa |
---|
85 | USE omp_para |
---|
86 | REAL(rstd),INTENT(IN) :: ue(3*iim*jjm,llm) |
---|
87 | REAL(rstd),INTENT(OUT) :: div(iim*jjm,llm) |
---|
88 | REAL(rstd) :: div_ij |
---|
89 | INTEGER :: ij,l |
---|
90 | |
---|
91 | #include "../kernels_hex/compute_divergence.k90" |
---|
92 | END SUBROUTINE compute_divergence_hex_ |
---|
93 | |
---|
94 | END MODULE compute_divergence_mod |
---|