Looking at the botton circuit, it can be calculated as folows. As you know Kirchoff applies in each node all the time. Instead of writing Kirchoff using currents, we do it using charge (current integral over time):
a) $$Q_{R1}=Q_{C1}+Q_{Cx}$$
b) $$Q_{Cx}=Q_{C2}+Q_{CL}$$
The total charge in each capacitor, at the end, is its initial charge plus the charge that has circulated afterwards, i.e. QC1total=QC1initial + QC1 (in previous equation).
Therefore the initial charges (before current starts to flow) must be known to solve the problem. We will assume the initial charge of all capacitors is 0, and therefore QC1total=0+QC1=QC1, QC2total=QC2, etc.
Using second law of Kirchoff we can now write the final voltages, knowing that final currents will be 0, and therefore there is no voltage drop in resistors.
I) $$-Vd+V1=0 \rightarrow -Vd+\frac {Q_{C1}} {C1}=0$$
II) $$-V1+Vx+V2+Vd=0 \rightarrow \frac{-Q_{C1}} {C1}+\frac {Q_{Cx}} {Cx}+\frac {Q_{C2}} {C2}+Vd=0$$
III) $$-Vd-V2+Vout=0 \rightarrow -Vd-\frac {Q_{C2}} {C2}+\frac {Q_{CL}} {CL}=0$$
With those 3 equations plus the equation in b) you get 4 equations with 4 unknowns.
The equation in b) is saying in fact that \$\Delta Q_{Cx}=\Delta Q_{C2}+\Delta Q_{CL}\$, i.e. $$Q_{Cx}-Q_{C2}-Q_{CL}=Q_{previousCx}-Q_{previousC2}-Q_{previousCL}$$
Taking equation II, III and the last one, you can write in matrix form
$$ \left( \begin{array}{c} 0 \\ Vd\\ Q_{previousCx}-Q_{previousC2}-Q_{previousCL} \end{array} \right) = \left( \begin{array}{ccc}
\frac 1 {Cx} & \frac 1 {C2} & 0 \\
0 & -\frac 1 {C2} & \frac 1 {CL} \\
1 & -1 & -1 \end{array} \right) \cdot \left( \begin{array}{c} Qx \\ Q2\\ QL \end{array} \right)$$
This can be solved by inverting the matrix and multiplying by the vector in the left where You must use the previous values of capacitor's charge (at the beginning they will be 0).
After doing this, you should get the equations for the other value of CLK. You will see that the matrix doesn't change, only the vector changes (Vd swaps position with 0) and you will use as Qprevious the charges obtained in the previous step. After multiplying you will get the new values of Q and you can iterate again with other value of CLK.
You will see that the output voltage has a ripple (oscillates between 2 values). For your simulations choose a slow clock and you'll see that same ripple. If the clock is fast, the output voltage won't have ripple, but its final value will be the average between the 2 values obtained from equations.
Example using Vd=5V, C1=1uF, Cx=0.1 uF, C2=1uF, CL=1uF and a slow CLK of 10 Hz, here is the simulation:

You can see it oscillates between 2.619 V and 238.1 mV.
We get those same results solving, in Matlab, the equations previously stated:

If you increase clock, the output voltage becomes smooth as you can see in this simulation (CLK changed to 100 kHz):

The final voltage is 1.43 V, which you can recognize as the average between 2.619 V and 238.1 mV.