]> Creatis software - CreaPhase.git/blob - octave_packages/secs2d-0.0.8/Utilities/Udescaling.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / secs2d-0.0.8 / Utilities / Udescaling.m
1 function [odata,omesh] = Udescaling(imesh,idata);
2
3 %  [odata,omesh] = Udescaling(imesh,idata);
4
5 % This file is part of 
6 %
7 %            SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
8 %         -------------------------------------------------------------------
9 %            Copyright (C) 2004-2006  Carlo de Falco
10 %
11 %
12 %
13 %  SECS2D is free software; you can redistribute it and/or modify
14 %  it under the terms of the GNU General Public License as published by
15 %  the Free Software Foundation; either version 2 of the License, or
16 %  (at your option) any later version.
17 %
18 %  SECS2D is distributed in the hope that it will be useful,
19 %  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 %  GNU General Public License for more details.
22 %
23 %  You should have received a copy of the GNU General Public License
24 %  along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
25
26 load (file_in_path(path,'constants.mat'));
27
28 omesh      = imesh;
29 odata      = idata;
30
31 % scaling factors
32 % odata.xs   = max(abs([max(imesh.p(1,:))-min(imesh.p(1,:)),max(imesh.p(2,:))-min(imesh.p(2,:))]));
33 % odata.Vs   = Vth;
34 % odata.ns   = norm(idata.D,inf);
35 % odata.us   = un;
36
37 % adimensional constants
38 % odata.etan2 = hbar^2 / (2*mndos*odata.xs^2*q);
39 % odata.etap2 = hbar^2 / (2*mpdos*odata.xs^2*q);
40 % odata.beta  = Vth/odata.Vs;
41 % odata.dn2   = hbar^2 / (6*mndos*odata.xs^2*q*odata.Vs);
42 % odata.dp2   = hbar^2 / (6*mpdos*odata.xs^2*q*odata.Vs);
43 % odata.l2    = (odata.Vs*esi) / (odata.ns*odata.xs^2*q);
44 % odata.un    = un/odata.us;
45 % odata.up    = up/odata.us;
46
47 % scaled quantities
48 odata.D     = idata.D*odata.ns;
49 odata.n     = idata.n*odata.ns;
50 odata.p     = idata.p*odata.ns;
51 odata.Fn    = (idata.Fn+log(ni/odata.ns))*odata.Vs;
52 odata.Fp    = (idata.Fp-log(ni/odata.ns))*odata.Vs;
53 odata.V     = idata.V*odata.Vs;
54 if (isfield(idata,'G'))
55     odata.G = idata.G*odata.Vs;
56 end
57 if (isfield(idata,'dt'))
58     odata.dt = idata.dt*odata.ts;
59 end
60
61 if (isfield(idata,'un'))    
62     odata.un    = idata.un*odata.us;  
63 else
64     odata.un    = un;
65 end
66
67 if (isfield(idata,'n0'))    
68     odata.n0    = idata.n0*odata.ns;  
69     odata.p0    = idata.p0*odata.ns;  
70 else
71     odata.p0    = ni;
72     odata.n0    = ni;
73 end
74
75 if (isfield(idata,'up'))
76     odata.up    = idata.up*odata.us;
77 else
78     odata.up    = up;
79 end
80 if (isfield(idata,'FDn'))    
81     odata.FDn    = idata.FDn*odata.Vs;  
82 end
83 if (isfield(idata,'FDp'))    
84     odata.FDp    = idata.FDp*odata.Vs;  
85 end
86
87 if (isfield(idata,'Tl'))    
88     odata.Tl    = idata.Tl*odata.Ts;  
89 end
90
91 if (isfield(idata,'Tn'))    
92     odata.Tn    = idata.Tn*odata.Ts;  
93 end
94
95 if (isfield(idata,'Tp'))    
96     odata.Tp    = idata.Tp*odata.Ts;  
97 end
98
99 omesh.p     = imesh.p*odata.xs;