None Reading_13

Challenge

In this reading, your challenge is to consider how we might use the first law of thermodynamics to analyze large, complex systems of many interacting components. For example, think about the following electrical system, which is a lot like the one you dealt with in Reading 12, but with more components.

image-2.png

Imagine that this is a small, "off-grid" DC (direct current) electrical system for alog cabin deep in the wilderness. A large wind turbine, the "input" to the system, provides intermittent electrical power. Electrical lines with non-trivial resistance carry that power to a storage system that you decide to model as an "ideal" capacitor with capacitance $C$. This could be a battery, but a battery is not well modeled as a single capacitor (sometimes, however, a battery is modeled as a system of capcitors and resistors, as in this paper). We will imagine for this example that your storage system is a "supercapacitor while we lack the tools for a more accurate model of a battery-based storage system.

More electrical lines, also with nontrivial resistance, carry this power to the cabin, which has a number of appliances running. Because the cabin does not have its own significant energy storage devices (such as batteries or supercapacitors), you model all of the appliances in each house as "ideal resistors."

In building this model, you have implicitly decided how the first law of thermodynamics should be written for each of the components in your system. All "ideal resistors" store no energy and transfer heat to the environment, while the "ideal capacitor" you used to represent your energy storage system (which may be a bank of batteries, not an actual capacitor) stores energy without heat transfer. Building an equation to represent this model is therefore within your skill set!

However, let's say the only thing you were interested in was the current used by "$R_4$." It's true that understanding how the power is "used" in this system, and how much electrical current is available to each house could be accomplished with the methods you've learned so far. However, the "junctions" at which wires connect mean that in writing the first law of thermodynamics for each component, you will have to keep track of "power out" and "power in" for each subsystem (component) in a disciplined way, and the algebra could get very complex.

Deciding just how to do that can be tricky, but the field of "system dynamics" has developed two rules that help with this bookkeeping:

  1. The principle of continuity (conservation of "stuff," a restatement of the first law of thermodynamics)
  2. The principle of compatibility (consistency of measurements with respect to a reference)

We will focus on the principle of continuity in this reading, and then use the principle of continuity to help us build a model of the aorta in a human aorta, but first we have to understand the concept of a "node," or a point in your system (almost certainly fictitious) where no energy is stored, no net energy carried by mass is important, and no heat is transferred.

Nodes

In system dynamics, a "node" is a fictitious element in your system through which power is transferred without energy storage or "losses" (energy transfer to outside the system boundary). In the case of an electrical, fluid, or mechanical system, we could say that a "node" represents a fictitious place where no heat transfer occurs from the system to its environment and no energy is stored.

Nodes in electrical systems

The easiest place to look for an almost literal representation of a node is in an electrical schematic, where two or more "ideal wires" (wires with negligible resistance) join together at a point. See the example below for a node joining three wires.

image-2.png

With our assumptions of no heat transfer, no mass transfer, and no energy storage in place, Writing the First Law of Thermodynamics for the electrical node yields:

$$\require{cancel}$$$$\cancel{\dot{E}} = \dot{W}_{in} - \dot{W}_{out} + \cancel{\dot{Q}}_{in} - \cancel{\dot{Q}}_{out} + \cancel{\dot{E}}_{m,in} - \cancel{\dot{E}}_{m,out}$$

Rewriting, we see that $\dot{W}_{in} = \dot{W}_{out}$. If our "node" represents an infinitesimal junction between wires with negligible resistance, the voltage that exists at each "end" of the node cannot be different. Therefore, we can make the assumption that at an electrical node, there can be only one voltage, $V_1$.

Then, Adopting the sign convention that currents flowing out of the node correspond with work flowing 'out' of the node, we can then write our first law of thermodynamics as:

$$ V_1 i_1 = V_1i_2 + V_1 i_3$$

Because we have only one voltage at the node, it is common to cancel it and write:

$$ i_1 = i_2 + i_3$$

Which is simply a re-statement of the first law of thermodynamics under specific conditions and assumptions. Because there is only one voltage, the currents must "split" in a way that conserves energy. Here, the conservation of energy boils down to a conservation of charged particles that can neither be created nor destroyed via the law of conservation of mass. The equation above, in electrical systems, is often called "Kirchoff's Current Law" or "KCL."

Nodes in Fluid Systems

In fluid systems, a node has a very similar meaning. Imagine that two pipes, each of which may have non-negligible fluid resistance, are joined with a tank, which is filled by flow from both pipes. We might draw the junction between the two inlet pipes and the tank as follows:

image-2.png

If we define a system boundary around the node as shown in red, and make the assumption that the junction is very small in volume, we can make the assumption that no energy is stored because there is no significant mass contained in the node boundary. If we assume that its size also means that it has negligible fluid resistance, we can also say that no energy is transferred as heat across the system boundary. Finally, both because the node doesn't store energy and because there is no energy loss inside the node, the net energy carried out of the system by mass will equal the energy brought in by mass. Thus, we can write the first law of thermodynamics for this junction as:

$$\cancel{\dot{E}} = \dot{W}_{in} - \dot{W}_{out} + \cancel{\dot{Q}}_{in} - \cancel{\dot{Q}}_{out}+ \cancel{\dot{E}}_{m,in} - \cancel{\dot{E}}_{m,out}$$

Rewriting, we see that $\dot{W}_{in} = \dot{W}_{out}$. If our "node" represents an infinitesimal junction between pipes, and if this junction has negligible resistance, the pressure that exists at each "end" of the node cannot be different. Therefore, we can make the assumption that at a fluid node, there can be only one pressure, $P_1$. Then, adopting the same sign convention as we did for the electrical system with inflows and outflows, we can write the first law of thermodynamics as:

$$P_1(\dot{\mathcal{V}}_2 + \dot{\mathcal{V}}_3) = P_1 \mathcal{\dot{V}}_1$$

Cancelling the extra power of $P_1$, the first law reduces to a simple conservation of flow rate equation, or:

$$\dot{\mathcal{V}}_2 + \dot{\mathcal{V}}_3 = \mathcal{\dot{V}}_1$$

Nodes in Mechanical Systems

The concept of a node for a mechanical system is a little trickier, but only because we have two sets of tools with which to analyze mechanical systems: Newton's laws and the first law of thermodynamics. But the concept of a node is still the same: it is a point in our system at which we could say that no energy is transferred outside of the system boundary (no "losses"), no mass transfer occurs, and no energy is stored. Consider the following system, in which a large mass, connected to ground through a damper, is connected to a second mass through a damper.

image-3.png

Now, one approach to studying this problem might be to simply draw energetic diagrams for the two dampers and the mass separately. Doing so using the standard assumptions for "idealized" masses and dampers might look like this:

image-2.png

But how does one know how the power $\dot{W}_{out}$ from $m_1$ "splits" to yield the input powers $\dot{W}_{in}$ for $b_1$ and $b_2$? Well, you might say that $\dot{W}_{out,m1} = \dot{W}_{in,b1}+\dot{W}_{in,b2}$ by inspection, but how do we know this is the case? Is there a more formal statement we can make?

Consider the dotted red box in the first picture. If we consider a tiny "slice" of the system that represents the physical connection between the mass and the two dampers, we could say that this slice has both negligible mass and negligible transfer of energy through the system boundary as heat. We could draw this in as another energetic element in our system as follows:

image-2.png

Zooming in on this new element and looking at the power (forces and velocities) "flowing" in and out of it, we could draw:

image-3.png

In this drawing, the blue line shows the node's single velocity $v_2$, and the forces are not drawn as vectors-- we are drawing them like currents, and assuming that the forces act parallel to the direction of $v_1$ so that the forces' magnitudes are fully "doing work" on the node.

As before, we could use these assumptions to write a simplified version of the first law of thermodynamics in derivative (power) form for this element.

$$\cancel{\dot{E}} = \dot{W}_{in} - \dot{W}_{out} + \cancel{\dot{Q}}_{in} - \cancel{\dot{Q}}_{out}+ \cancel{\dot{E}}_{m,in} - \cancel{\dot{E}}_{m,out}$$

We can then re-write this as $\dot{W}_{in} = \dot{W}_{out}$ for this fictitious element, which we'll call a node. To write the power terms in the first law more explicitly as the product of force and velocity, we could say that the "effective" or "net" force from the mass, which we'll call $F_m$, does work on the node, while the forces acting on the dampers are work "out" from the node. We can also say that because the node is a rigid element (it is the connection between the mass and its two dampers, in this example), there is only one velocity at the node! In this case, that velocity is $v_1$, or the velocity of $m_1$. Then, we could write the first law of thermodynamics for this node as:

$$F_m v_1 = F_{b1}v_1 + F_{b2} v_1$$

Cancelling the extra power of $v_1$ yields:

$$F_m = F_{b1} + F_{b2}$$

This, incidentally is a reduced statement of the first law of thermodynamics in derivative (power) form if we do not cancel $v_1$. If we do cancel that term, the equation is a restatement of Newton's 2nd law, where for the node, $\sum F = \cancel{m_{node}}\dot{v}_1 = 0$ since the node's mass is negligible. Analyzing this system with Newton's laws would show us that $F_m$ in the diagram above represents the "total force" of the two dampers on the mass-- in this representation, with the node "in between" the mass and the two dampers, we are simply saying that the node is the only "thing" exerting force on the mass (sort of like a middleman).

So, having defined the concept of a "node" for each of the three types of system's we've studied so far, we have discovered what system dynamicists call "The principle of Continuity."

The principle of Continuity

The principle of continuity is a re-statement of the first law of thermodynamics with specific assumptions. For many types of systems, the assumptions boil the first law of thermodynamics down to a simple statement about conservation of mass. In these cases, the principle of continuity states:

"flows into a node must balance with flows out of a node,"

Where the definition of "flows" depends on the type of system at hand. For electrical systems, the principle of continuity at a node boils down to a "conservation of current," or Kirchoff's Current Law:

$$\sum i _{node} = 0$$

With currents into a node considered positive, and currents out of a node considered negative.

For a mechanical system, Force is the quantity that "flows through" elements via Newton's 3rd law (making an imaginary cut anywhere along a rigid body and drawing a free body diagram will confirm this). Thus, a "node" in a mechanical system is an imaginary element with "no" mass. Writing the first law of thermodynamics for a node in a mechanical system, and canceling that its (single) velocty from the first law equation, one obtains:

$$\sum {F}_{node} = 0$$

For a fluid system (incompressible), a "node" might represent an infinitesimal junction between two pipes or valves, or a junction between a valve and a tank. Writing the first law of thermodynamics for this "infinitely thin" element in which only one pressure exists (and can thus be canceled), one obtains:

$$\sum \dot{\mathcal{V}}_{node} = 0$$

With volumetric flows into the node being considered positive, and flows out of the node negative.

Updated Disciplined Process for using Energy Conservation to Construct a Model inclusive of Kirchoff's Current Law (KCL)

Now that we have a "new tool" (the node) to help us with model construction, we can update our "step 3" in the general discplined process for Model Construction to include the use of nodes in our process. Our update of the disciplined process is as follows:

  1. Draw an energetic diagram for each element in your model scope, crossing off any terms you are assuming to be insignificant. When you do this, justify each assumption clearly in writing. Making an assumption is always a deliberate risk; the model evaluation step of our overall disciplined process for ES103 will guide you in determining the quality of the assumptions you make.
    1. You may reference the assumptions in the "standard" lumped element table in your justification, but you must still give a reason for assuming that an element acts like one of these "standard" element.
  2. Write the time-derivative of the first law of thermodynamics for each element to describe how the element transfers energy between itself and its surroundings. Take care to substitute what you know about the energy, work, and heat terms for each element into the equation.
    1. You may cross out any "extra" power variables in each final first-law equation for each element (e.g. $V_{12} i = i^2R \rightarrow V_{12} = iR$)
  3. Write equations that indicate how each element in your scope exchanges energy between itself and other elements in the scope, or between itself and the overall system's surroundings. Use physical connections between elements in your system to guide you here.
    1. Identify "nodes" in your system and write the principle of continuity for these nodes (e.g. $i_1 - i_2 - i_3 = 0$).
  4. Using algebraic manipulation, combine your equations from steps 2 and 3 to obtain a final system model.
  5. Check your final system model for internal validity, including the signs and units of each term, and the overall form of the equation.

Assignment

Background

In this assignment, you will be simulating blood flow through the aorta in a human patient. You will use the principle of continuity to help you with model construction. A description of how the aorta works is given below.

One of the key features of the aorta, which is the largest artery, is that it is stretchy. When the heart squeezes blood into the aorta, its walls "comply," and store blood. As a result the aorta stores potentiall energy in the form of fluid pressure (much like a tank or a capacitor-- see this section of Reading 11. While the aorta is not a "tank" in the sense that it stores energy as gravitational potential, it does store energy in elastic potential by stretching its walls as it fills up.

Generalized Fluid Capacitors

While a simple tank storing energy in gravitational potential is one example of a fluid "capacitor," or ideal fluid potential energy storage element, working against gravitational potential is not the only way a vessel full of fluid can store energy. In many cases, a fluid storage vessel can store potential energy by "stretching" or increasing its volume elastically as it is filled (like a balloon). Sometimes, hydraulic accumulators use air pressure to act as a "spring" making a cavity harder to fill with fluid as fluid volume increases. Sometimes, literal spring-loaded pistons are used.

In fact, the concept of the "fluid capacitor" can be applied to any fluid element that can be reasonably modeled as storing fluid potential energy without heat transfer, which means there is no significant resistance at the inlet to the vessel. Consider the following drawing, which represents a "balloon-like" fluid capacitor that stretches to store fluid as flow work is done on the element to result in an influx of fluid, $\dot{\mathcal{V}}_c$.

image-2.png

Writing the first law of thermodynamics for this element, assuming no heat transfer at the inlet, no significant kinetic energy storage, and no internal energy carried by mass, yields:

$$\dot{E} = \dot{W}_{in} - \dot{W}_{out} + \cancel{\dot{Q}}_{in} - \cancel{\dot{Q}}_{out}+ \cancel{\dot{E}}_{m,in} - \cancel{\dot{E}}_{m,out}$$

This means that the energy stored in the capacitor will go up if the net work $\dot{W}_{net} = \dot{W}_{in}-\dot{W}_{out}$ is positive. This work is flow work, where, defined using gauge pressure, we see:

$$\dot{W}_{net} = (P_c - \cancel{P_{atm}})\dot{\mathcal{V}} = P_c \dot{\mathcal{V}}_c$$

Now, it is true that knowing just how much work needs to be done to fill the capacitor with more fluid can be tricky, especially for "balloon-like" capacitors. To actually stretch the vessel, work must be done to increase the pressure inside the vessel with respect to atmospheric pressure, and this usually involves complex calculations how how stiff the vessel's material is.

Many times, a physics-based calculation of this work is intractible. Therefore, the effective "compliance" of a fluid capacitor is often studied empirically, and is characterized by defining a "fluid capacitance" for the vessel. Defining the capacitance of the element as $C\equiv \frac{ \mathcal{V}}{ P}$ allows us to develop an equation that is very similar to that of the electrical capacitor, as seen in Reading 11. Specifically, we can define the capacitor's stored energy by saying that "all of the work done on the element is stored energy," according to the first law equation we wrote above. Formally, that looks like this:

$$E_{stored} = W_{net} = \int_0^{\mathcal{V}_c} P_c(\mathcal{V}_c) d\mathcal{V}_c = \int_0^{\mathcal{V}_c} \frac{\mathcal{V}_c}{C} d\mathcal{V}_c = \frac{\mathcal{V}_c^2}{2C} = \frac{ P^2_c C^2}{2C} = \frac{1}{2}CP_c^2$$

Using this definition, we can write the first law of thermodynamics for a generalized fluid capacitor as:

$$\dot{E} = \dot{W}_{net} = CP_c \dot{P}_c = P_c \dot{\mathcal{V}}_c$$

Background Continued: System Scoping and Model Construction

Of course, the aorta doesn't really have negligible resistance. there is a heart valve on one end of it, and an entire circulatory system on the other. But the compliance in the aorta is often modeled using a "generalized fluid capacitor" as explained above. In biomedical engineering research, the aorta is often modeled using what is called a "3-element Windkessel model," which is shown below. It lumps all resistance on the "upstream" side of the aorta into a fluid resistor $R_p$ for "proximal resistance" and all of the resistance on the "downstream" side of the aorta into a fluid resistor $R_d$ or "distal resistance."

image-2.png

The compliance in the aorta (resulting in its capacitance $C_f$) results in what is often called the "Windkessel principle," Which is demonstrated below. If the aorta doesn't do its job in storing energy, then the "spikes" in pressure from the left ventricle of the heart would cause the circulation in the body to stop and start abruptly, affecting organ function. This is a lot like the capacitor in our 'mini electrical grid', which served to smooth out potential variations in power from our renewable energy source.

As the video shows, a "stiff aorta" can cause problems for circulation. In fact, as an aorta stiffens with age, cardiovascular risks increase. Your job today is to build a model of the aorta in a human, and determine a value for the aorta's capacitance $C$ by fitting your model to data obtained from in-vivo measurements of aortic pressure $P_2$ given a particular flow rate input from the left ventricle of the heart.

What you know

You know that a particular patient's heart has a volume of 115ml ($1.15\times 10^{-4} m^3$). You also know that "systole," or the period of contraction of the heart, lasts for $0.25s$. You can treat the left ventricle as a flow rate source, where the input flow rate is a constant value during systole, and 0 when systole ends. You will need to create an array representing this type of input, and it should have the following "pulse" shape. You can use a for-loop to do this, or you can use indexing via the colon notation to set a range of values in your array to a constant. I'm deliberately leaving this open-ended, because there are a few ways to approach it. If you get stuck, be sure to reach out and we can talk about your approach.

image.png

You also have access to pressure measurements from the aorta during one heart cycle, which lasts 0.8 seconds. These are provided in leftaorta_pressuredata_mmhg.txt. Time is the first column, and aortic pressure is the second column. It is provided in pressure units of "mmhg" or millimeters of mercury, which should be converted to Pascals in your code. You also have estimates for the following parameter values:

  • $R_d \approx 7.5 \times 10^{7} \frac{Pa\cdot s}{m^3}$
  • $R_p \approx 3 \times 10^{7} \frac{Pa\cdot s}{m^3}$

Deliverables: Model Scoping and Construction

Using the model scope and element types above, construct a differential equation relating the ventricle flow rate $\dot{\mathcal{V}}_{in}$ to aortic pressure $P_2$. Make explicit use of the principle of continuity to help you build your model.

YOUR ANSWER HERE

Deliverable: Model Calibration and Evaluation

Determine the capacitance of the aorta $C$ by fitting a simulation of your model against the aortic pressure data provided.

In [3]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Deliverable: Using your model to predict

Using your model, predict what would happen if the aorta's stiffness doubled, which would halve its capacitance. Assume the resistance doesn't change, and discuss possible effects on the patient's health. A quick look at this article, which discusses the effects of the parameters on rat health, may provide you some inspiration. Reading the article in full is not required, but you may find it useful in guiding your discussion.

YOUR ANSWER HERE

In [4]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!