35 REAL(KIND=8),
PRIVATE :: r0 = 0.5d0
36 REAL(KIND=8),
PRIVATE :: k0=6.28318530717958d0
37 INTEGER ,
PRIVATE :: m0=1
282 FUNCTION vexact(m, H_mesh) RESULT(vv) !Set uniquement a l'induction
285 INTEGER,
INTENT(IN) :: m
286 REAL(KIND=8),
DIMENSION(H_mesh%np,6) :: vv
311 FUNCTION hexact(H_mesh, TYPE, rr, m, mu_H_field, t) RESULT(vv)
314 INTEGER ,
INTENT(IN) :: type
315 REAL(KIND=8),
DIMENSION(:,:),
INTENT(IN) :: rr
316 INTEGER ,
INTENT(IN) :: m
317 REAL(KIND=8),
INTENT(IN) ::
t
318 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: mu_h_field
319 REAL(KIND=8),
DIMENSION(SIZE(rr,2)) :: vv
320 REAL(KIND=8),
DIMENSION(SIZE(rr,2)) :: r,
z
321 REAL(KIND=8),
DIMENSION(SIZE(rr,2)) :: f1, f2, f3, f4
322 REAL(KIND=8),
DIMENSION(SIZE(rr,2)) :: df2, df3
323 REAL(KIND=8) :: f1_r0, f2_r0, f3_r0
324 REAL(KIND=8) :: df2_r0, df3_r0
325 REAL(KIND=8) :: a, b, z0
338 f1_r0 = 1.d0/k0*(df3_r0-m0/r0*
bessk(m0,z0))
340 f2_r0 = m0/(k0*r0)*f3_r0 - (-
bessk(m0-1,z0)-m0/(k0*r0)*
bessk(m0,z0))
341 df2_r0 = (m0/r0*f1_r0-f2_r0/r0-k0*
bessk(m0,z0))
343 a = 3*f2_r0 - r0*df2_r0
344 b = r0*df2_r0-2*f2_r0
347 f2 = (r/r0)**2*(a+b*r/r0)
350 df2 = r/r0**2*(2*a+3*b*r/r0)
351 f4 = r/r0**2*(a+b*r/r0) + df2 - m0*r/r0**2*f1_r0
354 vv = (m0*r/r0**2-k0*f2)*cos(k0*
z)
355 ELSEIF (
TYPE == 2) then
357 ELSEIF (
TYPE ==3) then
359 ELSEIF (
TYPE == 4) then
360 vv = (k0*f1-df3)*cos(k0*
z)
361 ELSEIF (
TYPE == 5) then
363 ELSEIF (
TYPE == 6) then
370 r=mu_h_field; r=h_mesh%rr(1,1)
375 FUNCTION phiexact(TYPE, rr, m, mu_phi,t) RESULT(vv)
377 INTEGER ,
INTENT(IN) :: type
378 REAL(KIND=8),
DIMENSION(:,:),
INTENT(IN) :: rr
379 INTEGER ,
INTENT(IN) :: m
380 REAL(KIND=8),
INTENT(IN) :: mu_phi,
t
381 REAL(KIND=8),
DIMENSION(SIZE(rr,2)) :: vv
382 REAL(KIND=8),
DIMENSION(SIZE(rr,2)) :: r,
z
391 vv(n) =
bessk(m0,k0*r(n))*cos(k0*
z(n))
393 ELSEIF (
TYPE == 2) then
405 FUNCTION jexact_gauss(TYPE, rr, m, mu_phi, sigma, mu_H, t, mesh_id, opt_B_ext) RESULT(vv)
407 INTEGER ,
INTENT(IN) :: type
408 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: rr
409 INTEGER ,
INTENT(IN) :: m
410 REAL(KIND=8),
INTENT(IN) :: mu_phi, sigma, mu_h,
t
411 INTEGER ,
INTENT(IN) :: mesh_id
412 REAL(KIND=8),
DIMENSION(6),
OPTIONAL,
INTENT(IN) :: opt_b_ext
415 REAL(KIND=8) :: f1, f2, f3, f4
416 REAL(KIND=8) :: df2, df3, d2f2, df1, d2f3, df4
417 REAL(KIND=8) :: f1_r0, f2_r0, f3_r0
418 REAL(KIND=8) :: df2_r0, df3_r0
419 REAL(KIND=8) :: a, b, z0
420 REAL(KIND=8) :: h1, h2, h3, dh3, dh2
435 f1_r0 = 1.d0/k0*(df3_r0-m0/r0*
bessk(m0,z0))
437 f2_r0 = m0/(k0*r0)*f3_r0 - (-
bessk(m0-1,z0)-m0/(k0*r0)*
bessk(m0,z0))
438 df2_r0 = (m0/r0*f1_r0-f2_r0/r0-k0*
bessk(m0,z0))
440 a = 3*f2_r0 - r0*df2_r0
441 b = r0*df2_r0-2*f2_r0
444 f2 = (r/r0)**2*(a+b*r/r0)
447 df2 = r/r0**2*(2*a+3*b*r/r0)
448 f4 = r/r0**2*(a+b*r/r0) + df2 - m0*r/r0**2*f1_r0
449 df1 = 2*r/r0**2*f1_r0
451 d2f2= (1/r0**2)*(2*a+6*b*r/r0)
452 df4 = (1/r0**2)*(a+2*b*r/r0) + d2f2 -m0/r0**2*f1_r0
455 h1 = (m0*r/r0**2-k0*f2)
463 ELSEIF (
TYPE == 2) then
464 vv = ((-m0/r)*h3+k0*h2)*sin(k0*
z)
465 ELSEIF (
TYPE ==3) then
466 vv = (-k0*h1-dh3)*sin(k0*
z)
467 ELSEIF (
TYPE == 4) then
469 ELSEIF (
TYPE == 5) then
471 ELSEIF (
TYPE == 6) then
472 vv = 1/r*(h2 + r*dh2 + m0*h1)*cos(k0*
z)
474 vv = vv*cos(
t) - sigma*
eexact_gauss(type, rr, m, mu_phi, sigma, mu_h,
t)
481 IF (present(opt_b_ext)) r=opt_b_ext(1)
488 INTEGER,
INTENT(IN) :: type
489 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: rr
490 INTEGER,
INTENT(IN) :: m
491 REAL(KIND=8),
INTENT(IN) :: mu_phi, sigma, mu_h,
t
494 REAL(KIND=8) :: f1, f2, f3
495 REAL(KIND=8) :: f1_r0, f2_r0, f3_r0
496 REAL(KIND=8) :: df2_r0, df3_r0
497 REAL(KIND=8) :: a, b, z0
510 f1_r0 = 1.d0/k0*(df3_r0-m0/r0*
bessk(m0,z0))
512 f2_r0 = m0/(k0*r0)*f3_r0 - (-
bessk(m0-1,z0)-m0/(k0*r0)*
bessk(m0,z0))
513 df2_r0 = (m0/r0*f1_r0-f2_r0/r0-k0*
bessk(m0,z0))
515 a = 3*f2_r0 - r0*df2_r0
516 b = r0*df2_r0-2*f2_r0
519 f2 = (r/r0)**2*(a+b*r/r0)
524 ELSEIF (
TYPE == 2) then
526 ELSEIF (
TYPE ==3) then
528 ELSEIF (
TYPE == 4) then
530 ELSEIF (
TYPE == 5) then
532 ELSEIF (
TYPE == 6) then
544 SUBROUTINE init_maxwell(H_mesh, phi_mesh, time, dt, mu_H_field, mu_phi, &
545 list_mode, hn1, hn, phin1, phin)
548 REAL(KIND=8),
INTENT(OUT):: time
549 REAL(KIND=8),
INTENT(IN) :: dt
550 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: mu_h_field
551 REAL(KIND=8),
INTENT(IN) :: mu_phi
552 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
553 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT):: hn, hn1
554 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT):: phin, phin1
559 DO i=1,
SIZE(list_mode)
560 hn1(:,k,i) =
hexact(h_mesh,k, h_mesh%rr, list_mode(i), mu_h_field, time)
561 IF (inputs%nb_dom_phi>0)
THEN
563 phin1(:,k,i) =
phiexact(k, phi_mesh%rr, list_mode(i) , mu_phi, time)
571 DO i=1,
SIZE(list_mode)
572 hn(:,k,i) =
hexact(h_mesh,k, h_mesh%rr, list_mode(i), mu_h_field, time)
573 IF (inputs%nb_dom_phi>0)
THEN
575 phin(:,k,i) =
phiexact(k, phi_mesh%rr, list_mode(i), mu_phi, time)
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
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)
real *8 function, public bessk(N, X)
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