This work presents computer simulation tools that use a coupled discrete- niternelement methods for the modeling of granular materials. The simulation providesrna new insight (perspective) in understanding the behavior of granular media at arnmicroscopic level.It introduces and implements prevailing methods of computer sim-rnulation to examine the internal dynamics of granular material that are typically notrnamenable to direct observations in the laboratory and eld investigations. The sim-rnulation techniques are implemented using an object-oriented programming approachrnvia C++ and python in the open-source Linux package YADE.rnThe fundamental formulation of DEM ,FEM and the coupling scheme of discrete-rn nite element methods is presented. Along with Discrete Element soil sample andrnpacking generation algorithms are discussed. Among the proposed packing algo-rnrithms, Multi-layer under compaction packing process is adopted since it mimicsrnthe natural layer-by-layer depositing process of granular materials . Accordingly, anrnalgorithm is presented and coded in the platform (YADE). Then the generated DErnsoil sample is used to simulate a series of direct shear tests.rnThe microscopic view of Direct Shear Test (DST) is studied on the shear behaviorrnof dense and loose sand. The output results of the numerical simulation is validatedrnwith laboratory DST. The deformation pattern, stress-strain relationship, and changernare analyzed.The DEM assemblies with porosity =0.65 (dense sand) shows strainrnsoftening and volumetric dilation behavior. While strain hardening and volumetricrncontraction is observed for the assemblies with porosity =0.8 (loose sand) which isrnthe typical shear behavior of Dense and loose sand in laboratory DST.Furthermore,rnthe deformation pattern observed in the simulation is localized within the shear zonernof the sample which is comparable to observations from the laboratory Direct ShearrnTest. when the shear stress arrives at a steady-state after large shear displacement,rnthe soils inside the shear band reach a critical state while the entire sample doesn't.rnThe critical properties of the sand in DST should be investigated from the shear bandrninstead of the entire sample. This property is di cult to capture in laboratory DSTrnhowever the simulations allow us to resolve the limitation.Finally, a technical manualrnfor the development process of computer simulation tools to provide an e cientrnapproach for solving coupled discrete- nite geotechnical problems is presented.