Circuit emulators - classically SPICE, but there are many descendants from that - do what you want. A bunch are open source or free software. Getting (accurate) models for some components can be problematic, but searching the 'net will generally get you the clues you need to get there.
SPICE software is a big topic. Prepare to dive in...