diff --git a/regressioncheck/CHE_poisson/SurfFlux_ThermionicEmission_Schottky/parameter.ini b/regressioncheck/CHE_poisson/SurfFlux_ThermionicEmission_Schottky/parameter.ini index 5f25f34a2..d04cc4703 100644 --- a/regressioncheck/CHE_poisson/SurfFlux_ThermionicEmission_Schottky/parameter.ini +++ b/regressioncheck/CHE_poisson/SurfFlux_ThermionicEmission_Schottky/parameter.ini @@ -87,7 +87,7 @@ BPO-Species = (/1/) ! electrons ! =============================================================================== ! Part-Species1-MassIC = 9.11E-31 Part-Species1-ChargeIC = -1.60217653E-19 -Part-Species1-MacroParticleFactor = 2E4 +Part-Species1-MacroParticleFactor = 1E4 Part-Species1-nSurfaceFluxBCs=1 Part-Species1-Surfaceflux1-BC=2 diff --git a/src/particles/boundary/particle_boundary_init.f90 b/src/particles/boundary/particle_boundary_init.f90 index 51bab910c..460a0db9d 100644 --- a/src/particles/boundary/particle_boundary_init.f90 +++ b/src/particles/boundary/particle_boundary_init.f90 @@ -209,6 +209,10 @@ SUBROUTINE InitializeVariablesPartBoundary() PartBound%TargetBoundCond = -1 ALLOCATE(PartBound%MomentumACC( 1:nPartBound)) PartBound%MomentumACC = -1 +ALLOCATE(PartBound%OnlySpecular( 1:nPartBound)) +PartBound%OnlySpecular = .FALSE. +ALLOCATE(PartBound%OnlyDiffuse( 1:nPartBound)) +PartBound%OnlyDiffuse = .FALSE. ALLOCATE(PartBound%WallTemp( 1:nPartBound)) PartBound%WallTemp = -1. ALLOCATE(PartBound%WallTemp2( 1:nPartBound)) @@ -299,6 +303,11 @@ SUBROUTINE InitializeVariablesPartBoundary() #endif PartBound%TargetBoundCond(iPartBound) = PartBound%ReflectiveBC PartBound%MomentumACC(iPartBound) = GETREAL('Part-Boundary'//TRIM(hilf)//'-MomentumACC') + IF(PartBound%MomentumACC(iPartBound).EQ.0.0) THEN + PartBound%OnlySpecular(iPartBound) = .TRUE. + ELSE IF(PartBound%MomentumACC(iPartBound).EQ.1.0) THEN + PartBound%OnlyDiffuse(iPartBound) = .TRUE. + END IF PartBound%WallTemp(iPartBound) = GETREAL('Part-Boundary'//TRIM(hilf)//'-WallTemp') PartBound%TransACC(iPartBound) = GETREAL('Part-Boundary'//TRIM(hilf)//'-TransACC') PartBound%VibACC(iPartBound) = GETREAL('Part-Boundary'//TRIM(hilf)//'-VibACC') @@ -1122,6 +1131,8 @@ SUBROUTINE FinalizeParticleBoundary() SDEALLOCATE(PartBound%SourceBoundName) SDEALLOCATE(PartBound%TargetBoundCond) SDEALLOCATE(PartBound%MomentumACC) +SDEALLOCATE(PartBound%OnlySpecular) +SDEALLOCATE(PartBound%OnlyDiffuse) SDEALLOCATE(PartBound%WallTemp) SDEALLOCATE(PartBound%WallTemp2) SDEALLOCATE(PartBound%WallTempDelta) diff --git a/src/particles/boundary/particle_boundary_vars.f90 b/src/particles/boundary/particle_boundary_vars.f90 index c09697f27..0ddad36a7 100644 --- a/src/particles/boundary/particle_boundary_vars.f90 +++ b/src/particles/boundary/particle_boundary_vars.f90 @@ -257,6 +257,8 @@ MODULE MOD_Particle_Boundary_Vars INTEGER , ALLOCATABLE :: MapToFieldBC(:) ! Map from Particle BC (NOT TO TYPE!) to PICLas BCindex !!INTEGER , ALLOCATABLE :: SideBCType(:) ! list with boundary condition for each side REAL , ALLOCATABLE :: MomentumACC(:) + LOGICAL , ALLOCATABLE :: OnlySpecular(:) + LOGICAL , ALLOCATABLE :: OnlyDiffuse(:) REAL , ALLOCATABLE :: WallTemp(:), WallTemp2(:), WallTempDelta(:) REAL , ALLOCATABLE :: TempGradStart(:,:), TempGradEnd(:,:), TempGradVec(:,:) REAL , ALLOCATABLE :: TransACC(:) diff --git a/src/particles/dsmc/dsmc_symmetry.f90 b/src/particles/dsmc/dsmc_symmetry.f90 index ccfeec989..d4f9997b9 100644 --- a/src/particles/dsmc/dsmc_symmetry.f90 +++ b/src/particles/dsmc/dsmc_symmetry.f90 @@ -84,15 +84,16 @@ SUBROUTINE DSMC_2D_InitVolumes() USE MOD_Particle_Mesh_Vars ,ONLY: GEO,LocalVolume,MeshVolume USE MOD_DSMC_Vars ,ONLY: SymmetrySide USE MOD_Particle_Mesh_Vars ,ONLY: ElemVolume_Shared,ElemCharLength_Shared -USE MOD_Particle_Mesh_Vars ,ONLY: NodeCoords_Shared,ElemSideNodeID_Shared, SideInfo_Shared +USE MOD_Particle_Mesh_Vars ,ONLY: NodeCoords_Shared,ElemSideNodeID_Shared, SideInfo_Shared, SideIsSymSide_Shared USE MOD_Mesh_Tools ,ONLY: GetCNElemID +USE MOD_Particle_Mesh_Vars ,ONLY: nNonUniqueGlobalSides USE MOD_Particle_Mesh_Tools ,ONLY: GetGlobalNonUniqueSideID USE MOD_Particle_Surfaces ,ONLY: CalcNormAndTangTriangle #if USE_MPI -USE MOD_MPI_Shared ,ONLY: BARRIER_AND_SYNC +USE MOD_MPI_Shared USE MOD_MPI_Shared_Vars ,ONLY: MPI_COMM_SHARED USE MOD_Particle_Mesh_Vars ,ONLY: offsetComputeNodeElem -USE MOD_Particle_Mesh_Vars ,ONLY: ElemVolume_Shared_Win,ElemCharLength_Shared_Win +USE MOD_Particle_Mesh_Vars ,ONLY: ElemVolume_Shared_Win,ElemCharLength_Shared_Win,SideIsSymSide_Shared_Win USE MOD_MPI_Shared_Vars ,ONLY: myComputeNodeRank,MPI_COMM_LEADERS_SHARED #endif /*USE_MPI*/ ! IMPLICIT VARIABLE HANDLING @@ -113,13 +114,14 @@ SUBROUTINE DSMC_2D_InitVolumes() !=================================================================================================================================== #if USE_MPI -FirstElem = offsetElem - offsetComputeNodeElem + 1 -LastElem = offsetElem - offsetComputeNodeElem + nElems +CALL Allocate_Shared((/nNonUniqueGlobalSides/),SideIsSymSide_Shared_Win,SideIsSymSide_Shared) +CALL MPI_WIN_LOCK_ALL(0,SideIsSymSide_Shared_Win,IERROR) #else -firstElem = 1 -lastElem = nElems +ALLOCATE(SideIsSymSide_Shared(nNonUniqueGlobalSides)) #endif /*USE_MPI*/ +SideIsSymSide_Shared = .FALSE. + SymmetryBCExists = .FALSE. ALLOCATE(SymmetrySide(1:nElems,1:2)) ! 1: GlobalSide, 2: LocalSide SymmetrySide = -1 @@ -137,6 +139,8 @@ SUBROUTINE DSMC_2D_InitVolumes() iLocSide = SideToElem(S2E_LOC_SIDE_ID,BCSideID) SideID=GetGlobalNonUniqueSideID(offsetElem+locElemID,iLocSide) IF (PartBound%TargetBoundCond(PartBound%MapToPartBC(SideInfo_Shared(SIDE_BCID,SideID))).EQ.PartBound%SymmetryBC) THEN + ! Mark side to skip in tracking + SideIsSymSide_Shared(SideID) = .TRUE. CNElemID = GetCNElemID(SideInfo_Shared(SIDE_ELEMID,SideID)) iLocSide = SideInfo_Shared(SIDE_LOCALID,SideID) ! Exclude the symmetry axis (y=0) @@ -177,14 +181,25 @@ SUBROUTINE DSMC_2D_InitVolumes() END IF END DO + IF(.NOT.SymmetryBCExists) THEN CALL abort(__STAMP__& ,'At least one symmetric BC (in the xy-plane) has to be defined for 2D simulations') END IF ! LocalVolume & MeshVolume: Recalculate the volume of the mesh of a single process and the total mesh volume +#if USE_MPI +FirstElem = offsetElem - offsetComputeNodeElem + 1 +LastElem = offsetElem - offsetComputeNodeElem + nElems +#else +firstElem = 1 +lastElem = nElems +#endif /*USE_MPI*/ + LocalVolume = SUM(ElemVolume_Shared(FirstElem:LastElem)) + #if USE_MPI +CALL BARRIER_AND_SYNC(SideIsSymSide_Shared_Win ,MPI_COMM_SHARED) CALL BARRIER_AND_SYNC(ElemVolume_Shared_Win ,MPI_COMM_SHARED) CALL BARRIER_AND_SYNC(ElemCharLength_Shared_Win,MPI_COMM_SHARED) ! Compute-node mesh volume diff --git a/src/particles/particle_mesh/particle_mesh_readin.f90 b/src/particles/particle_mesh/particle_mesh_readin.f90 index 0ace4a412..4ad065c6d 100644 --- a/src/particles/particle_mesh/particle_mesh_readin.f90 +++ b/src/particles/particle_mesh/particle_mesh_readin.f90 @@ -465,6 +465,7 @@ SUBROUTINE FinalizeMeshReadin() #endif /*USE_MPI*/ ! Then, free the pointers or arrays +ADEALLOCATE(SideIsSymSide_Shared) ADEALLOCATE(ElemVolume_Shared) ADEALLOCATE(ElemCharLength_Shared) diff --git a/src/particles/particle_mesh/particle_mesh_vars.f90 b/src/particles/particle_mesh/particle_mesh_vars.f90 index b6b03604d..9ff537165 100644 --- a/src/particles/particle_mesh/particle_mesh_vars.f90 +++ b/src/particles/particle_mesh/particle_mesh_vars.f90 @@ -169,8 +169,10 @@ MODULE MOD_Particle_Mesh_Vars REAL,ALLOCPOINT :: ElemCharLengthX_Shared(:) REAL,ALLOCPOINT :: ElemCharLengthY_Shared(:) REAL,ALLOCPOINT :: ElemCharLengthZ_Shared(:) +LOGICAL,ALLOCPOINT :: SideIsSymSide_Shared(:) #if USE_MPI +INTEGER :: SideIsSymSide_Shared_Win ! integers to hold shared memory windows INTEGER :: NodeToElemMapping_Shared_Win INTEGER :: NodeToElemInfo_Shared_Win diff --git a/src/particles/surfacemodel/surfacemodel_main.f90 b/src/particles/surfacemodel/surfacemodel_main.f90 index cd8abe045..e690b7ee0 100644 --- a/src/particles/surfacemodel/surfacemodel_main.f90 +++ b/src/particles/surfacemodel/surfacemodel_main.f90 @@ -287,18 +287,18 @@ SUBROUTINE MaxwellScattering(PartID,SideID,n_loc,SpecularReflectionOnly_opt) ACC = PartBound%MomentumACC(iBC) ! Check if optional parameter was supplied -ASSOCIATE( SpecularReflectionOnly => MERGE(SpecularReflectionOnly_opt, .FALSE., PRESENT(SpecularReflectionOnly_opt)) ) - IF (SpecularReflectionOnly.OR.ACC.EQ.0.0) THEN +ASSOCIATE( SpecularReflectionOnly => MERGE(SpecularReflectionOnly_opt,PartBound%OnlySpecular(iBC),PRESENT(SpecularReflectionOnly_opt))) + IF (SpecularReflectionOnly) THEN CALL PerfectReflection(PartID,SideID,n_loc) - ELSE IF(ACC.LT.1.0) THEN + ELSE IF(PartBound%OnlyDiffuse(iBC)) THEN + CALL DiffuseReflection(PartID,SideID,n_loc) + ELSE CALL RANDOM_NUMBER(RanNum) IF(RanNum.GE.ACC) THEN CALL PerfectReflection(PartID,SideID,n_loc) ELSE CALL DiffuseReflection(PartID,SideID,n_loc) END IF - ELSE - CALL DiffuseReflection(PartID,SideID,n_loc) END IF END ASSOCIATE diff --git a/src/particles/tracking/particle_triatracking.f90 b/src/particles/tracking/particle_triatracking.f90 index c95ddb6ba..90be606e9 100644 --- a/src/particles/tracking/particle_triatracking.f90 +++ b/src/particles/tracking/particle_triatracking.f90 @@ -54,6 +54,7 @@ SUBROUTINE ParticleTriaTracking() USE MOD_Mesh_Tools ,ONLY: GetCNElemID USE MOD_Particle_Vars ,ONLY: PEM,PDM,PartSpecies USE MOD_Particle_Vars ,ONLY: PartState,LastPartPos +USE MOD_Particle_Vars ,ONLY: Symmetry USE MOD_Particle_Mesh_Tools ,ONLY: ParticleInsideQuad3D USE MOD_Particle_Mesh_Vars USE MOD_Particle_Tracking_vars ,ONLY: ntracks,MeasureTrackTime,CountNbrOfLostParts, NbrOfLostParticles, TrackInfo @@ -154,6 +155,10 @@ SUBROUTINE ParticleTriaTracking() nlocSides = ElemInfo_Shared(ELEM_LASTSIDEIND,ElemID) - ElemInfo_Shared(ELEM_FIRSTSIDEIND,ElemID) DO iLocSide=1,nlocSides TempSideID = ElemInfo_Shared(ELEM_FIRSTSIDEIND,ElemID) + iLocSide + ! Skip symmetry side + IF(Symmetry%Order.EQ.2) THEN + IF(SideIsSymSide_Shared(TempSideID)) CYCLE + END IF localSideID = SideInfo_Shared(SIDE_LOCALID,TempSideID) ! Side is not one of the 6 local sides