Commit be0bc6b3 authored by Juan Caneses Marin (nfc)'s avatar Juan Caneses Marin (nfc)
Browse files

Demonstrated correct magnetic compression on all mesh defined quantities

parent 5f6a289f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
&params_nml
! Simulation name:
! ===============
params%fileDescriptor = '2021_03_15b',
params%fileDescriptor = '2021_03_18a',

! Magnetic field input data:
! =========================
+9 −5
Original line number Diff line number Diff line
@@ -303,9 +303,9 @@ TYPE meshTYP
 REAL(r8) , DIMENSION(:), ALLOCATABLE :: zm
 REAL(r8) , DIMENSION(:), ALLOCATABLE :: n, nU, nUE, P11, P22
 REAL(r8) , DIMENSION(:), ALLOCATABLE :: U, Ppar, Pper, Tpar, Tper
 REAL(r8) , DIMENSION(:), ALLOCATABLE :: E, B, dB, ddB
 REAL(r8) , DIMENSION(:), ALLOCATABLE :: E, B, dB, ddB, A
 REAL(r8) , DIMENSION(:), ALLOCATABLE :: unU
 REAL(r8) :: LZ, zmin, zmax, dzm
 REAL(r8) :: LZ, zmin, zmax, dzm, B0
 INTEGER(i4) :: NZmesh
END TYPE meshTYP

@@ -342,6 +342,7 @@ SUBROUTINE AllocateMesh(mesh,params)
   ALLOCATE(mesh%Pper(NZmesh + 4))
   ALLOCATE(mesh%Tpar(NZmesh + 4))
   ALLOCATE(mesh%Tper(NZmesh + 4))
   ALLOCATE(mesh%A(NZmesh + 4))

END SUBROUTINE AllocateMesh

@@ -358,6 +359,7 @@ SUBROUTINE InitializeMesh(mesh,params,fieldspline)
   INTEGER(i4) :: i
   INTEGER(i4), DIMENSION(params%NZmesh+4) :: mg
   REAL(r8), DIMENSION(params%NZmesh+4) :: zmg
   REAL(r8) :: z0

   ! Populate fields:
   mesh%NZmesh   = params%NZmesh
@@ -367,6 +369,7 @@ SUBROUTINE InitializeMesh(mesh,params,fieldspline)
   ! Derived quantities:
   mesh%LZ  = params%zmax - params%zmin
   mesh%dzm = mesh%LZ/mesh%NZmesh
   z0 = 0.;  CALL Interp1(z0,mesh%B0, fieldspline%B)
   m = (/ (i, i=1,mesh%NZmesh, 1) /)

   ! Create mesh:
@@ -388,6 +391,7 @@ SUBROUTINE InitializeMesh(mesh,params,fieldspline)
   mesh%Pper = 0.
   mesh%Tpar = 0.
   mesh%Tper = 0.
   mesh%A    = 0.

   ! Populate E, B, dB and ddB with fieldspline data:
   mg = (/ (i, i=1,mesh%NZmesh+4, 1) /)
@@ -402,7 +406,7 @@ SUBROUTINE InitializeMesh(mesh,params,fieldspline)
   IF (.TRUE.) THEN
	   OPEN(unit=8,file="meshB.txt",form="formatted",status="unknown")
	   DO i = 1,SIZE(zmg)
	 	 WRITE(8,*) zmg(i), mesh%B(i), mesh%dB(i), mesh%ddB(i)
	 	 WRITE(8,*) zmg(i), mesh%B(i), mesh%dB(i), mesh%ddB(i), mesh%A(i)
	   END DO
	   CLOSE(unit=8) 
   END IF
@@ -507,7 +511,7 @@ SUBROUTINE InitializePlasma(plasma,mesh,params)
   CALL InterpolateElectromagneticFields(plasma,mesh,params)

   ! Test interpolate EM fields:
   IF (.TRUE.) THEN
   IF (.FALSE.) THEN
         OPEN(unit=8,file="InterpB.txt",form="formatted",status="unknown")
         DO i = 1,params%NC
                 WRITE(8,*) plasma%zp(i), plasma%Bp(i), plasma%dBp(i), plasma%ddBp(i)
+7 −6
Original line number Diff line number Diff line
@@ -363,7 +363,7 @@ TYPE(paramsTYP), INTENT(IN) :: params
INTEGER(i4) :: i, ix, frame, NZ
INTEGER(i4), DIMENSION(3) :: ixLeft, ixRight
REAL(r8) :: vpar, Ma, Ep, alpha, xip, vper, v, a
REAL(r8), DIMENSION(mesh%NZmesh + 4) :: n, nU, unU, P11, P22, nUE
REAL(r8), DIMENSION(mesh%NZmesh + 4) :: n, nU, unU, P11, P22, nUE, cf

! Initialize local mesh quantities:
n = 0.
@@ -437,12 +437,13 @@ n(ixLeft) = n(4)
n(ixRight) = n(NZ+1)

! Apply magnetic compression:
mesh%n   =  n/params%Area0
mesh%nU  = nU/params%Area0
cf = (mesh%B/mesh%B0)/params%Area0
mesh%n   = n*cf
mesh%nU  = nU*cf
mesh%unU = unU
mesh%P11 = P11/params%Area0
mesh%P22 = P22/params%Area0
mesh%nUE = nUE/params%Area0
mesh%P11 = P11*cf
mesh%P22 = P22*cf
mesh%nUE = nUE*cf

! Apply scaling factor:
mesh%n   = alpha*  mesh%n/mesh%dzm
+0 −2
Original line number Diff line number Diff line
@@ -89,9 +89,7 @@ CALL ComputeFieldSpline(fieldspline)

! Initialize simulation variables:
! ==============================================================================
WRITE(*,*) "Initialize Mesh"
CALL InitializeMesh(mesh,params,fieldspline)
WRITE(*,*) "Initialize Plasma"
CALL InitializePlasma(plasma,mesh,params)

!$OMP PARALLEL