Take the 2-minute tour ×
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 a TIKZ beginner going to make some maths notes and appreciate very much if someone could draw(designe/program) for me a two tanks system like this:

Sketch

share|improve this question
19  
Welcome to TeX.sx! Which is the specific problem here? We got more than 3300 TikZ questions with answers here, perhaps browse around to see how to draw cylinders, arrows, and more. Not to mention the great TikZ manual. It would be good if you would show what you could already achieve and then post a real question. As it stands, the question may be closed as too localized. However, it can be reopened if it was edited and improved. Or edit it right away. We answer questions and gladly help to solve problems. It's just not a drawing service. ;-) –  Stefan Kottwitz Dec 28 '12 at 10:18
    
You can draw it in Inkscape and export it as TikZ. The exported code should provide you with some insights on TikZ's structure. –  Uwe Ziegenhagen Dec 28 '12 at 17:06
    
Thank you for both answer. I downloaded Inkscape and extensions. But I have not used drawing programes before and it takes time to get used to draw pictures with 3D effects. I am finishing a maths book and should focus on the writing. Thank you any way. I just hope somebody gets time to help me here. Thanks in advance:) –  Leopard Dec 28 '12 at 19:44
    
do you want it to look 'hand drawn' (as in your picture), or would you be interested in a 'straight-line' (much easier!) approach? –  cmhughes Dec 29 '12 at 1:13
    
Dear cmhughes, No it can look like such a format:control.ee.ethz.ch/~mpt/docs/demos/twotanks.php –  Leopard Dec 29 '12 at 8:10
show 2 more comments

2 Answers 2

Here's something to get you started

screenshot

I'm sure that it could be done far more intelligently, but it does the job :)

I have used the siunitx to typeset the units- perhaps this is overkill, but I think it's worth doing these things properly. If you load the nicefrac package then you can use fraction-function = \nicefrac; experiment as you see fit.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage{siunitx}
\sisetup{per-mode=fraction} %,fraction-function = \nicefrac}
\DeclareSIUnit{\gallon}{gal}

% set the arrows as stealth fighters (personal preference)
\tikzset{>=stealth}

\begin{document}

\begin{tikzpicture}
    % draw the tanks
    \draw (0,6)--(0,0)--(3,0)--(3,1)--(4,1)--(4,0)--(6,0)--(6,-1);
    \draw (7,-1)--(7,5)--(4,5)--(4,4)--(3,4)--(3,5)--(1,5)--(1,6);
    % fill them with water (in the background)
    \begin{pgfonlayer}{background}
        \filldraw[blue!20] (0,4.5)--(3,4.5)--(3,4)% tank 1
                                  --(4,4)         % connection
                                  --(4,4.5)--(7,4.5)--(7,-1)--(6,-1)--(6,0)--(4,0) % tank 2
                                  --(4,1)--(3,1)--(3,0)--(0,0) %back to tank 1
                                  -- cycle;
    \end{pgfonlayer}
    % connection piece
    \filldraw[white,draw=black] (3,2)--(3,3)--(4,3)--(4,2)--cycle;
    % add the rates
    \draw[->] (0.5,6)--(0.5,5)node[pos=0,anchor=south west]{\SI{20}{\gallon\per\minute}};
    \draw[->] (6.5,0)--(6.5,-1)node[pos=1,anchor=north]{\SI{20}{\gallon\per\minute}};
    \draw[->] (3,1.5)--(4,1.5)node[anchor=south]{\SI{30}{\gallon\per\minute}};
    \draw[<-] (3,3.5)--(4,3.5)node[anchor=south]{\SI{10}{\gallon\per\minute}};
    \node at (1,1){Tank 1};
    \node at (6,1){Tank 2};
\end{tikzpicture}

\end{document}
share|improve this answer
2  
+1 Personally I prefer simpler diagrams to explain concepts. Can you correct the physics please? Both middle arrows should point to the right. –  Yiannis Lazarides Dec 30 '12 at 4:02
    
Thank you Yiannis, this can be a good start and I try to see if I can make it 3D by using cylinder form tanks instead for rectangle form. I appreciate your assistance:) Have a happy new year!! –  Leopard Dec 30 '12 at 14:50
    
@YiannisLazarides thanks! The current problem serves as a good introduction to systems of differential equations because the tanks mix their contents together- as such, the arrows are pointing in the correct direction (although the bottom 10gal/min should be 30gal/min, will update) –  cmhughes Dec 30 '12 at 16:33
    
@cmhughes Aha! I see what you were after. I was thinking more continuity equation. –  Yiannis Lazarides Dec 30 '12 at 16:39
    
@Leopard you're welcome! If your question is solved, you can consider 'accepting' an answer by using the green check mark- welcome :) –  cmhughes Dec 30 '12 at 17:16
show 2 more comments

If you want to concentrate on writing and do not have much time to learn PGF/TikZ then GeoGebra is another option. The following figure (and the associated code) was generated using GeoGebra in about 10 minutes. enter image description here

The following is the GeoGebra generated code.

\documentclass[9pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-4,-2) rectangle (11,5);
\draw [rotate around={0:(0.5,3)}] (0.5,3) ellipse (1.51cm and 0.19cm);
\draw (-1,3)-- (-1,0);
\draw (2,3)-- (2,0);
\draw [rotate around={0:(0.5,0)}] (0.5,0) ellipse (1.51cm and 0.19cm);
\draw [rotate around={0:(5.5,3)}] (5.5,3) ellipse (1.51cm and 0.19cm);
\draw (4,3)-- (4,0);
\draw (7,3)-- (7,0);
\draw [rotate around={0:(5.5,0)}] (5.5,0) ellipse (1.51cm and 0.19cm);
\draw (-3,4.4)-- (-1,4.4);
\draw (-3,4)-- (-1,4);
\draw [shift={(-1.6,4.2)}] plot[domain=-0.32:0.32,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(-0.4,4.2)}] plot[domain=2.82:3.46,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw (2,2.4)-- (4,2.4);
\draw (2,2)-- (4,2);
\draw [shift={(3.4,2.2)}] plot[domain=-0.32:0.32,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(4.6,2.2)}] plot[domain=2.82:3.46,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw (2,1)-- (4,1);
\draw (2,0.6)-- (4,0.6);
\draw [shift={(3.39,0.8)}] plot[domain=-0.32:0.32,variable=\t]({1*0.64*cos(\t r)+0*0.64*sin(\t r)},{0*0.64*cos(\t r)+1*0.64*sin(\t r)});
\draw [shift={(4.59,0.8)}] plot[domain=2.82:3.47,variable=\t]({1*0.62*cos(\t r)+0*0.62*sin(\t r)},{0*0.62*cos(\t r)+1*0.62*sin(\t r)});
\draw [shift={(1.4,2.2)}] plot[domain=-0.32:0.32,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(2.6,2.2)}] plot[domain=2.82:3.46,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(1.4,0.8)}] plot[domain=-0.32:0.32,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(2.6,0.8)}] plot[domain=2.82:3.46,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw (7,1)-- (7.4,1);
\draw (7,0.6)-- (7.4,0.6);
\draw (7.6,0.4)-- (7.6,-0.2);
\draw (8,0.4)-- (8,-0.2);
\draw [shift={(7.4,0.4)}] plot[domain=0:1.57,variable=\t]({1*0.2*cos(\t r)+0*0.2*sin(\t r)},{0*0.2*cos(\t r)+1*0.2*sin(\t r)});
\draw [shift={(7.4,0.4)}] plot[domain=0:1.57,variable=\t]({1*0.6*cos(\t r)+0*0.6*sin(\t r)},{0*0.6*cos(\t r)+1*0.6*sin(\t r)});
\draw [shift={(7.8,0.4)}] plot[domain=4.39:5.03,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(7.8,-0.8)}] plot[domain=1.25:1.89,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(6.4,0.8)}] plot[domain=-0.32:0.32,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw [shift={(7.6,0.8)}] plot[domain=2.82:3.46,variable=\t]({1*0.63*cos(\t r)+0*0.63*sin(\t r)},{0*0.63*cos(\t r)+1*0.63*sin(\t r)});
\draw (-0.8,4.2)-- (-0.4,4.2);
\draw [->] (-0.2,4) -- (-0.2,3.4);
\draw [shift={(-0.4,4)}] plot[domain=0:1.57,variable=\t]({1*0.2*cos(\t r)+0*0.2*sin(\t r)},{0*0.2*cos(\t r)+1*0.2*sin(\t r)});
\draw [->] (3.4,2.6) -- (2.6,2.6);
\draw [->] (2.6,0.4) -- (3.4,0.4);
\draw [->] (7.8,-0.4) -- (7.8,-1.2);
\draw (-.2,4) node[anchor=north west] {$20 gal/min$};
\draw (2,3.2) node[anchor=north west] {$10 gal/min$};
\draw (2,0.4) node[anchor=north west] {$30 gal/min$};
\draw (8.1,-0.5) node[anchor=north west] {$20 gal/min$};
\draw (0.06,2.29) node[anchor=north west] {$\# 1$};
\draw (5.2,2.26) node[anchor=north west] {$\#2$};
\end{tikzpicture}
\end{document}
share|improve this answer
    
This is wonderful. Can you please fill the tanks with some gray or blue liquid and demonstrating water is flows inn and run out the thanks? Thank you and happy new year to you and all here! –  Leopard Dec 31 '12 at 10:19
    
And can you please move the pipe from which the water is running out in the lower part of the tank? –  Leopard Dec 31 '12 at 10:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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