Useful Gibberish

Posts tagged ‘latex’

Draw particles contact with tikz

I wrote this code long time ago and I want to share it since it’s pretty cool and come in handy a lot of times.


\begin{figure}[H]
\begin{tikzpicture}[scale=0.5]
\draw[step=.5cm,lightgray,very thin] (0.1,0.6) grid (7.8,6.8);
\draw[fill=yellow,fill opacity=0.5] (1,3.5) -- (2,5) -- (4,5.5) -- (6,3.6) -- (4,2) -- (2,2) -- (1,3.5);
\draw[fill=cyan,fill opacity=0.5] (1,3.5) circle (0.78cm);
\draw[fill=cyan,fill opacity=0.5] (2,5) circle (1cm);
\draw[fill=cyan,fill opacity=0.5] (4,5.5) circle (1.05cm);
\draw[fill=cyan,fill opacity=0.5] (6,3.72) circle (1.64cm);
\draw[fill=cyan,fill opacity=0.5] (4,2) circle (1cm);
\draw[fill=cyan,fill opacity=0.5] (2,2) circle (1cm);
\fill[black,font=\footnotesize]
(1,3.5) node [above] {$P_1$}
(2,5) node [above] {$P_2$}
(4,5.5) node [above] {$P_3$}
(6,3.6) node [above] {$P_4$}
(4,2) node [above] {$P_5$}
(2,2) node [above] {$P_6$};
\draw[thick,->] (9,3.5) -- (10,3.5);
% draw 2 particles use for pair of contacts
\draw[fill=cyan,fill opacity=0.5] (13,5.5) circle (1.05cm);
\draw[fill=cyan,fill opacity=0.5] (15,3.72) circle (1.64cm);
\fill[black,font=\small]
(13,5.5) node [above] {$P_3$}
(15,3.72) node [above] {$P_4$};
\draw[blue,->,thick] (13,5.5) -- (15,3.72);
\fill[blue,font=\small]
(14,4.5) node [below] {$\vec{l}_{\,3,4}$};
\draw[red,->,thick] (13.784,4.802) -- (15.784,5);
\fill[red,font=\small]
(15.9,5) node [above] {$\vec{f}_{\,3,4}$};
% equation of the stress tensor
\fill[black,font=\small]
(14,2) node [below] {$\sigma_{ij}=\frac{1}{V}\sum \limits_{c} f_{ij}^c\times l_{ij}^c$};
\end{tikzpicture}
\caption{Calculation of meso-stress in a cycle of grains}
\end{figure}

Write with latex in wordpress

One of the good reasons to use wordpress is that we can post mathematical equation easily with the help of latex. The basic use is well explained in the official site of wordpress (link: http://tinyurl.com/84kqn3w), here I make a concise explanation of how to use latex with wordpress.

Syntax for latex posting:

First we will look at this result:

\frac {x^2+y^2}{x-y^3}

What I did is put the latex code:

\frac {x^2+y^2}{x-y^3}

Inside the latex tag, and wordpress will interprete automatically for me:

$latex  $ 

Very nice and easy huh?

Calculate kinetic energy in YADE

The term kinetic energy E_{c} when modelling in DEM is needed to define which state the simulation is in: quasi-static or dynamic.

For a quasi-static system, we have E_{c} < 10^{-7} and for dynamic system we’ll have E_{c}>10^{-7} (J).

E_{c} is calculated by the formula: \sum {\frac{1}{2}} ( {m_{i}}{v_{i}}^{2}+\omega ( I{{\omega }^{T}} ) )

Where:

m_{i}: density of the particle i

v_{i}: velocity of particles

I: inertia tensor

Tag Cloud