Darcy Flow
Quick Start
We all know about Darcy's law of flow. The basic equation is simple and not worth an app. For the more interesting issue of capillary flow into a porous medium the Darcy calculation is a bit tricky. The app handles those issues for you.
Darcy Flow
//One universal basic required here to get things going once loaded
window.onload = function () {
//restoreDefaultValues(); //Un-comment this if you want to start with defaults
Main();
};
//Main() is hard wired as THE place to start calculating when inputs change
//It does no calculations itself, it merely sets them up, sends off variables, gets results and, if necessary, plots them.
function Main() {
//Save settings every time you calculate, so they're always ready on a reload
saveSettings();
//Send all the inputs as a structured object
//If you need to convert to, say, SI units, do it here!
const inputs = {
D: sliders.SlideD.value * 1e-6, //μm to m
V: sliders.SlideV.value * 1e-3, //cP to Pa.s
sigma: sliders.Slidesigma.value * 1e-3, //mN/m to N/m
theta: sliders.Slidetheta.value * Math.PI / 180, //deg to rad
tmax: sliders.Slidetmax.value,
eta: sliders.Slideeta.value,
};
//Send inputs off to CalcIt where the names are instantly available
//Get all the resonses as an object, result
const result = CalcIt(inputs);
//Set all the text box outputs
// document.getElementById('ty').value = result.ty;
//Do all relevant plots by calling plotIt - if there's no plot, nothing happens
//plotIt is part of the app infrastructure in app.new.js
if (result.plots) {
for (let i = 0; i < result.plots.length; i++) {
plotIt(result.plots[i], result.canvas[i]);
}
}
//You might have some other stuff to do here, but for most apps that's it for Main!
}
//Here's the app calculation
function CalcIt({ D, V, sigma, theta, eta, tmax }) {
let DPts = [], dz = 0, z = 0.00001, tstep = 0.0001, t = 0
const S = -4 * (1 - eta) - Math.pow(1 - eta, 2) - 3 - 2 * Math.log(1 - eta)
const T = Math.log(1 - eta) + (1 - Math.pow(1 - eta, 2)) / (1 + Math.pow(1 - eta, 2))
const Big = -D * sigma * Math.cos(theta) / (8 * V) * S * T / (S + T)
DPts.push({ x: 0, y: 0 })
while (t < tmax) {
dz = tstep * Big / z
z += dz
DPts.push({ x: t, y: z * 1000 })
t += tstep
if (z * V/0.01 > 0.0005) tstep = 0.001
if (z * V/0.01 > 0.005) tstep = 0.01
}
const plotData = [DPts]
//Now set up all the graphing data detail by detail.
const prmap = {
plotData: plotData, //An array of 1 or more datasets
lineLabels: ["Darcy"], //An array of labels for each dataset
colors: ["blue"], //An array of colors for each dataset
hideLegend: true,
borderWidth: 2,
xLabel: 't&s', //Label for the x axis, with an & to separate the units
yLabel: 'z&mm', //Label for the y axis, with an & to separate the units
y2Label: null, //Label for the y2 axis, null if not needed
yAxisL1R2: [], //Array to say which axis each dataset goes on. Blank=Left=1
logX: false, //Is the x-axis in log form?
xTicks: null,
logY: false, //Is the y-axis in log form?
yTicks: null,
legendPosition: 'top', //Where we want the legend - top, bottom, left, right
xMinMax: [,], //Set min and max, e.g. [-10,100], leave one or both blank for auto
yMinMax: [,], //Set min and max, e.g. [-10,100], leave one or both blank for auto
y2MinMax: [,], //Set min and max, e.g. [-10,100], leave one or both blank for auto
xSigFigs: 'P3', //These are the sig figs for the Tooltip readout. A wide choice!
ySigFigs: 'P3', //F for Fixed, P for Precision, E for exponential
};
//Now we return everything - text boxes, plot and the name of the canvas, which is 'canvas' for a single plot
return {
plots: [prmap],
canvas: ['canvas'],
};
}
Basic Darcy's Law
The flow per unit area, q, of a fluid with viscosity η through a porous medium of length L under a pressure ΔP is described by Darcy's law
`q=k/(ηL)ΔP`
This is fine, but it needs the permeability k. Typically you apply various pressures, measure the flow and deduce k from the results. If the medium is complex, then measuring k is the best you can hope for.
Darcy Capillary Flow
Here we are interested in the case of capillary flow into a porous medium (a powder or fibre) where we only know some basic data:
- D: powder or fibre diameter
- ε: porosity (fraction of open space)
- σ: surface tension of the liquid
- θ: contact angle of liquid to solid
- η: viscosity of the liquid
It is convenient to define two parameters, S & T:
`S=-4(1-ε)-(1-ε)^2-3-2ln(1-ε)`
`T=ln(1-ε)+(1-(1-ε)^2)/(1+(1-ε)^2)`
We can then calculate the permeability:
`k=-D^2/(16(1-ε))(ST)/(S+T)`
And finally we can calculate the rate, `(δz)/(δt)` at which the liquid progresses along the z direction into the porous medium. The k term disappears through use of S & T
`(δz)/(δt)=-(Dσcos(θ))/(8ηz)(ST)/(S+T)`
Obviously the rate of penetration decreases over time because of the z term on the bottom of the equation.