In this paper we propose a completely unique approach to unravel the inverse problem of three-dimensional die design forextrudate swell, employing a real-time active control scheme. to the present end, we envisioned a feedback connectionbetween the corner-line finite element method, wont to predict the positions of the free surfaces of theextrudate, and therefore the controller. The corner-line method allows for local mesh refinement and transient flow tobe taken under consideration. We show the validity of this method by showing optimizationresults for 2D axisymmetric extrusion flows of a viscoelastic fluid for various Weissenberg numbers. In 3D wefirst provides a proof of concept by showing the results of a Newtonian fluid exiting dies with increasing complexityin shape. Finally, we show that this method is in a position to get the specified extrudate shape of extrudates of aviscoelastic fluid for various Weissenberg numbers and different amounts of shear-thinning.extrusion may be a common production technique within the polymer pro-cessing industry to get products with a desired cross-section. Inthis process a polymer is molten and pushed through a die with acertain cross-sectional shape, to get a product (extrudate) with thissame cross-sectional shape. a standard requirement on the extrudate isdimensional precision. However, the size of the extrudate arehighly influenced by a phenomenon called extrudate swell, where theextrudate starts to expand thanks to internal stresses within the polymer onceit leaves the die.The swelling process involves complex dynamics influenced bymany parameters like viscoelasticity and temperature.