We present a new numerical approach for estimating filtration through porous media from first principles. We numerically simulate particle motion as arises in a carrier gas flow. The filtration we look at occurs due to impaction of particles with obstructing surfaces that are contained in the solid filter. We consider the case when the motion of particles is governed by linear Stokes-drag, which is characterized by the particle relaxation time. The gas-particle interaction is modeled by using the Eulerian-Lagrangian approach and one-way coupling of the phases. In this case the carrier flow drags along the particles, without being affected by the motion of the particles. The gas flow is governed by Navier-Stokes equations for incompressible fluids and is calculated numerically using finite-volume discretization that is based on an energy conserving skew-symmetric discretization. We apply an immersed boundary (IB) method to capture the detailed flow in the porous filter, in which we explicitly incorporate flow around all small-scale features that make up the inner structure of the porous filter. To validate and develop our method we consider a porous medium composed of a staggered arrangement of square rods in 3D, which was already extensively considered in the literature for flow computation. This is a stepping-stone case on the way of simulating filtration of aerosol particles in complex, realistic filters. Based on results of our simulations we investigate the decay of the number of particles as a function of time. We focus on the dependence of the decay-rate on the Reynolds number of the gas and the inertial effects of the particles. For a range of particle relaxation times we observe a strong influence of the Reynolds number on filtration rate. A non-monotonic dependence of the filtration efficiency on Stokes number at different flow conditions is observed, hinting at qualitative differences in the motion of the aerosol ensemble through the structured filter.