Skip to content

Commit

Permalink
new tutorial (packingPolydisperse) added.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidrezanorouzi committed Dec 10, 2020
1 parent ff3d2af commit 123841d
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 20 deletions.
4 changes: 3 additions & 1 deletion ProgramDefinedGeometry.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ subroutine ProgramDefinedGeometry( Geom )
type(CylinderWall) cyl
logical res

! Creates a cylindrical shell with radius 7.5 cm and length 20 cm whose main axis is y.
! Creates a cylindrical shell with radius 7.5 cm and length 20 cm whose main axis is y-axis.
! the property type is 1
! the user_id of this shell wall is 1
res = cyl%CreateCylinder( 0.075_RK, 0.075_RK, p_line( real3(0.0, 0.0, 0.0), real3(0.0,0.2,0.0) ),24, 1, 1 )
call Geom%add_Cylinder( cyl )


! a plane with width of 15 cm with normal vector of (0,1,0).
! this plane is placed at the bottom of the cylinder shell.
! the property type is 1
Expand All @@ -44,5 +45,6 @@ subroutine ProgramDefinedGeometry( Geom )
p3 = real3( 0.075, 0, 0.075)
p4 = real3( 0.075, 0, -0.075)
call Geom%add_PlaneWall( p1, p2, p3, p4, 1, 1 )


end subroutine
3 changes: 2 additions & 1 deletion User_Mark.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ function User_Mark( id, flag, ptype, dpos ) result (mark)


return



end function
Binary file modified cemfDEM
Binary file not shown.
49 changes: 31 additions & 18 deletions main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ program main
implicit none

integer(IK) i
real(RK) Y, pr
real(RK) Y, pr, G
logical res
type(real3) minDomain, maxDomain
type(PS_Distribution), pointer:: PSD
Expand All @@ -43,55 +43,68 @@ program main
! options and settings for DEM simulation
DEM_opt%gravity = real3( 0.0, -9.8 , 0.0 )
DEM_opt%SaveFreq = 1000
DEM_opt%RunName = "PackingMono"
DEM_opt%RunName = "PackingBinary"
DEM_opt%Res_Dir = "./Results/"
DEM_opt%OutputFileType = OP_Type_VTK + OP_Type_Tec
DEM_opt%OutputFileType = OP_Type_VTK !+ OP_Type_Tec
DEM_opt%CT_model = CTM_ConstantTorque
DEM_opt%CF_Type = CFT_LSD_l
DEM_opt%CS_Method = CSM_NBS_Munjiza !_Hrchl !
DEM_opt%CS_Method = CSM_NBS_Munjiza_Hrchl ! for a system with size distribution
DEM_opt%PI_Method = PIM_AB3AM4
DEM_opt%PRI_Method= PIM_AB3AM4

!// properties of particles and walls
!//// properties of particles and walls
Y = 1000000.0_RK ! Young's modulus
pr = 0.23_RK ! Poisson's ratio
call prop%set_prop(2500.0_RK, Y , Y/(2*(1+pr)), pr , 0.0_RK)
pr = 0.23_RK ! Poisson's ratio
G = Y/(2*(1+pr)) ! shear modulus
call prop%set_prop(2500.0_RK, Y , G , pr , 0.0_RK)

! mono-sized particles, 8000 particles with size of 7 mm.
!//// particles
allocate(PSD)
PSD = PS_Distribution( 8000 , PSD_Uniform, 1 , 0.007_RK, 0.007_RK )

! associates particle size distribution with property
! bimodal particles with d1 = 7 mm and d2 = 3.5 mm
! total number of particles is (7+8)*1000 = 15K
!PSD = (PS_Distribution( 7 , PSD_Uniform, 1 , 0.007_RK, 0.007_RK ) + &
! PS_Distribution( 8 , PSD_Uniform, 1 , 0.0035_RK, 0.0035_RK ) ) * 1000

!particles with uniform size distribution
!Size range of particles is between 3 and 7.5 mm which are classified into 5 bins
PSD = PS_Distribution( 15000 , PSD_Uniform, 5 , 0.003_RK, 0.0075_RK )

! associates particle size distribution with a property set
allocate(PSDP)
PSDP = PSD_Property( PSD , prop )
deallocate(PSD)

!//// main components of DEM system

!// main components of DEM system
!//// geometry
allocate(geom)
call ProgramDefinedGeometry(geom)
call ProgramDefinedGeometry(geom)

!//// Property
allocate( Property )
call Property%ParticleProperty( PSDP ) ! particles
call Property%WallProperty(1 , (/prop/) ) ! walls
call Property%PP_BinaryProp(DEM_opt, 0.2_RK, 0.1_RK, 0.8_RK, 0.8_RK) ! binary pp
call Property%PW_BinaryProp(DEM_opt, 0.3_RK, 0.1_RK, 0.8_RK, 0.8_RK) ! binary pw

!//// DEM system with particle insertion
! simulation domain
minDomain = real3(-0.08, -0.01, -0.08)
maxDomain = real3( 0.08 , 0.21 , 0.08)
minDomain = real3(-0.077, -0.01, -0.077)
maxDomain = real3( 0.077 , 0.21 , 0.077)

! insertion plane
p1 = real3(-0.05, 0.18, -0.05)
p2 = real3(-0.05, 0.18, 0.05)
p3 = real3( 0.05, 0.18, 0.05)
p4 = real3( 0.05, 0.18, -0.05)
res = insPlane%CreateWall_nv(p4,p3,p2,p1)

! initializes DEM system, dt = 0.00001 s, insert in 130 k iterations with initial velocity of 0.2 m/s
call DEM%Initialize( 0.00001_RK, PSDP, insPlane, 130000 , 0.2_RK ,geom, Property, minDomain, maxDomain, DEM_opt )
! initializes DEM system, dt = 0.00001 sec, particles are inserted in 150k iterations with initial velocity of 0.3 m
call DEM%Initialize( 0.00001_RK, PSDP, insPlane, 150000 , 0.3_RK ,geom, Property, minDomain, maxDomain, DEM_opt )


!//// iteration loop for 2.5 seconds
!//// iteration loop for 2.5 seconds
call DEM%iterate(250000)


end program
50 changes: 50 additions & 0 deletions tutorials/packingPolydisperse/ProgramDefinedGeometry.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
!-------------- cemfDEM code: a dem simulation code ----------------------------
! D C enter of
! D M E ngineering and
! D M M ultiscale modeling of
! D M F luid flow
! EEEEEEEEM .ir
!------------------------------------------------------------------------------
! Copyright (C): cemf
! website: www.cemf.ir
!------------------------------------------------------------------------------
! This file is part of cemfDEM code. It is a free software for simulating
! granular flow. You can redistribute it and/or modify it under the terms of
! GNU General Public License version 3 or any other later versions.
!
! cemfDEM code is distributed to help others in their research in the field
! of granular flow, but WITHOUT ANY WARRANTY; without even the implied
! warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!------------------------------------------------------------------------------

subroutine ProgramDefinedGeometry( Geom )
use g_Geometry
use g_Line
implicit none
class(Geometry),intent(in):: Geom

!// locals
type(real3) p1, p2, p3, p4
type(PlaneWall) plane
type(CylinderWall) cyl
logical res

! Creates a cylindrical shell with radius 7.5 cm and length 20 cm whose main axis is y-axis.
! the property type is 1
! the user_id of this shell wall is 1
res = cyl%CreateCylinder( 0.075_RK, 0.075_RK, p_line( real3(0.0, 0.0, 0.0), real3(0.0,0.2,0.0) ),24, 1, 1 )
call Geom%add_Cylinder( cyl )


! a plane with width of 15 cm with normal vector of (0,1,0).
! this plane is placed at the bottom of the cylinder shell.
! the property type is 1
! the user_id of this plane is 1
p1 = real3( -0.075, 0, -0.075)
p2 = real3( -0.075, 0, 0.075)
p3 = real3( 0.075, 0, 0.075)
p4 = real3( 0.075, 0, -0.075)
call Geom%add_PlaneWall( p1, p2, p3, p4, 1, 1 )


end subroutine
35 changes: 35 additions & 0 deletions tutorials/packingPolydisperse/User_Mark.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
!-------------- cemfDEM code: a dem simulation code ----------------------------
! D C enter of
! D M E ngineering and
! D M M ultiscale modeling of
! D M F luid flow
! EEEEEEEEM .ir
!------------------------------------------------------------------------------
! Copyright (C): cemf
! website: www.cemf.ir
!------------------------------------------------------------------------------
! This file is part of cemfDEM code. It is a free software for simulating
! granular flow. You can redistribute it and/or modify it under the terms of
! GNU General Public License version 3 or any other later versions.
!
! cemfDEM code is distributed to help others in their research in the field
! of granular flow, but WITHOUT ANY WARRANTY; without even the implied
! warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!------------------------------------------------------------------------------

function User_Mark( id, flag, ptype, dpos ) result (mark)
use g_TypeDef
implicit none

integer(IK),intent(in):: id, flag, ptype
type(real4),intent(in):: dpos
integer(IK) mark


mark = 1


return


end function
110 changes: 110 additions & 0 deletions tutorials/packingPolydisperse/main.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
!-------------- cemfDEM code: a dem simulation code ----------------------------
! D C enter of
! D M E ngineering and
! D M M ultiscale modeling of
! D M F luid flow
! EEEEEEEEM .ir
!------------------------------------------------------------------------------
! Copyright (C): cemf
! website: www.cemf.ir
!------------------------------------------------------------------------------
! This file is part of cemfDEM code. It is a free software for simulating
! granular flow. You can redistribute it and/or modify it under the terms of
! GNU General Public License version 3 or any other later versions.
!
! cemfDEM code is distributed to help others in their research in the field
! of granular flow, but WITHOUT ANY WARRANTY; without even the implied
! warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!------------------------------------------------------------------------------

program main

use g_DEMSystem
use g_stl_reader
use g_Prtcl_PureProperty
implicit none

integer(IK) i
real(RK) Y, pr, G
logical res
type(real3) minDomain, maxDomain
type(PS_Distribution), pointer:: PSD
type(PSD_Property), pointer:: PSDP
class(PhysicalProperty),pointer:: Property
class(Geometry), pointer:: geom
type(real3) p1, p2, p3, p4
type(PlaneWall) insPlane
type(PureProperty) prop
type(DEMS_Options) DEM_opt
type(DEMSystem) DEM

!//// Initial settings

! options and settings for DEM simulation
DEM_opt%gravity = real3( 0.0, -9.8 , 0.0 )
DEM_opt%SaveFreq = 1000
DEM_opt%RunName = "PackingBinary"
DEM_opt%Res_Dir = "./Results/"
DEM_opt%OutputFileType = OP_Type_VTK !+ OP_Type_Tec
DEM_opt%CT_model = CTM_ConstantTorque
DEM_opt%CF_Type = CFT_LSD_l
DEM_opt%CS_Method = CSM_NBS_Munjiza_Hrchl ! for a system with size distribution
DEM_opt%PI_Method = PIM_AB3AM4
DEM_opt%PRI_Method= PIM_AB3AM4

!//// properties of particles and walls
Y = 1000000.0_RK ! Young's modulus
pr = 0.23_RK ! Poisson's ratio
G = Y/(2*(1+pr)) ! shear modulus
call prop%set_prop(2500.0_RK, Y , G , pr , 0.0_RK)

!//// particles
allocate(PSD)

! bimodal particles with d1 = 7 mm and d2 = 3.5 mm
! total number of particles is (7+8)*1000 = 15K
!PSD = (PS_Distribution( 7 , PSD_Uniform, 1 , 0.007_RK, 0.007_RK ) + &
! PS_Distribution( 8 , PSD_Uniform, 1 , 0.0035_RK, 0.0035_RK ) ) * 1000

!particles with uniform size distribution
!Size range of particles is between 3 and 7.5 mm which are classified into 5 bins
PSD = PS_Distribution( 15000 , PSD_Uniform, 5 , 0.003_RK, 0.0075_RK )

! associates particle size distribution with a property set
allocate(PSDP)
PSDP = PSD_Property( PSD , prop )
deallocate(PSD)

!// main components of DEM system
!//// geometry
allocate(geom)
call ProgramDefinedGeometry(geom)

!//// Property
allocate( Property )
call Property%ParticleProperty( PSDP ) ! particles
call Property%WallProperty(1 , (/prop/) ) ! walls
call Property%PP_BinaryProp(DEM_opt, 0.2_RK, 0.1_RK, 0.8_RK, 0.8_RK) ! binary pp
call Property%PW_BinaryProp(DEM_opt, 0.3_RK, 0.1_RK, 0.8_RK, 0.8_RK) ! binary pw

!//// DEM system with particle insertion
! simulation domain
minDomain = real3(-0.077, -0.01, -0.077)
maxDomain = real3( 0.077 , 0.21 , 0.077)

! insertion plane
p1 = real3(-0.05, 0.18, -0.05)
p2 = real3(-0.05, 0.18, 0.05)
p3 = real3( 0.05, 0.18, 0.05)
p4 = real3( 0.05, 0.18, -0.05)
res = insPlane%CreateWall_nv(p4,p3,p2,p1)

! initializes DEM system, dt = 0.00001 sec, particles are inserted in 150k iterations with initial velocity of 0.3 m
call DEM%Initialize( 0.00001_RK, PSDP, insPlane, 150000 , 0.3_RK ,geom, Property, minDomain, maxDomain, DEM_opt )


!//// iteration loop for 2.5 seconds
call DEM%iterate(250000)


end program
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 123841d

Please sign in to comment.