26. Partial Differential Equations 2 by MIT OpenCourseWare

Description

26. Partial Differential Equations 2 by MIT OpenCourseWare

Summary by www.lecturesummary.com: 26. Partial Differential Equations 2 by MIT OpenCourseWare 


  • 1. Partial Differential Equations (PDEs)

    • More PDEs before going into probability.
    • Revisiting PDEs prior to Thanksgiving mentioned.

    2. Homework 7

    • Homework 7 is identical to the problem demonstrated in class for Comsol.
    • The problem must be solved both through Comsol and by coding a finite volume.
    • Warning: The problem has a characteristic length much less than the dimensions and may need an extremely fine mesh.
    • Description of the problem: drug patch diffusing into flow.
    • Explanation of characteristic length scale (d/dvx dy) and Péclet number, showing possible sharp gradients and warning to be careful.
    • Physical intuition presumes steep gradients close to the upstream boundary and possible odd behavior at the patch end.
    • The goal is to determine the drug diffusion well downstream.
    • The problem is an easy 2D case with no reactions, one-way flow, but it is difficult to obtain the proper solution.
    • Tip: Don't take code output blindly; play around to check for convergence to the actual physical solution.
    • If possible, use a more refined mesh in the x-direction close to the upstream edge where the gradients are likely to be steeper. Rectangular finite volumes can be used.
    • Explanation of vx = y * some number: velocity rises with y because of no-slip boundary condition at the wall.
    • This particular velocity profile (vx = y * number) is specified in the problem.
    • For homework, recommend that a simpler problem with the boundary closer first be solved using a C=0 boundary condition as an upper limit.
    • Tweak mesh size (delta x, delta y) and monitor convergence behavior.
    • Homework 7 is conceptual, not merely a Matlab coding exercise.
    • The homework requires using the finite volume method.

    3. Finite Volume Method

    • Involves imagining little control volumes (like CSTRs).
    • Apply mass balances: flows in and out equal accumulation.
    • For a steady-state problem, accumulation is zero.
    • Get one equation for each box; all boxes are coupled.
    • Approximation: Assume uniform concentration across the volume, using the average concentration in the cell.
    • Advantage: Treat fluxes across control volume boundaries exactly. This is why it's preferred in many chem problems.
    • Boundary Conditions:
      • Impermeable wall: flux is zero.
      • Drug patch: There is a flux. The boundary condition is C = C_drug.
    • Method 1 for patch boundary: Calculate flux using diffusivity * (C_drug - C_middle) / (delta Y / 2). C_middle is the unknown average concentration in the cell next to the patch.
    • Method 2 for patch boundary: Use a 'ghost volume'. Imagine a cell below the patch with concentration C_ghost. Write the diffusive flux equation: d * (C_ghost - C_middle) / delta y. Estimate C_ghost by assuming the boundary concentration (C_drug) is the linear interpolation between C_ghost and C_middle: C_boundary = (C_ghost + C_mid) / 2. Solve for C_ghost using the known C_boundary (C_drug).
    • Both methods (Method 1 and Method 2 with ghost volume) must result in the same formula here.
    • Ghost points are handy for finite difference schemes, particularly for symmetry or fixed flux boundary conditions.
    • Fluxes: Net flux into a volume (flux from neighbors plus boundaries) must be zero in steady state.
    • Velocity: Finite volume method calculates velocity halfway between mesh centers, thus making the process more numerically stable. This is opposed to finite difference, which calculates velocity at the same location.
    • Pressure: Navier-Stokes discretization with pressure can cause numerical instability through acoustic waves if velocity and pressure are computed at the same location. Finite volume method occurs naturally for this. Special techniques are required otherwise. Pressure is usually eliminated from equations by employing an equation of state to enhance numerical solutions.

    4. **Solvers for Linear Systems (from Finite Volumes)**

    • The system of equations formed by finite volumes for this particular problem is linear.
    • fsolve: Can be used, but would need to be solved for lots of variables if many mesh points. Needs an initial guess.
    • Backslash (\): Built-in solver in Matlab. Performance degrades with large, sparse matrices unless informed that the matrix is sparse. No need for initial guess. Test the size of the matrix to determine at which point it fails.
    • Conjugate Gradient (CG) / ICG stack: Experts would most probably apply this to big 3D problems.
    • 5. Conjugate Gradient (CG) / ICG Stack

      Experts would most probably apply this to big 3D problems. Benefit: No need to store the entire matrix; just needs to evaluate matrix elements. Suitable for extremely large sparse matrices. Note: It's an iterative solver that needs an initial guess.

      6. Time-Dependent PDEs and the CFL Number

      • Introduction: Overview of time-dependent PDEs.
      • CFL Number: An important term for discretizing space (x) and time (t). Named after the paper of 1928.
      • Definition: CFL = (delta t * velocity in x) / delta x. It's dimensionless.
      • Ratio: The ratio of the time mesh to the space mesh scaled by velocity.
      • Conceptual Meaning: When CFL is big (e.g., 10), material can convect through several mesh points in a single time step.
      • Warning: This is bad news for numerical schemes that compute locally from spatial derivatives.
      • Guideline: CFL number should be less than or comparable in order of magnitude to one.
      • Risk: Increasing delta t to many times larger than 1 produces "crazy" results, which may have nothing to do with the physical world.
      • Limitation: Very severe limitation, particularly for long simulations, needing extremely small delta t.
      • Trade-off: Reducing delta x smaller (for higher accuracy) means delta t needs to be reduced as well, doubling CPU time drastically.
      • Consequence: Violating the CFL condition will give solutions that calculate something but are unrelated to the actual problem.

      7. Adaptive Meshing

      • Potential: Ability to alter mesh size (adaptive meshing) to gain precision.
      • Examples: Different box sizes, a big mesh area divided into two smaller areas.
      • Warning: Adaptive meshing is susceptible to bugs; be vigilant and do not overuse it.
      • Note: Comsol is intelligent and meshes well automatically.

      8. Introduction to Probability

      • Context: Probability surrounds you, as opposed to typical deterministic undergraduate chemistry problems.
      • Reality: Measurement noise and non-reproducible results are common.
      • Foundation: Continuum equations are obtained from averages over fluctuating reality (molecules wiggling).
      • Fluctuation: Real physical systems inherently fluctuate about the average.
      • Quantum Mechanics: The Schrödinger equation gives probability densities rather than definite values explicitly.
      • Experiments: Produce varying results each time; this is unsettling.
      • Concept of a 'True' Value: We tend to think there is a true value (e.g., height) even if measurements vary.
      • Method: Average by repeated measurements is one common method to approximate the true value.
      • Representation: A truthful representation has an error bar, showing the range within which the true value is to be found.
      • Sources of Fluctuation: Arise from the actual physical system naturally fluctuating and the measurement instrument fluctuating.
      • Instrument Quality: A good instrument's fluctuation is less than the system's fluctuation.

      9. Basic Probability Concepts

      • Probability of an event is expressed as a number.
      • Example: Coin toss (Heads or Tails); likelihood of heads is about 1/2. Accuracy can be difficult to quantify.
      • Joint Probabilities: Chance of two events occurring simultaneously.
      • Example: Two coins being flipped (penny, dime); four possible results (HH, HT, TH, TT), each about 1/4 probability.
      • Calculation: Chance that event 1 AND event 2: P(A and B).
      • Independence: If events are independent, P(A and B) = P(A) * P(B).
      • Correlation: If events are correlated, P(A and B) = P(A) * P(B given A). This equation is an essential equality.
      • Rearrangement: P(B given A) = P(A and B) / P(A).
      • Probability of OR: Probability of event 1 OR event 2: P(A or B)
      • Avoid double-counting outcomes when adding probabilities.

        10. Bayes' Theorem

        • Obtained by rearranging the basic equality P(A and B) = P(B and A).
        • Standard form: P(A given B) = [P(B given A) * P(A)] / P(B).
        • Enables reversing the statement (e.g., probability of my height given measurements to probability of getting measurements given my height).
        • If event A has several exclusive possibilities (Ai), P(B) can be expressed as the sum of P(B given AJ) * P(AJ) over all J possibilities.
        • Standard form with marginalization: P(Ai given B) = [P(B given Ai) * P(Ai)] / Sum(P(B given AJ) * P(AJ) over all J).

        11. Probability Distributions (for Continuous Variables)

        • For continuous variables, use probability distributions in place of discrete event probabilities.
        • Example: Maxwell-Boltzmann distribution for particle velocity vx.
        • This is a probability density function (p(vx)).
        • The area under the probability density curve for all possible values has to be one.
        • Units: Units of probability density are 1 / units of the variable, for example, seconds per centimeter for velocity distribution.
        • Probability of a velocity being precisely a specific value is zero.
        • Needs to multiply density by a delta (e.g., p(vx) * delta vx) in order to obtain a non-zero probability for an interval.

        12. Cumulative Probability Distribution

        • Alternative formulation of probability for continuous variables.
        • Definition (F(vx)): Integral from negative infinity to vx of the probability density p(vx').
        • The probability that the variable is less than or equal to vx.
        • It is dimensionless.
        • Applied to queries such as "What is the probability that speed is less than X?".