An electromagnet model or models are created to generate the static and radio frequency magnetic fields of an NMR downhole logging tool. The magnetic field distributions are then used in spin dynamics (SD) simulations to model the impacts of various effects on NMR logging data, effects that cannot be accurately describe by theoretical formulation alone. The accuracy of the electromagnetic model and the SD simulation may be verified against experimental observations or trial logging runs. Simulation of electronic circuit, molecular diffusion, tool motion can all be incorporated in the SD simulation. The NMR data inversion process can be modified according to echoes obtained from SD simulation to obtain more accurate petrophysical parameters.