The LM317 is a commonly used, rugged linear regulator with an adjustable output but suffers from the normal inefficiency of linear regulators which can require a large heatsink for the higher output currents, especially if input to output voltage drop is high.
To minimize this, a tracking, switching preregulator can be used to keep the voltage drop (Vi-Vo) across the LM317 essentially constant, at a voltage of the 2.5V volts or so required for proper regulator operation. This increases efficiency and can greatly reduce the power dissipated by the LM317 and thus its required heat sinking while still giving the good regulation, current limiting, and low noise of this linear regulator.
The preregulation also minimizes any reduction in maximum output current due to a Vin-Vout voltage over 15V or from thermal shutdown.
The preregulator used here is a hysteretic (bang-bang) switching converter. It is a simple circuit with no specialized controller IC, using only a common LM339 or LM393 comparator, and requires no control loop compensation. Hysteretic converters do tend to have a higher ripple voltage but that's of little consequence here since the LM317 filters out much of that ripple. (If more ripple reduction is desired a filter capacitor can be added from the LM317 ADJ pin to ground with a protection diode from the ADJ pin to the output.)
The output voltage can be adjusted to a maximum of 20V for the circuit shown, with the normal minimum of 1.25V for the LM317.
Here is an LTspice simulation of the circuit:
The prereg voltage stays at 2.5V above the output voltage (as determined by the TL431 reference) which is sufficient voltage overhead for the LM317 and keeps its power dissipation constant for a given current, independent of the output voltage. The simulation shows a maximum dissipation of a little less than 4W, which occurs at 1.3A output current, with only a small variation due to the output voltage simulated values (1.3V, 10V and 20V). That requires only a moderate sized heatsink for the LM317.
This dissipation will increase some if the output is short-circuited, depending upon the internal current-limit of the particular LM317 being used.
The P-MOSFET needs to have a fairly low gate capacitance, as the one shown, so that it can be driven directly from the LM339 output.
The inductor must have a peak current rating of at least 4A due to the high peak inductor current generated by a hysteretic type converter.
The simulations indicate the MOSFET transistor M1 may dissipate less than a watt maximum so a heatsink should not be required.
One caveat is that this circuit has only been simulated, not built, so problems with the real circuit are always a possibility, especially if care is not taken in the layout. This circuit has high current, high switching speed currents flowing, and a ground plane is necessary for good circuit performance (such as using a vector board with a ground plane). In particular, keep a minimum ground connection distance between C1, D2, C2, C6 and U1 and away from the LM317 output circuit grounds to minimize coupling of switching noise into the output.
This circuit is unlikely to operate properly if constructed on a plug-in type breadboard.
Edit: After writing this I realized that it is quite similar to Ronv's Swinear circuit previously published here. My apologies to Ron for this apparent plagiarism but, in my meager defense, I did my circuit before I read his article. Since this one is somewhat different in details, uses different parts, and may be somewhat simpler, I'll leave it posted for a slightly different approach to a similar end.
LM317 Adjustable 20V, 1.5A Supply with Simple SMPS Tracking Preregulator
LM317 supply with switching tracking prereg for good efficiency and minimal heat sink requirements.