Compact modeling of spintronic devices