SFEMaNS  version 4.1 (work in progress)
Reference documentation for SFEMaNS
 All Classes Files Functions Variables Groups Pages
condlim_test_5.f90
Go to the documentation of this file.
2  USE my_util
3  USE def_type_mesh
4  USE input_data
5 !!$ATTENTION
6 !!$Some subroutines have been commented to avoid warning messages when compiling executable.
7 !!$It can not be done in the module boundary_generic that expects all subroutines to be present.
8 !!$END ATTENTION
9 !!$ PUBLIC :: init_velocity_pressure
10 !!$ PUBLIC :: init_temperature
11 !!$ PUBLIC :: init_level_set
12 !!$ PUBLIC :: source_in_NS_momentum
13 !!$ PUBLIC :: source_in_temperature
14 !!$ PUBLIC :: source_in_level_set
15 !!$ PUBLIC :: vv_exact
16 !!$ PUBLIC :: imposed_velocity_by_penalty
17 !!$ PUBLIC :: pp_exact
18 !!$ PUBLIC :: temperature_exact
19 !!$ PUBLIC :: level_set_exact
20 !!$ PUBLIC :: penal_in_real_space
21 !!$ PUBLIC :: extension_velocity
22  PUBLIC :: vexact
23 !!$ PUBLIC :: H_B_quasi_static
24  PUBLIC :: hexact
25  PUBLIC :: phiexact
26  PUBLIC :: jexact_gauss
27  PUBLIC :: eexact_gauss
28  PUBLIC :: init_maxwell
29 !!$ PUBLIC :: mu_bar_in_fourier_space
30 !!$ PUBLIC :: grad_mu_bar_in_fourier_space
31 !!$ PUBLIC :: mu_in_real_space
32  PRIVATE
33 
34  REAL (KIND=8), PRIVATE :: alpha=1.d0, beta=1.d0
35 
36 CONTAINS
37  !===============================================================================
38  ! Boundary conditions for Navier-Stokes
39  !===============================================================================
40 
41 !!$ !===Initialize velocity, pressure
42 !!$ SUBROUTINE init_velocity_pressure(mesh_f, mesh_c, time, dt, list_mode, &
43 !!$ un_m1, un, pn_m1, pn, phin_m1, phin)
44 !!$ IMPLICIT NONE
45 !!$ TYPE(mesh_type) :: mesh_f, mesh_c
46 !!$ REAL(KIND=8), INTENT(OUT):: time
47 !!$ REAL(KIND=8), INTENT(IN) :: dt
48 !!$ INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
49 !!$ REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: un_m1, un
50 !!$ REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: pn_m1, pn, phin_m1, phin
51 !!$ INTEGER :: mode, i, j
52 !!$ REAL(KIND=8), DIMENSION(mesh_c%np) :: pn_m2
53 !!$
54 !!$ time = 0.d0
55 !!$ DO i= 1, SIZE(list_mode)
56 !!$ mode = list_mode(i)
57 !!$ DO j = 1, 6
58 !!$ !===velocity
59 !!$ un_m1(:,j,i) = vv_exact(j,mesh_f%rr,mode,time-dt)
60 !!$ un (:,j,i) = vv_exact(j,mesh_f%rr,mode,time)
61 !!$ END DO
62 !!$ DO j = 1, 2
63 !!$ !===pressure
64 !!$ pn_m2(:) = pp_exact(j,mesh_c%rr,mode,time-2*dt)
65 !!$ pn_m1 (:,j,i) = pp_exact(j,mesh_c%rr,mode,time-dt)
66 !!$ pn (:,j,i) = pp_exact(j,mesh_c%rr,mode,time)
67 !!$ phin_m1(:,j,i) = pn_m1(:,j,i) - pn_m2(:)
68 !!$ phin (:,j,i) = Pn (:,j,i) - pn_m1(:,j,i)
69 !!$ ENDDO
70 !!$ ENDDO
71 !!$ END SUBROUTINE init_velocity_pressure
72 
73 !!$ !===Initialize temperature
74 !!$ SUBROUTINE init_temperature(mesh, time, dt, list_mode, tempn_m1, tempn)
75 !!$ IMPLICIT NONE
76 !!$ TYPE(mesh_type) :: mesh
77 !!$ REAL(KIND=8), INTENT(OUT):: time
78 !!$ REAL(KIND=8), INTENT(IN) :: dt
79 !!$ INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
80 !!$ REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: tempn_m1, tempn
81 !!$ INTEGER :: mode, i, j
82 !!$
83 !!$ time = 0.d0
84 !!$ DO i= 1, SIZE(list_mode)
85 !!$ mode = list_mode(i)
86 !!$ DO j = 1, 2
87 !!$ tempn_m1(:,j,i) = temperature_exact(j, mesh%rr, mode, time-dt)
88 !!$ tempn (:,j,i) = temperature_exact(j, mesh%rr, mode, time)
89 !!$ ENDDO
90 !!$ ENDDO
91 !!$ END SUBROUTINE init_temperature
92 
93 !!$ !===Initialize level_set
94 !!$ SUBROUTINE init_level_set(vv_mesh, time, &
95 !!$ dt, list_mode, level_set_m1, level_set)
96 !!$ IMPLICIT NONE
97 !!$ TYPE(mesh_type) :: vv_mesh
98 !!$ REAL(KIND=8), INTENT(OUT):: time
99 !!$ REAL(KIND=8), INTENT(IN) :: dt
100 !!$ INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
101 !!$ REAL(KIND=8), DIMENSION(:,:,:,:), INTENT(OUT):: level_set, level_set_m1
102 !!$ INTEGER :: mode, i, j, n
103 !!$
104 !!$ time = 0.d0
105 !!$ DO i= 1, SIZE(list_mode)
106 !!$ mode = list_mode(i)
107 !!$ DO j = 1, 2
108 !!$ !===level_set
109 !!$ DO n = 1, inputs%nb_fluid -1
110 !!$ level_set_m1(n,:,j,i) = level_set_exact(n,j,vv_mesh%rr,mode,time-dt)
111 !!$ level_set (n,:,j,i) = level_set_exact(n,j,vv_mesh%rr,mode,time)
112 !!$ END DO
113 !!$ END DO
114 !!$ END DO
115 !!$
116 !!$ END SUBROUTINE init_level_set
117 
118 !!$ !===Source in momemtum equation. Always called.
119 !!$ FUNCTION source_in_NS_momentum(TYPE, rr, mode, i, time, Re, ty, opt_density, opt_tempn) RESULT(vv)
120 !!$ IMPLICIT NONE
121 !!$ INTEGER , INTENT(IN) :: TYPE
122 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
123 !!$ INTEGER , INTENT(IN) :: mode, i
124 !!$ REAL(KIND=8), INTENT(IN) :: time
125 !!$ REAL(KIND=8), INTENT(IN) :: Re
126 !!$ CHARACTER(LEN=2), INTENT(IN) :: ty
127 !!$ REAL(KIND=8), DIMENSION(:,:,:), OPTIONAL, INTENT(IN) :: opt_density
128 !!$ REAL(KIND=8), DIMENSION(:,:,:), OPTIONAL, INTENT(IN) :: opt_tempn
129 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
130 !!$
131 !!$ vv = 0.d0
132 !!$ CALL error_petsc('source_in_NS_momentum: should not be called for this test')
133 !!$ RETURN
134 !!$ END FUNCTION source_in_NS_momentum
135 
136 !!$ !===Extra source in temperature equation. Always called.
137 !!$ FUNCTION source_in_temperature(TYPE, rr, m, t)RESULT(vv)
138 !!$ IMPLICIT NONE
139 !!$ INTEGER , INTENT(IN) :: TYPE
140 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
141 !!$ INTEGER , INTENT(IN) :: m
142 !!$ REAL(KIND=8), INTENT(IN) :: t
143 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
144 !!$
145 !!$ vv = 0.d0
146 !!$ CALL error_petsc('source_in_temperature: should not be called for this test')
147 !!$ RETURN
148 !!$ END FUNCTION source_in_temperature
149 
150 !!$ !===Extra source in level set equation. Always called.
151 !!$ FUNCTION source_in_level_set(interface_nb,TYPE, rr, m, t)RESULT(vv)
152 !!$ IMPLICIT NONE
153 !!$ INTEGER , INTENT(IN) :: TYPE
154 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
155 !!$ INTEGER , INTENT(IN) :: m, interface_nb
156 !!$ REAL(KIND=8), INTENT(IN) :: t
157 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
158 !!$
159 !!$ vv=0.d0
160 !!$ CALL error_petsc('sourece_in_temperature: should not be called for this test')
161 !!$ END FUNCTION source_in_level_set
162 
163 !!$ !===Velocity for boundary conditions in Navier-Stokes.
164 !!$ !===Can be used also to initialize velocity in: init_velocity_pressure_temperature
165 !!$ FUNCTION vv_exact(TYPE,rr,m,t) RESULT(vv)
166 !!$
167 !!$ IMPLICIT NONE
168 !!$ INTEGER , INTENT(IN) :: TYPE
169 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
170 !!$ INTEGER, INTENT(IN) :: m
171 !!$ REAL(KIND=8), INTENT(IN) :: t
172 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
173 !!$
174 !!$ vv(:) = 0.d0
175 !!$ CALL error_petsc('vv_exact: should not be called for this test')
176 !!$ RETURN
177 !!$ END FUNCTION vv_exact
178 
179 !!$ !===Solid velocity imposed when using penalty technique
180 !!$ !===Defined in Fourier space on mode 0 only.
181 !!$ FUNCTION imposed_velocity_by_penalty(rr,t) RESULT(vv)
182 !!$ IMPLICIT NONE
183 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
184 !!$ REAL(KIND=8), INTENT(IN) :: t
185 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2),6) :: vv
186 !!$
187 !!$ vv=0.d0
188 !!$ RETURN
189 !!$ END FUNCTION imposed_velocity_by_penalty
190 
191 !!$ !===Pressure for boundary conditions in Navier-Stokes.
192 !!$ !===Can be used also to initialize pressure in the subroutine init_velocity_pressure.
193 !!$ !===Use this routine for outflow BCs only.
194 !!$ !===CAUTION: Do not enfore BCs on pressure where normal component
195 !!$ ! of velocity is prescribed.
196 !!$ FUNCTION pp_exact(TYPE,rr,m,t) RESULT (vv)
197 !!$ IMPLICIT NONE
198 !!$ INTEGER , INTENT(IN) :: TYPE
199 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
200 !!$ INTEGER , INTENT(IN) :: m
201 !!$ REAL(KIND=8), INTENT(IN) :: t
202 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
203 !!$
204 !!$ vv=0.d0
205 !!$ CALL error_petsc('pp_exact: should not be called for this test')
206 !!$ RETURN
207 !!$ END FUNCTION pp_exact
208 
209 !!$ !===Temperature for boundary conditions in temperature equation.
210 !!$ FUNCTION temperature_exact(TYPE,rr,m,t) RESULT (vv)
211 !!$ IMPLICIT NONE
212 !!$ INTEGER , INTENT(IN) :: TYPE
213 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
214 !!$ INTEGER , INTENT(IN) :: m
215 !!$ REAL(KIND=8), INTENT(IN) :: t
216 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
217 !!$
218 !!$ vv = 0.d0
219 !!$ CALL error_petsc('temperature_exact: should not be called for this test')
220 !!$ RETURN
221 !!$ END FUNCTION temperature_exact
222 
223 !!$ !===Can be used to initialize level set in the subroutine init_level_set.
224 !!$ FUNCTION level_set_exact(interface_nb,TYPE,rr,m,t) RESULT (vv)
225 !!$ IMPLICIT NONE
226 !!$ INTEGER , INTENT(IN) :: TYPE
227 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
228 !!$ INTEGER , INTENT(IN) :: m, interface_nb
229 !!$ REAL(KIND=8), INTENT(IN) :: t
230 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
231 !!$
232 !!$ vv = 0.d0
233 !!$ CALL error_petsc('level_set_exact: should not be called for this test')
234 !!$ RETURN
235 !!$
236 !!$ END FUNCTION level_set_exact
237 
238 !!$ !===Penalty coefficient (if needed)
239 !!$ !===This coefficient is equal to zero in subdomain
240 !!$ !===where penalty is applied (penalty is zero in solid)
241 !!$ FUNCTION penal_in_real_space(mesh,rr_gauss,angles,nb_angles,nb,ne,time) RESULT(vv)
242 !!$ IMPLICIT NONE
243 !!$ TYPE(mesh_type) :: mesh
244 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr_gauss
245 !!$ REAL(KIND=8), DIMENSION(:), INTENT(IN) :: angles
246 !!$ INTEGER, INTENT(IN) :: nb_angles
247 !!$ INTEGER, INTENT(IN) :: nb, ne
248 !!$ REAL(KIND=8), INTENT(IN) :: time
249 !!$ REAL(KIND=8), DIMENSION(nb_angles,ne-nb+1) :: vv
250 !!$
251 !!$ vv = 1.d0
252 !!$ CALL error_petsc('penal_in_real_space: should not be called for this test')
253 !!$ RETURN
254 !!$ END FUNCTION penal_in_real_space
255 
256 !!$ !===Extension of the velocity field in the solid.
257 !!$ !===Used when temperature or Maxwell equations are solved.
258 !!$ !===It extends the velocity field on the Navier-Stokes domain to a
259 !!$ !===velocity field on the temperature and the Maxwell domain.
260 !!$ !===It is also used if problem type=mxw and restart velocity
261 !!$ !===is set to true in data (type problem denoted mxx in the code).
262 !!$ FUNCTION extension_velocity(TYPE, H_mesh, mode, t, n_start) RESULT(vv)
263 !!$ IMPLICIT NONE
264 !!$ TYPE(mesh_type), INTENT(IN) :: H_mesh
265 !!$ INTEGER , INTENT(IN) :: TYPE, n_start
266 !!$ INTEGER, INTENT(IN) :: mode
267 !!$ REAL(KIND=8), INTENT(IN) :: t
268 !!$ REAL(KIND=8), DIMENSION(H_Mesh%np) :: vv
269 !!$
270 !!$ vv = 0.d0
271 !!$ RETURN
272 !!$
273 !!$ END FUNCTION extension_velocity
274 
275  !===============================================================================
276  ! Boundary conditions for Maxwell
277  !===============================================================================
278  !===Velocity used in the induction equation.
279  !===Used only if problem type is mxw and restart velocity is false
280  FUNCTION vexact(m, H_mesh) RESULT(vv) !Set uniquement a l'induction
281  IMPLICIT NONE
282  TYPE(mesh_type), INTENT(IN) :: h_mesh
283  INTEGER, INTENT(IN) :: m
284  REAL(KIND=8), DIMENSION(H_mesh%np,6) :: vv
285  REAL(KIND=8), DIMENSION(:), POINTER :: r, z
286 
287  IF (m==0) THEN
288  vv = 0
289  RETURN
290  END IF
291  r => h_mesh%rr(1,:)
292  z => h_mesh%rr(2,:)
293  vv(:,1) = alpha*z*(r**(m-1))*m !-alpha*z*gamma/r**(m+1)*m
294  vv(:,2) = beta *z*(r**(m-1))*m !-beta *z*gamma/r**(m+1)*m
295  vv(:,3) = beta *z*(r**(m-1))*m !+beta *z*gamma/r**(m+1)*m
296  vv(:,4) =-alpha*z*(r**(m-1))*m !-alpha*z*gamma/r**(m+1)*m
297  vv(:,5) = alpha*(r**m) !+ alpha*gamma/r**m)
298  vv(:,6) = beta *(r**m) !+ beta*gamma/r**m)
299  vv = vv/m**3
300  RETURN
301  END FUNCTION vexact
302 
303 !!$ !===Magnetic field and magnetic induction for quasi-static approximation
304 !!$ !===if needed
305 !!$ FUNCTION H_B_quasi_static(char_h_b, rr, m) RESULT(vv)
306 !!$ IMPLICIT NONE
307 !!$ CHARACTER(LEN=1), INTENT(IN) :: char_h_b
308 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
309 !!$ INTEGER, INTENT(IN) :: m
310 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2),6) :: vv
311 !!$
312 !!$ vv = 0.d0
313 !!$ RETURN
314 !!$ END FUNCTION H_B_quasi_static
315 
316 
317  !===Magnetic field for boundary conditions in the Maxwell equations.
318  FUNCTION hexact(H_mesh, TYPE, rr, m, mu_H_field, t) RESULT(vv)
319  IMPLICIT NONE
320  TYPE(mesh_type), INTENT(IN) :: h_mesh
321  INTEGER , INTENT(IN) :: type
322  REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
323  INTEGER , INTENT(IN) :: m
324  REAL(KIND=8), INTENT(IN) :: t
325  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: mu_h_field
326  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
327  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: r, z
328  REAL(KIND=8) :: muh
329 
330  IF (maxval(mu_h_field) /= minval(mu_h_field)) THEN
331  CALL error_petsc(' BUG in condlim, mu not constant')
332  END IF
333  muh=mu_h_field(1)
334  r = rr(1,:)
335  z = rr(2,:)
336  IF (m==0) THEN
337  vv = 0
338  RETURN
339  END IF
340  IF (TYPE == 1) then
341  vv = alpha*z*(r**(m-1))*m !-alpha*z*gamma/r**(m+1)*m
342  ELSEIF (TYPE == 2) then
343  vv = beta *z*(r**(m-1))*m !-beta *z*gamma/r**(m+1)*m
344  ELSEIF (TYPE ==3) then
345  vv = beta *z*(r**(m-1))*m !+beta *z*gamma/r**(m+1)*m
346  ELSEIF (TYPE == 4) then
347  vv =-alpha*z*(r**(m-1))*m !+-alpha*z*gamma/r**(m+1)*m
348  ELSEIF (TYPE == 5) then
349  vv = alpha*(r**m) ! + alpha*(gamma/r**m)
350  ELSEIF (TYPE == 6) then
351  vv = beta *(r**m) ! + beta *(gamma/r**m)
352  ENDIF
353  vv = (vv/muh)*cos(t)/m**3
354  RETURN
355 
356  !===Dummies variables to avoid warning
357  r=h_mesh%rr(1,1)
358  !===Dummies variables to avoid warning
359  END FUNCTION hexact
360 
361  !===Scalar potential for boundary conditions in the Maxwell equations.
362  FUNCTION phiexact(TYPE, rr, m, mu_phi,t) RESULT(vv)
363  IMPLICIT NONE
364  INTEGER , INTENT(IN) :: type
365  REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
366  INTEGER , INTENT(IN) :: m
367  REAL(KIND=8), INTENT(IN) :: mu_phi, t
368  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
369  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: r, z
370 
371  r = rr(1,:)
372  z = rr(2,:)
373 
374  vv(:) = 0.d0
375  IF (m==0) RETURN
376  IF (TYPE == 1) then
377  vv = alpha*z*(r**m) ! + alpha*z*(gamma/r**m)
378  ELSEIF (TYPE == 2) then
379  vv = beta *z*(r**m) ! + beta *z*(gamma/r**m)
380  ENDIF
381  vv = (vv/mu_phi)*cos(t)/m**3
382  RETURN
383  END FUNCTION phiexact
384 
385  !===Current in Ohm's law. Curl(H) = sigma(E + uxB) + current
386  FUNCTION jexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t, mesh_id, opt_B_ext) RESULT(vv)
387  IMPLICIT NONE
388  INTEGER , INTENT(IN) :: type
389  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: rr
390  INTEGER , INTENT(IN) :: m
391  REAL(KIND=8), INTENT(IN) :: mu_phi, sigma, mu_h, t
392  INTEGER , INTENT(IN) :: mesh_id
393  REAL(KIND=8), DIMENSION(6), OPTIONAL,INTENT(IN) :: opt_b_ext
394  REAL(KIND=8) :: vv
395  REAL(KIND=8) :: r
396  INTEGER :: n
397 
398  vv = -sigma* eexact_gauss(type, rr, m, mu_phi, sigma, mu_h, t)
399  RETURN
400 
401  !===Dummies variables to avoid warning
402  n=mesh_id
403  IF (present(opt_b_ext)) r=opt_b_ext(1)
404  !===Dummies variables to avoid warningg
405  END FUNCTION jexact_gauss
406 
407  !===Electric field for Neumann BC (cf. doc)
408  FUNCTION eexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t) RESULT(vv)
409  IMPLICIT NONE
410  INTEGER, INTENT(IN) :: type
411  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: rr
412  INTEGER, INTENT(IN) :: m
413  REAL(KIND=8), INTENT(IN) :: mu_phi, sigma, mu_h, t
414  REAL(KIND=8) :: vv
415  REAL(KIND=8) :: r, z
416 
417  r = rr(1)
418  z = rr(2)
419  vv = 0.d0
420 
421  IF (m == 0) RETURN
422  IF (TYPE == 1) then
423  vv = 0.d0
424  ELSEIF (TYPE == 2) then
425  vv = 0.d0
426  ELSEIF (TYPE ==3) then
427  vv = alpha*(-1.d0/(m+2)*r**(m+1)) ! + alpha*(1.d0/(m-2)*gamma/r**(m-1))
428  ELSEIF (TYPE == 4) then
429  vv = beta *(-1.d0/(m+2)*r**(m+1)) !+ beta *(1.d0/(m-2)*gamma/r**(m-1))
430  ELSEIF (TYPE == 5) then
431  vv = beta*z*(r**m) ! beta*z*(-gamma/r**m)
432  ELSEIF (TYPE == 6) then
433  vv =-alpha*z*(r**m) ! -alpha*z*(-gamma/r**m)
434  ENDIF
435  vv = -vv*sin(t)/m**3
436  RETURN
437 
438  !===Dummies variables to avoid warning
439  r=mu_phi; r=sigma; r=mu_h
440  !===Dummies variables to avoid warning
441  END FUNCTION eexact_gauss
442 
443  !===Initialization of magnetic field and scalar potential (if present)
444  SUBROUTINE init_maxwell(H_mesh, phi_mesh, time, dt, mu_H_field, mu_phi, &
445  list_mode, hn1, hn, phin1, phin)
446  IMPLICIT NONE
447  TYPE(mesh_type) :: h_mesh, phi_mesh
448  REAL(KIND=8), INTENT(OUT):: time
449  REAL(KIND=8), INTENT(IN) :: dt
450  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: mu_h_field
451  REAL(KIND=8), INTENT(IN) :: mu_phi
452  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
453  REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: hn, hn1
454  REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: phin, phin1
455  INTEGER :: i, k
456 
457  time = -dt
458  DO k=1,6
459  DO i=1, SIZE(list_mode)
460  hn1(:,k,i) = hexact(h_mesh,k, h_mesh%rr, list_mode(i), mu_h_field, time)
461  IF (inputs%nb_dom_phi>0) THEN
462  IF (k<3) THEN
463  phin1(:,k,i) = phiexact(k, phi_mesh%rr, list_mode(i) , mu_phi, time)
464  ENDIF
465  END IF
466  ENDDO
467  ENDDO
468 
469  time = time + dt
470  DO k=1,6
471  DO i=1, SIZE(list_mode)
472  hn(:,k,i) = hexact(h_mesh,k, h_mesh%rr, list_mode(i), mu_h_field, time)
473  IF (inputs%nb_dom_phi>0) THEN
474  IF (k<3) THEN
475  phin(:,k,i) = phiexact(k, phi_mesh%rr, list_mode(i), mu_phi, time)
476  ENDIF
477  END IF
478  ENDDO
479  ENDDO
480  END SUBROUTINE init_maxwell
481 
482 !!$ !===Analytical permeability (if needed)
483 !!$ !===This function is not needed unless the flag
484 !!$ !=== ===Use FEM Interpolation for magnetic permeability (true/false)
485 !!$ !===is activated and set to .FALSE. in the data data file. Default is .TRUE.
486 !!$ FUNCTION mu_bar_in_fourier_space(H_mesh,nb,ne,pts,pts_ids) RESULT(vv)
487 !!$ IMPLICIT NONE
488 !!$ TYPE(mesh_type), INTENT(IN) :: H_mesh
489 !!$ REAL(KIND=8), DIMENSION(ne-nb+1) :: vv
490 !!$ INTEGER, INTENT(IN) :: nb, ne
491 !!$ REAL(KIND=8),DIMENSION(2,ne-nb+1),OPTIONAL :: pts
492 !!$ INTEGER, DIMENSION(ne-nb+1), OPTIONAL :: pts_ids
493 !!$
494 !!$ vv = 1.d0
495 !!$ CALL error_petsc('mu_bar_in_fourier_space: should not be called for this test')
496 !!$ RETURN
497 !!$ END FUNCTION mu_bar_in_fourier_space
498 
499 !!$ !===Analytical mu_in_fourier_space (if needed)
500 !!$ !===This function is not needed unless the flag
501 !!$ !=== ===Use FEM Interpolation for magnetic permeability (true/false)
502 !!$ !===is activated and set to .FALSE. in the data data file. Default is .TRUE.
503 !!$ FUNCTION grad_mu_bar_in_fourier_space(pt,pt_id) RESULT(vv)
504 !!$ IMPLICIT NONE
505 !!$ REAL(KIND=8),DIMENSION(2), INTENT(in):: pt
506 !!$ INTEGER,DIMENSION(1), INTENT(in) :: pt_id
507 !!$ REAL(KIND=8),DIMENSION(2) :: vv
508 !!$
509 !!$ vv=0.d0
510 !!$ CALL error_petsc('grad_mu_bar_in_fourier_space: should not be called for this test')
511 !!$ RETURN
512 !!$ END FUNCTION grad_mu_bar_in_fourier_space
513 
514 !!$ !===Analytical permeability, mu in real space (if needed)
515 !!$ FUNCTION mu_in_real_space(H_mesh,angles,nb_angles,nb,ne,time) RESULT(vv)
516 !!$ IMPLICIT NONE
517 !!$ TYPE(mesh_type), INTENT(IN) :: H_mesh
518 !!$ REAL(KIND=8), DIMENSION(:), INTENT(IN) :: angles
519 !!$ INTEGER, INTENT(IN) :: nb_angles
520 !!$ INTEGER, INTENT(IN) :: nb, ne
521 !!$ REAL(KIND=8), INTENT(IN) :: time
522 !!$ REAL(KIND=8), DIMENSION(nb_angles,ne-nb+1) :: vv
523 !!$
524 !!$ vv = 1.d0
525 !!$ CALL error_petsc('mu_in_real_space: should not be called for this test')
526 !!$ RETURN
527 !!$ END FUNCTION mu_in_real_space
528 
529 END MODULE boundary_test_5
section doc_intro_frame_work_num_app Numerical approximation subsection doc_intro_fram_work_num_app_Fourier_FEM Fourier Finite element representation The SFEMaNS code uses a hybrid Fourier Finite element formulation The Fourier decomposition allows to approximate the problem’s solutions for each Fourier mode modulo nonlinear terms that are made explicit The variables are then approximated on a meridian section of the domain with a finite element method The numerical approximation of a function f $f f is written in the following generic t
Definition: doc_intro.h:199
subroutine, public init_maxwell(H_mesh, phi_mesh, time, dt, mu_H_field, mu_phi, list_mode, Hn1, Hn, phin1, phin)
real(kind=8) function, public jexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t, mesh_id, opt_B_ext)
real(kind=8) function, dimension(h_mesh%np, 6), public vexact(m, H_mesh)
real(kind=8) function, dimension(size(rr, 2)), public phiexact(TYPE, rr, m, mu_phi, t)
real(kind=8) function, public eexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t)
subroutine error_petsc(string)
Definition: my_util.f90:15
real(kind=8) function, dimension(size(rr, 2)), public hexact(H_mesh, TYPE, rr, m, mu_H_field, t)
section doc_intro_frame_work_num_app Numerical approximation subsection doc_intro_fram_work_num_app_Fourier_FEM Fourier Finite element representation The SFEMaNS code uses a hybrid Fourier Finite element formulation The Fourier decomposition allows to approximate the problem’s solutions for each Fourier mode modulo nonlinear terms that are made explicit The variables are then approximated on a meridian section of the domain with a finite element method The numerical approximation of a function f $f f is written in the following generic z
Definition: doc_intro.h:193