2

I am in the process of creating a flowchart diagram for the code provided below. Could you please assist me by creating a flowchart that outlines the key components and flow of the code?

\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, positioning}
\begin{document}
    \tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=red!30]
    \tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
    \tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
    \tikzstyle{arrow} = [thick,->,>=stealth]
    
    \begin{center}
        \begin{tikzpicture}[node distance=1.5cm]
            \node (start) [startstop] {Start};
            \node (experiment) [process,  below left of=start, xshift=-3cm] {Design of Experiment};
            \node (work) [process, below right of=start, xshift=3cm] {Experimental Work};
            \node (numerical) [process, below of=experiment] {Numerical Procedures};
            \node (Design) [process, below of=work] {Design Of Test Module};
            \node (Governing) [process, below of=numerical] {Governing Equations: Mass, Momentum and Energy};
            \node (Instrumental) [process, below of=Design] {Instrumental Calibration};
            \node (Prog) [process, below of=Governing] {Programming with Ansys Fluent};
            \node (Test) [process, below of=Instrumental] {Testing Rig Installation with all Senses};
            \node (2D) [process, below of=Prog] {2D Modeling and Validation Code with Previous work};
            \node (ModVal) [process, below of=Test] {Experimental Test for Models Validations};
            \node (Para1) [process, below of=2D, xshift = -5cm] {$S_L$};
            \node (Para2) [process, below of=2D, xshift = -3cm] {$S_T$};
            \node (Para3) [process, below of=2D, xshift = -1cm] {$Lu$};
            \node (Para4) [process, below of=2D, xshift = 1cm] {$Ld$};
            \node (Para5) [process, below of=2D, xshift = 3cm] {$Re$};
            \node (Para6) [process, below of=2D, xshift = 5cm] {$\theta$};
            \node (Result)[decision, below of=start, yshift=-13cm] {Are the Result Valid?};
            \node (Optimum) [process, below of=Result, yshift=-2cm] {Optimum Configuration};
            \node (stop) [startstop, below of=Optimum] {Stop};
            
            \draw [arrow] (start) -- (experiment);
            \draw [arrow] (start) -- (work);
            \draw [arrow] (work) -- (Design);
            \draw [arrow] (Design) -- (Instrumental);
            \draw [arrow] (experiment) -- (numerical);
            \draw [arrow] (numerical) -- (Governing);
            \draw [arrow] (Governing) -- (Prog);
            \draw [arrow] (Prog) -- (2D);
            \draw [arrow] (2D) -- (Para1);
            \draw [arrow] (2D) -- (Para2);
            \draw [arrow] (2D) -- (Para3);
            \draw [arrow] (2D) -- (Para4);
            \draw [arrow] (2D) -- (Para5);
            \draw [arrow] (2D) -- (Para6);
            \draw [arrow] (Para1) -- (Result);
            \draw [arrow] (Para2) -- (Result);
            \draw [arrow] (Para3) -- (Result);
            \draw [arrow] (Para4) -- (Result);
            \draw [arrow] (Para5) -- (Result);
            \draw [arrow] (Para6) -- (Result);
            \draw [arrow] (Instrumental) -- (Test);
            \draw [arrow] (Test) -- (ModVal);
            \draw [arrow] (ModVal) |- (Result);
            \draw [arrow] (Result) --node[anchor=east] {yes} (Optimum);
            \draw [arrow] (Result) |-node[anchor=east] {No}(experiment);
            \draw [arrow] (Optimum) -- (stop);
        \end{tikzpicture}
    \end{center}
\end{document}

enter image description here

1
  • Unfortunately I don’t see a question here. What is your challenge with changing the documentclass, after checking the beamer manual? Thank you
    – MS-SPO
    Commented Aug 6 at 4:58

1 Answer 1

6

I suspect that you looking for something like this:

enter image description here

However, your question is not entirely clear: MWE is article document, but you tagged it with beamer: What actually is document class?

So far I use standalone that I didn't need to bother with flowchart size:

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, 
                chains,
                ext.paths.ortho,    % defined in the tikz-ext package
                positioning,
                shapes.geometric}

\tikzset{FlowChart/.style={
     base/.style = {rectangle, draw,
                    minimum width=22mm, minimum height=1cm, align=flush center,
                    },
startstop/.style = {base},
  process/.style = {base, 
                    text width=5cm},
 decision/.style = {diamond, draw, sharp corners, aspect=1.3, 
                    text width=3cm, inner sep=0mm, align=flush center},
    arrow/.style = {thick,-Triangle},
        }   }
\makeatletter
\tikzset{suspend join/.code={\def\tikz@after@path{}}}
\makeatother


\begin{document}
    \begin{tikzpicture}[FlowChart,
node distance=4mm and 2mm,
  start chain = A going below,
  start chain = B going right,
every edge/.append style = {draw, arrow}
                        ]
\node (start) [startstop] {Start};
    \begin{scope}[nodes={process, on chain=A, join=by arrow}]
\node (experiment)  [below left=of start] {Design of Experiment};
\node (numerical)   {Numerical Procedures};
\node (Governing)   {Governing Equations: Mass, Momentum and Energy};
\node (Prog)        {Programming with Ansys Fluent};
\node (2D)          {2D Modeling and Validation Code with Previous work};
    \end{scope}
    \begin{scope}[nodes={base, minimum width=9mm, on chain=B}]
\node (Para1) [below left=8mm and 24mm of 2D.south] {$S_L$};
\node (Para2)   {$S_T$};
\node (Para3)   {$Lu$};
\node (Para4)   {$Ld$};
\node (Para5)   {$Re$};
\node (Para6)   {$\theta$};
    \end{scope}
    \begin{scope}[nodes={process, on chain=A, join=by arrow}]
\node (work)    [suspend join,
                 below right=of start] {Experimental Work};
\node (Design)  {Design Of Test Module};
\node (Instrumental)    {Instrumental Calibration};
\node (Test)    {Testing Rig Installation with all Senses};
\node (ModVal)  {Experimental Test for Models Validations};

\node (Result)  [decision, suspend join, 
                 below=8mm of start |- Para6.south] {Are the Result Valid?};
\node (Optimum) [process] {Optimum Configuration};
    \end{scope}
\node (stop)    [startstop, below=of Optimum] {Stop};
% lines not drawn by join
\draw   (start)     edge    (experiment) 
        (start)     edge    (work)
        (Optimum)   edge    (stop);
\draw [arrow] (ModVal) |-   (Result);
\draw [arrow] (Result) r-lr [lr distance=11mm](experiment);
    \foreach \i in {1,...,6}
{
\draw [arrow] (2D.south) |-|   (Para\i);
\draw [arrow] (Para\i)   |-|   (Result);
}
    \end{tikzpicture}
\end{document}

Addendum:
In the case when this flowchart will be inserted into beamer frame, than flowchart produced by above MWe is to big. You need to reduce its size, for example with the following measures:

  • In flowchart use \scriptsize font size`.
  • Reduce size of nodes.
  • Reduce distances between nodes.
  • For decision shape use style as is suggested in Qrrbrbirlbel answer

Additional, you may liked added coloring of nodes ...

\documentclass{beamer}
\usepackage{changepage}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                calc, chains,
                ext.paths.ortho,  % -|-, |-| and r-rl path operations
                positioning,
                shapes}
\makeatletter
\tikzset{suspend join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
\begin{frame}[fragile]
\frametitle{Flowchart}
    \begin{adjustwidth}{-1em}{-1em}
    \centering
    \begin{tikzpicture}[
node distance = 3mm and 4mm,
  start chain = A going below,
  start chain = B going right,
    arrow/.style = {thick,-Triangle},
every edge/.append style = {draw, arrow},
     base/.style = {draw=#1, semithick, fill=#1!25,
                    minimum height=4mm, align=flush center,
                    inner sep=2.4pt,
                    font=\scriptsize\linespread{0.92}\selectfont
                    },
       be/.style = {% BeginEnd
                    base=red, text width=#1, rounded corners},
     be/.default = 17mm,
       pc/.style = {% ProCess
                    base=#1, text width=40mm},
     pc/.default = orange,
       if/.style = {% decision node: https://tex.stackexchange.com/questions/661461
                    pc=teal, align=left,
                    label={[D=teal]north east:?}
                    },
            D/.style   = {diamond, draw=#1, fill=#1!50, 
                          inner sep=1pt, font=\scriptsize, 
                          anchor=center},
      lbl/.style = {inner ysep=2pt, inner xsep=4pt, font=\tiny},
       la/.style = {label={[lbl, anchor=north east]west:#1}},       % left above
       bl/.style = {label={[lbl, anchor=north west]south:#1}},      % below left
                    ]
\node (start) [be] {Start};
    \begin{scope}[nodes={pc, on chain=A, join=by arrow}]
\node (DE)  [below left=of start.south] {Design of Experiment};
\node       {Numerical Procedures};
\node       {Governing Equations: Mass, Momentum and Energy};
\node       {Programming with Ansys Fluent};
\node (2D)  {2D Modeling and Validation Code with Previous work};
    \end{scope}
    \begin{scope}[nodes={draw, minimum size=5mm, font=\scriptsize, on chain=B}]
\node (p1) [below left=6mm and 23mm of 2D.south] {$S_L$};
\node (p2)   {$S_T$};
\node (p3)   {$Lu$};
\node (p4)   {$Ld$};
\node (p5)   {$Re$};
\node (p6)   {$\theta$};
    \end{scope}  
%
    \begin{scope}[nodes={pc, on chain=A, join=by arrow}]
\node (EW)  [suspend join,
             below right=of start.south] {Experimental Work};
\node       {Design Of Test Module};
\node       {Instrumental Calibration};
\node       {Testing Rig Installation with all Senses};
\node (ET)  {Experimental Test for Models Validations};
    \end{scope}
%
\node (Q)   [if, 
             below=6mm of p6.south -| start,
             la=No,
             bl=Yes]   
            {Test:\\Is Result Valid?};
    \begin{scope}[nodes={on chain=A}]
\node   (OC)    [pc,
                 below=of Q] {Optimum Configuration};
\node (stop)    [be, join=by arrow] {Stop};
    \end{scope}
% lines not drawn by join
\draw   (start) edge    (DE) 
        (start) edge    (EW)
        (Q)     edge    (OC);
\draw [arrow] (ET) |-   (Q);
\draw [arrow] (Q.west) r-lr [lr distance=9mm] (DE);
    \foreach \i in {1,...,6}
{
\draw [arrow] (2D.south) |-|   (p\i);
\draw [arrow] (p\i)   |-|   (Q);
}
    \end{tikzpicture}
    \end{adjustwidth}
\end{frame}
\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .