Ignore:
Timestamp:
Feb 2, 2011, 8:44:07 PM (13 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

Config format versioning. Scale config data from the previous version to a.u. as needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/class/pf/Application.js

    r197 r198  
    21322132            var config = new Object;
    21332133           
     2134            // version of config format
     2135            config.format_v = 1;
     2136           
    21342137            config.N_e = this.plasma.e.getN();
    21352138
     
    21792182           
    21802183            if (config) {
    2181                 this.plasma.e.setN(config.N_e);
    2182 
    2183                 this.plasma.e.setT(config.T_e);
    2184                 this.plasma.i.setT(config.T_i);
    2185                 this.plasma.r.setT(config.T_r);
    2186 
    2187                 this.plasma.i.setM(config.M_i);
    2188                 this.plasma.r.setM(config.M_r);
     2184                var au_fn, au_fT, au_fM, au_fB;
     2185                if (!config.format_v) {
     2186                    // old format, rescale data
     2187                    au_fn = pf.base.Bohr.n0;
     2188                    au_fT = pf.base.Bohr.E0;
     2189                    au_fM = 1/pf.base.Bohr.m_p;
     2190                    au_fB = pf.base.Bohr.B0;
     2191                } else {
     2192                    au_fn = 1;
     2193                    au_fT = 1;
     2194                    au_fM = 1;
     2195                    au_fB = 1;
     2196                }
     2197               
     2198                this.plasma.e.setN(config.N_e/au_fn);
     2199
     2200                this.plasma.e.setT(config.T_e/au_fT);
     2201                this.plasma.i.setT(config.T_i/au_fT);
     2202                this.plasma.r.setT(config.T_r/au_fT);
     2203
     2204                this.plasma.i.setM(config.M_i/au_fM);
     2205                this.plasma.r.setM(config.M_r/au_fM);
    21892206
    21902207                this.plasma.i.setQ(config.Q_i);
     
    21932210                this.plasma.P_r = config.P_r;
    21942211
    2195                 this.plasma.B   = config.B  ;
     2212                this.plasma.B   = config.B/au_fB;
    21962213
    21972214                this.plasma.n_u = config.n_u;
Note: See TracChangeset for help on using the changeset viewer.