-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathloca_interface_i.f90
197 lines (155 loc) · 7.55 KB
/
loca_interface_i.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
! -----------------------------------------------------------------------------
! LOCA 1.0: Library of Continuation Algorithms
MODULE Loca_interface_i
!******************************************************************************
!******************************************************************************
!******************************************************************************
USE Loca_types ! definition of all the types of variables needed
USE Loca_pd ! declaration of the passdown structure 'pd'
USE Loca_lib ! con_lib
USE Loca_interface_o ! cvarsparser, print_con_struct, print_final
IMPLICIT NONE
CONTAINS
!=======
!
! SUBROUTINE do_loca(pd)
! FUNCTION continuation_hook(x, delta_x, con, reltol, abstol) RESULT (output)
!******************************************************************************
!******************************************************************************
!******************************************************************************
SUBROUTINE do_loca(pd)
!
!*************************************
! edit: removed con_struct from input,
! use the passdown_struct in its
! place and read con in cvarsparser
!*************************************
IMPLICIT NONE
! input variable
TYPE(passdown_struct) :: pd
! local variables
TYPE(con_struct) :: con
INTEGER :: nstep
WRITE(*,*) ''
WRITE(*,*) '+++++++++++++++++++++++++++++++++++++'
WRITE(*,*) ' --> CALL to do_loca'
WRITE(*,*) ''
! read input file
!
CALL cvarsparser(con, pd, "loca_data.in")
! Assign problem information coming through argument list to elements
! of the passdown structure. This makes them global to the file and
! can be accessed below in the conwrap routines.
!
!pd%matrix_save = FALSE
! Fill all the necessary information into the 'con' structure
! for running the continuation routines.
! First load the general info structure
!
! con%general_info%method = con_input%general_info%method
! con%general_info%param = con_input%general_info%param
! con%general_info%x = con_input%general_info%x
! con%general_info%numUnks = con_input%general_info% numUnks
! con%general_info%numOwnedUnks = con_input%general_info%numOwnedUnks
! con%general_info%printproc = con_input%general_info%printproc
con%general_info%nv_restart = FALSE
con%general_info%nv_save = FALSE
con%general_info%perturb = 1.0d-6
! Then load the stepping info structure
!
! con%stepping_info%first_step = con_input%stepping_info%first_step
con%stepping_info%base_step = 0
! con%stepping_info%max_steps = con_input%stepping_info%max_steps
! con%stepping_info%max_param = con_input%stepping_info%max_param
! con%stepping_info%max_delta_p = con_input%stepping_info%max_delta_p
! con%stepping_info%step_ctrl = con_input%stepping_info%step_ctrl
! con%stepping_info%max_newton_its = con_input%stepping_info%max_newton_its
! Then load one of the method dependent structures
!
SELECT CASE (con%general_info%method)
CASE(ZERO_ORDER_CONTINUATION)
CASE (FIRST_ORDER_CONTINUATION)
CASE (ARC_LENGTH_CONTINUATION)
! pd%matrix_save = FALSE
! con%arclength_info%dp_ds2_goal = con_input%arclength_info%dp_ds2_goal
! con%arclength_info%dp_ds_max = con_input%arclength_info%dp_ds_max
! con%arclength_info%tang_exp = con_input%arclength_info%tang_exp
! con%arclength_info%tang_step_limit = con_input%arclength_info%tang_step_limit
CASE (TURNING_POINT_CONTINUATION)
! con%turning_point_info%bif_param = con_input%turning_point_info%bif_param
NULLIFY(con%turning_point_info%nv)
CASE (PITCHFORK_CONTINUATION)
! con%pitchfork_info%bif_param = con_input%pitchfork_info%bif_param
! con%pitchfork_info%psi = con_input%pitchfork_info%psi
CASE (HOPF_CONTINUATION)
! pd%matrix_save = FALSE
! con%hopf_info%bif_param = con_input%hopf_info%bif_param
! con%hopf_info%omega = con_input%hopf_info%omega
! con%hopf_info%y_vec = con_input%hopf_info%y_vec
! con%hopf_info%z_vec = con_input%hopf_info%z_vec
! con%hopf_info%mass_flag = con_input%hopf_info%mass_flag
CASE (HOPF_BETA_CONTINUATION)
! pd%matrix_save = FALSE
! con%hopf_info%bif_param = con_input%hopf_info%bif_param
! con%hopf_info%omega = con_input%hopf_info%omega
! con%hopf_info%y_vec = con_input%hopf_info%y_vec
! con%hopf_info%z_vec = con_input%hopf_info%z_vec
! con%hopf_info%mass_flag = con_input%hopf_info%mass_flag
CASE (MANIFOLD_CONTINUATION)
WRITE(*,*) 'manifold continuation not yet implemented'
con%manifold_info%k = 2 ! number of parameters
NULLIFY(con%manifold_info%param_vec) ! vec of length k
NULLIFY(con%manifold_info%param_lower_bounds) ! vec of length k
NULLIFY(con%manifold_info%param_upper_bounds) ! vec of length k
NULLIFY(con%manifold_info%param_steps) ! vec of length k
CASE (PHASE_TRANSITION_CONTINUATION)
WRITE(*,*) 'phase transition continuation not yet implemented'
! con%phase_transition_info%bif_param = con_input%phase_transition_info%bif_param
! con%phase_transition_info%x2 = con_input%phase_transition_info%x2
CASE DEFAULT
WRITE(*,*) 'ERROR: Unknown LOCA input method: ', con%general_info%method
STOP ! FixMe change with MPI_ABORT?
END SELECT
! Finally, load the eigensolver structures
!
! con%eigen_info%Num_Eigenvalues = con_input%eigen_info%Num_Eigenvalues
! This is a temporary default:
con%eigen_info%Num_Eigenvectors = con%eigen_info%Num_Eigenvalues
con%eigen_info%sort = TRUE
! con%eigen_info%Shift_Point(0) = con_input%eigen_info%Shift_Point(0)
! con%eigen_info%Shift_Point(1) = con_input%eigen_info%Shift_Point(1)
! con%eigen_info%Shift_Point(2) = con_input%eigen_info%Shift_Point(2)
! con%eigen_info%Arnoldi = con_input%eigen_info%Arnoldi
! con%eigen_info%Residual_Tol(0) = con_input%eigen_info%Residual_Tol(0)
! con%eigen_info%Residual_Tol(1) = con_input%eigen_info%Residual_Tol(1)
! con%eigen_info%Max_Iter = con_input%eigen_info%Max_Iter
! con%eigen_info%Every_n_Steps = con_input%eigen_info%Every_n_Steps
! print out continuation structure
!
CALL print_con_struct(con)
! CALL LOCA, now that all information is set
!
nstep = con_lib(con)
! Final printing and cleanup here
!
IF (con%general_info%printproc == TRUE) THEN
CALL print_final(con%general_info%param, nstep)
! CALL print_final(con%general_info%param, nstep, pd%num_mat_fills, &
! pd%num_res_fills, pd%num_linear_its)
END IF
SELECT CASE(con%general_info%method)
CASE(PITCHFORK_CONTINUATION)
DEALLOCATE(con%pitchfork_info%psi)
CASE(HOPF_CONTINUATION)
DEALLOCATE(con%hopf_info%y_vec)
DEALLOCATE(con%hopf_info%z_vec)
CASE(HOPF_BETA_CONTINUATION)
DEALLOCATE(con%hopf_info%y_vec)
DEALLOCATE(con%hopf_info%z_vec)
END SELECT
! DEALLOCATE(con)
END SUBROUTINE do_loca
!******************************************************************************
!******************************************************************************
!******************************************************************************
END MODULE Loca_interface_i