1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv! 2 ! ! 3 ! Subroutine: CHECK_IC_DEM ! 4 ! Author: R.Garg Date: 11-Mar-14 ! 5 ! ! 6 ! Purpose: check the initial conditions input section for DEM model ! 7 ! - calculate the number of particles needed to initialize the ! 8 ! DEM model ! 9 ! ! 10 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 11 SUBROUTINE CHECK_IC_DEM 12 13 ! Global variables 14 !---------------------------------------------------------------------// 15 ! Runtime Flag: Generate initial particle configuration. 16 USE discretelement, only : gener_part_config 17 ! Simulation dimension (2D/3D) 18 USE discretelement, only: DIMN 19 ! Number of DEM solids phases. 20 USE discretelement, only: DES_MMAX 21 ! runtime flag to specify if the simulation uses both discrete/continuum 22 ! solids 23 USE discretelement, only: DES_CONTINUUM_HYBRID 24 25 ! direction wise spans of the domain and grid spacing in each direction 26 Use geometry, only: zlength 27 ! Use the error manager for posting error messages. 28 use error_manager 29 30 use physprop, only: mmax, d_p0 31 use toleranc 32 33 implicit none 34 ! Local variables 35 !---------------------------------------------------------------------// 36 integer :: dm 37 !......................................................................! 38 39 ! Initialize the error manager. 40 CALL INIT_ERR_MSG("CHECK_IC_DEM") 41 42 ! Determine the domain volume which is used to calculate the total 43 ! number of particles and the number of particles in each phase. 44 ! Values of DZ(1) or zlength are guaranteed at this point due to 45 ! check_geometry_prereqs. If the user left both undefined and 46 ! NO_K = .T., then they are set to ONE. If dz(1) is undefined but 47 ! zlength is defined, then dz(1) is set to zlength (and vice versa). 48 ! If both are defined they must be equal. 49 IF(DIMN.EQ.2) THEN 50 IF (DES_MMAX.EQ.1) THEN 51 ! account for a possible offset index when using d_p0 and ro_s. 52 DM = MMAX+1 53 ! Warn the user if the domain depth is not equal to the particle 54 ! diameter as it may cause problems for coupled simulations. 55 ! The user should also be aware of this when interpreting 56 ! volume/void fraction calculations (including bulk density). 57 IF(.NOT.COMPARE(ZLENGTH,D_P0(DM))) THEN 58 WRITE(ERR_MSG, 1000) iVal(d_p0(DM)) 59 CALL FLUSH_ERR_MSG 60 ENDIF 61 ELSE 62 ! Let the user know basis of depth dimension for calculating number of 63 ! particles. this will also be important when considering volume/void 64 ! fraction calculations. 65 WRITE(ERR_MSG, 1001) 66 CALL FLUSH_ERR_MSG 67 ENDIF 68 ENDIF 69 70 71 1000 FORMAT(' Message: ',& 72 'WARNING: zlength or dz(1) is used to calculate the ',& 73 'number of particles in the 2D simulation when ',& 74 'GENER_PART_CONFIG is T and DIMN = 2.',/10X,'This depth ',& 75 'does not equal D_P0 = ', A, '.') 76 77 1001 FORMAT(' Message: ',& 78 'WARNING: zlength or dz(1) is used to calculate the ',& 79 'number of particles in the 2D simulation when ',& 80 'GENER_PART_CONFIG is T and DIMN = 2.') 81 82 83 IF (Gener_part_config.and.DES_CONTINUUM_HYBRID) THEN 84 WRITE(ERR_MSG, 999) 85 CALL FLUSH_ERR_MSG(ABORT=.TRUE.) 86 ENDIF 87 88 999 format('Error # 999: Gener_part_config set to', & 89 ' true for DES_continuum hybrid', /, & 90 ' This is not allowed, specify the initial particle', & 91 ' configuration explicitly', /, & 92 ' See MFIX readme', /, & 93 ' Please correct the data file.') 94 95 CALL FINL_ERR_MSG 96 97 END SUBROUTINE CHECK_IC_DEM 98