V3FIT
bhtobf.f90
1 !*******************************************************************************
4 !
5 ! Note separating the Doxygen comment block here so detailed decription is
6 ! found in the Module not the file.
7 !
9 !*******************************************************************************
10  MODULE bhtobf
11 
12  IMPLICIT NONE
13 
14  CONTAINS
15 
16 !*******************************************************************************
17 ! UTILITY SUBROUTINES
18 !*******************************************************************************
19 !-------------------------------------------------------------------------------
33 !-------------------------------------------------------------------------------
34  SUBROUTINE bhalftobfull(bsupsijh, bsupuijh, bsupvijh, &
35  bsupsijf, bsupuijf, bsupvijf, &
36  pijh, pijf)
37  USE stel_kinds
38  USE v3_utilities, ONLY: assert_eq
39  USE quantities, ONLY: ns, jacobf, jacobh
40  USE timer_mod
41  USE utilities, ONLY: to_full_mesh
42  USE siesta_namelist, ONLY: l_vessel
43 
44  IMPLICIT NONE
45 
46 ! Declare Arguments
47  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: bsupsijh
48  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: bsupuijh
49  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: bsupvijh
50  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: bsupsijf
51  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: bsupuijf
52  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: bsupvijf
53  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: pijh
54  REAL (dp), DIMENSION(:,:,:), ALLOCATABLE, INTENT(inout) :: pijf
55 
56 ! local variables
57  INTEGER :: nsmin
58  INTEGER :: nsmax
59 
60 ! Start of executable code
61  nsmin = lbound(bsupsijh,3)
62  nsmax = ubound(bsupsijh,3)
63 
64  CALL to_full_mesh(bsupsijh, bsupsijf)
65  IF (nsmin .EQ. 1) THEN
66  bsupsijf(:,:,1) = bsupsijh(:,:,1)
67  END IF
68  bsupsijf = bsupsijf/jacobf(:,:,nsmin:nsmax)
69  bsupsijh = bsupsijh/jacobh(:,:,nsmin:nsmax)
70 
71  CALL to_full_mesh(bsupuijh, bsupuijf)
72  IF (nsmin .EQ. 1) THEN
73  bsupuijf(:,:,1) = bsupuijh(:,:,1)
74  END IF
75  bsupuijf = bsupuijf/jacobf(:,:,nsmin:nsmax)
76  bsupuijh = bsupuijh/jacobh(:,:,nsmin:nsmax)
77 
78  CALL to_full_mesh(bsupvijh, bsupvijf)
79  IF (nsmin .EQ. 1) THEN
80  bsupvijf(:,:,1) = bsupvijh(:,:,1)
81  END IF
82  bsupvijf = bsupvijf/jacobf(:,:,nsmin:nsmax)
83  bsupvijh = bsupvijh/jacobh(:,:,nsmin:nsmax)
84 
85  CALL assert_eq(SIZE(bsupsijh,3), SIZE(pijh,3), 'bhtobf pijh SIZE WRONG')
86  CALL to_full_mesh(pijh, pijf)
87  IF (nsmin .EQ. 1) THEN
88  pijf(:,:,1) = pijh(:,:,1)
89  END IF
90  pijf = pijf/jacobf(:,:,nsmin:nsmax)
91  pijh = pijh/jacobh(:,:,nsmin:nsmax)
92 
93  IF (nsmax .eq. ns .and. .not.l_vessel) THEN
94  bsupsijf(:,:,ns) = 0
95  END IF
96 
97  END SUBROUTINE
98 
99  END MODULE
siesta_namelist::l_vessel
logical l_vessel
If extended grid is to be used using an available vessel file.
Definition: siesta_namelist.f90:140
quantities
This file contains subroutines for allocating and initializing curvilinear magnetic covariant and pre...
Definition: quantities.f90:11
v3_utilities::assert_eq
Definition: v3_utilities.f:62
siesta_namelist
This file contains all the variables and maximum sizes of the inputs for a SIESTA namelist input file...
Definition: siesta_namelist.f90:103