Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_MembraneCS.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2011 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_MembraneCS.C,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Richard Schiek, Electrical and Microsytem Modeling
33 //
34 // Creation Date : 08/11/2010
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.10 $
40 //
41 // Revision Date : $Date: 2014/01/23 16:19:04 $
42 //
43 // Current Owner : $Author: dgbaur $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 
49 // ---------- Standard Includes ----------
50 
51 #include <N_UTL_Misc.h>
52 
53 // ---------- Xyce Includes ----------
54 #include <N_DEV_MembraneCS.h>
55 #include <N_LAS_Vector.h>
56 #include <N_LAS_Matrix.h>
57 #include <N_DEV_SolverState.h>
58 
59 namespace Xyce {
60 namespace Device {
61 
62 //-----------------------------------------------------------------------------
63 // Function : MembraneCS::MembraneCS
64 // Purpose :
65 // Special Notes :
66 // Scope : public
67 // Creator : Richard Schiek, Electrical and Microsytem Modeling
68 // Creation Date : 08/11/2010
69 //-----------------------------------------------------------------------------
71 {
72  // Connor Stevens has the following unknowns for the membrane
73  // 1. voltage
74  // 2. n
75  // 3. m
76  // 4. h
77  // 5. a
78  // 6. b
79  // 7. M
80  // 8. H
81  // 9. c
82  // 10. Ca
83 
85 }
86 
87 
88 //-----------------------------------------------------------------------------
89 // Function : MembraneCS::setJacStamp
90 // Purpose :
91 // Special Notes :
92 // Scope : public
93 // Creator : Richard Schiek, Electrical and Microsytem Modeling
94 // Creation Date : 08/11/2010
95 //-----------------------------------------------------------------------------
96 void MembraneCS::setJacStamp( int numExtVars, int segmentNumber, int vOffset, std::vector< std::vector< int > > & segmentJacStamp )
97 {
98  int offset = numExtVars + numIndependentVars_*segmentNumber;
99  int jacobianRowSize = segmentJacStamp[offset].size();
100 
101  //
102  // jacobian element count by row:
103  // vin: 2
104  // vout: 2
105  // v1: 3
106  //
107  // i(n) - I(n)/A - g(n,n+1) * (V(n+1) - V(n)) - g(n,n-1) * (V(n-1) - V(n)) + Cm dV(n)/d(t) = 0
108  //
109  // Vin : g(0,1) * (V(1) - Vin ) = 0
110  // Vout : g(n,n-1) * (V(n-1) - Vout) = 0
111  // Vnode : i(n) - I(n)/A - g(n,n+1) * (V(n+1) - V(n)) - g(n,n-1) * (V(n-1) - V(n)) + Cm dV(n)/d(t) = 0
112  // plus node supporting equations (a, b, m)
113 
114  // jacobian format for full Connor Stevens Model
115  // Vin Vout V1 n m h a b M H c Ca V2 n m h V(nSeg) n m h
116  // kcl Vin -g(0,1) g(0,1)
117  // kcl Vout -g(n,n-1) g(n,n-1)
118  // kcl V1 yes yes yes yes yes y y y y y yes
119  // n yes yes
120  // m yes yes
121  // h yes yes
122  // a yes yes
123  // b yes yes
124  // M yes yes
125  // H yes yes
126  // c yes yes yes
127  // Ca yes yes yes yes
128  //
129  //
130  // jacobian element count by row:
131  // vin: 2
132  // vout: 2
133  // v1: 11
134  // n1: 2
135  // m1: 2
136  // h1: 2
137  // a1: 2
138  // b1: 2
139  // M1: 2
140  // H1: 2
141  // c1: 3
142  // Ca1: 4
143  //
144 
145  // this resize should already have been done ?
146  //segmentJacStamp[offset].resize(11);
147 
148  // This is for Vprev, Cable handles that
149  /*
150  if( i == 2 )
151  {
152  segmentJacStamp[offset][0] = 0; // v_in
153  }
154  else
155  {
156  segmentJacStamp[offset][0] = offset-10; // v_prev
157  }
158  */
159  segmentJacStamp[offset][1] = offset; // v
160  segmentJacStamp[offset][2] = offset+1; // n
161  segmentJacStamp[offset][3] = offset+2; // m
162  segmentJacStamp[offset][4] = offset+3; // h
163  segmentJacStamp[offset][5] = offset+4; // a
164  segmentJacStamp[offset][6] = offset+5; // b
165  segmentJacStamp[offset][7] = offset+6; // M
166  segmentJacStamp[offset][8] = offset+7; // H
167  segmentJacStamp[offset][9] = offset+8; // c
168 
169  // this is for Vnext, Cable handles that
170  /*
171  if( offset==(numVars-10) )
172  {
173  segmentJacStamp[offset][10] = 1; // v_out
174  }
175  else
176  {
177  segmentJacStamp[offset][10] = offset+10; // v_next
178  }
179  */
180  segmentJacStamp[offset+1].resize(2); // n
181  segmentJacStamp[offset+1][0] = offset;
182  segmentJacStamp[offset+1][1] = offset+1;
183  segmentJacStamp[offset+2].resize(2); // m
184  segmentJacStamp[offset+2][0] = offset;
185  segmentJacStamp[offset+2][1] = offset+2;
186  segmentJacStamp[offset+3].resize(2); // h
187  segmentJacStamp[offset+3][0] = offset;
188  segmentJacStamp[offset+3][1] = offset+3;
189  segmentJacStamp[offset+4].resize(2); // a
190  segmentJacStamp[offset+4][0] = offset;
191  segmentJacStamp[offset+4][1] = offset+4;
192  segmentJacStamp[offset+5].resize(2); // b
193  segmentJacStamp[offset+5][0] = offset;
194  segmentJacStamp[offset+5][1] = offset+5;
195  segmentJacStamp[offset+6].resize(2); // M
196  segmentJacStamp[offset+6][0] = offset;
197  segmentJacStamp[offset+6][1] = offset+6;
198  segmentJacStamp[offset+7].resize(2); // H
199  segmentJacStamp[offset+7][0] = offset;
200  segmentJacStamp[offset+7][1] = offset+7;
201  segmentJacStamp[offset+8].resize(3); // c
202  segmentJacStamp[offset+8][0] = offset;
203  segmentJacStamp[offset+8][1] = offset+8;
204  segmentJacStamp[offset+8][2] = offset+9;
205  segmentJacStamp[offset+9].resize(4); // ca
206  segmentJacStamp[offset+9][0] = offset;
207  segmentJacStamp[offset+9][1] = offset+6;
208  segmentJacStamp[offset+9][2] = offset+7;
209  segmentJacStamp[offset+9][3] = offset+9;
210 }
211 
212 //-----------------------------------------------------------------------------
213 // Function : MembraneCS::loadDAEQVector
214 // Purpose :
215 // Special Notes :
216 // Scope : public
217 // Creator : Richard Schiek, Electrical and Microsytem Modeling
218 // Creation Date : 08/11/2010
219 //-----------------------------------------------------------------------------
220 void MembraneCS::loadDAEQVector( int segmentNumber, std::vector< int > & lidIndexVector, N_LAS_Vector * solnVecPtr, N_LAS_Vector * daeQVecPtr, double segArea)
221 {
222 }
223 
224 //-----------------------------------------------------------------------------
225 // Function : MembraneCS::loadDAEFVector
226 // Purpose :
227 // Special Notes :
228 // Scope : public
229 // Creator : Richard Schiek, Electrical and Microsytem Modeling
230 // Creation Date : 08/11/2010
231 //-----------------------------------------------------------------------------
232 void MembraneCS::loadDAEFVector( int segmentNumber, std::vector< int > & lidIndexVector, N_LAS_Vector * solnVecPtr, N_LAS_Vector * daeFVecPtr, double segArea)
233 {
234 }
235 
236 //-----------------------------------------------------------------------------
237 // Function : MembraneCS::loadDAEdQdx
238 // Purpose :
239 // Special Notes :
240 // Scope : public
241 // Creator : Richard Schiek, Electrical and Microsytem Modeling
242 // Creation Date : 08/11/2010
243 //-----------------------------------------------------------------------------
244 void MembraneCS::loadDAEdQdx( int segmentNumber, int vOffset, std::vector< int > & lidIndexVector, std::vector< std::vector< int > > & jacobianOffsets, N_LAS_Vector * solnVecPtr, N_LAS_Matrix * dQdxMatPtr, double segArea)
245 {
246 }
247 
248 //-----------------------------------------------------------------------------
249 // Function : MembraneCS::loadDAEdFdx
250 // Purpose :
251 // Special Notes :
252 // Scope : public
253 // Creator : Richard Schiek, Electrical and Microsytem Modeling
254 // Creation Date : 08/11/2010
255 //-----------------------------------------------------------------------------
256 void MembraneCS::loadDAEdFdx( int segmentNumber, int vOffset, std::vector< int > & lidIndexVector, std::vector< std::vector< int > > & jacobianOffsets, N_LAS_Vector * solnVecPtr, N_LAS_Matrix * dFdxMatPtr, double segArea)
257 {
258 }
259 
260 } // namespace Device
261 } // namespace Xyce