-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmultiphysicsL2.tex
More file actions
263 lines (263 loc) · 7.37 KB
/
multiphysicsL2.tex
File metadata and controls
263 lines (263 loc) · 7.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
%
% Copyright © 2014 Peeter Joot. All Rights Reserved.
% Licenced as described in the file LICENSE under the root directory of this GIT repository.
%
%\input{../blogpost.tex}
%
%\renewcommand{\basename}{multiphysicsL2}
%\renewcommand{\dirname}{notes/ece1254/}
%\newcommand{\keywords}{ECE1254H}
%\input{../peeter_prologue_print2.tex}
%
%\usepackage{listing}
%\usepackage{algorithm}
%\usepackage{algorithmic}
%
%\beginArtNoToc
%\generatetitle{ECE1254H Modeling of Multiphysics Systems. Lecture 2: Assembling system equations automatically. Taught by Prof.\ Piero Triverio}
%\section{Assembling system equations automatically}
\label{chap:multiphysicsL2}
%
%\section{Disclaimer}
%
%Peeter's lecture notes from class. These may be incoherent and rough.
%
\section{Node/branch construction of system equations.}
\index{node branch method}
%
Consider the sample circuit of \cref{fig:lecture2:lecture2Fig1}.
%
%\imageFigure{../figures/ece1254-multiphysics/lecture2Fig1}{Sample resistive circuit}{fig:lecture2:lecture2Fig1}{0.3}
\imageFigure{../figures/ece1254-multiphysics/1254-sample-resistive-circuit.pdf}{Sample resistive circuit.}{fig:lecture2:lecture2Fig1}{0.3}
%
%
\paragraph{Step 1. Choose unknowns:} For this problem, take
%
\begin{itemize}
\item
node voltages: \(V_1, V_2, V_3, V_4\)
\item
branch currents: \(i_{\textrm{A}}, i_{\textrm{B}}, i_{\textrm{C}}, i_{\textrm{D}}, i_{\textrm{E}}\)
\end{itemize}
%
No additional labels are required for the source current sources.
A reference node is always introduced, given the node number zero.
%
For a circuit with \(N\)
nodes, and
\(B\) resistors, there will be
\(N-1\)
unknown node voltages \index{node voltage} and \(B\) unknown branch currents \index{branch current}, for a total number of
\(N - 1 + B\) unknowns.
%
\paragraph{Step 2. Conservation equations:} KCL
%
\begin{itemize}
\item 0: \(i_{\textrm{A}} + i_{\textrm{E}} - i_{\textrm{D}} = 0\)
\item 1: \(-i_{\textrm{A}} + i_{\textrm{B}} + i_{\textrm{S},\textrm{A}} = 0\)
\item 2: \(-i_{\textrm{B}} + i_{\textrm{S},\textrm{B}} - i_{\textrm{E}} + i_{\textrm{S},\textrm{C}} = 0\)
\item 3: \(i_{\textrm{C}} - i_{\textrm{S},\textrm{C}} = 0\)
\item 4: \(-i_{\textrm{S},\textrm{A}} - i_{\textrm{S},\textrm{B}} + i_{\textrm{D}} - i_{\textrm{C}} = 0\)
\end{itemize}
Grouping unknown currents, this is
\begin{itemize}
\item 0: \(i_{\textrm{A}} + i_{\textrm{E}} - i_{\textrm{D}} = 0\)
\item 1: \(-i_{\textrm{A}} + i_{\textrm{B}} = -i_{\textrm{S},\textrm{A}}\)
\item 2: \(-i_{\textrm{B}} -i_{\textrm{E}} = -i_{\textrm{S},\textrm{B}} -i_{\textrm{S},\textrm{C}}\)
\item 3: \(i_{\textrm{C}} = i_{\textrm{S},\textrm{C}}\)
\item 4: \(i_{\textrm{D}} - i_{\textrm{C}} = i_{\textrm{S},\textrm{A}} + i_{\textrm{S},\textrm{B}}\)
\end{itemize}
%
Note that one of these equations is redundant (sum 1-4).
In a circuit with \(N\) nodes, are at most \(N-1\) independent KCLs.
In matrix form
\begin{equation}\label{eqn:multiphysicsL2:20}
\begin{bmatrix}
-1 & 1 & 0 & 0 & 0 \\
0 & -1 & 0 & 0 & -1 \\
0 & 0 & 1 & 0 & 0 \\
0 & 0 & -1 & 1 & 0
\end{bmatrix}
\begin{bmatrix}
i_{\textrm{A}} \\
i_{\textrm{B}} \\
i_{\textrm{C}} \\
i_{\textrm{D}} \\
i_{\textrm{E}} \\
\end{bmatrix}
=
\begin{bmatrix}
-i_{\textrm{S},\textrm{A}} \\
-i_{\textrm{S},\textrm{B}} -i_{\textrm{S},\textrm{C}} \\
i_{\textrm{S},\textrm{C}} \\
i_{\textrm{S},\textrm{A}} + i_{\textrm{S},\textrm{B}}
\end{bmatrix}
\end{equation}
%
This first matrix of ones and minus ones is called the \textAndIndex{incidence matrix}
\(A\). This matrix has
\(B\) columns and
\(N-1\) rows. The matrix of known currents is called
\(\BI_{\textrm{S}}\), and the branch currents called
\(\BI_{\textrm{B}}\). That is
%
\begin{equation}\label{eqn:multiphysicsL2:40}
A \BI_{\textrm{B}} = \BI_{\textrm{S}}.
\end{equation}
%
Observe that there is a plus and minus one in all columns except for those columns impacted by the neglect of the reference node current conservation equation.
%
\paragraph{Algorithm for filling \(A\)}
%
In the input file, to describe a resistor of \cref{fig:lecture2:lecture2Fig2}, you'll have a line of the form
%
\begin{center}
\textbf{Rlabel \(n_1\) \(n_2\) value}
\end{center}
%
\imageFigure{../figures/ece1254-multiphysics/lecture2Fig2}{Resistor node convention.}{fig:lecture2:lecture2Fig2}{0.1}
%
The algorithm to process resistor lines is
%
\index{stamp!resistor}
\makealgorithm{Resistor line handling.}{alg:multiphysicsL2:1}{
\STATE \(A \leftarrow 0\)
\STATE \(ic \leftarrow 0\)
\FORALL{resistor lines}
\STATE \(ic \leftarrow ic + 1\), adding one column to \(A\)
\IF{\(n_1 != 0\)}
\STATE \(A(n_1, ic) \leftarrow +1\)
\ENDIF
\IF{\(n_2 != 0\)}
\STATE \(A(n_2, ic) \leftarrow -1\)
\ENDIF
\ENDFOR
}
%
\paragraph{Algorithm for filling \(\BI_{\textrm{S}}\)}
%
Current sources, as in \cref{fig:lecture2:lecture2Fig3}, a line will have the specification
%
\begin{center}
\textbf{Ilabel \(n_1\) \(n_2\) value}
\end{center}
%
\imageFigure{../figures/ece1254-multiphysics/lecture2Fig3}{Current source conventions.}{fig:lecture2:lecture2Fig3}{0.1}
%
\index{stamp!current}
\makealgorithm{Current line handling.}{alg:multiphysicsL2:2}{
\STATE \(\BI_{\textrm{S}} = \text{zeros}(N-1, 1)\)
\FORALL{current lines}
\STATE \(\BI_{\textrm{S}}(n_1) \leftarrow \BI_{\textrm{S}}(n_1) - \text{value}\)
\STATE \(\BI_{\textrm{S}}(n_2) \leftarrow \BI_{\textrm{S}}(n_2) + \text{value}\)
\ENDFOR
}
%
\paragraph{Step 3. Constitutive equations:}
%
\begin{equation}\label{eqn:multiphysicsL2:60}
\begin{bmatrix}
i_{\textrm{A}} \\
i_{\textrm{B}} \\
i_{\textrm{C}} \\
i_{\textrm{D}} \\
i_{\textrm{E}}
\end{bmatrix}
=
\begin{bmatrix}
1/R_{\textrm{A}} & & & & \\
& 1/R_{\textrm{B}} & & & & \\
& & 1/R_{\textrm{C}} & & & \\
& & & 1/R_{\textrm{D}} & & \\
& & & & & 1/R_{\textrm{E}}
\end{bmatrix}
\begin{bmatrix}
v_{\textrm{A}} \\
v_{\textrm{B}} \\
v_{\textrm{C}} \\
v_{\textrm{D}} \\
v_{\textrm{E}}
\end{bmatrix}
\end{equation}
%
Or
%
\begin{equation}\label{eqn:multiphysicsL2:80}
\BI_{\textrm{B}} = \alpha \BV_{\textrm{B}},
\end{equation}
%
where \(\BV_{\textrm{B}}\) are the branch voltages, not unknowns of interest directly. That can be written
%
\begin{equation}\label{eqn:multiphysicsL2:100}
\begin{bmatrix}
v_{\textrm{A}} \\
v_{\textrm{B}} \\
v_{\textrm{C}} \\
v_{\textrm{D}} \\
v_{\textrm{E}}
\end{bmatrix}
=
\begin{bmatrix}
-1 & & & \\
1 & -1 & & \\
& & 1 & -1 \\
& & & 1 \\
& -1 & &
\end{bmatrix}
\begin{bmatrix}
v_1 \\
v_2 \\
v_3 \\
v_4
\end{bmatrix}
\end{equation}
%
Observe that this %\(\alpha\) %FIXME: label
is the transpose of \(A\), so
%
\begin{equation}\label{eqn:multiphysicsL2:120}
\BV_{\textrm{B}} = A^\T \BV_{\textrm{N}}.
\end{equation}
%
\paragraph{Solving}
%
\begin{itemize}
\item
KCLs: \(A \BI_{\textrm{B}} = \BI_{\textrm{S}}\)
\item
constitutive: \(\BI_{\textrm{B}} = \alpha \BV_{\textrm{B}} \implies \BI_{\textrm{B}} = \alpha A^\T \BV_{\textrm{N}}\)
\item
branch and node voltages: \(\BV_{\textrm{B}} = A^\T \BV_{\textrm{N}}\)
\end{itemize}
%
In block matrix form, this is
%
\begin{equation}\label{eqn:multiphysicsL2:140}
\begin{bmatrix}
A & 0 \\
I & -\alpha A^\T
\end{bmatrix}
\begin{bmatrix}
\BI_{\textrm{B}} \\
\BV_{\textrm{N}}
\end{bmatrix}
=
\begin{bmatrix}
\BI_{\textrm{S}} \\
0
\end{bmatrix}.
\end{equation}
%
Is it square? This can be observing to be the case after noting that there are
%
\begin{itemize}
\item \(N-1\)
rows in \(A\)
, and \(B\) columns.
\item \(B\)
rows in \(I\).
\item \(N-1\) columns.
\end{itemize}
%
%\EndArticle
%\EndNoBibArticle