SFEMaNS  version 4.1 (work in progress)
Reference documentation for SFEMaNS
 All Classes Files Functions Variables Groups Pages
condlim_test_10.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 !!$ IMPLICIT NONE
167 !!$ INTEGER , INTENT(IN) :: TYPE
168 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
169 !!$ INTEGER, INTENT(IN) :: m
170 !!$ REAL(KIND=8), INTENT(IN) :: t
171 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
172 !!$
173 !!$ vv(:) = 0.d0
174 !!$ CALL error_petsc('vv_exact: should not be called for this test')
175 !!$ RETURN
176 !!$ END FUNCTION vv_exact
177 
178 !!$ !===Solid velocity imposed when using penalty technique
179 !!$ !===Defined in Fourier space on mode 0 only.
180 !!$ FUNCTION imposed_velocity_by_penalty(rr,t) RESULT(vv)
181 !!$ IMPLICIT NONE
182 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
183 !!$ REAL(KIND=8), INTENT(IN) :: t
184 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2),6) :: vv
185 !!$
186 !!$ vv=0.d0
187 !!$ RETURN
188 !!$ END FUNCTION imposed_velocity_by_penalty
189 
190 !!$ !===Pressure for boundary conditions in Navier-Stokes.
191 !!$ !===Can be used also to initialize pressure in the subroutine init_velocity_pressure.
192 !!$ !===Use this routine for outflow BCs only.
193 !!$ !===CAUTION: Do not enfore BCs on pressure where normal component
194 !!$ ! of velocity is prescribed.
195 !!$ FUNCTION pp_exact(TYPE,rr,m,t) RESULT (vv)
196 !!$ IMPLICIT NONE
197 !!$ INTEGER , INTENT(IN) :: TYPE
198 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
199 !!$ INTEGER , INTENT(IN) :: m
200 !!$ REAL(KIND=8), INTENT(IN) :: t
201 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
202 !!$
203 !!$ vv=0.d0
204 !!$ CALL error_petsc('pp_exact: should not be called for this test')
205 !!$ RETURN
206 !!$ END FUNCTION pp_exact
207 
208 !!$ !===Temperature for boundary conditions in temperature equation.
209 !!$ FUNCTION temperature_exact(TYPE,rr,m,t) RESULT (vv)
210 !!$ IMPLICIT NONE
211 !!$ INTEGER , INTENT(IN) :: TYPE
212 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
213 !!$ INTEGER , INTENT(IN) :: m
214 !!$ REAL(KIND=8), INTENT(IN) :: t
215 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
216 !!$
217 !!$ vv = 0.d0
218 !!$ CALL error_petsc('temperature_exact: should not be called for this test')
219 !!$ RETURN
220 !!$ END FUNCTION temperature_exact
221 
222 !!$ !===Can be used to initialize level set in the subroutine init_level_set.
223 !!$ FUNCTION level_set_exact(interface_nb,TYPE,rr,m,t) RESULT (vv)
224 !!$ IMPLICIT NONE
225 !!$ INTEGER , INTENT(IN) :: TYPE
226 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
227 !!$ INTEGER , INTENT(IN) :: m, interface_nb
228 !!$ REAL(KIND=8), INTENT(IN) :: t
229 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
230 !!$
231 !!$ vv = 0.d0
232 !!$ CALL error_petsc('level_set_exact: should not be called for this test')
233 !!$ RETURN
234 !!$
235 !!$ END FUNCTION level_set_exact
236 
237 !!$ !===Penalty coefficient (if needed)
238 !!$ !===This coefficient is equal to zero in subdomain
239 !!$ !===where penalty is applied (penalty is zero in solid)
240 !!$ FUNCTION penal_in_real_space(mesh,rr_gauss,angles,nb_angles,nb,ne,time) RESULT(vv)
241 !!$ IMPLICIT NONE
242 !!$ TYPE(mesh_type) :: mesh
243 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr_gauss
244 !!$ REAL(KIND=8), DIMENSION(:), INTENT(IN) :: angles
245 !!$ INTEGER, INTENT(IN) :: nb_angles
246 !!$ INTEGER, INTENT(IN) :: nb, ne
247 !!$ REAL(KIND=8), INTENT(IN) :: time
248 !!$ REAL(KIND=8), DIMENSION(nb_angles,ne-nb+1) :: vv
249 !!$
250 !!$ vv = 1.d0
251 !!$ CALL error_petsc('penal_in_real_space: should not be called for this test')
252 !!$ RETURN
253 !!$ END FUNCTION penal_in_real_space
254 
255 !!$ !===Extension of the velocity field in the solid.
256 !!$ !===Used when temperature or Maxwell equations are solved.
257 !!$ !===It extends the velocity field on the Navier-Stokes domain to a
258 !!$ !===velocity field on the temperature and the Maxwell domain.
259 !!$ !===It is also used if problem type=mxw and restart velocity
260 !!$ !===is set to true in data (type problem denoted mxx in the code).
261 !!$ FUNCTION extension_velocity(TYPE, H_mesh, mode, t, n_start) RESULT(vv)
262 !!$ IMPLICIT NONE
263 !!$ TYPE(mesh_type), INTENT(IN) :: H_mesh
264 !!$ INTEGER , INTENT(IN) :: TYPE, n_start
265 !!$ INTEGER, INTENT(IN) :: mode
266 !!$ REAL(KIND=8), INTENT(IN) :: t
267 !!$ REAL(KIND=8), DIMENSION(H_Mesh%np) :: vv
268 !!$
269 !!$ vv = 0.d0
270 !!$ RETURN
271 !!$
272 !!$ END FUNCTION extension_velocity
273 
274  !===============================================================================
275  ! Boundary conditions for Maxwell
276  !===============================================================================
277  !===Velocity used in the induction equation.
278  !===Used only if problem type is mxw and restart velocity is false
279  FUNCTION vexact(m, H_mesh) RESULT(vv) !Set uniquement a l'induction
280  IMPLICIT NONE
281  TYPE(mesh_type), INTENT(IN) :: h_mesh
282  INTEGER, INTENT(IN) :: m
283  REAL(KIND=8), DIMENSION(H_mesh%np,6) :: vv
284  REAL(KIND=8), DIMENSION(:), POINTER :: r, z
285 
286  IF (m==0) THEN
287  vv = 0
288  RETURN
289  END IF
290  r => h_mesh%rr(1,:)
291  z => h_mesh%rr(2,:)
292  vv(:,1) = alpha*z*(r**(m-1))*m !-alpha*z*gamma/r**(m+1)*m
293  vv(:,2) = beta *z*(r**(m-1))*m !-beta *z*gamma/r**(m+1)*m
294  vv(:,3) = beta *z*(r**(m-1))*m !+beta *z*gamma/r**(m+1)*m
295  vv(:,4) =-alpha*z*(r**(m-1))*m !-alpha*z*gamma/r**(m+1)*m
296  vv(:,5) = alpha*(r**m) !+ alpha*gamma/r**m)
297  vv(:,6) = beta *(r**m) !+ beta*gamma/r**m)
298  vv = vv/m**3
299  RETURN
300  END FUNCTION vexact
301 
302 !!$ !===Magnetic field and magnetic induction for quasi-static approximation
303 !!$ !===if needed
304 !!$ FUNCTION H_B_quasi_static(char_h_b, rr, m) RESULT(vv)
305 !!$ IMPLICIT NONE
306 !!$ CHARACTER(LEN=1), INTENT(IN) :: char_h_b
307 !!$ REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
308 !!$ INTEGER, INTENT(IN) :: m
309 !!$ REAL(KIND=8), DIMENSION(SIZE(rr,2),6) :: vv
310 !!$
311 !!$ vv = 0.d0
312 !!$ RETURN
313 !!$ END FUNCTION H_B_quasi_static
314 
315  !===Magnetic field for boundary conditions in the Maxwell equations.
316  FUNCTION hexact(H_mesh,TYPE, rr, m, mu_H_field, t) RESULT(vv)
317  IMPLICIT NONE
318  TYPE(mesh_type), INTENT(IN) :: h_mesh
319  INTEGER , INTENT(IN) :: type
320  REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
321  INTEGER , INTENT(IN) :: m
322  REAL(KIND=8), INTENT(IN) :: t
323  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: mu_h_field
324  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
325  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: r, z
326  REAL(KIND=8) :: muh
327 
328  IF (maxval(mu_h_field) /= minval(mu_h_field)) THEN
329  CALL error_petsc(' BUG in condlim, mu not constant')
330  END IF
331  muh=mu_h_field(1)
332  r = rr(1,:)
333  z = rr(2,:)
334  IF (m==0) THEN
335  vv = 0
336  RETURN
337  END IF
338  IF (TYPE == 1) then
339  vv = alpha*z*(r**(m-1))*m !-alpha*z*gamma/r**(m+1)*m
340  ELSEIF (TYPE == 2) then
341  vv = beta *z*(r**(m-1))*m !-beta *z*gamma/r**(m+1)*m
342  ELSEIF (TYPE ==3) then
343  vv = beta *z*(r**(m-1))*m !+beta *z*gamma/r**(m+1)*m
344  ELSEIF (TYPE == 4) then
345  vv =-alpha*z*(r**(m-1))*m !+-alpha*z*gamma/r**(m+1)*m
346  ELSEIF (TYPE == 5) then
347  vv = alpha*(r**m) ! + alpha*(gamma/r**m)
348  ELSEIF (TYPE == 6) then
349  vv = beta *(r**m) ! + beta *(gamma/r**m)
350  ENDIF
351  vv = (vv/muh)*cos(t)/m**3
352  RETURN
353 
354  !===Dummies variables to avoid warning
355  r=h_mesh%rr(1,1)
356  !===Dummies variables to avoid warning
357  END FUNCTION hexact
358 
359  !===Scalar potential for boundary conditions in the Maxwell equations.
360  FUNCTION phiexact(TYPE, rr, m, mu_phi,t) RESULT(vv)
361  IMPLICIT NONE
362  INTEGER , INTENT(IN) :: type
363  REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: rr
364  INTEGER , INTENT(IN) :: m
365  REAL(KIND=8), INTENT(IN) :: mu_phi, t
366  REAL(KIND=8), DIMENSION(SIZE(rr,2)) :: vv
367  REAL(KIND=8) :: r
368  INTEGER :: n
369 
370  vv=0.d0
371  CALL error_petsc('Phiexact: should not be called for this test')
372  RETURN
373 
374  !===Dummies variables to avoid warning
375  n=type; n=m; r=rr(1,1); r=mu_phi; r=t
376  !===Dummies variables to avoid warning
377  END FUNCTION phiexact
378 
379  !===Current in Ohm's law. Curl(H) = sigma(E + uxB) + current
380  FUNCTION jexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t, mesh_id, opt_B_ext) RESULT(vv)
381  IMPLICIT NONE
382  INTEGER , INTENT(IN) :: type
383  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: rr
384  INTEGER , INTENT(IN) :: m
385  REAL(KIND=8), INTENT(IN) :: mu_phi, sigma, mu_h, t
386  INTEGER , INTENT(IN) :: mesh_id
387  REAL(KIND=8), DIMENSION(6), OPTIONAL,INTENT(IN) :: opt_b_ext
388  REAL(KIND=8) :: vv
389  REAL(KIND=8) :: r
390  INTEGER :: n
391 
392  vv = -sigma* eexact_gauss(type, rr, m, mu_phi, sigma, mu_h, t)
393  RETURN
394 
395  !===Dummies variables to avoid warning
396  n=mesh_id
397  IF (present(opt_b_ext)) r=opt_b_ext(1)
398  !===Dummies variables to avoid warning
399  END FUNCTION jexact_gauss
400 
401  !===Electric field for Neumann BC (cf. doc)
402  FUNCTION eexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t) RESULT(vv)
403  IMPLICIT NONE
404  INTEGER, INTENT(IN) :: type
405  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: rr
406  INTEGER, INTENT(IN) :: m
407  REAL(KIND=8), INTENT(IN) :: mu_phi, sigma, mu_h, t
408  REAL(KIND=8) :: vv
409  REAL(KIND=8) :: r, z
410 
411  r = rr(1)
412  z = rr(2)
413  vv = 0.d0
414 
415  IF (m == 0) RETURN
416  IF (TYPE == 1) then
417  vv = 0.d0
418  ELSEIF (TYPE == 2) then
419  vv = 0.d0
420  ELSEIF (TYPE ==3) then
421  vv = alpha*(-1.d0/(m+2)*r**(m+1)) ! + alpha*(1.d0/(m-2)*gamma/r**(m-1))
422  ELSEIF (TYPE == 4) then
423  vv = beta *(-1.d0/(m+2)*r**(m+1)) !+ beta *(1.d0/(m-2)*gamma/r**(m-1))
424  ELSEIF (TYPE == 5) then
425  vv = beta*z*(r**m) ! beta*z*(-gamma/r**m)
426  ELSEIF (TYPE == 6) then
427  vv =-alpha*z*(r**m) ! -alpha*z*(-gamma/r**m)
428  ENDIF
429  vv = -vv*sin(t)/m**3
430  RETURN
431 
432  !===Dummies variables to avoid warning
433  r=mu_phi; r=sigma; r=mu_h
434  !===Dummies variables to avoid warning
435  END FUNCTION eexact_gauss
436 
437  !===Initialization of magnetic field and scalar potential (if present)
438  SUBROUTINE init_maxwell(H_mesh, phi_mesh, time, dt, mu_H_field, mu_phi, &
439  list_mode, hn1, hn, phin1, phin)
440  IMPLICIT NONE
441  TYPE(mesh_type) :: h_mesh, phi_mesh
442  REAL(KIND=8), INTENT(OUT):: time
443  REAL(KIND=8), INTENT(IN) :: dt
444  REAL(KIND=8), DIMENSION(:), INTENT(IN) :: mu_h_field
445  REAL(KIND=8), INTENT(IN) :: mu_phi
446  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
447  REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: hn, hn1
448  REAL(KIND=8), DIMENSION(:,:,:), INTENT(OUT):: phin, phin1
449  INTEGER :: i, k
450 
451  time = -dt
452  DO k=1,6
453  DO i=1, SIZE(list_mode)
454  hn1(:,k,i) = hexact(h_mesh,k, h_mesh%rr, list_mode(i), mu_h_field, time)
455  IF (inputs%nb_dom_phi>0) THEN
456  IF (k<3) THEN
457  phin1(:,k,i) = phiexact(k, phi_mesh%rr, list_mode(i) , mu_phi, time)
458  ENDIF
459  END IF
460  ENDDO
461  ENDDO
462 
463  time = time + dt
464  DO k=1,6
465  DO i=1, SIZE(list_mode)
466  hn(:,k,i) = hexact(h_mesh,k, h_mesh%rr, list_mode(i), mu_h_field, time)
467  IF (inputs%nb_dom_phi>0) THEN
468  IF (k<3) THEN
469  phin(:,k,i) = phiexact(k, phi_mesh%rr, list_mode(i), mu_phi, time)
470  ENDIF
471  END IF
472  ENDDO
473  ENDDO
474  END SUBROUTINE init_maxwell
475 
476 !!$ !===Analytical permeability (if needed)
477 !!$ !===This function is not needed unless the flag
478 !!$ !=== ===Use FEM Interpolation for magnetic permeability (true/false)
479 !!$ !===is activated and set to .FALSE. in the data data file. Default is .TRUE.
480 !!$ FUNCTION mu_bar_in_fourier_space(H_mesh,nb,ne,pts,pts_ids) RESULT(vv)
481 !!$ IMPLICIT NONE
482 !!$ TYPE(mesh_type), INTENT(IN) :: H_mesh
483 !!$ REAL(KIND=8), DIMENSION(ne-nb+1) :: vv
484 !!$ INTEGER, INTENT(IN) :: nb, ne
485 !!$ REAL(KIND=8),DIMENSION(2,ne-nb+1),OPTIONAL :: pts
486 !!$ INTEGER, DIMENSION(ne-nb+1), OPTIONAL :: pts_ids
487 !!$
488 !!$ vv = 1.d0
489 !!$ CALL error_petsc('mu_bar_in_fourier_space: should not be called for this test')
490 !!$ RETURN
491 !!$ END FUNCTION mu_bar_in_fourier_space
492 
493 !!$ !===Analytical mu_in_fourier_space (if needed)
494 !!$ !===This function is not needed unless the flag
495 !!$ !=== ===Use FEM Interpolation for magnetic permeability (true/false)
496 !!$ !===is activated and set to .FALSE. in the data data file. Default is .TRUE.
497 !!$ FUNCTION grad_mu_bar_in_fourier_space(pt,pt_id) RESULT(vv)
498 !!$ IMPLICIT NONE
499 !!$ REAL(KIND=8),DIMENSION(2), INTENT(in):: pt
500 !!$ INTEGER,DIMENSION(1), INTENT(in) :: pt_id
501 !!$ REAL(KIND=8),DIMENSION(2) :: vv
502 !!$
503 !!$ vv=0.d0
504 !!$ CALL error_petsc('grad_mu_bar_in_fourier_space: should not be called for this test')
505 !!$ RETURN
506 !!$ END FUNCTION grad_mu_bar_in_fourier_space
507 
508 !!$ !===Analytical permeability, mu in real space (if needed)
509 !!$ FUNCTION mu_in_real_space(H_mesh,angles,nb_angles,nb,ne,time) RESULT(vv)
510 !!$ IMPLICIT NONE
511 !!$ TYPE(mesh_type), INTENT(IN) :: H_mesh
512 !!$ REAL(KIND=8), DIMENSION(:), INTENT(IN) :: angles
513 !!$ INTEGER, INTENT(IN) :: nb_angles
514 !!$ INTEGER, INTENT(IN) :: nb, ne
515 !!$ REAL(KIND=8), INTENT(IN) :: time
516 !!$ REAL(KIND=8), DIMENSION(nb_angles,ne-nb+1) :: vv
517 !!$
518 !!$
519 !!$ vv = 1.d0
520 !!$ CALL error_petsc('mu_in_real_space: should not be called for this test')
521 !!$ RETURN
522 !!$ END FUNCTION mu_in_real_space
523 
524 END MODULE boundary_test_10
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