Skip to content

Commit

Permalink
Added BGField contribution when fallback algorithm "CVWM save" is act…
Browse files Browse the repository at this point in the history
…ivated when elements are strongly deformed and TriaTracking yields a different host element than RefMapping (the latter is used for deposition within the reference element).
  • Loading branch information
scopplestone committed Mar 6, 2022
1 parent e83ebb0 commit 865c5cc
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 9 deletions.
2 changes: 1 addition & 1 deletion REGGIE.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Overview of the test cases performed during the nightly regression testing.
| 4 | feature_TWT_recordpoints | maxwell,RK4 | RPs, ExactFlux | nProcs=1,4, RPs, interior TE-Inflow | RP_State, RP_Daata | |
| 5 | NIG_PIC_poisson_plasma_wave | poisson,RK4,CN | Poisson-PIC,Shape-Function-1D for normal, charge conserving and adaptive SF, auto initial LB | nProcs=1,(2), (Imex for CN) | W_el LineIntegration over 2Per | |
| 6 | NIG_PIC_Deposition/Plasma_Ball_cell_volweight_mean | maxwell,RK3 | Maxwell-PIC,CVWM deposition | nProcs=1,5,10 | Particle_ref.csv | [Link](regressioncheck/NIG_PIC_Deposition/Plasma_Ball_cell_volweight_mean/readme.md) |
| 7 | NIG_PIC_Deposition/Plasma_Ball_cell_volweight_mean_save_CVWM | maxwell,RK3 | Maxwell-PIC,CVWM deposition + fallback algorithm | nProcs=1,5,10 | Particle_ref.csv | [Link](regressioncheck/NIG_PIC_Deposition/Plasma_Ball_cell_volweight_mean_save_CVWM/readme.md) |
| 7 | NIG_PIC_Deposition/Plasma_Ball_cell_volweight_mean_save_CVWM | maxwell,RK3 | Maxwell-PIC, CVWM deposition + fallback algorithm + BGField (superB) | nProcs=1,5,10 | Particle_ref.csv | [Link](regressioncheck/NIG_PIC_Deposition/Plasma_Ball_cell_volweight_mean_save_CVWM/readme.md) |
| 8 | NIG_PIC_Deposition/Plasma_Ball_Shape-function-xDir | maxwell,RK3 | Maxwell-PIC,deposition shape_function, shape_function_cc, shape_function_adaptive | nProcs=1,5,10 | PartAnalyze.csv vs. reference | [Link](regressioncheck/NIG_PIC_Deposition/Plasma_Ball_Shape-function-xDir/readme.md) |
| 9 | NIG_PIC_Deposition/Plasma_Ball_Shape-function-yDir | maxwell,RK3 | Maxwell-PIC,deposition shape_function, shape_function_cc, shape_function_adaptive | nProcs=1,5,10 | PartAnalyze.csv vs. reference | [Link](regressioncheck/NIG_PIC_Deposition/Plasma_Ball_Shape-function-yDir/readme.md) |
| 10 | NIG_PIC_Deposition/Plasma_Ball_Shape-function-zDir | maxwell,RK3 | Maxwell-PIC,deposition shape_function, shape_function_cc, shape_function_adaptive | nProcs=1,5,10 | PartAnalyze.csv vs. reference | [Link](regressioncheck/NIG_PIC_Deposition/Plasma_Ball_Shape-function-zDir/readme.md) |
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
! Only 2 elements, therefore max. 2 cores
MPI = 1,2
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,20 @@ PIC-OutputSource = T

CalcHaloInfo = T
CalcMeshInfo = T

! =============================================================================== !
! SuperB
! =============================================================================== !
PIC-BG-Field = T

PIC-CalcBField-OutputVTK = T

NumOfCoils = 1
Coil1-Type = circle
Coil1-BasePoint = (/0.0,0.0,-0.5/)
Coil1-LengthVector = (/0.,0.,1.0/)
Coil1-Current = 1.e-6
Coil1-Radius = 1.9
Coil1-LoopNum = 10
Coil1-PointsPerLoop = 20
Coil1-AxisVec1 = (/0.,0.,1.0/)
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ because one element interface is strongly deformed
- this feature is useful if the Jacobians are determined good enough with N and the integration error is then reduced using a much
higher NAnalyze (in this case the Jacobians are bad from the beginning, which is why the calculation of the error does not improve
much)
- also considers superB magnetic field to test functionality of CVWM fallback in combination with B-field
3 changes: 3 additions & 0 deletions src/particles/pic/interpolation/init_BGField.f90
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,17 @@ SUBROUTINE InitializeBackgroundField
IF(nVar_BField.EQ.3) THEN
BGDataSize=3
IF(TRIM(VarNames(1)).EQ.'BG-ElectricFieldX') THEN
! Ex, Ey, Ez
BGType=1
ELSE IF(TRIM(VarNames(1)).EQ.'BG-MagneticFieldX') THEN
! Bx, By, Bz
BGType=2
ELSE
CALL abort(__STAMP__,'ERROR Background Field: Variable names do not seem to be correct!')
END IF
ELSE
BGDataSize=6
! Ex,Ey,Ez,Bx,By,Bz
BGType=3
END IF

Expand Down
7 changes: 2 additions & 5 deletions src/particles/pic/interpolation/pic_interpolation.f90
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ SUBROUTINE InterpolateFieldToSingleParticle(PartID,FieldAtParticle)
!2. Calculate fields at particle
#if USE_MPI
IF(PEM%LocalElemID(PartID).GT.PP_nElems)THEN! RETURN
CALL abort(&
__STAMP__&
CALL abort(__STAMP__&
,'ERROR: This check used to "RETURN" here but is now set to "ABORT". PEM%LocalElemID(PartID).GT.PP_nElems should not happen here.')
END IF
#endif
Expand All @@ -343,9 +342,7 @@ SUBROUTINE InterpolateFieldToSingleParticle(PartID,FieldAtParticle)
! Add the interpolated electro-(magnetic) field
FieldAtParticle(:) = FieldAtParticle(:) + GetInterpolatedFieldPartPos(PEM%GlobalElemID(PartID),PartID)
CASE DEFAULT
CALL abort(&
__STAMP__&
, 'ERROR: Unknown InterpolationType!')
CALL abort(__STAMP__, 'ERROR: Unknown InterpolationType!')
END SELECT

END SUBROUTINE InterpolateFieldToSingleParticle
Expand Down
25 changes: 22 additions & 3 deletions src/particles/pic/interpolation/pic_interpolation_tools.f90
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,14 @@ PPURE FUNCTION GetEMField(ElemID,PartPosRef_loc)
END FUNCTION GetEMField


FUNCTION GetEMFieldDW(ElemID, PartPos_loc)
PPURE FUNCTION GetEMFieldDW(ElemID, PartPos_loc)
!===================================================================================================================================
! Evaluate the electro-(magnetic) field using the reference position and return the field
!===================================================================================================================================
! MODULES
USE MOD_Mesh_Vars ,ONLY: Elem_xGP
USE MOD_PICInterpolation_Vars ,ONLY: useBGField
USE MOD_Interpolation_Vars ,ONLY: BGField,BGType
USE MOD_Globals
USE MOD_PreProc
#if ! (USE_HDG)
Expand Down Expand Up @@ -313,7 +314,7 @@ FUNCTION GetEMFieldDW(ElemID, PartPos_loc)
! LOCAL VARIABLES
REAL :: HelperU(1:6,0:PP_N,0:PP_N,0:PP_N)
REAL :: PartDistDepo(0:PP_N,0:PP_N,0:PP_N), DistSum
INTEGER :: k,l,m
INTEGER :: k,l,m,ind1,ind2
REAL :: norm
!===================================================================================================================================
GetEMFieldDW(1:6)=0.
Expand Down Expand Up @@ -367,7 +368,25 @@ FUNCTION GetEMFieldDW(ElemID, PartPos_loc)
GetEMFieldDW(1:6) = GetEMFieldDW(1:6) + PartDistDepo(k,l,m)/DistSum*HelperU(1:6,k,l,m)
END DO; END DO; END DO

IF(useBGField) CALL abort(__STAMP__,' ERROR BG Field not implemented for GetEMFieldDW!')
! Check whether magnetic background field is activated (superB)
IF(useBGField)THEN
! Check BG type and set dimensions
SELECT CASE(BGType)
CASE(1) ! Ex,Ey,Ez
ind1 = 1
ind2 = 3
CASE(2) ! Bx,By,Bz
ind1 = 4
ind2 = 6
CASE(3) ! Ex,Ey,Ez,Bx,By,Bz
ind1 = 1
ind2 = 6
END SELECT
! Add contribution of the magnetic field
DO k = 0, PP_N; DO l=0, PP_N; DO m=0, PP_N
GetEMFieldDW(ind1:ind2) = GetEMFieldDW(ind1:ind2) + PartDistDepo(k,l,m)/DistSum*BGField(ind1:ind2,k,l,m,ElemID)
END DO; END DO; END DO
END IF ! useBGField

END FUNCTION GetEMFieldDW

Expand Down

0 comments on commit 865c5cc

Please sign in to comment.