In the literature, optimization models deal with planning and scheduling of several subsystems of the petroleum supply chain such as oilfield infrastructure, crude oil supply, refinery operations and product transportation. The focus of the present work is to propose a general framework for modeling petroleum supply chains. As a starting point, processing units are modeled based on the framework developed by Pinto et al. [Computers and Chemical Engineering 24 (2000) 2259]. Particular frameworks are then proposed to storage tanks and pipelines. Nodes of the chain are considered as grouped elementary entities that are interconnected by intermediate streams. The complex topology is then built by connecting the nodes representing refineries, terminals and pipeline networks. Decision variables include stream flow rates, properties, operational variables, inventory and facilities assignment. The resulting multiperiod model is a large-scale MINLP. The proposed model is applied to a real-world corporation and results show model performance by analyzing different scenarios.