diffusion rate between two pipe-connected volumes should be proportional to: someGlobalConstant * (in_t + out_t )/2 *pipe_size * exp(-abs(in_p - out_p)) this would be in an if(two_ways)){ //... } block at the end of void h_Pipe::refresh(double dt)