I assume you are talking about some kind of engine exhaust system?
What you are talking about is not easy as it relates to fluid dynamics (yes a gas is a fluid): the equations used to model fluid flow are not simple to solve, so numerical methods are used to get approximate solutions. The software that is used to solve the kind of problem you have is called CFD (Computational Fluid Dynamics) software, and I imagine is not so easy to use (although I did find some open source software online).
There is someone posting
here that maybe able to help as I imagine they are using this kind of software, although your problem is harder because it involves gases (they compress and liquids typically do not) and you are also interested in thermal properties.
If you can't be bothered with all that, here are my simple ideas to optimise your pipework (assuming you don't want a 'tuned' 2-stroke exhaust):
- A bigger pipe will always allow the gas to flow better (faster) than a thin one;
- When you change diameter of the pipe do it as gradually as possible if you are reducing: if you are increasing, it is not so important, but avoid step changes;
- make bends in pipes as long and as gradual as you can;
- For the heat aspect, imagine your gas flow is carrying sand or something - where would the sand hit? Those are the places where the pressure will be higher and the heat transfer greatest, I think. So anything that protrudes into the flow, any place where a pipe diameter reduces and the outside of bends.
Having said all that, I hope your system is for a model engine otherwise it may be too expensive/too big to print.
Good luck!