This paper proposes mathematical models of the microwave heating process of dielectric materials filled in a rectangular waveguide with a resonator. A microwave system supplies a monochromatic wave in a fundamental mode ($TE10$ mode). A convection exchange at the upper surface of the sample is considered. The effects of resonator distance and operating frequency on distributions of electromagnetic fields inside the waveguide, temperature profile, and flow pattern within the sample are investigated. The finite-difference time-domain method is used to determine the electromagnetic field distribution in a microwave cavity by solving the transient Maxwell equations. The finite control volume method based on the SIMPLE algorithm is used to predict the heat transfer and fluid flow model. Two dielectric materials, saturated porous medium and water, are chosen to display microwave heating phenomena. The simulation results agree well with the experimental data. Based on the results obtained, the inserted resonator has a strong effect on the uniformity of temperature distributions, depending on the penetration depth of microwave. The optimum distances of the resonator depend greatly on the operating frequencies.