This was inspired by Marius Hornberger who made something similar for 75mm and 100mm pipes which was way to big for me. So I ended up in making my own design using tinkercad.
This design has 40mm tubes on both ends, the longer one is intended to fit into a DN40 pipe, the shorter end is your actual nozzle.
If required you can build your own additional nozzle as needed to fit to the 40mm diameter, length is 25mm (a conical design 39.5/40.5mm may be a good idea), a nozzle for drilling is also included to download here.
With 5 elements you get an angle of nearly 90°, so with 10 to 12 elements you have a wide range of flexibility.
I printed it using PLA with 100% infill at 0.2mm layer height. It has a tight fit in the beginning, so it needs some initial movements or even sanding (just sand the smaller male part slightly) to make it work - but this way it won't get to loose.
PETG might work better due to its higher flexibility.
Print orientation as it comes from the STL files.
If if fits too loose try increasing your flow rate, if too tight lower your flow rate. Or for both cases trying a different filament may also work.
The author marked this model as their own original creation.