Buckingham Pi method (dimensional analysis)

This notebook has been written in Mathematica by 

Mark J. McCready
Professor of Chemical and Biomolecular Engineering
University of Notre Dame
Notre Dame IN 46556
USA

mjm@nd.edu
http://www.chemeprof.com

It is copyrighted to the extent allowed by whatever laws pertain to the World Wide Web and the Internet.

I would hope that as a professional courtesy that this notice remain visible to other users. 
There is no charge for copying and dissemination   

Version: 6/4/20

Physical Motivation

Why do dimensional analysis?

We do not know how to attach significance to the numerical value of something unless it is in comparison to another thing that has the same dimensions.  For example, 1 is much less that 10^4, but if it is 1 ton of sand versus 10^6 grains of sand, we change our mind.  Thus we need to have the same dimensions (and units) for our comparison.    

A generalization of this kind of comparison is that we need to measure the effects of two different things that act similarly.  If we are determining the "filling" effect of our favorite foods,  we might compare a 15 inch thin crust pepperoni pizza to 3/4 lb of spaghetti with meat sauce.  They are different foods, but they both can satisfy a significant appetite.
  
A systematic way of building into our problems these comparisons of like quantities and perhaps more importantly, generalizations that involve comparisons of say forces associated with gravity compared to forces associated with a moving fluid, say inertia is called dimensional analysis.  The idea is that by making quantities dimensionless, we will be making these comparisons between different "things" that have the same effect.

A problem that we care about is pipeflow.  Flow in a pipe can be caused by a pressure difference, Δp.  Pressure has the same dimensions as ρ v2, which is a measure of the force associated with the inertia of the fluid.  Thus the ratio Δp/ρ v2 measures force due to pressure to force associated with fluid inertia.  Engineers think about their systems in terms of these comparisons so they will be important.  The particular ratio that we are describing is giving us an idea how difficult it is to pump the fluid in question.

Examination of simulated data

Let is create some simulated data and plot it:

We need secret formulas

dp=2* 0.079 (d v ρ/μ)^(-.25) ρ v^2  /d

re= (d v ρ/μ)

Here are the calculated data.

data1=Table[{v RandomReal[{0.97`,1.04`}],dp}/. {μ->0.01`,ρ->1,d->2.54`,v->i},{i,1,100,4}]

ListPlot[data1,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"}]

data2=Table[{v RandomReal[{0.94`,1.04`}],dp}/. {μ->.01,ρ->1,d->2.54/2`,v->i},{i,1,100,4}];

ListPlot[data2,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->{RGBColor[1,0,1],RGBColor[1,0.5`,0.5`],RGBColor[0,0,1]}]

data3=Table[{v RandomReal[{0.94`,1.04`}],dp}/. {μ->0.01`,ρ->1,d-> 2 2.54`,v->i},{i,1,100,4}];

ListPlot[data3,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->{RGBColor[1,0.5`,0.5`],RGBColor[1,0,1]}]

data4=Table[{v RandomReal[{0.94`,1.04`}],dp}/. {μ->0.01`,ρ->1,d->8,v->i},{i,1,100,4}];

ListPlot[data4,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->{RGBColor[1,0.5`,0.5`],RGBColor[0,1,1]}]

Here is a plot of it

ListPlot[{data1,data2,data3,data4},AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"}]

It looks sort of like the pressure drop varies as v^2.

ans=NonlinearModelFit[data2, a x^2, {a},x]

ListPlot[ans["FitResiduals"]]

Plot[.01238 x^2,{x,0,100}]

Show[%31,%]

Sort of OK.  But it doesn’t look perfect!

Try harder!!

FindFit[data2, a x^b, {a,b},x]

ans2 = NonlinearModelFit[data2, a x^b, {a,b},x]

Plot[ .04556x^ 1.703, {x,0,100}, PlotStyle->{Dashed, Green}]

Show[%31,%]

I put noise in the data, but I like the Green dashed line better

Sum[( data2[[i,2]]-.01238 data2[[i,1]]^2)^2, {i, 1, Length[data2]}]

We see that the two parameter fit works better.

Sum[( data2[[i,2]]-.04556 data2[[i,1]]^ 1.70325)^2, {i, 1, Length[data2]}]

Examination of simulated data

Here is a way to make a function that you can use to make the numbers above

turbulentpressdrop[d_,v_,ρ_,μ_]:=2* 0.079 (d v ρ/μ)^(-.25) ρ v^2  /d;

Table[{v,turbulentpressdrop[.1,v,1000,.001]},{v,1,10}]

Here are the calculated data.

data1=Table[{v RandomReal[{0.97`,1.04`}],turbulentpressdrop[d,v,ρ,μ]}/. {μ->0.01`,ρ->1,d->2.54`,v->i},{i,1,100,4}]

ListPlot[data1,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->Orange]

data2=Table[{v RandomReal[{0.94`,1.04`}],turbulentpressdrop[d,v,ρ,μ]}/. {μ->.01,ρ->1,d->2 2.54`,v->i},{i,1,100,4}];

ListPlot[data2,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->{RGBColor[1,0,1],RGBColor[1,0.5`,0.5`],RGBColor[0,0,1]}]

data3=Table[{v RandomReal[{0.94`,1.04`}],turbulentpressdrop[d,v,ρ,μ]}/. {μ->0.01`,ρ->.5,d->2.54`,v->i},{i,1,100,4}];

ListPlot[data3,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->{RGBColor[1,0.5`,0.5`],RGBColor[0,1,1]}]

data4=Table[{v RandomReal[{0.94`,1.04`}],turbulentpressdrop[d,v,ρ,μ]}/. {μ->0.01`,ρ->1,d->10,v->i},{i,1,100,4}];

data4plot = ListPlot[data4,AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"},PlotStyle->{RGBColor[1,0.5`,0.5`],RGBColor[1,1,1]}]

Here is a plot of it

ListPlot[{data1,data2,data3,data4},AxesLabel->{"v, cm/s","ΔP/L,dyne/\!\(\*SuperscriptBox[\(cm\), \(3\)]\)"}]

Fit[data1, a v^b, {a,b},v]

ans21 =NonlinearModelFit[data2, b  v^2, {b},v]

ans21[{"BestFit","FitResiduals","ParameterTable"}]

Sum[ans21["FitResiduals"][[i]]^2,{i,1, Length[ans21["FitResiduals"]]}]

Sum[ans2["FitResiduals"][[i]]^2,{i,1, Length[ans21["FitResiduals"]]}]

ListPlot[ans21["FitResiduals"]]

ListPlot[ans2["FitResiduals"]]

ans2[{"BestFit","FitResiduals","ParameterTable"}]

ans2 = NonlinearModelFit[data2, a v^b, {a,b},v]

ans2[{"BestFit","FitResiduals","ParameterTable"}]

FindFit[data3, a v^b, {a,b},v]

FindFit[data4, a v^b, {a,b},v]

We see that the power is clearly not 2 and the coefficient in front varies by a lot!

testplot = Plot[.00273 v^1.756,{v,0,100},PlotStyle->{Dashing[{.02,.05}], Purple},PlotLegends->{"fit"}]

Show[data4plot,testplot]

We see that the pressure drop increases with velocity (duh).   

Do we need to take data for every situation?  

Can we collapse the data onto one curve? 

From data, how would we know if we are getting a completely general picture of the situation?

We can resolve these issues by doing dimensional analysis.

Procedure for doing dimensional analysis.

Let’s  do pipe flow.

The three fundamental dimensions are mass, m, length, l and time θ.

The variables associated with pipe flow are Δp, D, L, v, μ, ρ.  They have dimensions:

Δp [=]  m/(l θ2)

D [=] l

L [=] l

v [=] l/θ

μ [=] m/(l θ)

ρ[=] m/(l^3)

The pressure change by itself does not tell us anything.  It is really the gradient in pressure that is driving the flow.  So we  use Δp/L as one quantity, ΔpsL, with dimensions, [=]  m/( l2 θ2)

A dimensionless group must be of the form

ΔpsLa  Db  vc  μd  ρe

where a, b, c, d, e  satisfy equations that make the group dimensionless.  This gives for mass

mass:   a + d+ e  =0,

length:	 -2 a +b +c - d - 3e = 0

time:	-2a -c-d   = 0

To solve these.  First write down the equations as a matrix

eqs = {{a,0,0,d,e},{-2a,b,c,-d,-3 e},{-2a,0,-c,-d,0}}

MatrixForm[eqs]

From this we expect that there certainly is not one unique solution.  You can solve this system for 3 of the variables in terms of the other two.  This will give us three dimensionless groups.  

In general solving this linear algebra problem for:  number of variables - number of equations, will give the number of dimensionless groups (or “solutions”).

It turns out that I need to put the coefficients into equations to solve them so I use a "dot" product and set it equal to 0.  The "[[1]]"  after eqs is telling Mathematica to take the first, second or third set of coefficients.

one =eqs[[1]].{1,1,1,1,1} == 0

two=eqs[[2]].{1,1,1,1,1} == 0

three=eqs[[3]].{1,1,1,1,1} == 0

Now I solve these equations

{one,two,three}

Solve[{one,two,three},{a,d,c,b,e}]

I choose the three to solve for by checking some choices and then deciding.

Now reconstruct our dimensionless group

ΔpsLa  Db  vc  μd  ρe     =   Δpa  Da-d  v-2a-d  μd  ρ--a-d

Now rearrange this into:

(ΔpsL D/ρ v2)a  (μ/D v ρ)d

Each of the groups that we have made is dimensionless.  This has to be true because we know that the entire thing is dimensionless and the solution is true for any values of a, c and e.  (Check what would happen if each group had some dimension and the values of a, c, and e were changed)  Thus we have found two groups and we have an answer.

The way we actually end up using this result is to define

Reynolds number 

Re ≡ ρ v D/μ

and friction factor

f = Δp D/2 L ρv2

where we write L explicitly.  A 2 has been added to the denominator of the friction factor by convention.

Let’s  do pipe flow, but no viscosity

Suppose we know that the viscosity and density have not been changed,

The three fundamental dimensions are still mass, m, length, l and time θ.

We realize that pressure drop is what is causing flow: Δp, 
Δp [=]  m/(l θ2)

We can expect that the pipe diameter matters.
D [=] l

Same argument as above about length:  L [=] l

and velocity:v [=] l/θ

We immediately realize that we need another variable with mass in it.

ρ[=] m/(l^3)

The pressure change by itself does not tell us anything.  It is really the gradient in pressure that is driving the flow.  So we  use Δp/L as one quantity, ΔpsL, with dimensions, [=]  m/( l2 θ2)

A dimensionless group must be of the form

ΔpsLa  Db  vc     ρe

where a, b, c, d, e  satisfy equations that make the group dimensionless.  This gives for mass

mass:   a  + e  =0,

length:	 b +c   - 3e = 0

time:	-2a -c    = 0

To solve these.  First write down the equations as a matrix

eqs = {{a,0,0,e},{-2a,b,c,-3 e},{-2a,0,-c,0}}

MatrixForm[eqs]

From this we expect that there certainly is not one unique solution.  You can solve this system for 3 of the variables in terms of the other two.  This will give us three dimensionless groups.  

In general solving this linear algebra problem for:  number of variables - number of equations, will give the number of dimensionless groups (or “solutions”).

It turns out that I need to put the coefficients into equations to solve them so I use a "dot" product and set it equal to 0.  The "[[1]]"  after eqs is telling Mathematica to take the first, second or third set of coefficients.

one =eqs[[1]].{1,1,1,1} == 0

two=eqs[[2]].{1,1,1,1} == 0

three=eqs[[3]].{1,1,1,1} == 0

Now I solve these equations

{one,two,three}

Solve[{one,two,three},{a,c,b,e}]

I choose the three to solve for by checking some choices and then deciding.

Now reconstruct our dimensionless group

ΔpsLa  Db  vc   ρe     =   ΔpsLa  Da  v-2a  ρ--a

Now rearrange this into:

(ΔpsL D/ρ v2)a   

But we see that this doesn’t work!  You can’t get v^1.75 power from this.

So...

Relevance to data mining.

It is easy enough to get some data, try to fit a function to different variables.   You might get some generalization, but.

So you start dimensional analysis and immediately see that you can’t make a dimensionless group without including the density.  

Then when you get to the end, the data still don’t fit even though the density (and viscosity) are constant. 

So then you include both density and viscosity and it works!

Mixing

We are interested in understanding how to characterize and scale up a mixing tank

You expect that the diameter of the mixer, the diameter of the tank, the height of the tank, the rotation rate of the mixer, the density of the liquid, the viscosity of the liquid and the power input to the mixer. 

1.  How many dimensionless groups will there be?
2.  Find them?
3.  Does the result match a standard correlation?

Answer for mixing

For a mixing problem we can expect a dimensionless group must be of the form

pn a  dtb  dmc  μd  ρe (ω^f)(h^g)

where a, b, c, d, e  satisfy equations that make the group dimensionless.  

The variables are pn, power to stirrer, dt, diameter of the tank, dm, diameter of the mixer, μ the liquid viscosity, ρ the liquid denisty, ω, the rotation frequency and h, the height of the tank.


This gives for mass

mass:   a + d+ e  =0,

length:	  2 a +b +c - d - 3e+g = 0

time:	-3a -d -f  = 0

To solve these.  First write down the equations as a matrix

eqs = {{a,0,0,d,e,0,0},{ 2 a,b,c,-d,-3 e,0, g},{-3 a,0,0,-d,0,-f,0}}

MatrixForm[eqs]

From this we expect that there certainly is not one unique solution.  You can solve this system for 3 of the variables in terms of the other two.  This will give us three dimensionless groups.  

In general solving this linear algebra problem for:  number of variables - number of equations, will give the number of dimensionless groups (or “solutions”).

It turns out that I need to put the coefficients into equations to solve them so I use a "dot" product and set it equal to 0.  The "[[1]]"  after eqs is telling Mathematica to take the first, second or third set of coefficients.

one =eqs[[1]].{1,1,1,1,1,1,1} == 0

two=eqs[[2]].{1,1,1,1,1,1,1} == 0

three=eqs[[3]].{1,1,1,1,1,1,1} == 0

Now I solve these equations

{one,two,three}

We would find that with 3 variables that have the same dimension, the answer will be (ultimately) nonsensical.  So we need to pick just one “length”.  So use the diameter of the mixer, dm.

eqs = {one,two,three}/.{ g->c, b->- c}

Solve[eqs,{a,d,c,e,f}]

From this we would find that the “a” group is pn/( ρ (dm^5), (ω^3)), which is a “power number”.  The viscosity group is (μ/(ρ  ω (dm^2))).

Heat transfer

Let’s try finding the dimensionless groups that describe heat transfer from a flowing liquid to the wall of a pipe. 

I would presume that heat capacity, thermal conductivity, the heat transfer coefficient, the fluid velocity, the fluid viscosity and density and the size of the pipe would all be important.  

You will now have temperature as an additional fundamental dimension.

1.  How many dimensionless groups will there be?
2.  Find them?
3.  Does the result match a standard correlation?
4.  Suppose that you chose thermal energy as an additional fundamental dimension, now how does the dimensional analysis come out?