From: <cd...@us...> - 2011-09-09 01:37:32
|
Revision: 8514 http://octave.svn.sourceforge.net/octave/?rev=8514&view=rev Author: cdf Date: 2011-09-09 01:37:13 +0000 (Fri, 09 Sep 2011) Log Message: ----------- added secs3d Added Paths: ----------- trunk/octave-forge/extra/secs3d/ trunk/octave-forge/extra/secs3d/COPYING trunk/octave-forge/extra/secs3d/DESCRIPTION trunk/octave-forge/extra/secs3d/INDEX trunk/octave-forge/extra/secs3d/README trunk/octave-forge/extra/secs3d/inst/ trunk/octave-forge/extra/secs3d/inst/DDG/ trunk/octave-forge/extra/secs3d/inst/DDG/DDGelectron_driftdiffusion.m trunk/octave-forge/extra/secs3d/inst/DDG/DDGgummelmap.m trunk/octave-forge/extra/secs3d/inst/DDG/DDGhole_driftdiffusion.m trunk/octave-forge/extra/secs3d/inst/DDG/DDGnlpoisson.m trunk/octave-forge/extra/secs3d/inst/DDGOX/ trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXddcurrent.m trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXgummelmap.m trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXnlpoisson.m trunk/octave-forge/extra/secs3d/inst/DDGt/ trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtelectron_driftdiffusion.m trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtgummelmap.m trunk/octave-forge/extra/secs3d/inst/DDGt/DDGthole_driftdiffusion.m trunk/octave-forge/extra/secs3d/inst/QDDGOX/ trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXcompdens.m trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXddcurrent.m trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXelectron_driftdiffusion.m trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXgummelmap.m trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXnlpoisson.m trunk/octave-forge/extra/secs3d/inst/Utilities/ trunk/octave-forge/extra/secs3d/inst/Utilities/Ubern.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ucompconst.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ucomplap.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ucompmass.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ucompmass2.m trunk/octave-forge/extra/secs3d/inst/Utilities/Udescaling.m trunk/octave-forge/extra/secs3d/inst/Utilities/Udrawfaces.m trunk/octave-forge/extra/secs3d/inst/Utilities/Udrawregions.m trunk/octave-forge/extra/secs3d/inst/Utilities/Udriftdiffusion.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ufielddepmob.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ugetnodesonface.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ujoinmeshes.m trunk/octave-forge/extra/secs3d/inst/Utilities/Umeshproperties.m trunk/octave-forge/extra/secs3d/inst/Utilities/Updegrad.m trunk/octave-forge/extra/secs3d/inst/Utilities/Urrextrapolation.m trunk/octave-forge/extra/secs3d/inst/Utilities/Uscaling.m trunk/octave-forge/extra/secs3d/inst/Utilities/Uscharfettergummel.m trunk/octave-forge/extra/secs3d/inst/Utilities/Ustructmesh.m trunk/octave-forge/extra/secs3d/inst/Utilities/Usubmesh.m trunk/octave-forge/extra/secs3d/inst/Utilities/constants.m trunk/octave-forge/extra/secs3d/inst/Utilities/constants.mat trunk/octave-forge/extra/secs3d/inst/data/ trunk/octave-forge/extra/secs3d/inst/data/CMOS/ trunk/octave-forge/extra/secs3d/inst/data/CMOS/SGMOS.m trunk/octave-forge/extra/secs3d/inst/data/CMOS/SGMOS_data.m trunk/octave-forge/extra/secs3d/inst/data/CMOS/SGMOS_run.m trunk/octave-forge/extra/secs3d/inst/secs3d.m Added: trunk/octave-forge/extra/secs3d/COPYING =================================================================== --- trunk/octave-forge/extra/secs3d/COPYING (rev 0) +++ trunk/octave-forge/extra/secs3d/COPYING 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,337 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Added: trunk/octave-forge/extra/secs3d/DESCRIPTION =================================================================== --- trunk/octave-forge/extra/secs3d/DESCRIPTION (rev 0) +++ trunk/octave-forge/extra/secs3d/DESCRIPTION 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,12 @@ +Name: secs3d +Version: 0.0.1 +Date: 2011-09-08 +Author: Carlo de Falco +Maintainer: Carlo de Falco +Title: SEmi Conductor Simulator in 3D +Description: A Drift-Diffusion simulator for 3d semiconductor devices +Categories: Electrical Engineering +Depends: octave (>= 3.2.4), bim, fpl +Autoload: no +License: GPL version 2 or later + Added: trunk/octave-forge/extra/secs3d/INDEX =================================================================== --- trunk/octave-forge/extra/secs3d/INDEX (rev 0) +++ trunk/octave-forge/extra/secs3d/INDEX 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,27 @@ +secs3d >> SEmiConductor Simulator in 3D +DDG: DD solver for semiconductor only devices + DDGgummelmap + DDGnlpoisson +DDGOX: DD solver for semiconductor devices with insuating oxide layers + DDGOXddcurrent + DDGOXgummelmap + DDGOXnlpoisson +QDDGOX: DD solver for semiconductor devices with insuating oxide layers + QDDGOXddcurrent + QDDGOXgummelmap.m + QDDGOXnlpoisson.m +DDGt: Transient DD solver + DDGtgummelmap +Utilities + constants + Udescaling + Ujoinmeshes.m + Uscaling.m + Ustructmesh.m + Usubmesh.m + + + + + + Added: trunk/octave-forge/extra/secs3d/README =================================================================== --- trunk/octave-forge/extra/secs3d/README (rev 0) +++ trunk/octave-forge/extra/secs3d/README 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,18 @@ + + SECS3D - A 3-D Drift--Diffusion Semiconductor Device Simulator +------------------------------------------------------------------- + Copyright (C) 2004-2011 Carlo de Falco + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program (see the file COPYING); if not, see +<http://www.gnu.org/licenses/>. + Added: trunk/octave-forge/extra/secs3d/inst/DDG/DDGelectron_driftdiffusion.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDG/DDGelectron_driftdiffusion.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDG/DDGelectron_driftdiffusion.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,53 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% n=DDGelectron_driftdiffusion(mesh,Dsides,nin,pin,V,un,tn,tp,n0,p0) +% IN: +% v = electric potential +% mesh = integration domain +% ng = initial guess and BCs for electron density +% p = hole density (to compute SRH recombination) +% OUT: +% n = updated electron density + +function n=DDGelectron_driftdiffusion(mesh,Dsides,nin,pin,V,un,tn,tp,n0,p0) + +if (columns(nin)>rows(nin)) + nin=nin'; +end + +if (columns(V)>rows(V)) + V=V'; +end + +if (columns(pin)>rows(pin)) + pin=pin'; +end + +Nnodes = max(size(mesh.p)); +Nelements = max(size(mesh.t)); + +denom = (tp*(nin+sqrt(n0.*p0))+tn*(pin+sqrt(n0.*p0))); +u = un; +U = p0.*n0./denom; +M = pin./denom; +guess = nin; + +n = Udriftdiffusion(mesh,Dsides,guess,M,U,V,u); Added: trunk/octave-forge/extra/secs3d/inst/DDG/DDGgummelmap.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDG/DDGgummelmap.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDG/DDGgummelmap.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,120 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% +% [odata,it,res] =... +% DDGgummelmap (imesh,Dsides,idata,toll,maxit,ptoll,pmaxit,verbose) +% + +function [odata,it,res] =... + DDGgummelmap (imesh,Dsides,idata,toll,maxit,ptoll,pmaxit,verbose) + + +clear global +global DDGNLPOISSON_LAP DDGNLPOISSON_MASS DDG_RHS DDG_MASS + +V (:,1) = idata.V; +p (:,1) = idata.p; +n (:,1) = idata.n; +Fn(:,1) = idata.Fn; +Fp(:,1) = idata.Fp; +D = idata.D; + +Nnodes = max(size(imesh.p)); +Nelements = max(size(imesh.t)); + +for i=1:1:maxit + if (verbose>1) + fprintf(1,'*****************************************************************\n'); + fprintf(1,'**** start of gummel iteration number: %d\n',i); + fprintf(1,'*****************************************************************\n'); + + end + + if (verbose>1) + fprintf(1,'solving non linear poisson equation\n\n'); + end + [V(:,2),n(:,2),p(:,2)] =... + DDGnlpoisson (imesh,Dsides,V(:,1),n(:,1),p(:,1),Fn(:,1),Fp(:,1),D,... + idata.l2,ptoll,pmaxit,verbose-1); + + + if (verbose>1) + fprintf (1,'\n\nupdating electron qfl\n\n'); + end + n(:,3) =DDGelectron_driftdiffusion(imesh,Dsides,n(:,2),p(:,2),V(:,2),... + idata.un*ones(Nelements,1),... + idata.tn,idata.tp,idata.ni,idata.ni); + Fn(:,2)=V(:,2) - log(n(:,3)); + + if (verbose>1) + fprintf(1,'updating hole qfl\n\n'); + end + p(:,3) =DDGhole_driftdiffusion(imesh,Dsides,n(:,3),p(:,2),V(:,2),... + idata.up*ones(Nelements,1),... + idata.tn,idata.tp,idata.ni,idata.ni); + + Fp(:,2)=V(:,2) + log(p(:,3)); + + if (verbose>1) + fprintf(1,'checking for convergence\n\n'); + end + + nrfn= norm(Fn(:,2)-Fn(:,1),inf); + nrfp= norm (Fp(:,2)-Fp(:,1),inf); + nrv = norm (V(:,2)-V(:,1),inf); + nrm(i) = max([nrfn;nrfp;nrv]); + + if (verbose>1) + fprintf (1,' max(|phin_(k+1)-phinn_(k)| , |phip_(k+1)-phip_(k)| , |v_(k+1)- v_(k)| )= %d\n',nrm(i)); + end + if (nrm(i)<toll) + break + end + + V(:,1) = V(:,end); + n(:,1) = n(:,end); + p(:,1) = p(:,end); + Fn(:,1)= Fn(:,end); + Fp(:,1)= Fp(:,end); + + +end + +it = i; +res = nrm + +if (verbose>0) + fprintf(1,'\n\nDD: # of Gummel iterations = %d\n\n',it); +end + +odata = idata; + +odata.n = n(:,end); +odata.p = p(:,end); +odata.V = V(:,end); +odata.Fn = Fn(:,end); +odata.Fp = Fp(:,end); + +clear global + +% Last Revision: +% $Author: carlo $ +% $Date: 2005/05/27 15:29:23 $ Added: trunk/octave-forge/extra/secs3d/inst/DDG/DDGhole_driftdiffusion.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDG/DDGhole_driftdiffusion.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDG/DDGhole_driftdiffusion.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,56 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% p=DDGhole_driftdiffusion(mesh,Dsides,nin,pin,V,up,tn,tp,n0,p0) +% IN: +% v = electric potential +% mesh = integration domain +% nin = initial guess and BCs for electron density +% pin = hole density (to compute SRH recombination) +% OUT: +% p = updated hole density + + +function p=DDGhole_driftdiffusion(mesh,Dsides,nin,pin,V,up,tn,tp,n0,p0) + +if (columns(nin)>rows(nin)) + nin=nin'; +end + +if (columns(V)>rows(V)) + V=V'; +end + +if (columns(pin)>rows(pin)) + pin=pin'; +end + +Nnodes = max(size(mesh.p)); +Nelements = max(size(mesh.t)); + +denom = (tp*(nin+sqrt(n0.*p0))+tn*(pin+sqrt(n0.*p0))); +u = up; +U = n0.*p0./denom; +M = nin./denom; +guess = pin; +V = -V; + +p = Udriftdiffusion(mesh,Dsides,guess,M,U,V,u); + Added: trunk/octave-forge/extra/secs3d/inst/DDG/DDGnlpoisson.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDG/DDGnlpoisson.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDG/DDGnlpoisson.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,233 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% +% [V,n,p,res,niter] = DDGnlpoisson (mesh,Dsides,Vin,nin,pin,Fnin,Fpin,D,l2,toll,maxit,verbose) +% solves $$ -\lambda^2 V'' + (n(V,Fn) - p(V,Fp) -D)$$ +% + +function [V,n,p,res,niter] = DDGnlpoisson (mesh,Dsides,Vin,nin,pin,Fnin,Fpin,D,l2,toll,maxit,verbose) + +global DDGNLPOISSON_LAP DDGNLPOISSON_MASS DDG_RHS + +%% Set some useful constants +dampit = 3; +dampcoeff = 2; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% convert input vectors to columns +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +if columns(D)>rows(D) + D=D'; +end + + +if columns(nin)>rows(nin) + nin=nin'; +end + +if columns(pin)>rows(pin) + pin=pin'; +end + +if columns(Vin)>rows(Vin) + Vin=Vin'; +end + +if columns(Fnin)>rows(Fnin) + Fnin=Fnin'; +end + +if columns(Fpin)>rows(Fpin) + Fpin=Fpin'; +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% setup FEM data structures +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +nodes=mesh.p; +elements=mesh.t; +Nnodes = length(nodes); +Nelements = length(elements); + + + + +% Set values of Dirichelet BCs +Dnodes = Ugetnodesonface(mesh,Dsides); +Bc = zeros(length(Dnodes),1); +% Set list of nodes without Dirichelet BCs +Varnodes = setdiff([1:Nnodes],Dnodes); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% initialization: +%% we're going to solve +%% $$ - \lambda^2 (\delta V)'' + (\frac{\partial n}{\partial V} - \frac{\partial p}{\partial V})= -R $$ +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% set $$ n_1 = nin $$ and $$ V = Vin $$ +V = Vin; +Fn = Fnin; +Fp = Fpin; +n = exp(V-Fn); +p = exp(-V+Fp); +n(Dnodes) = nin(Dnodes); +p(Dnodes) = pin(Dnodes); + + +%%% +%%% Compute LHS matrices +%%% + +%% let's compute FEM approximation of $$ L = - \frac{d^2}{x^2} $$ +if (isempty(DDGNLPOISSON_LAP)) + DDGNLPOISSON_LAP = Ucomplap (mesh,l2*ones(Nelements,1)); +end + +%% compute $$ Mv = ( n + p) $$ +%% and the (lumped) mass matrix M +if (isempty(DDGNLPOISSON_MASS)) + DDGNLPOISSON_MASS=Ucompmass2 (mesh,ones(Nnodes,1),ones(Nelements,1)); +end +Mv = (n + p); +M = DDGNLPOISSON_MASS*sparse(diag(Mv));%Ucompmass (mesh,Mv); + +%%% +%%% Compute RHS vector (-residual) +%%% + +%% now compute $$ T0 = \frac{q}{\epsilon} (n - p - D) $$ +if (isempty(DDG_RHS)) + DDG_RHS= Ucompconst (mesh,ones(Nnodes,1),ones(Nelements,1)); +end +Tv0 = (n - p - D); +T0 = DDG_RHS.*Tv0;%Ucompconst (mesh,Tv0,ones(Nelements,1)); + +%% now we're ready to build LHS matrix and RHS of the linear system for 1st Newton step +A = DDGNLPOISSON_LAP + M; +R = DDGNLPOISSON_LAP * V + T0; + +%% Apply boundary conditions +A (Dnodes,:) = []; +A (:,Dnodes) = []; +R(Dnodes) = []; + +%% we need $$ \norm{R_1} $$ and $$ \norm{R_k} $$ for the convergence test +normr(1) = norm(R,inf); +relresnorm = 1; +reldVnorm = 1; +normrnew = normr(1); +dV = V*0; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% START OF THE NEWTON CYCLE +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +for newtit=1:maxit + if verbose + fprintf(1,'\n newton iteration: %d, reldVnorm = %e\n',newtit,reldVnorm); + end + + dV(Varnodes) =(A)\(-R); + + + + %%%%%%%%%%%%%%%%%% + %% Start of th damping procedure + %%%%%%%%%%%%%%%%%% + tk = 1; + for dit = 1:dampit + if verbose + fprintf(1,'\n damping iteration: %d, residual norm = %e\n',dit,normrnew); + end + Vnew = V + tk * dV; + + n = exp(Vnew-Fn); + p = exp(-Vnew+Fp); + n(Dnodes) = nin(Dnodes); + p(Dnodes) = pin(Dnodes); + + + %%% + %%% Compute LHS matrices + %%% + + %% let's compute FEM approximation of $$ L = - \frac{d^2}{x^2} $$ + %L = Ucomplap (mesh,ones(Nelements,1)); + + %% compute $$ Mv = ( n + p) $$ + %% and the (lumped) mass matrix M + Mv = (n + p); + M = DDGNLPOISSON_MASS*sparse(diag(Mv));%Ucompmass (mesh,Mv); + + %%% + %%% Compute RHS vector (-residual) + %%% + + %% now compute $$ T0 = \frac{q}{\epsilon} (n - p - D) $$ + Tv0 = (n - p - D); + T0 = DDG_RHS.*Tv0;%Ucompconst (mesh,Tv0,ones(Nelements,1)); + + %% now we're ready to build LHS matrix and RHS of the linear system for 1st Newton step + A = DDGNLPOISSON_LAP + M; + R = DDGNLPOISSON_LAP * Vnew + T0; + + %% Apply boundary conditions + A (Dnodes,:) = []; + A (:,Dnodes) = []; + R(Dnodes) = []; + + %% compute $$ | R_{k+1} | $$ for the convergence test + normrnew= norm(R,inf); + + % check if more damping is needed + if (normrnew > normr(newtit)) + tk = tk/dampcoeff; + else + if verbose + fprintf(1,'\nexiting damping cycle because residual norm = %e \n',normrnew); + end + break + end + end + + V = Vnew; + normr(newtit+1) = normrnew; + dVnorm = norm(tk*dV,inf); + % check if convergence has been reached + reldVnorm = dVnorm / norm(V,inf); + if (reldVnorm <= toll) + if(verbose) + fprintf(1,'\nexiting newton cycle because reldVnorm= %e \n',reldVnorm); + end + break + end + +end + +res = normr; +niter = newtit; + Added: trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXddcurrent.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXddcurrent.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXddcurrent.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,42 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% [current,divrg]=DDGOXddcurrent(mesh,Sinodes,data,contacts); + +function [current,divrg]=DDGOXddcurrent(mesh,Sinodes,data,contacts); + +load constants +Nelements = size(mesh.t,2); +mob = data.un*ones(Nelements,1);%Ufielddepmob(mesh,data.un,data.Fn,data.vsatn,data.mubn); +An = Uscharfettergummel(mesh,data.V(Sinodes),mob); +mob = data.up*ones(Nelements,1);%Ufielddepmob(mesh,data.up,-data.V(Sinodes),data.vsatp,data.mubp); +Ap = Uscharfettergummel(mesh,-data.V(Sinodes),mob); +divrg = An * data.n - Ap * data.p; + +for con = 1:length(contacts) + + cnodes = Ugetnodesonface(mesh,contacts(con)); + current(con) = sum(divrg(cnodes)); + +end + +Is = q*data.us*data.Vs*data.ns; +current = current * Is; + Added: trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXgummelmap.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXgummelmap.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXgummelmap.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,145 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% [odata,it,res] = DDGOXgummelmap (imesh,Dsides,... +% Simesh,Sinodes,Sielements,SiDsides,... +% idata,toll,maxit,ptoll,pmaxit,verbose) +% + +function [odata,it,res] = DDGOXgummelmap (imesh,Dsides,... + Simesh,Sinodes,Sielements,SiDsides,... + idata,toll,maxit,ptoll,pmaxit,verbose) + + +clear global +global LOGFILENAME DDGOXNLPOISSON_LAP DDGOXNLPOISSON_MASS DDGOXNLPOISSON_RHS DDG_RHS DDG_MASS + +Nnodes = max(size(imesh.p)); +Nelements = max(size(imesh.t)); +SiNnodes = max(size(Simesh.p)); +SiNelements = max(size(Simesh.t)); + +V (:,1) = idata.V; + +p (:,1) = idata.p; +n (:,1) = idata.n; + +Fn(:,1) = idata.Fn; +Fp(:,1) = idata.Fp; + +D = idata.D; + +Dnodes = Ugetnodesonface(imesh,Dsides); +SiDnodes = Ugetnodesonface(Simesh,SiDsides); + +nrm = 1; + +for i=1:1:maxit + if (verbose>1) + fprintf(1,'*****************************************************************\n'); + fprintf(1,'**** start of gummel iteration number: %d\n',i); + fprintf(1,'*****************************************************************\n'); + + end + + if (verbose>1) + fprintf(1,'solving non linear poisson equation\n\n'); + end + + + [V(:,2),n(:,2),p(:,2)] =DDGOXnlpoisson (imesh,Dsides,Sinodes,SiDnodes,Sielements,... + V(:,1),n(:,1),p(:,1),Fn(:,1),Fp(:,1),D,... + idata.l2,idata.l2ox,ptoll,pmaxit,verbose-1); + V(Dnodes,2) = idata.V(Dnodes); + + if (verbose>1) + fprintf (1,'\n\nupdating electron qfl\n\n'); + end + + mob = Ufielddepmob(Simesh,idata.un,Fn(:,1),idata.vsatn,idata.mubn); + + n(:,3) =DDGelectron_driftdiffusion(Simesh,SiDsides,n(:,2),p(:,2),... + V(Sinodes,2),mob,... + idata.tn,idata.tp,idata.ni,idata.ni); + + Fn(:,2)=V(Sinodes,2) - log(n(:,3)); + n(SiDnodes,3) = idata.n(SiDnodes); + Fn(SiDnodes,2) = idata.Fn(SiDnodes); + + if (verbose>1) + fprintf(1,'updating hole qfl\n\n'); + end + + mob = Ufielddepmob(Simesh,idata.up,Fp(:,1),idata.vsatp,idata.mubp); + + p(:,3) =DDGhole_driftdiffusion(Simesh,SiDsides,n(:,3),p(:,2),... + V(Sinodes,2),mob,... + idata.tn,idata.tp,idata.ni,idata.ni); + + + Fp(:,2)= V(Sinodes,2) + log(p(:,3)); + p(SiDnodes,3) = idata.p(SiDnodes); + Fp(SiDnodes,2) = idata.Fp(SiDnodes); + + if (verbose>1) + fprintf(1,'checking for convergence\n\n'); + end + + nrfn= norm(Fn(:,2)-Fn(:,1),inf); + nrfp= norm (Fp(:,2)-Fp(:,1),inf); + nrv = norm (V(:,2)-V(:,1),inf); + nrm(i) = max([nrfn;nrfp;nrv]); + + figure(2) + semilogy(nrm) + pause(.1) + + + if (verbose>1) + fprintf (1,' max(|phin_(k+1)-phinn_(k)| , |phip_(k+1)-phip_(k)| , |v_(k+1)- v_(k)| )= %d\n',nrm(i)); + end + if (nrm(i)<toll) + break + end + + V(:,1) = V(:,end); + n(:,1) = n(:,end); + p(:,1) = p(:,end); + Fn(:,1)= Fn(:,end); + Fp(:,1)= Fp(:,end); + + +end + +it = i; +res = nrm; + +if (verbose>0) + fprintf(1,'\n\nDD: # of Gummel iterations = %d\n\n',it); +end + +odata = idata; + +odata.n = n(:,end); +odata.p = p(:,end); +odata.V = V(:,end); +odata.Fn = Fn(:,end); +odata.Fp = Fp(:,end); + Added: trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXnlpoisson.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXnlpoisson.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDGOX/DDGOXnlpoisson.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,250 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% +% [V,n,p,res,niter] = DDGOXnlpoisson (mesh,Dsides,Sinodes,Vin,nin,pin,... +% Fnin,Fpin,D,l2,l2ox,toll,maxit,verbose) +% +% solves $$ -\lambda^2 V'' + (n(V,Fn) - p(V,Fp) -D)$$ +% + +function [V,n,p,res,niter] = DDGOXnlpoisson (mesh,Dsides,Sinodes,SiDnodes,... + Sielements,Vin,nin,pin,... + Fnin,Fpin,D,l2,l2ox,... + toll,maxit,verbose) + + +global DDGOXNLPOISSON_LAP DDGOXNLPOISSON_MASS DDGOXNLPOISSON_RHS LOGFILENAME + +%% Set some useful constants +dampit = 3; +dampcoeff = 2; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% convert input vectors to columns +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +if columns(D)>rows(D) + D=D'; +end + + +if columns(nin)>rows(nin) + nin=nin'; +end + +if columns(pin)>rows(pin) + pin=pin'; +end + +if columns(Vin)>rows(Vin) + Vin=Vin'; +end + +if columns(Fnin)>rows(Fnin) + Fnin=Fnin'; +end + +if columns(Fpin)>rows(Fpin) + Fpin=Fpin'; +end +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% setup FEM data structures +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +nodes=mesh.p; +elements=mesh.t; +Nnodes = length(nodes); +Nelements = length(elements); + +Dnodes = Ugetnodesonface(mesh,Dsides); + +% Set values of Dirichelet BCs +Bc = zeros(length(Dnodes),1); +% Set list of nodes without Dirichelet BCs +Varnodes = setdiff([1:Nnodes],Dnodes); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% initialization: +%% we're going to solve +%% $$ - \lambda^2 (\delta V)'' + (\frac{\partial n}{\partial V} - \frac{\partial p}{\partial V})= -R $$ +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% set $$ n_1 = nin $$ and $$ V = Vin $$ +V = Vin; +Fn = Fnin; +Fp = Fpin; +n = exp(V(Sinodes)-Fn); +p = exp(-V(Sinodes)+Fp); +n(SiDnodes) = nin(SiDnodes); +p(SiDnodes) = pin(SiDnodes); + + +%%% +%%% Compute LHS matrices +%%% + +%% let's compute FEM approximation of $$ L = - \frac{d^2}{x^2} $$ +if (isempty(DDGOXNLPOISSON_LAP)) + coeff = l2ox * ones(Nelements,1); + coeff(Sielements)=l2; + DDGOXNLPOISSON_LAP = Ucomplap (mesh,coeff); +end + +%% compute $$ Mv = ( n + p) $$ +%% and the (lumped) mass matrix M +if (isempty(DDGOXNLPOISSON_MASS)) + coeffe = zeros(Nelements,1); + coeffe(Sielements)=1; + DDGOXNLPOISSON_MASS = Ucompmass2(mesh,ones(Nnodes,1),coeffe); +end +freecarr=zeros(Nnodes,1); +freecarr(Sinodes)=(n + p); +Mv = freecarr; +M = DDGOXNLPOISSON_MASS*spdiags(Mv,0,Nnodes,Nnodes); + +%%% +%%% Compute RHS vector (-residual) +%%% + +%% now compute $$ T0 = \frac{q}{\epsilon} (n - p - D) $$ +if (isempty(DDGOXNLPOISSON_RHS)) + coeffe = zeros(Nelements,1); + coeffe(Sielements)=1; + DDGOXNLPOISSON_RHS = Ucompconst (mesh,ones(Nnodes,1),coeffe); +end +totcharge = zeros(Nnodes,1); +totcharge(Sinodes)=(n - p - D); +Tv0 = totcharge; +T0 = Tv0 .* DDGOXNLPOISSON_RHS; + +%% now we're ready to build LHS matrix and RHS of the linear system for 1st Newton step +A = DDGOXNLPOISSON_LAP + M; +R = DDGOXNLPOISSON_LAP * V + T0; + +%% Apply boundary conditions +A (Dnodes,:) = []; +A (:,Dnodes) = []; +R(Dnodes) = []; + +%% we need $$ \norm{R_1} $$ and $$ \norm{R_k} $$ for the convergence test +normr(1) = norm(R,inf); +relresnorm = 1; +reldVnorm = 1; +normrnew = normr(1); +dV = V*0; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% START OF THE NEWTON CYCLE +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +for newtit=1:maxit + if (verbose>0) + fprintf(1,'\n***\nNewton iteration: %d, reldVnorm = %e\n***\n',newtit,reldVnorm); + end + + dV(Varnodes) =(A)\(-R); + dV(Dnodes)=0; + + + %%%%%%%%%%%%%%%%%% + %% Start of th damping procedure + %%%%%%%%%%%%%%%%%% + tk = 1; + for dit = 1:dampit + if (verbose>0) + fprintf(1,'\ndamping iteration: %d, residual norm = %e\n',dit,normrnew); + end + Vnew = V + tk * dV; + + n = exp(Vnew(Sinodes)-Fn); + p = exp(-Vnew(Sinodes)+Fp); + n(SiDnodes) = nin(SiDnodes); + p(SiDnodes) = pin(SiDnodes); + + + %%% + %%% Compute LHS matrices + %%% + + %% let's compute FEM approximation of $$ L = - \frac{d^2}{x^2} $$ + %L = Ucomplap (mesh,ones(Nelements,1)); + + %% compute $$ Mv = ( n + p) $$ + %% and the (lumped) mass matrix M + freecarr=zeros(Nnodes,1); + freecarr(Sinodes)=(n + p); + Mv = freecarr; + M = DDGOXNLPOISSON_MASS*spdiags(Mv,0,Nnodes,Nnodes); + + %%% + %%% Compute RHS vector (-residual) + %%% + + %% now compute $$ T0 = \frac{q}{\epsilon} (n - p - D) $$ + totcharge( Sinodes)=(n - p - D); + Tv0 = totcharge; + T0 = Tv0 .* DDGOXNLPOISSON_RHS;%T0 = Ucompconst (mesh,Tv0,ones(Nelements,1)); + + %% now we're ready to build LHS matrix and RHS of the linear system for 1st Newton step + A = DDGOXNLPOISSON_LAP + M; + R = DDGOXNLPOISSON_LAP * Vnew + T0; + + %% Apply boundary conditions + A (Dnodes,:) = []; + A (:,Dnodes) = []; + R(Dnodes) = []; + + %% compute $$ | R_{k+1} | $$ for the convergence test + normrnew= norm(R,inf); + + % check if more damping is needed + if (normrnew > normr(newtit)) + tk = tk/dampcoeff; + else + if (verbose>0) + fprintf(1,'\nexiting damping cycle because residual norm = %e \n-----------\n',normrnew); + end + break + end + end + + V = Vnew; + normr(newtit+1) = normrnew; + dVnorm = norm(tk*dV,inf); + pause(.1); + % check if convergence has been reached + reldVnorm = dVnorm / norm(V,inf); + if (reldVnorm <= toll) + if(verbose>0) + fprintf(1,'\nexiting newton cycle because reldVnorm= %e \n',reldVnorm); + end + break + end + +end + +res = normr; +niter = newtit; + Added: trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtelectron_driftdiffusion.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtelectron_driftdiffusion.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtelectron_driftdiffusion.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,58 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% +% n=DDGtelectron_driftdiffusion(mesh,Dsides,nin,pin,V,un,tn,tp,n0,p0) +% IN: +% v = electric potential +% mesh = integration domain +% ng = initial guess and BCs for electron density +% p = hole density (to compute SRH recombination) +% dt = timestep +% OUT: +% n = updated electron density +% + +function n=DDGtelectron_driftdiffusion(mesh,Dsides,nin,pin,V,un,tn,tp,n0,p0,nold,dt) + + +if (columns(nin)>rows(nin)) + nin=nin'; +end + +if (columns(V)>rows(V)) + V=V'; +end + +if (columns(pin)>rows(pin)) + pin=pin'; +end + +Nnodes = max(size(mesh.p)); +Nelements = max(size(mesh.t)); + +denom = (tp*(nin+sqrt(n0.*p0))+tn*(pin+sqrt(n0.*p0))); +u = un; +U = p0.*n0./denom + nold/dt; +M = pin./denom + ones(size(nin))/dt; +guess = nin; + +n = Udriftdiffusion(mesh,Dsides,guess,M,U,V,u); + Added: trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtgummelmap.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtgummelmap.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDGt/DDGtgummelmap.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,121 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + +% +% [odata,it,res] =... +% DDGtgummelmap (imesh,Dsides,idata,toll,maxit,ptoll,pmaxit,verbose) +% + +function [odata,it,res] =... + DDGtgummelmap (imesh,Dsides,idata,toll,maxit,ptoll,pmaxit,verbose) + +clear global +global DDGNLPOISSON_LAP DDGNLPOISSON_MASS DDG_RHS DDG_MASS + +V (:,1) = idata.V; +p (:,1) = idata.p; +n (:,1) = idata.n; +Fn(:,1) = idata.Fn; +Fp(:,1) = idata.Fp; +D = idata.D; + +Nnodes = max(size(imesh.p)); +Nelements = max(size(imesh.t)); + +for i=1:1:maxit + if (verbose>1) + fprintf(1,'*****************************************************************\n'); + fprintf(1,'**** start of gummel iteration number: %d\n',i); + fprintf(1,'*****************************************************************\n'); + + end + + if (verbose>1) + fprintf(1,'solving non linear poisson equation\n\n'); + end + [V(:,2),n(:,2),p(:,2)] =... + DDGnlpoisson (imesh,Dsides,V(:,1),n(:,1),p(:,1),Fn(:,1),Fp(:,1),D,... + idata.l2,ptoll,pmaxit,verbose-1); + + + if (verbose>1) + fprintf (1,'\n\nupdating electron qfl\n\n'); + end + n(:,3) =DDGtelectron_driftdiffusion(imesh,Dsides,idata.n,idata.p,V(:,2),... + idata.un*ones(Nelements,1),... + idata.tn,idata.tp,idata.ni,idata.ni,idata.n,idata.dt); + Fn(:,2)=V(:,2) - log(n(:,3)); + + if (verbose>1) + fprintf(1,'updating hole qfl\n\n'); + end + p(:,3) =DDGthole_driftdiffusion(imesh,Dsides,idata.n,idata.p,V(:,2),... + idata.up*ones(Nelements,1),... + idata.tn,idata.tp,idata.ni,idata.ni,idata.p,idata.dt); + + Fp(:,2)=V(:,2) + log(p(:,3)); + + if (verbose>1) + fprintf(1,'checking for convergence\n\n'); + end + + nrfn= norm(Fn(:,2)-Fn(:,1),inf); + nrfp= norm (Fp(:,2)-Fp(:,1),inf); + nrv = norm (V(:,2)-V(:,1),inf); + nrm(i) = max([nrfn;nrfp;nrv]); + + if (verbose>1) + fprintf (1,' max(|phin_(k+1)-phinn_(k)| , |phip_(k+1)-phip_(k)| , |v_(k+1)- v_(k)| )= %d\n',nrm(i)); + end + if (nrm(i)<toll) + break + end + + V(:,1) = V(:,end); + n(:,1) = n(:,end); + p(:,1) = p(:,end); + Fn(:,1)= Fn(:,end); + Fp(:,1)= Fp(:,end); + + +end + +it = i; +res = nrm; + +if (verbose>0) + fprintf(1,'\n\nDD: # of Gummel iterations = %d\n\n',it); +end + +odata = idata; + +odata.n = n(:,end); +odata.p = p(:,end); +odata.V = V(:,end); +odata.Fn = Fn(:,end); +odata.Fp = Fp(:,end); + +clear global + +% Last Revision: +% $Author: carlo $ +% $Date: 2005/05/27 15:29:23 $ + + Added: trunk/octave-forge/extra/secs3d/inst/DDGt/DDGthole_driftdiffusion.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/DDGt/DDGthole_driftdiffusion.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/DDGt/DDGthole_driftdiffusion.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,57 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is part of: +%% secs3d - A 3-D Drift--Diffusion Semiconductor Device Simulator +%% +%% secs3d is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% secs3d is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with secs3d; If not, see <http://www.gnu.org/licenses/>. +%% +%% author: Carlo de Falco <cdf _AT_ users.sourceforge.net> + + +% p=DDGthole_driftdiffusion(mesh,Dsides,nin,pin,V,up,tn,tp,n0,p0) +% IN: +% v = electric potential +% mesh = integration domain +% nin = initial guess and BCs for electron density +% pin = hole density (to compute SRH recombination) +% pold = hole density at previous timestep +% dt = timestep +% OUT: +% p = updated hole density + +function p=DDGthole_driftdiffusion(mesh,Dsides,nin,pin,V,up,tn,tp,n0,p0,pold,dt) + +if (columns(nin)>rows(nin)) + nin=nin'; +end + +if (columns(V)>rows(V)) + V=V'; +end + +if (columns(pin)>rows(pin)) + pin=pin'; +end + +Nnodes = max(size(mesh.p)); +Nelements = max(size(mesh.t)); + +denom = (tp*(nin+sqrt(n0.*p0))+tn*(pin+sqrt(n0.*p0))); +u = up; +U = n0.*p0./denom + pold/dt; +M = nin./denom + ones(size(pin))/dt ; +guess = pin; +V = -V; + +p = Udriftdiffusion(mesh,Dsides,guess,M,U,V,u); Added: trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXcompdens.m =================================================================== --- trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXcompdens.m (rev 0) +++ trunk/octave-forge/extra/secs3d/inst/QDDGOX/QDDGOXcompdens.m 2011-09-09 01:37:13 UTC (rev 8514) @@ -0,0 +1,198 @@ +%% Copyright (C) 2004,2007,2008,2009,2010,2011 Carlo de Falco +%% +%% This file is pa... [truncated message content] |