Xyce  6.1
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-2015 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.12.2.1 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:29:37 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 
49 // ---------- Standard Includes ----------
50 
51 
52 // ---------- Xyce Includes ----------
53 #include <N_DEV_MembraneCS.h>
54 #include <N_LAS_Vector.h>
55 #include <N_LAS_Matrix.h>
56 #include <N_DEV_SolverState.h>
57 
58 namespace Xyce {
59 namespace Device {
60 
61 //-----------------------------------------------------------------------------
62 // Function : MembraneCS::MembraneCS
63 // Purpose :
64 // Special Notes :
65 // Scope : public
66 // Creator : Richard Schiek, Electrical and Microsytem Modeling
67 // Creation Date : 08/11/2010
68 //-----------------------------------------------------------------------------
70 {
71  // Connor Stevens has the following unknowns for the membrane
72  // 1. voltage
73  // 2. n
74  // 3. m
75  // 4. h
76  // 5. a
77  // 6. b
78  // 7. M
79  // 8. H
80  // 9. c
81  // 10. Ca
82 
84 }
85 
86 
87 //-----------------------------------------------------------------------------
88 // Function : MembraneCS::setJacStamp
89 // Purpose :
90 // Special Notes :
91 // Scope : public
92 // Creator : Richard Schiek, Electrical and Microsytem Modeling
93 // Creation Date : 08/11/2010
94 //-----------------------------------------------------------------------------
95 void MembraneCS::setJacStamp( int numExtVars, int segmentNumber, int vOffset, std::vector< std::vector< int > > & segmentJacStamp )
96 {
97  int offset = numExtVars + numIndependentVars_*segmentNumber;
98  int jacobianRowSize = segmentJacStamp[offset].size();
99 
100  //
101  // jacobian element count by row:
102  // vin: 2
103  // vout: 2
104  // v1: 3
105  //
106  // 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
107  //
108  // Vin : g(0,1) * (V(1) - Vin ) = 0
109  // Vout : g(n,n-1) * (V(n-1) - Vout) = 0
110  // 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
111  // plus node supporting equations (a, b, m)
112 
113  // jacobian format for full Connor Stevens Model
114  // Vin Vout V1 n m h a b M H c Ca V2 n m h V(nSeg) n m h
115  // kcl Vin -g(0,1) g(0,1)
116  // kcl Vout -g(n,n-1) g(n,n-1)
117  // kcl V1 yes yes yes yes yes y y y y y yes
118  // n yes yes
119  // m yes yes
120  // h yes yes
121  // a yes yes
122  // b yes yes
123  // M yes yes
124  // H yes yes
125  // c yes yes yes
126  // Ca yes yes yes yes
127  //
128  //
129  // jacobian element count by row:
130  // vin: 2
131  // vout: 2
132  // v1: 11
133  // n1: 2
134  // m1: 2
135  // h1: 2
136  // a1: 2
137  // b1: 2
138  // M1: 2
139  // H1: 2
140  // c1: 3
141  // Ca1: 4
142  //
143 
144  // this resize should already have been done ?
145  //segmentJacStamp[offset].resize(11);
146 
147  // This is for Vprev, Cable handles that
148  /*
149  if( i == 2 )
150  {
151  segmentJacStamp[offset][0] = 0; // v_in
152  }
153  else
154  {
155  segmentJacStamp[offset][0] = offset-10; // v_prev
156  }
157  */
158  segmentJacStamp[offset][1] = offset; // v
159  segmentJacStamp[offset][2] = offset+1; // n
160  segmentJacStamp[offset][3] = offset+2; // m
161  segmentJacStamp[offset][4] = offset+3; // h
162  segmentJacStamp[offset][5] = offset+4; // a
163  segmentJacStamp[offset][6] = offset+5; // b
164  segmentJacStamp[offset][7] = offset+6; // M
165  segmentJacStamp[offset][8] = offset+7; // H
166  segmentJacStamp[offset][9] = offset+8; // c
167 
168  // this is for Vnext, Cable handles that
169  /*
170  if( offset==(numVars-10) )
171  {
172  segmentJacStamp[offset][10] = 1; // v_out
173  }
174  else
175  {
176  segmentJacStamp[offset][10] = offset+10; // v_next
177  }
178  */
179  segmentJacStamp[offset+1].resize(2); // n
180  segmentJacStamp[offset+1][0] = offset;
181  segmentJacStamp[offset+1][1] = offset+1;
182  segmentJacStamp[offset+2].resize(2); // m
183  segmentJacStamp[offset+2][0] = offset;
184  segmentJacStamp[offset+2][1] = offset+2;
185  segmentJacStamp[offset+3].resize(2); // h
186  segmentJacStamp[offset+3][0] = offset;
187  segmentJacStamp[offset+3][1] = offset+3;
188  segmentJacStamp[offset+4].resize(2); // a
189  segmentJacStamp[offset+4][0] = offset;
190  segmentJacStamp[offset+4][1] = offset+4;
191  segmentJacStamp[offset+5].resize(2); // b
192  segmentJacStamp[offset+5][0] = offset;
193  segmentJacStamp[offset+5][1] = offset+5;
194  segmentJacStamp[offset+6].resize(2); // M
195  segmentJacStamp[offset+6][0] = offset;
196  segmentJacStamp[offset+6][1] = offset+6;
197  segmentJacStamp[offset+7].resize(2); // H
198  segmentJacStamp[offset+7][0] = offset;
199  segmentJacStamp[offset+7][1] = offset+7;
200  segmentJacStamp[offset+8].resize(3); // c
201  segmentJacStamp[offset+8][0] = offset;
202  segmentJacStamp[offset+8][1] = offset+8;
203  segmentJacStamp[offset+8][2] = offset+9;
204  segmentJacStamp[offset+9].resize(4); // ca
205  segmentJacStamp[offset+9][0] = offset;
206  segmentJacStamp[offset+9][1] = offset+6;
207  segmentJacStamp[offset+9][2] = offset+7;
208  segmentJacStamp[offset+9][3] = offset+9;
209 }
210 
211 //-----------------------------------------------------------------------------
212 // Function : MembraneCS::loadDAEQVector
213 // Purpose :
214 // Special Notes :
215 // Scope : public
216 // Creator : Richard Schiek, Electrical and Microsytem Modeling
217 // Creation Date : 08/11/2010
218 //-----------------------------------------------------------------------------
219 void MembraneCS::loadDAEQVector( int segmentNumber, std::vector< int > & lidIndexVector, Linear::Vector * solnVecPtr, Linear::Vector * daeQVecPtr, double segArea)
220 {
221 }
222 
223 //-----------------------------------------------------------------------------
224 // Function : MembraneCS::loadDAEFVector
225 // Purpose :
226 // Special Notes :
227 // Scope : public
228 // Creator : Richard Schiek, Electrical and Microsytem Modeling
229 // Creation Date : 08/11/2010
230 //-----------------------------------------------------------------------------
231 void MembraneCS::loadDAEFVector( int segmentNumber, std::vector< int > & lidIndexVector, Linear::Vector * solnVecPtr, Linear::Vector * daeFVecPtr, double segArea)
232 {
233 }
234 
235 //-----------------------------------------------------------------------------
236 // Function : MembraneCS::loadDAEdQdx
237 // Purpose :
238 // Special Notes :
239 // Scope : public
240 // Creator : Richard Schiek, Electrical and Microsytem Modeling
241 // Creation Date : 08/11/2010
242 //-----------------------------------------------------------------------------
243 void MembraneCS::loadDAEdQdx( int segmentNumber, int vOffset, std::vector< int > & lidIndexVector, std::vector< std::vector< int > > & jacobianOffsets, Linear::Vector * solnVecPtr, Linear::Matrix * dQdxMatPtr, double segArea)
244 {
245 }
246 
247 //-----------------------------------------------------------------------------
248 // Function : MembraneCS::loadDAEdFdx
249 // Purpose :
250 // Special Notes :
251 // Scope : public
252 // Creator : Richard Schiek, Electrical and Microsytem Modeling
253 // Creation Date : 08/11/2010
254 //-----------------------------------------------------------------------------
255 void MembraneCS::loadDAEdFdx( int segmentNumber, int vOffset, std::vector< int > & lidIndexVector, std::vector< std::vector< int > > & jacobianOffsets, Linear::Vector * solnVecPtr, Linear::Matrix * dFdxMatPtr, double segArea)
256 {
257 }
258 
259 } // namespace Device
260 } // namespace Xyce
void setJacStamp(int numExtVars, int segmentNumber, int vOffset, std::vector< std::vector< int > > &segmentJacStamp)
void loadDAEQVector(int segmentNumber, std::vector< int > &lidIndexVector, Linear::Vector *solnVecPtr, Linear::Vector *daeQVecPtr, double segArea)
Pure virtual class to augment a linear system.
void loadDAEdFdx(int segmentNumber, int vOffset, std::vector< int > &lidIndexVector, std::vector< std::vector< int > > &jacobianOffsets, Linear::Vector *solnVecPtr, Linear::Matrix *dFdxMatPtr, double segArea)
void loadDAEFVector(int segmentNumber, std::vector< int > &lidIndexVector, Linear::Vector *solnVecPtr, Linear::Vector *daeFVecPtr, double segArea)
MembraneCS(const SolverState &ss1)
void loadDAEdQdx(int segmentNumber, int vOffset, std::vector< int > &lidIndexVector, std::vector< std::vector< int > > &jacobianOffsets, Linear::Vector *solnVecPtr, Linear::Matrix *dQdxMatPtr, double segArea)