  In this contribution, we develop a variational integrator for the simulation
of (stochastic and multiscale) electric circuits. When considering the dynamics
of an electrical circuit, one is faced with three special situations: 1. The
system involves external (control) forcing through external (controlled)
voltage sources and resistors. 2. The system is constrained via the Kirchhoff
current (KCL) and voltage laws (KVL). 3. The Lagrangian is degenerate. Based on
a geometric setting, an appropriate variational formulation is presented to
model the circuit from which the equations of motion are derived. A
time-discrete variational formulation provides an iteration scheme for the
simulation of the electric circuit. Dependent on the discretization, the
intrinsic degeneracy of the system can be canceled for the discrete variational
scheme. In this way, a variational integrator is constructed that gains several
advantages compared to standard integration tools for circuits; in particular,
a comparison to BDF methods (which are usually the method of choice for the
simulation of electric circuits) shows that even for simple LCR circuits, a
better energy behavior and frequency spectrum preservation can be observed
using the developed variational integrator.
