Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to draw the diagram below in Tikz. I have been unable to do so, I need the minimalist and a 3D representation.

Mixing Problem unequal flow rates

share|improve this question

closed as off-topic by Ingo, Christian Hupfer, Svend Tveskæg, ChrisS, Malipivo Aug 18 '14 at 9:57

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Can you include your code of the failed version here too? – percusse Aug 17 '14 at 0:21
Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – cfr Aug 17 '14 at 0:49
If you are in a hurry, I recommend including your graphics using the graphicx \includegraphics{} since you clearly have the image available as an external image and TikZ may take a little while to learn. (You don't say how far you got in your attempts.) – cfr Aug 17 '14 at 0:54
It is against our community guidelines as it is of the type "Do this for me" (even without the "please"). We should be consistent with this and close the question. – Ingo Aug 18 '14 at 8:38

3 Answers 3

up vote 22 down vote accepted

   ragged border/.style={ decoration={random steps, segment length=1mm, amplitude=0.5mm},

        decorate[ragged border]{
        (0,2) -- (6,2)
        -- (6,1) -- (6.5,1) -- (6.5,0.5) -- (6,0.5) --(6,0) -- (0,0) -- cycle;
  \fill[cyan!30] (-0.5,2.5) -- (0,2.5) to[in=120,out=0](0.7,1.9)-- (1.4,1.9)
                  to[out=120,in=0] (0,3) -- (-0.5,3) -- cycle;
  \draw (-0.5,2.5) -- (0,2.5) -- (0,0) -- (6,0) -- (6,0.5) -- (6.5,0.5);
  \draw (-0.5,3) -- (0,3) -- (0,3.5) -- (6,3.5) -- (6,1) -- (6.5,1);
  \draw[|-|] (-0.2,0) --
        node[fill=white,font=\footnotesize,inner ysep=2pt,inner
  \draw[stealth-] (-0.5,2.75) -- (-1,2.75)
  \draw[-stealth] (6.5,0.75) -- (7.2,0.75)
  \node[anchor=north,font=\footnotesize] at (3,3) {$x(t)$};
  \node[anchor=north,font=\footnotesize] at (3,2) {?\si{\liter}};
  \node[anchor=north,font=\footnotesize] at (3,1) {$x(0) = \SI{0}{\kilo\gram}$};

enter image description here

share|improve this answer
The flowing liquid should form a parabolic trajectory, IMHO. – kiss my armpit Aug 17 '14 at 11:25
@cyanide-basedfood Aah! I am poisoned! – Harish Kumar Aug 17 '14 at 12:25
Thank you! on a future occasion I will include my progress as suggested @cfr – Cristian Rodríguez Aug 17 '14 at 13:57
@CristianRodríguez Welcome to tikz mafia. On your spare time please do read pgfmanual (tikz manual) which has lot of examples easy to understand. When you are struck, people here will always be happy to help. – Harish Kumar Aug 17 '14 at 14:41
This is a great community, I appreciate the helpful attitude. usually I have problems with TikZ, since there are no manuals in Spanish, and I'm a Spanish speaker. I am in the process of learning English, but my level is still very basic. – Cristian Rodríguez Aug 17 '14 at 14:44

I decided to post this answer for several reasons:

  • This picture gives me the opportunity to show some useful options for users of TikZ.

  • I defined customizable macros for: Dimensions of the tank \tankwidth, \tankheight and \waterheight. This allows to change them without affect the picture (without exaggeration);

  • I defined a color for the water to allow changing in whole picture.
  • I show some features of the last version of PGF/Tikz (v 3.0.0) as: the pic operation, the arrows.meta library.
  • I use operations like parabola simuling a water fall.
  • The code is mostly commented for better understanding.
  • I use mathptmx for emulating the font used in the picture (Times).
  • I use the siunitx package to handle units.

The code

\usepackage{mathptmx} % To emulate your `font`
\usepackage{siunitx} % To write units correctly 
\usepackage{tikz} % Obvious
\usetikzlibrary{decorations.pathmorphing} % To decorate the surface of water
\usetikzlibrary{arrows.meta} % The newer options for arrows (PGF 3.0)
\colorlet{water}{cyan!25} % Define color for the water
% Dimensions of the tank
\def\waterheight{2.2} % Water height 
    faucet/.pic={ % Define a 'pic' for the water inlet and outlet (PGF 3.0)
        \fill[water](-0.25,-0.25) rectangle (0.25,0.25);
        \draw[line width=1pt](-0.25,-0.25)--(0.25,-0.25) (-0.25,0.25)--(0.25,0.25);
    myarrow/.tip={Stealth[scale=1.5]}, % Define a style for the tip of arrow
    surface water/.style= % style for border of water surface
    {decoration={random steps,segment length=1mm,amplitude=0.5mm}, decorate}
% Water fill (I filled first so that way it is in the background)
\fill[water] decorate[surface water]{(\tankwidth,\waterheight) -- (0,\waterheight)}--(0,0) -- (\tankwidth,0) -- cycle;

% Tank
\draw[line width=1pt] (0,0) rectangle (\tankwidth,\tankheight);

\coordinate (entrance) at (0,\tankheight-0.7);
\coordinate (exit) at (\tankwidth,0.7);

\pic[xshift=-2.5mm+0.5pt] at (entrance) {faucet}; % water inlet (0.5pt is half of line width) 
\pic[xshift=2.5mm-0.5pt] at (exit) {faucet}; % outlet water

% Entrance label (with `siunitx`)
\node[align=right,left=1cm] (inlet-unit) at (entrance)  {\SI[per-mode=symbol]{6}{\liter\per\minute}\\\SI[per-mode=symbol]{0.1}{\kilogram\per\liter}};
 %[align=...] in the last node is necessary for splitting in two lines with `\\`

% Exit label
\node[align=left,right=1cm] (outlet-unit) at (exit) {\SI[per-mode=symbol]{5}{\liter\per\minute}};

\draw[|-|] ([xshift=-2mm]0,0) -- node[fill=white,inner xsep=0]{$V_{0}$}([xshift=-2mm]0,\waterheight); 

% Fall water (i use `parabola` operation, it's more realistic, bacause it's a fall water) 
\fill[water] ([shift={(0.5pt,-2.5mm)}]entrance) parabola (0.3*\tankwidth,1pt) -- 
 (0.5*\tankwidth,1pt) parabola[bend at end] ([shift={(0.5pt,2.5mm)}]entrance);

% Inner labels
\path (0.5*\tankwidth,\tankheight)--(0.5*\tankwidth,0)
    node[pos=0.2] {$x(t)$}
    node[pos=0.5] {?\,L}
    node[pos=0.8] {$x(0)=\SI{0}{\kilogram}$};

The result

enter image description here

You can change some parameters (without exaggeration) like \colorlet{water}{...}, \tankwidth, \tankheight, \waterheight ((entrance) and (exit) inclusive, but carefully) and to watch the behavior of the picture.

share|improve this answer
Muchas gracias!, tomé un par de cosas que necesitaba de acá, pero no te puedo dar el voto de mejor respuesta, soy alguien que aprecia la simplicidad del código ;) – Cristian Rodríguez Aug 17 '14 at 14:00

The following is intentionally made simple without labels just for fun with PSTricks.

\pstVerb{realtime srand}




enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.