secs3d-0.0.1/0000755000076500000240000000000011632334220011653 5ustar carlostaffsecs3d-0.0.1/COPYING0000644000076500000240000004307711632266711012732 0ustar carlostaff GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 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. Copyright (C) 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 . 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. , 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. secs3d-0.0.1/DESCRIPTION0000644000076500000240000000050211632266711013367 0ustar carlostaffName: 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 secs3d-0.0.1/INDEX0000644000076500000240000000075611632266711012466 0ustar carlostaffsecs3d >> 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 secs3d-0.0.1/inst/0000755000076500000240000000000011632334220012630 5ustar carlostaffsecs3d-0.0.1/inst/data/0000755000076500000240000000000011632334220013541 5ustar carlostaffsecs3d-0.0.1/inst/data/CMOS/0000755000076500000240000000000011632334220014302 5ustar carlostaffsecs3d-0.0.1/inst/data/CMOS/SGMOS.m0000644000076500000240000000411211632334177015361 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % single gate MOS mesh close all clear all sx = 2; sy = 1/2; sz = 3; xm1 =linspace(0,10,4*sx); x0 =linspace(10,25,6*sx); x1 =linspace(25,30,4*sx); x2 =linspace(30,45,15*sx); x3 =linspace(45,50,4*sx); x4 =linspace(50,65,6*sx); x5 =linspace(65,75,4*sx); y =linspace(0,50,15*sy); spacing = (linspace(0,1,15*sz)+5*linspace(0,1,15*sz).^4)/6; z1 = 40*(1-spacing); z2 = linspace(40,41.5,5*sz); meshm11= Ustructmesh(xm1,y,z1,1,1:6); mesh01 = Ustructmesh(x0,y,z1,1,1:6); mesh11 = Ustructmesh(x1,y,z1,1,1:6); mesh21 = Ustructmesh(x2,y,z1,1,1:6); mesh31 = Ustructmesh(x3,y,z1,1,1:6); mesh12 = Ustructmesh(x1,y,z2,1,1:6); mesh22 = Ustructmesh(x2,y,z2,1,1:6); mesh32 = Ustructmesh(x3,y,z2,1,1:6); mesh41 = Ustructmesh(x4,y,z1,1,1:6); mesh51 = Ustructmesh(x5,y,z1,1,1:6); mesh = Ujoinmeshes(mesh11,mesh21,2,1); mesh = Ujoinmeshes(mesh,mesh31,7,1); mesh = Ujoinmeshes(mesh,mesh22,11,5); mesh = Ujoinmeshes(mesh,mesh01,1,2); mesh = Ujoinmeshes(mesh,mesh41,12,1); mesh = Ujoinmeshes(mesh,meshm11,22,2); mesh = Ujoinmeshes(mesh,mesh51,27,1); mesh = Ujoinmeshes(mesh,mesh12,[6,17],[5,2]); mesh = Ujoinmeshes(mesh,mesh32,[16,18],[5,1]); mesh.p = 1e-9*mesh.p; fpl_vtk_write_field("SGMOS_mesh", mesh, {}, {}, 0);secs3d-0.0.1/inst/data/CMOS/SGMOS_data.m0000644000076500000240000000535511632334177016364 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % single gate MOS data load constants; SiDsides = [ 36 41 35 25 5 10 15 30 40 ]; Dsides = [ SiDsides 45 21 49]; Intsides = [ 6 11 16]; [Simesh,Sinodes] = Usubmesh(mesh,[],[1:3,5:8],1); % Set list of Interface nodes Intnodes = Ugetnodesonface(Simesh,Intsides); x = Simesh.p(1,:)'; y = Simesh.p(2,:)'; z = Simesh.p(3,:)'; lung = max(x)-min(x); lungy= max(y)-min(y); lungz= max(z)-min(z); xm = (max(x)-min(x))/2; ym = (max(y)-min(y))/2; zm = (max(z)-min(z))/2; vs = 0; vd = 0.3; vg = 0.1; vb = 0.0; [tmpmesh,source] =Usubmesh(Simesh,[ ],[7 5 1],1); clear tmpmesh; source = source(find(z(source)>=zm)); [tmpmesh,drain] =Usubmesh(Simesh,[],[8 3 6],1); clear tmpmesh; drain = drain(find(z(drain)>=zm)); [tmpmesh,channel] =Usubmesh(Simesh,[],[2],1); clear tmpmesh; [tmpmesh,oxide] = Usubmesh(mesh,[],[9 4 10],1); clear tmpmesh; bulkdoping = -2e25; sourcedoping = 5e25; draindoping = 5e25; channeldoping = -2e25; data.D = 0*x+bulkdoping; data.D(source) = sourcedoping; data.D(drain) = draindoping; data.D(channel) = channeldoping; data.n = data.D .* (data.D > 0); data.p = -data.D .* (data.D < 0); data.n = data.n - (ni^2 ./ data.D) .* (data.D < 0); data.p = data.p + (ni^2 ./ data.D) .* (data.D > 0); data.n(Intnodes) = 1e-2; data.p(Intnodes) = 1e-2; data.Fn = 0*x+vb; data.Fn(drain) = vd; data.Fn(source) = vs; data.Fn(channel) = vb; data.Fp= data.Fn; data.V = 0*mesh.p(2,:)'+vg-Phims; data.V(oxide) = vg-Phims; data.V(Sinodes) = data.Fn + Vth * log(data.n/ni); [idata,imesh]=Uscaling(mesh,data); idata.n0 = idata.n; idata.p0 = idata.p; imesh = bim3c_mesh_properties (imesh); [Simesh,Sinodes,Sielements] = Usubmesh(imesh,[],[1:3,5:8],0); toll = 1e-4; stoll = 1e-4; ptoll = 1e-10; smaxit = 10; maxit = 50; pmaxit = 100; verbose = 2; options.holes = 0; options.SRH = 0; optionds.FD = 0; save -binary SGMOS_data secs3d-0.0.1/inst/data/CMOS/SGMOS_run.m0000644000076500000240000000302711632334177016251 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % Simulate a single gate MOS with a classical model clear all fprintf ('build mesh\n'); SGMOS; fprintf ('setup data\n'); SGMOS_data; fprintf ('run simulation\n'); [odata, it, res] = DDGOXgummelmap (imesh, Dsides,... Simesh, Sinodes, Sielements, SiDsides,... idata, toll, maxit, ptoll, pmaxit, verbose); fprintf ('posrprocess\n'); [odatads, omeshds] = Udescaling (imesh, odata); [odatads, Siomeshds] = Udescaling (Simesh, odata); fpl_vtk_write_field("SGMOS", omeshds, {odatads.V, "V"}, {}, 1); fpl_vtk_write_field("SGMOS_Si", Siomeshds, {odatads.n, "n"; odatads.p, "p"; odatads.Fn, "Fn"; odatads.Fp, "Fp"}, {}, 1);secs3d-0.0.1/inst/DDG/0000755000076500000240000000000011632334220013226 5ustar carlostaffsecs3d-0.0.1/inst/DDG/DDGelectron_driftdiffusion.m0000644000076500000240000000311111632266711020642 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % 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); secs3d-0.0.1/inst/DDG/DDGgummelmap.m0000644000076500000240000000633211632266711015724 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [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)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 $ secs3d-0.0.1/inst/DDG/DDGhole_driftdiffusion.m0000644000076500000240000000311411632266711017761 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % 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); secs3d-0.0.1/inst/DDG/DDGnlpoisson.m0000644000076500000240000001313711632266711015765 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [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; secs3d-0.0.1/inst/DDGOX/0000755000076500000240000000000011632334220013475 5ustar carlostaffsecs3d-0.0.1/inst/DDGOX/DDGOXddcurrent.m0000644000076500000240000000304611632266711016447 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % [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; secs3d-0.0.1/inst/DDGOX/DDGOXgummelmap.m0000644000076500000240000000777411632266711016455 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % [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)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); secs3d-0.0.1/inst/DDGOX/DDGOXnlpoisson.m0000644000076500000240000001443511632266711016505 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [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; secs3d-0.0.1/inst/DDGt/0000755000076500000240000000000011632334220013412 5ustar carlostaffsecs3d-0.0.1/inst/DDGt/DDGtelectron_driftdiffusion.m0000644000076500000240000000321611632266711021220 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % 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); secs3d-0.0.1/inst/DDGt/DDGtgummelmap.m0000644000076500000240000000641211632266711016273 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [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)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 $ secs3d-0.0.1/inst/DDGt/DDGthole_driftdiffusion.m0000644000076500000240000000327211632266711020336 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % 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); secs3d-0.0.1/inst/QDDGOX/0000755000076500000240000000000011632334220013616 5ustar carlostaffsecs3d-0.0.1/inst/QDDGOX/QDDGOXcompdens.m0000644000076500000240000001156211632266711016531 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % w = QDDGOXcompdens(mesh,Dsides,win,vin,fermiin,d2,toll,maxit,verbose); % % This is an internal function which is only expected to be called by QDDGOgummelmap. % function w = QDDGOXcompdens(mesh,Dsides,win,vin,fermiin,d2,toll,maxit,verbose); global QDDGOXCOMPDENS_LAP QDDGOXCOMPDENS_MASS QDDGOXCOMPDENS_RHS LOGFILENAME %% Set some usefull constants VErank = 4; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% convert input vectors to columns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if columns(win)>rows(win) win=win'; end if columns(vin)>rows(vin) vin=vin'; end if columns(fermiin)>rows(fermiin) fermiin=fermiin'; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% convert grid info to FEM form %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% nodes = mesh.p; Nnodes = size(nodes,2); elements = mesh.t(1:3,:); Nelements = size(elements,2); Dedges =[]; for ii = 1:length(Dsides) Dedges=[Dedges,find(mesh.e(5,:)==Dsides(ii))]; end % Set list of nodes with Dirichelet BCs Dnodes = mesh.e(1:2,Dedges); Dnodes = [Dnodes(1,:) Dnodes(2,:)]; Dnodes = unique(Dnodes); Dvals = win(Dnodes); Varnodes = setdiff([1:Nnodes],Dnodes); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% initialization: %% we're going to solve %% $$ -\delta^2 \Lap w_{k+1} + B'(w_k) \delta w_{k+1} = 2 * w_k$$ %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set $$ w_1 = win $$ w = win; wnew = win; %% let's compute FEM approximation of $$ L = - \aleph \frac{d^2}{x^2} $$ if (isempty(QDDGOXCOMPDENS_LAP)) QDDGOXCOMPDENS_LAP = Ucomplap (mesh,ones(Nelements,1)); end L = d2*QDDGOXCOMPDENS_LAP; %% now compute $$ G_k = F - V + 2 V_{th} log(w) $$ if (isempty(QDDGOXCOMPDENS_MASS)) QDDGOXCOMPDENS_MASS = Ucompmass (mesh,ones(Nnodes,1)); end G = fermiin - vin + 2*log(w); Bmat = QDDGOXCOMPDENS_MASS*spdiags(G,0,Nnodes,Nnodes); nrm = 1; %%%%%%%%%%%%%%%%%%%%%%%% %%% NEWTON ITERATION START %%%%%%%%%%%%%%%%%%%%%%%% converged = 0; for jnewt =1:ceil(maxit/VErank) for k=1:VErank [w(:,k+1),converged,G,L,Bmat]=onenewtit(w(:,k),G,fermiin,vin,L,Bmat,jnewt,mesh,Dnodes,Varnodes,Dvals,Nnodes,Nelements,toll); if converged break end end if converged break end w = Urrextrapolation(w); end %%%%%%%%%%%%%%%%%%%%%%%% %%% NEWTON ITERATION END %%%%%%%%%%%%%%%%%%%%%%%% w = w(:,end); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% ONE NEWTON ITERATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [w,converged,G,L,Bmat]=onenewtit(w,G,fermiin,vin,L,Bmat,jnewt,mesh,Dnodes,Varnodes,Dvals,Nnodes,Nelements,toll); global QDDGOXCOMPDENS_LAP QDDGOXCOMPDENS_MASS QDDGOXCOMPDENS_RHS LOGFILENAME dampit = 5; dampcoeff = 2; converged = 0; wnew = w; res0 = norm((L + Bmat) * w,inf); %% chose $ t_k $ to ensure positivity of $w$ mm = -min(G); pause(1) if (mm>2) tk = max( 1/(mm)); else tk = 1; end tmpmat = QDDGOXCOMPDENS_MASS*2; if (isempty(QDDGOXCOMPDENS_RHS)) QDDGOXCOMPDENS_RHS = Ucompconst (mesh,ones(Nnodes,1),ones(Nelements,1)); end tmpvect= 2*QDDGOXCOMPDENS_RHS.*w; %%%%%%%%%%%%%%%%%%%%%%%% %%% DAMPING ITERATION START %%%%%%%%%%%%%%%%%%%%%%%% for idamp = 1:dampit %% Compute $ B1mat = \frac{2}{t_k} $ %% and the (lumped) mass matrix B1mat(w_k) B1mat = tmpmat/tk; %% now we're ready to build LHS matrix and RHS of the linear system for 1st Newton step A = L + B1mat + Bmat; b = tmpvect/tk; %% Apply boundary conditions A (Dnodes,:) = 0; b (Dnodes) = 0; b = b - A (:,Dnodes) * Dvals; A(Dnodes,:)= []; A(:,Dnodes)= []; b(Dnodes) = []; wnew(Varnodes) = A\b; %% compute $$ G_{k+1} = F - V + 2 V_{th} log(w) $$ G = fermiin - vin + 2*log(wnew); Bmat = QDDGOXCOMPDENS_MASS*spdiags(G,0,Nnodes,Nnodes); res = norm((L + Bmat) * wnew,inf); if (res. %% %% author: Carlo de Falco % [current,divrg] = QDDGOXddcurrent (mesh,Sinodes,data,contacts); % Compute contact currents wit the QDD model. function [current,divrg] = QDDGOXddcurrent (mesh,Sinodes,data,contacts); load constants Nelements = size(mesh.t,2); mob = Ufielddepmob(mesh,data.un,data.Fn,data.vsatn,data.mubn); An = Uscharfettergummel(mesh,data.V(Sinodes)+data.G,-mob); mob = Ufielddepmob(mesh,data.up,data.Fp,data.vsatp,data.mubp); Ap = Uscharfettergummel(mesh,-data.V(Sinodes)-data.Gp,mob); divrg = An * data.n + Ap * data.p; for con = 1:length(contacts) cedges = []; cedges=[cedges,find(mesh.e(5,:)==contacts(con))]; cnodes = mesh.e(1:2,cedges); cnodes = [cnodes(1,:) cnodes(2,:)]; cnodes = unique(cnodes); current(con) = sum(divrg(cnodes)); end Is = q*data.us*data.Vs*data.ns; current = current * Is; secs3d-0.0.1/inst/QDDGOX/QDDGOXelectron_driftdiffusion.m0000644000076500000240000000331611632266711021631 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % n=QDDGOXelectron_driftdiffusion(mesh,Dsides,Intsides,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=QDDGOXelectron_driftdiffusion(mesh,Dsides,Intsides,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)); Intnodes=Ugetnodesonface(mesh,Intsides)'; denom = (tp*(nin+sqrt(n0.*p0))+tn*(pin+sqrt(n0.*p0))); u = un; M = pin./denom; M(Intnodes)=M(Intnodes)+1; U = p0.*n0./denom; U(Intnodes)=U(Intnodes)+nin(Intnodes); guess = nin; n = Udriftdiffusion(mesh,Dsides,guess,M,U,V,u); secs3d-0.0.1/inst/QDDGOX/QDDGOXgummelmap.m0000644000076500000240000001632711632266711016711 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % [odata,it,res] = QDDGOXgummelmap (imesh,Dsides,... % Simesh,Sinodes,Sielements,SiDsides,Intsides,... % idata,toll,maxit,ptoll,pmaxit,stoll,smaxit,verbose,options); function [odata,it,res] = QDDGOXgummelmap (imesh,Dsides,... Simesh,Sinodes,Sielements,SiDsides,Intsides,... idata,toll,maxit,ptoll,pmaxit,stoll,smaxit,verbose,options) clear global global DDGOXNLPOISSON_LAP DDGOXNLPOISSON_MASS DDGOXNLPOISSON_RHS DDG_RHS DDG_MASS LOGFILENAME Nnodes = max(size(imesh.p)); Nelements = max(size(imesh.t)); SiNnodes = max(size(Simesh.p)); SiNelements = max(size(Simesh.t)); if (options.SRH==1) tn= idata.tn;tp=idata.tp; else tn=Inf;tp=Inf; end 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)'; Intnodes = Ugetnodesonface(Simesh,Intsides)'; SiDnodes = Ugetnodesonface(Simesh,SiDsides)'; if (options.FD==1) FDn = idata.FDn; FDp = idata.FDp; else FDn = zeros(SiNnodes,1); FDp = zeros(SiNnodes,1); end G (:,1) = Fn(:,1) - V(Sinodes,1) - FDn + log(n(:,1)); if (options.holes==1) Gp (:,1) = Fp(:,1) - V(Sinodes,1) - FDp - log(p(:,1)); else Gp (:,1) = G(:,1)*0; end 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 V(:,2)= V(:,1); G(:,2)= G(:,1); Gp(:,2)= Gp(:,1); n(:,2)= n(:,1); bohmdeltav=1; for j=1:smaxit if (verbose>=1) fprintf(1,'*---------------------------------------------------------------*\n'); fprintf(1,'**** start of Poisson-Bohm iteration number: %d (bohmdeltav=%g)\n',j,bohmdeltav); fprintf(1,'*---------------------------------------------------------------*\n'); end if (verbose>1) fprintf(1,'solving non linear poisson equation\n\n'); end [V(:,3),n(:,2),p(:,2)] =... QDDGOXnlpoisson (imesh,Dsides,Sinodes,[SiDnodes,Intnodes] ,Sielements,... V(:,2),n(:,1),p(:,1),Fn(:,1),Fp(:,1),G(:,2)+FDn,Gp(:,2)+FDp,D,... idata.l2,idata.l2ox,ptoll,pmaxit,verbose-1); n([SiDnodes,Intnodes],2) = idata.n([SiDnodes,Intnodes]); p([SiDnodes,Intnodes],2) = idata.p([SiDnodes,Intnodes]); V(Dnodes,3) = idata.V(Dnodes); if (verbose>1) fprintf(1,'solving non linear Bohm equation for electrons\n\n'); end n(Intnodes,2) = idata.n(Intnodes); w = QDDGOXcompdens(Simesh,[SiDsides,Intsides],sqrt(n(:,2)),V(Sinodes,3) + FDn,Fn(:,1),idata.dn2,stoll,smaxit,verbose-1); n(:,2) = w.^2; n([SiDnodes,Intnodes],2) = idata.n([SiDnodes,Intnodes]); G(:,3) = Fn(:,1) - V(Sinodes,3) - FDn + log(n(:,2)); if (verbose>1) fprintf(1,'solving non linear Bohm equation for holes\n\n'); end if (options.holes==1) p(Intnodes,2) = idata.p(Intnodes); wp = QDDGOXcompdens(Simesh,[SiDsides,Intsides],sqrt(p(:,2)),-V(Sinodes,3) - FDp,... -Fp(:,1),idata.dp2,ptoll,pmaxit,verbose-1); p(:,2) = wp.^2; p([SiDnodes,Intnodes],2) = idata.p([SiDnodes,Intnodes]); Gp(:,3) = Fp(:,1) - V(Sinodes,3) - FDp - log(p(:,2)); else Gp(:,3)=G(:,3)*0; end if (options.FD==1) fprintf(1,'\n*** APPLYING FD STATISTICS ***\n') n(:,2) = idata.Nc*Ufermidirac(V(Sinodes,3)+G(:,3)-Fn(:,1)-log(idata.Nc),1/2); n(SiDnodes,2) = idata.n(SiDnodes); nMBtmp = exp(V(Sinodes,3)+G(:,3)-Fn(:,1)); FDn = log(n(:,2)./ nMBtmp); FDn(SiDnodes) = idata.FDn(SiDnodes); p(:,2) = idata.Nv*Ufermidirac(-V(Sinodes,3)-Gp(:,3)+Fp(:,1)-log(idata.Nv),1/2); p([SiDnodes,Intnodes],2) = idata.p([SiDnodes,Intnodes]); pMBtmp = exp(-V(Sinodes,3)-Gp(:,3)+Fp(:,1)); FDp = -log(p(:,2)./ pMBtmp); FDp(SiDnodes) = idata.FDp(SiDnodes); end bohmdeltav = norm(G(:,3)-G(:,2),inf) +... norm(Gp(:,3)-Gp(:,2),inf) +... norm(V(:,3)-V(:,2),inf); Gp(:,2)=Gp(:,3); G(:,2)=G(:,3); V(:,2)=V(:,3); if (bohmdeltav<=stoll) if (verbose>1) fprintf(1,'Exiting poisson-bohm iteration because bohmdeltav=%g\n\n',bohmdeltav); end break; end end if (verbose>1) fprintf (1,'\n\nupdating electron qfl\n\n'); end mob = idata.un*ones(Nelements,1); n(:,3) =QDDGOXelectron_driftdiffusion(Simesh,SiDsides,Intsides,n(:,2),p(:,2),... V(Sinodes,3)+G(:,3)+FDn,mob,... tn,tp,idata.n0,idata.p0); Fn(:,2) = V(Sinodes,3) + G(:,3) + FDn - log(n(:,3)); Fn(SiDnodes,2) = idata.Fn(SiDnodes); n([SiDnodes,Intnodes],3) = idata.n([SiDnodes,Intnodes]); if (verbose>1) fprintf(1,'updating hole qfl\n\n'); end if (options.holes==1) mob = idata.up*ones(Nelements,1); p(:,3) =DDGhole_driftdiffusion(Simesh,SiDsides,n(:,3),p(:,2),... V(Sinodes,3)+Gp(:,3)+FDp,mob,... tn,tp,idata.n0,idata.p0); Fp(:,2)=V(Sinodes,3) + Gp(:,3) + FDp + log(p(:,3)); p([SiDnodes,Intnodes],3) = idata.p([SiDnodes,Intnodes]); else Fp(:,2)=Fn(:,2) + 2 * log(idata.ni); p(:,3) = exp(Fp(:,2)-V(Sinodes,3)-FDp); p([SiDnodes],3) = idata.p([SiDnodes]); end 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(:,3)-V(:,1),inf); nrg = norm (G(:,3)-G(:,1),inf); nrgp = norm (Gp(:,3)-Gp(:,1),inf); nrm(i) = max([nrfn;nrfp;nrv;nrg;nrgp]); 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)| |g_(k+1)-g_(k)|)= %d\n',nrm(i)); end if (nrm(i)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); odata.G = G(:,end); odata.Gp = Gp(:,end); secs3d-0.0.1/inst/QDDGOX/QDDGOXnlpoisson.m0000644000076500000240000001514111632266711016742 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [V,n,p,res,niter] = QDDGOXnlpoisson (mesh,Dsides,Sinodes,SiDnodes,... % Sielements,Vin,nin,pin,... % Fnin,Fpin,Gin,Gpin,D,l2,l2ox,... % toll,maxit,verbose) % % solves $$ -\lambda^2 V'' + (n(V,Fn) - p(V,Fp) -D)$$ % function [V,n,p,res,niter] = QDDGOXnlpoisson (mesh,Dsides,Sinodes,SiDnodes,... Sielements,Vin,nin,pin,... Fnin,Fpin,Gin,Gpin,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); Dedges =[]; for ii = 1:length(Dsides) Dedges=[Dedges,find(mesh.e(5,:)==Dsides(ii))]; end % Set list of nodes with Dirichelet BCs Dnodes = mesh.e(1:2,Dedges); Dnodes = [Dnodes(1,:) Dnodes(2,:)]; Dnodes = unique(Dnodes); % 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; G = Gin; Gp = Gpin; n = exp(V(Sinodes)+G-Fn); p = exp(-V(Sinodes)-Gp+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)) Cvect = zeros(Nelements,1); Cvect(Sielements)=1; DDGOXNLPOISSON_MASS = Ucompmass2 (mesh,ones(Nnodes,1),Cvect); end freecarr=zeros(Nnodes,1); freecarr(Sinodes)=(n + p); Mv = freecarr; MV(SiDnodes) = 0; 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)) DDGOXNLPOISSON_RHS = Ucompconst (mesh,ones(Nnodes,1),ones(Nelements,1)); 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)+G-Fn); p = exp(-Vnew(Sinodes)-Gp+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);%M = Ucompmass (mesh,Mv); %%% %%% 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; secs3d-0.0.1/inst/secs3d.m0000644000076500000240000000310611632332530014174 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco # Run this only if the package is installed ## PKG_ADD: if (! exist (fullfile (fileparts (mfilename ("fullpath")), "inst"), "dir")) ## PKG_ADD: dirlist= {"Utilities", "DDG", "DDGOX", "DDGt", "QDDGOX", "data/CMOS"}; ## PKG_ADD: for ii=1:length(dirlist) ## PKG_ADD: addpath ( [ fileparts( mfilename("fullpath")) "/" dirlist{ii}]); ## PKG_ADD: end ## PKG_ADD: end # Run this only if the package is installed ## PKG_DEL: if (! exist (fullfile (fileparts (mfilename ("fullpath")), "inst"), "dir")) ## PKG_DEL: dirlist= {"Utilities", "DDG", "DDGOX", "DDGt", "QDDGOX", "data/CMOS"}; ## PKG_DEL: for ii=1:length(dirlist) ## PKG_DEL: rmpath ( [ fileparts( mfilename("fullpath")) "/" dirlist{ii}]); ## PKG_DEL: end ## PKG_DEL: end secs3d-0.0.1/inst/Utilities/0000755000076500000240000000000011632334220014603 5ustar carlostaffsecs3d-0.0.1/inst/Utilities/constants.m0000644000076500000240000000605011632266711017007 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % Material properties for Si and SiO2 % change this script and use it to overwrite constants.mat % if you want to use different materials Kb = 1.3806503e-23; q = 1.602176462e-19; e0 = 8.854187817e-12; esir = 11.7; esio2r = 3.9; esi = e0 * esir; esio2 = e0 * esio2r; hplanck = 6.626e-34; hbar = ( hplanck/ (2*pi)); mn0 = 9.11e-31; mn = 0.26*mn0; mh = 0.18*mn0; qsue = q / esi; T0 = 300 ; Vth = Kb * T0 / q; un = 1417e-4; up = 480e-4; vsatn0 = 1.07e5; vsatp0 = 8.37e4; vsatnexp = 0.87; vsatpexp = 0.52; vsatn = vsatn0*(300/T0).^vsatnexp; vsatp = vsatp0*(300/T0).^vsatpexp; mubn0 = 1.109; mubp0 = 1.213; mubnexp = 0.66; mubpexp = 0.17; mubn = mubn0*(T0/300)^mubnexp; mubp = mubp0*(T0/300)^mubpexp; mudopparn = [ 52.2e-4 %mumin1 52.2e-4 %mumin2 43.4e-4 %mu1 0e-6 %Pc 9.68e10 %Cr 3.34e14 %Cs 0.680 %alpha 2.0 %beta ]; mudopparp = [ 44.9e-4 %mumin1 0.00e-4 %mumin2 29.0e-4 %mu1 9.23e10 %Pc 2.23e11 %Cr 6.10e14 %Cs 0.719 %alpha 2.0 %beta ]; tp = 1e-7; tn = 1e-7; mnl = 0.98*mn0; mnt = 0.19*mn0; mndos = (mnl*mnt*mnt)^(1/3); mhh = 0.49*mn0; mlh = 0.16*mn0; mhdos = (mhh^(3/2)+mlh^(3/2))^(2/3); rn = 3; aleph = hbar^2/(4*rn*q*mn); alephn = aleph; rp = .1; alephp = hbar^2/(4*rp*q*mh); Nc = (6/4)*(2*mndos*Kb*T0/(hbar^2*pi))^(3/2); Nv = (1/4)*(2*mhdos*Kb*T0/(hbar^2*pi))^(3/2); Eg0 = 1.16964*q; alfaEg = 4.73e-4*q; betaEg = 6.36e2; Egap = Eg0-alfaEg*((T0^2)/(T0+betaEg)); ni = sqrt(Nc*Nv)*exp(-Egap/(2*(Kb * T0))); Phims = - Egap /(2*q); secs3d-0.0.1/inst/Utilities/constants.mat0000644000076500000240000000554411632266711017343 0ustar carlostaffMATLAB 5.0 MAT-file, Platform: GLNX86, Created on: Mon Feb 14 03:56:24 2005 IM[xc``hb6 0#sqniJ~AAbQTHXjxxX=ik؟ONjz w>_xc``hb6 0#sqniJ~AAbQTHsS .{0ķn5uҿ_}ҍ]aΦqHO+xc``b6 31Cn'T-<E+xc``b6 31Cn'TT,xc``b6 31Ci'T,D3P+xc``b6 31Ci'TW]֞+@>*xc``b6 3"a\YqbIHBF>0p*xc``b6 3"a\YqbIH#='/xc``pb6 3"a8$/ʿk{yj7/xc``pb6 3"a8 _R`u}{v)xc``b6 3"aXYqbIc!#< ?)xc``b6 3"aXYqbIō;.xc``pb6 3"aXniRGXn9Q=Z.xc``pb6 3"aXniR9(=[0xc``pb6 3"av -MK(`˷!n&d0xc``pb6 3"av -M*H(`=s-+xc``b6 31 CniR'T/xc``pb6 3"a\bNjAF'TϷZmn +xc``b6 31_2'Tm\sW5b\+xc``b6 31_'T||kMg 58+xc``b6 313k'T<68/xc``pb6 3"a\bNZk:'T~fìdV2,xc``b6 3"a\RjIk: C 8=+xc``b6 31 kzb'T|b㢸)\6DL"+xc``b6 31C^&'T.% L=e.xc``pb6 3"aX@Ffn1?Nߕ~asecs3d-0.0.1/inst/Utilities/Ubern.m0000644000076500000240000000346311632266711016053 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [bp,bn]=Ubern(x) % % calcola la funzione di Bernoulli % B(x)=x/(exp(x)-1) in corrispondenza dei % due argomenti Z e -Z, ricordando che risulta % B(-Z)=Z+B(Z) % function [bp,bn]=Ubern(x) xlim=1e-2; ax=abs(x); % % Calcola la funz. di Bernoulli per x=0 % if (ax == 0) bp=1.; bn=1.; return end; % % Calcola la funz. di Bernoulli per valori % asintotici dell'argomento % if (ax > 80), if (x >0), bp=0.; bn=x; return else bp=-x; bn=0.; return end; end; % % Calcola la funz. di Bernoulli per valori % intermedi dell'argomento % if (ax > xlim), bp=x/(exp(x)-1); bn=x+bp; return else % % Calcola la funz. di Bernoulli per valori % piccoli dell'argomento mediante sviluppo % di Taylor troncato dell'esponenziale % ii=1; fp=1.; fn=1.; df=1.; segno=1.; while (abs(df) > eps), ii=ii+1; segno=-segno; df=df*x/ii; fp=fp+df; fn=fn+segno*df; bp=1./fp; bn=1./fn; end; return end secs3d-0.0.1/inst/Utilities/Ucompconst.m0000644000076500000240000000232311632266711017124 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco function C = Ucompconst (mesh,coeffn,coeffe) % C = Ucompconst (mesh,coeffn,coeffe) p=mesh.p; t=mesh.t; wjacdet=mesh.wjacdet; shp=mesh.shp; Nnodes = length(p); Nelements = length(t); C=zeros(length(p),1); fprintf(1,'*--------------------*\n'); fprintf(1,'building RHS\n*'); C = bim3a_rhs (mesh, coeffe, coeffn); fprintf(1,'--------------------*\nDONE!\n\n\n'); secs3d-0.0.1/inst/Utilities/Ucomplap.m0000644000076500000240000000230411632266711016551 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % L = Ucomplap (mesh,coeff) function L = Ucomplap (mesh,coeff) p=mesh.p; t=mesh.t; Nnodes = length(p); Nelements = length(t); L=spalloc(Nnodes,Nnodes,5*Nnodes); fprintf(1,'*--------------------*\n'); fprintf(1,'building Stiffness Matrix\n*'); L = bim3a_laplacian (mesh, coeff, ones(Nnodes, 1)); fprintf(1,'--------------------*\nDONE!\n\n\n'); secs3d-0.0.1/inst/Utilities/Ucompmass.m0000644000076500000240000000177511632266711016753 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % Bmat = Ucompmass (mesh,Bvect); function Bmat = Ucompmass (mesh,Bvect); Nelements =length(mesh.t); Bmat= Ucompmass2 (mesh,Bvect,ones(Nelements,1));secs3d-0.0.1/inst/Utilities/Ucompmass2.m0000644000076500000240000000232211632266711017022 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % Bmat = Ucompmass2 (mesh,Bvect,Cvect); function Bmat = Ucompmass2 (mesh,Bvect,Cvect); p =mesh.p; t =mesh.t; Nnodes =length(p); Nelements =length(t); shp =mesh.shp; fprintf(1,'\n*--------------------*\n'); fprintf(1,'building Mass Matrix\n*'); Bmat = bim3a_reaction (mesh,Cvect,Bvect); fprintf(1,'--------------------*\nDONE!\n\n\n'); secs3d-0.0.1/inst/Utilities/Udescaling.m0000644000076500000240000000452111632266711017052 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % [odata,omesh] = Udescaling(imesh,idata); % rescale data back from non-dimensional form. function [odata,omesh] = Udescaling(imesh,idata); load constants omesh = imesh; odata = idata; % scaling factors % odata.xs = max(abs([max(imesh.p(1,:))-min(imesh.p(1,:)),max(imesh.p(2,:))-min(imesh.p(2,:))])); % odata.Vs = Vth; % odata.ns = norm(idata.D,inf); % odata.us = un; % adimensional constants % odata.etan2 = hbar^2 / (2*mndos*odata.xs^2*q); % odata.etap2 = hbar^2 / (2*mpdos*odata.xs^2*q); % odata.beta = Vth/odata.Vs; % odata.dn2 = hbar^2 / (6*mndos*odata.xs^2*q*odata.Vs); % odata.dp2 = hbar^2 / (6*mpdos*odata.xs^2*q*odata.Vs); % odata.l2 = (odata.Vs*esi) / (odata.ns*odata.xs^2*q); % odata.un = un/odata.us; % odata.up = up/odata.us; % scaled quantities odata.D = idata.D*odata.ns; odata.n = idata.n*odata.ns; odata.p = idata.p*odata.ns; odata.Fn = (idata.Fn+log(ni/odata.ns))*odata.Vs; odata.Fp = (idata.Fp-log(ni/odata.ns))*odata.Vs; odata.V = idata.V*odata.Vs; if (isfield(idata,'G')) odata.G = idata.G*odata.Vs; end if (isfield(idata,'dt')) odata.dt = idata.dt*odata.ts; end if (isfield(idata,'un')) odata.un = idata.un*odata.us; else odata.un = un; end if (isfield(idata,'up')) odata.up = idata.up*odata.us; else odata.up = up; end if (isfield(idata,'FDn')) odata.FDn = idata.FDn*odata.Vs; end if (isfield(idata,'FDp')) odata.FDp = idata.FDp*odata.Vs; end omesh.p = imesh.p*odata.xs; secs3d-0.0.1/inst/Utilities/Udrawfaces.m0000644000076500000240000000417411632266711017064 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % Udrawfaces(mesh,sides) function Udrawfaces(mesh,sides) nsides = max(sides); %max(mesh.e(10,:)); % nfaces = size(mesh.e,2); % for ifac = 1:nfaces % if (sides==0 | ismember(mesh.e(10,ifac),sides)) % patch(mesh.p(1,mesh.e(1:3,ifac)),... % mesh.p(2,mesh.e(1:3,ifac)),... % mesh.p(3,mesh.e(1:3,ifac)),... % mesh.e(10,ifac),... % 'linestyle','none'); % end % hold on % end [yesno]=ismember(mesh.e(10,:),sides); where = find(yesno); patch(reshape(mesh.p(1,mesh.e(1:3,where)),3,[]),... reshape(mesh.p(2,mesh.e(1:3,where)),3,[]),... reshape(mesh.p(3,mesh.e(1:3,where)),3,[]),mesh.e(10,where)); % cm = zeros(nsides+1,3); % grad = linspace(0,1,nsides+1)'; % cm(:,1) = grad(1+randperm(nsides)); % cm(:,2) = grad(1+randperm(nsides)); % cm(:,3) = grad(1+randperm(nsides)); % colormap(cm) colorbar %colorbar('ytick',1:nsides) % figure(2) % xbase=0; % done=[]; % for ii=1:nfaces % if ((sides==0 | ismember(mesh.e(10,ii),sides))& ~ismember(mesh.e(10,ii),done)) % patch(xbase+[0,1,1,0],[0,0,1,1],cm(mesh.e(10,ii),:)) % hold on % % text(xbase+.5,.5,num2str(mesh.e(10,ii))); % xbase = xbase +1; % done = [done mesh.e(10,ii)]; % end % end xlabel('x'),ylabel('y'),zlabel('z') secs3d-0.0.1/inst/Utilities/Udrawregions.m0000644000076500000240000000255411632266711017451 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % Udrawregions(mesh,r) function Udrawregions(mesh,r) pct = mesh.p(1:3,:)'; nr = length(r); if r~=0 wch=[]; for ir=1:nr wch = union(wch,find(mesh.t(5,:)==r(ir))); end tet=mesh.t(1:4,wch)'; col=mesh.t(5,wch)'; else tet=mesh.t(1:4,:)'; col=mesh.t(5,:)'; end tetramesh(tet,pct,col);%a! ,'linestyle','none'); nr = max(col); cm = zeros(nr,3); grad = linspace(0,1,nr)'; cm(:,1) = grad(randperm(nr)); cm(:,2) = grad(randperm(nr)); cm(:,3) = grad(randperm(nr)); colormap(cm) colorbar('ytick',1:nr) secs3d-0.0.1/inst/Utilities/Udriftdiffusion.m0000644000076500000240000000365011632266711020142 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % c = Udriftdiffusion(mesh,Dsides,guess,M,U,V,u) % solves the drift diffusion equation % $ -div[ mu (u \nabla n - n \nabla V) ] + M u = U $ function c=Udriftdiffusion(mesh,Dsides,guess,M,U,V,mu) global DDG_RHS DDG_MASS if (columns(guess)>rows(guess)) guess=guess'; end if (columns(V)>rows(V)) V=V'; end if (columns(U)>rows(U)) U=U'; end Nnodes = max(size(mesh.p)); Nelements = max(size(mesh.t)); % Set values of Dirichelet BCs Dnodes = Ugetnodesonface(mesh,Dsides); Bc = guess(Dnodes); % Set list of nodes without Dirichelet BCs Varnodes = setdiff([1:Nnodes],Dnodes); % Build LHS matrix and RHS A = Uscharfettergummel(mesh,V,mu); if (isempty(DDG_MASS)) DDG_MASS=Ucompmass2(mesh,ones(Nnodes,1),ones(Nelements,1)); end A = A + DDG_MASS*spdiags(M,0,Nnodes,Nnodes); if (isempty(DDG_RHS)) DDG_RHS=Ucompconst(mesh,ones(Nnodes,1),ones(Nelements,1)); end b = DDG_RHS.*U; %% Apply boundary conditions A (Dnodes,:) = 0; b (Dnodes) = 0; b = b - A (:,Dnodes) * Bc; A(Dnodes,:)= []; A(:,Dnodes)= []; b(Dnodes) = []; % Boundary conditions c = guess; c(Varnodes) = A \ b; secs3d-0.0.1/inst/Utilities/Ufielddepmob.m0000644000076500000240000000223411632266711017372 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % mob = Ufielddepmob(imesh,u0,F,vsat,b) % Computes field dependent mobility function mob = Ufielddepmob(imesh,u0,F,vsat,b) [Ex,Ey,Ez]=Updegrad(imesh,F); ef = sqrt(Ex.^2+Ey.^2+Ez.^2); if columns(ef)>rows(ef) ef=ef'; end if columns(u0)>rows(u0) u0=u0'; end mob = u0 ./ (1+(u0 .* ef ./ vsat).^b).^(1/b); secs3d-0.0.1/inst/Utilities/Ugetnodesonface.m0000644000076500000240000000225111632266711020103 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [outnodes]=Ugetnodesonface(mesh,faceID); % % Returns a list of nodes on face with ID faceID % function [outnodes]=Ugetnodesonface(mesh,faceID); facefaces = []; for ii=1:length(faceID) facefaces = [facefaces,find(mesh.e(10,:)==faceID(ii))]; end facenodes = mesh.e(1:3,facefaces); outnodes = unique(facenodes(:)); secs3d-0.0.1/inst/Utilities/Ujoinmeshes.m0000644000076500000240000000712511632266711017270 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % mesh=Ujoinmeshes(mesh1,mesh2,side1,side2) % Join two structured 3d meshes. function mesh=Ujoinmeshes(mesh1,mesh2,s1,s2) % make sure that the outside world is always % on the same side of the boundary of mesh1 [mesh1.e(8:9,:),I] = sort(mesh1.e(8:9,:)); %% NYI!! If the regions are inverted the vertex order %% should also be inverted!! % get interface nodes intnodes1= Ugetnodesonface(mesh1,s1)'; intnodes2= Ugetnodesonface(mesh2,s2)'; % sort interface nodes by position [tmp,I] = sort(mesh1.p(1,intnodes1)); intnodes1 = intnodes1(I); [tmp,I] = sort(mesh1.p(2,intnodes1)); intnodes1 = intnodes1(I); [tmp,I] = sort(mesh1.p(3,intnodes1)); intnodes1 = intnodes1(I); [tmp,I] = sort(mesh2.p(1,intnodes2)); intnodes2 = intnodes2(I); [tmp,I] = sort(mesh2.p(2,intnodes2)); intnodes2 = intnodes2(I); [tmp,I] = sort(mesh2.p(3,intnodes2)); intnodes2 = intnodes2(I); % delete redundant boundary faces % but first remeber what region % they were connected to for is = 1:length(s2) ii = find(mesh2.e(10,:)==s2(is)); adreg(is,:) = unique(mesh2.e(9,ii)); end for is=1:length(s2) mesh2.e(:,find(mesh2.e(10,:)==s2(is))) = []; end % change face numbers indici=[];consecutivi=[]; indici = unique(mesh2.e(10,:)); consecutivi (indici) = [1:length(indici)]+max(mesh1.e(10,:)); mesh2.e(10,:)=consecutivi(mesh2.e(10,:)); % change node indices in connectivity matrix % and edge list indici=[];consecutivi=[]; indici = 1:size(mesh2.p,2); offint = setdiff(indici,intnodes2); consecutivi (offint) = [1:length(offint)]+size(mesh1.p,2); consecutivi (intnodes2) = intnodes1; mesh2.e(1:3,:)=consecutivi(mesh2.e(1:3,:)); mesh2.t(1:4,:)=consecutivi(mesh2.t(1:4,:)); % delete redundant points mesh2.p(:,intnodes2) = []; % set region numbers regions = unique(mesh1.t(5,:)); newregions(regions) = 1:length(regions); mesh1.t(5,:) = newregions(mesh1.t(5,:)); % set region numbers regions = unique(mesh2.t(5,:)); newregions(regions) = [1:length(regions)]+max(mesh1.t(5,:)); mesh2.t(5,:) = newregions(mesh2.t(5,:)); % set adjacent region numbers in face structure 2 [i,j] = find(mesh2.e(8:9,:)); i = i+7; mesh2.e(i,j) = newregions(mesh2.e(i,j)); % set adjacent region numbers in edge structure 1 for is = 1:length(s1) ii = find(mesh1.e(10,:)==s1(is)); mesh1.e(8,ii) = newregions(regions(adreg(is,:))); end % make the new p structure mesh.p = [mesh1.p mesh2.p]; mesh.e = [mesh1.e mesh2.e]; mesh.t = [mesh1.t mesh2.t]; % % %double check to avoid degenerate triangles % [p,ii,jj]=unique(mesh.p(1:2,:)','rows'); % mesh.p =p'; % mesh.e(1:2,:)=jj(mesh.e(1:2,:)); % mesh.t(1:3,:)=jj(mesh.t(1:3,:)); % % [ii,jj] = find (mesh.e(1,:)==mesh.e(2,:)); % mesh.e(:,jj) = []; % [ii,jj] = find ((mesh.t(1,:)==mesh.t(2,:))|(mesh.t(1,:)==mesh.t(3,:))|(mesh.t(3,:)==mesh.t(2,:))); % mesh.t(:,jj) = []; secs3d-0.0.1/inst/Utilities/Umeshproperties.m0000644000076500000240000000534111632266711020173 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % omesh = Umeshproperties (imesh) % Precompute mesh data. function omesh = Umeshproperties(imesh) omesh = imesh; Nnodes = size(imesh.p,2); Nelements = size(imesh.t,2); weight = [1/4 1/4 1/4 1/4]'; for iel=1:Nelements x1=imesh.p(1,imesh.t(1,iel)); y1=imesh.p(2,imesh.t(1,iel)); z1=imesh.p(3,imesh.t(1,iel)); x2=imesh.p(1,imesh.t(2,iel)); y2=imesh.p(2,imesh.t(2,iel)); z2=imesh.p(3,imesh.t(2,iel)); x3=imesh.p(1,imesh.t(3,iel)); y3=imesh.p(2,imesh.t(3,iel)); z3=imesh.p(3,imesh.t(3,iel)); x4=imesh.p(1,imesh.t(4,iel)); y4=imesh.p(2,imesh.t(4,iel)); z4=imesh.p(3,imesh.t(4,iel)); Nb2 = y1*(z3-z4) + y3*(z4-z1) + y4*(z1-z3); Nb3 = y1*(z4-z2) + y2*(z1-z4) + y4*(z2-z1); Nb4 = y1*(z2-z3) + y2*(z3-z1) + y3*(z1-z2); detJ = (x2-x1)*Nb2 +(x3-x1)*Nb3 +(x4-x1)*Nb4; % Determinant of the Jacobian of the % transformation from the base tetrahedron % to the tetrahedron K Kkvolume = 1/6; % Volume of the reference tetrahedron omesh.wjacdet(:,iel) = Kkvolume * weight * detJ; % Shape function gradients follow % first index represents space direction % second index represents the shape function % third index represents the tetrahedron number omesh.shg(:,1,iel) = [ y2*(z4-z3) + y3*(z2-z4) + y4*(z3-z2) x2*(z3-z4) + x3*(z4-z2) + x4*(z2-z3) x2*(y4-y3) + x3*(y2-y4) + x4*(y3-y2) ] / detJ; omesh.shg(:,2,iel) = [ Nb2 x1*(z4-z3) + x3*(z1-z4) + x4*(z3-z1) x1*(y3-y4) + x3*(y4-y1) + x4*(y1-y3) ] / detJ; omesh.shg(:,3,iel) = [ Nb3 x1*(z2-z4) + x2*(z4-z1) + x4*(z1-z2) x1*(y4-y2) + x2*(y1-y4) + x4*(y2-y1) ] / detJ; omesh.shg(:,4,iel) = [ Nb4 x1*(z3-z2) + x2*(z1-z3) + x3*(z2-z1) x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2) ] / detJ; omesh.shp = eye(4); end secs3d-0.0.1/inst/Utilities/Updegrad.m0000644000076500000240000000241711632266711016531 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % [Fx,Fy]=Updegrad(mesh,F); % % computes piecewise constant % gradient of a piecewise linear % scalar function F defined on % the mesh structure described by mesh function [Fx,Fy,Fz]=Updegrad(mesh,F); shgx = reshape(mesh.shg(1,:,:),4,[]); Fx = sum(shgx.*F(mesh.t(1:4,:)),1); shgy = reshape(mesh.shg(2,:,:),4,[]); Fy = sum(shgy.*F(mesh.t(1:4,:)),1); shgz = reshape(mesh.shg(3,:,:),4,[]); Fz = sum(shgz.*F(mesh.t(1:4,:)),1); secs3d-0.0.1/inst/Utilities/Urrextrapolation.m0000644000076500000240000000231411632266711020354 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % s = Urrextrapolation(X) % RRE vector extrapolation see % Smith, Ford & Sidi SIREV 29 II 06/1987 function s = Urrextrapolation(X) if (columns(X)>rows(X)) X=X'; end % compute first and second variations U = X(:,2:end) - X(:,1:end-1); V = U(:,2:end) - U(:,1:end-1); % eliminate unused u_k column U(:,end) = []; s = X(:,1) - U * pinv(V) * U(:,1); secs3d-0.0.1/inst/Utilities/Uscaling.m0000644000076500000240000001016511632266711016542 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % function [odata,omesh] = Uscaling(imesh,idata); % % Convert input data to non-dimensional form. % function [odata,omesh] = Uscaling(imesh,idata); % [odata,omesh] = Uscaling(imesh,idata); load constants omesh = imesh; odata = idata; % scaling factors odata.xs = max(abs([max(imesh.p(1,:))-min(imesh.p(1,:)),max(imesh.p(2,:))-min(imesh.p(2,:))])); odata.Vs = Vth; odata.ns = norm(idata.D,inf); odata.us = un; odata.ts = odata.xs/(odata.Vs*odata.us); % adimensional constants odata.etan2 = hbar^2 / (2*mndos*odata.xs^2*q*odata.Vs); % 3-valley masses odata.etanxx2 = hbar^2 / (2*mnl*odata.xs^2*q*odata.Vs); odata.etanxy2 = hbar^2 / (2*mnt*odata.xs^2*q*odata.Vs); odata.etanyx2 = hbar^2 / (2*mnt*odata.xs^2*q*odata.Vs); odata.etanyy2 = hbar^2 / (2*mnl*odata.xs^2*q*odata.Vs); odata.etanzx2 = hbar^2 / (2*mnt*odata.xs^2*q*odata.Vs); odata.etanzy2 = hbar^2 / (2*mnt*odata.xs^2*q*odata.Vs); odata.etap2 = hbar^2 / (2*mhdos*odata.xs^2*q*odata.Vs); odata.beta = Vth/odata.Vs; odata.dn2 = hbar^2 / (4*rn*mndos*odata.xs^2*q*odata.Vs); odata.dp2 = hbar^2 / (4*rp*mhdos*odata.xs^2*q*odata.Vs); odata.l2 = (odata.Vs*esi) / (odata.ns*odata.xs^2*q); odata.l2ox = (odata.Vs*esio2) / (odata.ns*odata.xs^2*q); if (isfield(idata,'un')) odata.un = idata.un/odata.us; else odata.un = un/odata.us; end if (isfield(idata,'up')) odata.up = idata.up/odata.us; else odata.up = up/odata.us; end if (isfield(idata,'FDn')) odata.FDn = idata.FDn/odata.Vs; end if (isfield(idata,'FDp')) odata.FDp = idata.FDp/odata.Vs; end if (isfield(idata,'tn')) odata.tn = idata.tn/odata.ts; else odata.tn = tn/odata.ts; end if (isfield(idata,'tp')) odata.tp = idata.tp/odata.ts; else odata.tp = tp/odata.ts; end odata.ni = ni/odata.ns; odata.Nc = Nc/odata.ns; odata.Nv = Nv/odata.ns; odata.ei = Egap/(2*q*odata.Vs) - log(Nv/Nc)/2; odata.eip = Egap/(2*q*odata.Vs) + log(Nv/Nc)/2; odata.wn2 = 6*sqrt(mndos*2*Kb*T0/(pi*hbar^2))/(ni*odata.xs^2); odata.vsatn = vsatn * odata.xs / (odata.us * odata.Vs); odata.vsatp = vsatp * odata.xs / (odata.us * odata.Vs); odata.mubn = mubn; odata.mubp = mubp; odata.mudopparn = [ mudopparn(1:3)/odata.us; mudopparn(4:6)/odata.ns; mudopparn(7:8) ]; odata.mudopparp = [ mudopparp(1:3)/odata.us; mudopparp(4:6)/odata.ns; mudopparp(7:8) ]; % 3-valley weights odata.wnx2 = 2*sqrt(mnt*2*Kb*T0/(pi*hbar^2))/(ni*odata.xs^2); odata.wny2 = odata.wnx2; odata.wnz2 = 2*sqrt(mnl*2*Kb*T0/(pi*hbar^2))/(ni*odata.xs^2); % 3-valley weights odata.wnx2FD = 2*sqrt(mnt*2*Kb*T0/(pi*hbar^2))/(odata.ns*odata.xs^2); odata.wny2FD = odata.wnx2FD; odata.wnz2FD = 2*sqrt(mnl*2*Kb*T0/(pi*hbar^2))/(odata.ns*odata.xs^2); odata.mg = Egap/(2*Kb*T0) - log(Nv/Nc)/2; % scaled quantities odata.D = idata.D/odata.ns; odata.n = idata.n/odata.ns; odata.p = idata.p/odata.ns; odata.Fn = idata.Fn/odata.Vs-log(ni/odata.ns); odata.Fp = idata.Fp/odata.Vs+log(ni/odata.ns); odata.V = idata.V/odata.Vs; if (isfield(idata,'G')) odata.G= idata.G/odata.Vs; end if (isfield(idata,'dt')) odata.dt= idata.dt/odata.ts; end omesh.p = imesh.p/odata.xs; % Last Revision: % $Author: carlo $ % $Date: 2005/05/27 15:29:23 $ secs3d-0.0.1/inst/Utilities/Uscharfettergummel.m0000644000076500000240000000301111632266711020633 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % SG=Uscharfettergummel(mesh,v,acoeff) % % % Builds the Scharfetter-Gummel matrix for the % the discretization of the LHS % of the Drift-Diffusion equation: % % $ -\div (a(x) (\grad u - u \grad v'(x) ))= f $ % % where a(x) is piecewise constant % and v(x) is piecewise linear, so that % v'(x) is still piecewise constant % b is a constant independent of x % and u is the unknown % function SG=Uscharfettergummel(mesh,v,acoeff) p=mesh.p; t=mesh.t; Nnodes = length(p); Nelements = length(t); fprintf(1,'*--------------------*\n'); fprintf(1,'building SG Matrix\n*'); SG = bim3a_advection_diffusion (mesh, acoeff, v); fprintf(1,'--------------------*\nDONE!\n\n\n'); secs3d-0.0.1/inst/Utilities/Ustructmesh.m0000644000076500000240000000576011632266711017330 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [omesh]=Ustructmesh(x,y,z,region,sides) % % Construct a structured mesh of a parallelepiped. % function [omesh]=Ustructmesh(x,y,z,region,sides) % sort point coordinates x = sort(x); y = sort(y); z = sort(z); nx = length(x); ny = length(y); nz = length(z); % generate verticeces [XX,YY,ZZ] = meshgrid(x,y,z); p = [XX(:),YY(:),ZZ(:)]'; iiv (ny,nx,nz)=0; iiv(:)=1:nx*ny*nz; iiv(end,:,:)=[]; iiv(:,end,:)=[]; iiv(:,:,end)=[]; iiv=iiv(:)'; % generate connections: % bottom faces n1 = iiv; n2 = iiv + 1; n3 = iiv + ny; n4 = iiv + ny + 1; % top faces N1 = iiv + nx * ny; N2 = N1 + 1; N3 = N1 + ny; N4 = N3 + 1; t = [... [n1; n3; n2; N2],... [N1; N2; N3; n3],... [N1; N2; n3; n1],... [N2; n3; n2; n4],... [N3; n3; N2; N4],... [N4; n3; N2; n4],... ]; % generate boundary face list: % left T = t; T(:) = p(1,t)'==x(1); [ignore,order] = sort(T,1); ii = (find(sum(T,1)==3)); order(1,:) = []; for jj=1:length(ii) e1(:,jj) = t(order(:,ii(jj)),ii(jj)); end e1(10,:) = sides(1); % right T(:) = p(1,t)'==x(end); [ignore,order] = sort(T,1); ii = (find(sum(T,1)==3)); order(1,:) = []; for jj=1:length(ii) e2(:,jj) = t(order(:,ii(jj)),ii(jj)); end e2(10,:) = sides(2); % front T(:) = p(2,t)'==y(1); [ignore,order] = sort(T,1); ii = (find(sum(T,1)==3)); order(1,:) = []; for jj=1:length(ii) e3(:,jj) = t(order(:,ii(jj)),ii(jj)); end e3(10,:) = sides(3); % back T(:) = p(2,t)'==y(end); [ignore,order] = sort(T,1); ii = (find(sum(T,1)==3)); order(1,:) = []; for jj=1:length(ii) e4(:,jj) = t(order(:,ii(jj)),ii(jj)); end e4(10,:) = sides(4); % bottom T = t; T(:) = p(3,t)'==z(1); [ignore,order] = sort(T,1); ii = (find(sum(T,1)==3)); order(1,:) = []; for jj=1:length(ii) e5(:,jj) = t(order(:,ii(jj)),ii(jj)); end e5(10,:) = sides(5); % top T = t; T(:) = p(3,t)'==z(end); [ignore,order] = sort(T,1); ii = (find(sum(T,1)==3)); order(1,:) = []; for jj=1:length(ii) e6(:,jj) = t(order(:,ii(jj)),ii(jj)); end e6(10,:) = sides(6); omesh.e = [e1,e2,e3,e4,e5,e6]; omesh.t = t; omesh.e (9,:) = region; omesh.t (5,:) = region; omesh.p = p; secs3d-0.0.1/inst/Utilities/Usubmesh.m0000644000076500000240000000335611632266711016574 0ustar carlostaff%% 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 . %% %% author: Carlo de Falco % % [omesh,onodes,oelements]=Usubmesh(imesh,intrfc,sdl,short) % % builds the mesh structure for the given list % of subdomains sdl % function [omesh,onodes,oelements]=Usubmesh(imesh,intrfc,sdl,short) oelements=[]; for ir = 1:length(sdl) oelements = [ oelements find(imesh.t(5,:)==sdl(ir)) ]; end onodes = reshape(imesh.t(1:4,oelements),1,[]); onodes = unique(onodes); if (~short) omesh.shp = imesh.shp; omesh.wjacdet = imesh.wjacdet(:,oelements); omesh.area = imesh.area(oelements); omesh.shg = imesh.shg(:,:,oelements); end omesh.p = imesh.p (:,onodes); indx(onodes) = 1:length (onodes); omesh.t = imesh.t (:,oelements); omesh.t(1:4,:) = indx(omesh.t(1:4,:)); omesh.e = []; for ifac = 1:size(imesh.e,2) if (length(intersect(imesh.e(1:3,ifac),onodes) )== 3) omesh.e = [omesh.e imesh.e(:,ifac)]; end end omesh.e(1:3,:) = indx(omesh.e(1:3,:)); secs3d-0.0.1/README0000644000076500000240000000134311632266711012545 0ustar carlostaff 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 .