Difference between revisions of "Statistical Thermodynamics and Transport Phenomena"

From AutoMeKin
Jump to navigation Jump to search
(Replaced content with "Here you will find useful jupyter notebooks on this subject. You can run the notebooks at the following URLs: [https://mybinder.org/v2/gh/emartineznunez/QF_IV/master Ju...")
(Tag: Replaced)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Here you will find useful jupyter notebooks on this subject.
 
Here you will find useful jupyter notebooks on this subject.
  
You can run the notebooks at the following URLs (choose: Notebook or Lab):  
+
You can run the notebooks at the following URLs:  
  
 
[https://mybinder.org/v2/gh/emartineznunez/QF_IV/master Jupyter Notebook ]
 
[https://mybinder.org/v2/gh/emartineznunez/QF_IV/master Jupyter Notebook ]
 
[https://mybinder.org/v2/gh/emartineznunez/QF_IV/master?urlpath=lab Jupyter Lab ]
 
 
 
<html lang="en">
 
 
 
  <head>
 
<div id="glowscript" class="glowscript">
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
<link type="text/css" href="https://s3.amazonaws.com/glowscript/css/redmond/2.1/jquery-ui.custom.css" rel="stylesheet" />
 
<link type="text/css" href="https://s3.amazonaws.com/glowscript/css/ide.css" rel="stylesheet" />
 
<script type="text/javascript" src="https://s3.amazonaws.com/glowscript/lib/jquery/2.1/jquery.min.js"></script>
 
<script type="text/javascript" src="https://s3.amazonaws.com/glowscript/lib/jquery/2.1/jquery-ui.custom.min.js"></script>
 
<script type="text/javascript" src="https://s3.amazonaws.com/glowscript/package/glow.3.0.min.js"></script>
 
<script type="text/javascript" src="https://s3.amazonaws.com/glowscript/package/RSrun.3.0.min.js"></script>
 
<script type="text/javascript"><!--//--><![CDATA[//><!--
 
 
// START JAVASCRIPT
 
;(function() {;
 
var RS_modules = {};
 
RS_modules.pythonize = {};
 
 
(function(){
 
    function strings() {
 
        var string_funcs, exclude, name;
 
        string_funcs = set("capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase center count endswith startswith find rfind index rindex format join ljust rjust partition rpartition replace split rsplit splitlines zfill".split(" "));
 
        if (!arguments.length) {
 
            exclude = (function(){
 
                var s = RS_set();
 
                s.jsset.add("split");
 
                s.jsset.add("replace");
 
                return s;
 
            })();
 
        } else if (arguments[0]) {
 
            exclude = Array.prototype.slice.call(arguments);
 
        } else {
 
            exclude = null;
 
        }
 
        if (exclude) {
 
            string_funcs = string_funcs.difference(set(exclude));
 
        }
 
        var RS_Iter0 = string_funcs;
 
        RS_Iter0 = ((typeof RS_Iter0[Symbol.iterator] === "function") ? (RS_Iter0 instanceof Map ? RS_Iter0.keys() : RS_Iter0) : Object.keys(RS_Iter0));
 
        for (var RS_Index0 of RS_Iter0) {
 
            name = RS_Index0;
 
            (RS_expr_temp = String.prototype)[(typeof name === "number" && name < 0) ? RS_expr_temp.length + name : name] = (RS_expr_temp = RS_str.prototype)[(typeof name === "number" && name < 0) ? RS_expr_temp.length + name : name];
 
        }
 
    };
 
    if (!strings.__module__) Object.defineProperties(strings, {
 
        __module__ : {value: "pythonize"}
 
    });
 
 
    RS_modules.pythonize.strings = strings;
 
})();
 
async function __main__() {
 
"use strict";
 
 
    var version, display, vector, print, arange, __name__, type, scene, RS_ls, win, Natoms, NA, L, V, gray, mass, Ratom, k, T, dt, animation, s, d, r, boxbottom, boxtop, vert1, vert2, vert3, vert4, Atoms, p, apos, mfp, pavg, x, y, z, theta, phi, px, py, pz, i, deltav, nhisto, histo, xmax, ymax, gg, theory, dv, v, accum, vdist, nc, gmfp, cnts, ti, tiref, gti, t, ncoll, aposold, dist, v_square, vi, P, hitlist, j, ptot, posi, posj, vj, vrel, a, rrel, dx, dy, value, alpha, deltat, mtot, pcmi, pcmj, ij, sigma, gmfp0, MFP, Zco, z0, loc, nsteps;
 
    version = RS_list_decorate([ "3.0", "glowscript" ]);
 
    Array.prototype['+'] = function(r) {return this.concat(r)}
 
    Array.prototype['*'] = function(r) {return __array_times_number(this, r)}
 
    window.__GSlang = "vpython";
 
    display = canvas;
 
    vector = vec;
 
    print = GSprint;
 
    arange = range;
 
    __name__ = "__main__";
 
    type = pytype;
 
    scene = canvas();
 
    var strings = RS_modules.pythonize.strings;
 
 
    strings();
 
    "5";
 
    win = 500;
 
    "7";
 
    Natoms = 200;
 
    "8";
 
    NA = 6.022e23;
 
    "10";
 
    L = 1;
 
    "11";
 
    V = GS_power(L, 3);
 
    "12";
 
    gray = (await color.gray(.7));
 
    "13";
 
    mass = .004["/"](NA);
 
    "14";
 
    Ratom = .03;
 
    "15";
 
    k = 1.38064852e-23;
 
    "16";
 
    T = 298;
 
    "17";
 
    dt = 1e-5;
 
    "19";
 
    animation = RS_interpolate_kwargs.call(this, canvas, [RS_desugar_kwargs({width: win, height: win, align: "left"})]);
 
    "20";
 
    animation.range = L;
 
    "21";
 
    animation.title = "Simulation with "["+"](str(Natoms))["+"](" \"hard-sphere\" gas particles at T = ")["+"](str(T))["+"](" K");
 
    "32";
 
    s = "<b>Theoretical and simulated speed distributions.<\/b>\n  Initially all atoms have the same speed, \n  but collisions change the speeds of the \n  colliding atoms. \n  \n  One of the atoms is marked and leaves a \n  trail so you can follow its path.\n  \n  While speeds are realistic, the collision\n  frequency and mean free path are not\n";
 
    "33";
 
    animation.caption = s;
 
    "35";
 
    d = L["/"](2)["+"](Ratom);
 
    "36";
 
    r = .005;
 
    "37";
 
    boxbottom = RS_interpolate_kwargs.call(this, curve, [RS_desugar_kwargs({color: gray, radius: r})]);
 
    "38";
 
    boxbottom.append(RS_list_decorate([ vector(d["-u"](), d["-u"](), d["-u"]()), vector(d["-u"](), d["-u"](), d), vector(d, d["-u"](), d), vector(d, d["-u"](), d["-u"]()), vector(d["-u"](), d["-u"](), d["-u"]()) ]));
 
    "39";
 
    boxtop = RS_interpolate_kwargs.call(this, curve, [RS_desugar_kwargs({color: gray, radius: r})]);
 
    "40";
 
    boxtop.append(RS_list_decorate([ vector(d["-u"](), d, d["-u"]()), vector(d["-u"](), d, d), vector(d, d, d), vector(d, d, d["-u"]()), vector(d["-u"](), d, d["-u"]()) ]));
 
    "41";
 
    vert1 = RS_interpolate_kwargs.call(this, curve, [RS_desugar_kwargs({color: gray, radius: r})]);
 
    "42";
 
    vert2 = RS_interpolate_kwargs.call(this, curve, [RS_desugar_kwargs({color: gray, radius: r})]);
 
    "43";
 
    vert3 = RS_interpolate_kwargs.call(this, curve, [RS_desugar_kwargs({color: gray, radius: r})]);
 
    "44";
 
    vert4 = RS_interpolate_kwargs.call(this, curve, [RS_desugar_kwargs({color: gray, radius: r})]);
 
    "45";
 
    vert1.append(RS_list_decorate([ vector(d["-u"](), d["-u"](), d["-u"]()), vector(d["-u"](), d, d["-u"]()) ]));
 
    "46";
 
    vert2.append(RS_list_decorate([ vector(d["-u"](), d["-u"](), d), vector(d["-u"](), d, d) ]));
 
    "47";
 
    vert3.append(RS_list_decorate([ vector(d, d["-u"](), d), vector(d, d, d) ]));
 
    "48";
 
    vert4.append(RS_list_decorate([ vector(d, d["-u"](), d["-u"]()), vector(d, d, d["-u"]()) ]));
 
    "50";
 
    Atoms = RS_list_decorate([]);
 
    "51";
 
    p = RS_list_decorate([]);
 
    "52";
 
    apos = RS_list_decorate([]);
 
    "53";
 
    mfp = RS_list_decorate([ 0 ])["*"](Natoms);
 
    "54";
 
    pavg = sqrt(2["*"](mass)["*"](1.5)["*"](k)["*"](T));
 
    "56";
 
    for (var RS_Index1 = 0; RS_Index1["<"](Natoms); RS_Index1++) {
 
        i = RS_Index1;
 
        "57";
 
        x = L["*"](random())["-"](L["/"](2));
 
        "58";
 
        y = L["*"](random())["-"](L["/"](2));
 
        "59";
 
        z = L["*"](random())["-"](L["/"](2));
 
        "60";
 
        if ((i === 0 || typeof i === "object" && RS_equals(i, 0))) {
 
            "61";
 
            Atoms.append(RS_interpolate_kwargs.call(this, sphere, [RS_desugar_kwargs({pos: vector(x, y, z), radius: Ratom, color: color.cyan, make_trail: true, retain: 100, trail_radius: .3["*"](Ratom)})]));
 
            "62";
 
        } else {
 
            Atoms.append(RS_interpolate_kwargs.call(this, sphere, [RS_desugar_kwargs({pos: vector(x, y, z), radius: Ratom, color: gray})]));
 
        }
 
        "63";
 
        apos.append(vec(x, y, z));
 
        "64";
 
        theta = pi["*"](random());
 
        "65";
 
        phi = 2["*"](pi)["*"](random());
 
        "66";
 
        px = pavg["*"](sin(theta))["*"](cos(phi));
 
        "67";
 
        py = pavg["*"](sin(theta))["*"](sin(phi));
 
        "68";
 
        pz = pavg["*"](cos(theta));
 
        "69";
 
        p.append(vector(px, py, pz));
 
    }
 
    "71";
 
    deltav = 100;
 
    "73";
 
    async function barx(v) {
 
        "74";
 
        return int(v["/"](deltav));
 
    };
 
    if (!barx.__argnames__) Object.defineProperties(barx, {
 
        __argnames__ : {value: ["v"]},
 
        __module__ : {value: null}
 
    });
 
 
    "77";
 
    nhisto = int(5e3["/"](deltav));
 
    "79";
 
    histo = RS_list_decorate([]);
 
    "80";
 
    for (var RS_Index2 = 0; RS_Index2["<"](nhisto); RS_Index2++) {
 
        i = RS_Index2;
 
        histo.append(0);
 
    }
 
    "81";
 
    histo[RS_bound_index((await barx(pavg["/"](mass))), histo)] = Natoms;
 
    "83";
 
    xmax = sqrt(2["*"](k)["*"](T)["/"](mass))["+"](2.5["*"](sqrt(k["*"](T)["/"](mass))));
 
    "84";
 
    ymax = Natoms["*"](4)["*"](GS_power((mass["/"](2["*"](pi)["*"](k)["*"](T))), .5))["/"](2.3)["*"](deltav)["*"](1.2);
 
    "85";
 
    gg = RS_interpolate_kwargs.call(this, graph, [RS_desugar_kwargs({width: win, height: .4["*"](win), xmax: xmax, align: "left", xtitle: "speed, m/s", ytitle: "Number of atoms", ymax: ymax})]);
 
    "88";
 
    theory = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({color: color.blue})]);
 
    "89";
 
    dv = 10;
 
    "90";
 
    var RS_Iter3 = range(0, 5001["+"](dv), dv);
 
    RS_Iter3 = ((typeof RS_Iter3[Symbol.iterator] === "function") ? (RS_Iter3 instanceof Map ? RS_Iter3.keys() : RS_Iter3) : Object.keys(RS_Iter3));
 
    for (var RS_Index3 of RS_Iter3) {
 
        v = RS_Index3;
 
        "91";
 
        (await theory.plot(v, deltav["/"](dv)["*"](Natoms)["*"](4)["*"](pi)["*"](GS_power((mass["/"](2["*"](pi)["*"](k)["*"](T))), 1.5))["*"](exp(.5["-u"]()["*"](mass)["*"](GS_power(v, 2))["/"](k["*"](T))))["*"](GS_power(v, 2))["*"](dv)));
 
    }
 
    "93";
 
    accum = RS_list_decorate([]);
 
    "95";
 
    var RS_Iter4 = range(int(5e3["/"](deltav)));
 
    RS_Iter4 = ((typeof RS_Iter4[Symbol.iterator] === "function") ? (RS_Iter4 instanceof Map ? RS_Iter4.keys() : RS_Iter4) : Object.keys(RS_Iter4));
 
    for (var RS_Index4 of RS_Iter4) {
 
        i = RS_Index4;
 
        accum.append(RS_list_decorate([ deltav["*"](i["+"](.5)), 0 ]));
 
    }
 
    "96";
 
    vdist = RS_interpolate_kwargs.call(this, gvbars, [RS_desugar_kwargs({color: color.red, delta: deltav})]);
 
    "98";
 
    async function interchange(v1, v2) {
 
        var RS_ls, barx1, barx2;
 
        "99";
 
        barx1 = (await barx(v1));
 
        "100";
 
        barx2 = (await barx(v2));
 
        "101";
 
        if ((barx1 === barx2 || typeof barx1 === "object" && RS_equals(barx1, barx2))) {
 
            return;
 
        }
 
        "102";
 
        if (barx1[">="](len(histo)) || barx2[">="](len(histo))) {
 
            return;
 
        }
 
        "103";
 
        histo[(typeof barx1 === "number" && barx1["<"](0)) ? histo.length["+"](barx1) : barx1]=histo[(typeof barx1 === "number" && barx1["<"](0)) ? histo.length["+"](barx1) : barx1]["-"](1);
 
        "104";
 
        histo[(typeof barx2 === "number" && barx2["<"](0)) ? histo.length["+"](barx2) : barx2]=histo[(typeof barx2 === "number" && barx2["<"](0)) ? histo.length["+"](barx2) : barx2]["+"](1);
 
    };
 
    if (!interchange.__argnames__) Object.defineProperties(interchange, {
 
        __argnames__ : {value: ["v1", "v2"]},
 
        __module__ : {value: null}
 
    });
 
 
    "106";
 
    async function checkCollisions() {
 
        var RS_ls, hitlist, r2, ai, aj, dr, j, i;
 
        "107";
 
        hitlist = RS_list_decorate([]);
 
        "108";
 
        r2 = 2["*"](Ratom);
 
        "109";
 
        r2=r2["*"](r2);
 
        "111";
 
        for (var RS_Index5 = 0; RS_Index5["<"](Natoms); RS_Index5++) {
 
            i = RS_Index5;
 
            "112";
 
            ai = apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i];
 
            "113";
 
            for (var RS_Index6 = 0; RS_Index6["<"](i); RS_Index6++) {
 
                j = RS_Index6;
 
                "114";
 
                aj = apos[(typeof j === "number" && j["<"](0)) ? apos.length["+"](j) : j];
 
                "115";
 
                dr = ai["-"](aj);
 
                "117";
 
                if (mag2(dr)["<"](r2)) {
 
                    hitlist.append(RS_list_decorate([ i, j ]));
 
                }
 
            }
 
        }
 
        "119";
 
        return hitlist;
 
    };
 
    if (!checkCollisions.__module__) Object.defineProperties(checkCollisions, {
 
        __module__ : {value: null}
 
    });
 
 
    "121";
 
    nhisto = 0;
 
    "122";
 
    z = 0;
 
    "123";
 
    nc = 0;
 
    "124";
 
    gmfp = RS_list_decorate([ 0 ])["*"](Natoms);
 
    "125";
 
    cnts = RS_list_decorate([ 0 ])["*"](Natoms);
 
    "126";
 
    ti = RS_list_decorate([ 0 ])["*"](Natoms);
 
    "127";
 
    tiref = RS_list_decorate([ 0 ])["*"](Natoms);
 
    "128";
 
    gti = RS_list_decorate([ 0 ])["*"](Natoms);
 
    "129";
 
    t = 0;
 
    "130";
 
    ncoll = 0;
 
    "132";
 
    for (var RS_Index7 = 0; RS_Index7["<"](5e4); RS_Index7++) {
 
        nsteps = RS_Index7;
 
        "133";
 
        (await rate(T));
 
        "135";
 
        var RS_Iter8 = range(len(accum));
 
        RS_Iter8 = ((typeof RS_Iter8[Symbol.iterator] === "function") ? (RS_Iter8 instanceof Map ? RS_Iter8.keys() : RS_Iter8) : Object.keys(RS_Iter8));
 
        for (var RS_Index8 of RS_Iter8) {
 
            i = RS_Index8;
 
            accum[(typeof i === "number" && i["<"](0)) ? accum.length["+"](i) : i][1] = nhisto["*"](accum[(typeof i === "number" && i["<"](0)) ? accum.length["+"](i) : i][1])["+"](histo[(typeof i === "number" && i["<"](0)) ? histo.length["+"](i) : i])["/"](nhisto["+"](1));
 
        }
 
        "136";
 
        if (RS_equals(nhisto["%"](10), 0)) {
 
            "137";
 
            vdist.data = accum;
 
        }
 
        "138";
 
        nhisto=nhisto["+"](1);
 
        "141";
 
        t = t["+"](dt);
 
        "142";
 
        for (var RS_Index9 = 0; RS_Index9["<"](Natoms); RS_Index9++) {
 
            i = RS_Index9;
 
            "143";
 
            aposold = apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i];
 
            "144";
 
            Atoms[(typeof i === "number" && i["<"](0)) ? Atoms.length["+"](i) : i].pos = apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i] = apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i]["+"](p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i]["/"](mass)["*"](dt));
 
            "145";
 
            ti[(typeof i === "number" && i["<"](0)) ? ti.length["+"](i) : i] = t["-"](tiref[(typeof i === "number" && i["<"](0)) ? tiref.length["+"](i) : i]);
 
            "147";
 
            dist = GS_power((GS_power((apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i].x["-"](aposold.x)), 2)["+"](GS_power((apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i].y["-"](aposold.y)), 2))["+"](GS_power((apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i].z["-"](aposold.z)), 2))), .5);
 
            "148";
 
            mfp[(typeof i === "number" && i["<"](0)) ? mfp.length["+"](i) : i] = mfp[(typeof i === "number" && i["<"](0)) ? mfp.length["+"](i) : i]["+"](dist);
 
        }
 
        "150";
 
        v_square = 0;
 
        "151";
 
        for (var RS_Index10 = 0; RS_Index10["<"](Natoms); RS_Index10++) {
 
            i = RS_Index10;
 
            "152";
 
            vi = p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i]["/"](mass);
 
            "153";
 
            v_square = v_square["+"](vi.x["*"](vi.x))["+"](vi.y["*"](vi.y))["+"](vi.z["*"](vi.z));
 
        }
 
        "155";
 
        P = mass["*"](v_square)["/"](3)["/"](V);
 
        "159";
 
        hitlist = (await checkCollisions());
 
        "164";
 
        var RS_Iter11 = hitlist;
 
        RS_Iter11 = ((typeof RS_Iter11[Symbol.iterator] === "function") ? (RS_Iter11 instanceof Map ? RS_Iter11.keys() : RS_Iter11) : Object.keys(RS_Iter11));
 
        for (var RS_Index11 of RS_Iter11) {
 
            ij = RS_Index11;
 
            "165";
 
            i = ij[0];
 
            "166";
 
            j = ij[1];
 
            "167";
 
            gmfp[(typeof i === "number" && i["<"](0)) ? gmfp.length["+"](i) : i]=gmfp[(typeof i === "number" && i["<"](0)) ? gmfp.length["+"](i) : i]["+"](mfp[(typeof i === "number" && i["<"](0)) ? mfp.length["+"](i) : i]);
 
            "168";
 
            gmfp[(typeof j === "number" && j["<"](0)) ? gmfp.length["+"](j) : j]=gmfp[(typeof j === "number" && j["<"](0)) ? gmfp.length["+"](j) : j]["+"](mfp[(typeof j === "number" && j["<"](0)) ? mfp.length["+"](j) : j]);
 
            "169";
 
            gti[(typeof i === "number" && i["<"](0)) ? gti.length["+"](i) : i]=gti[(typeof i === "number" && i["<"](0)) ? gti.length["+"](i) : i]["+"](ti[(typeof i === "number" && i["<"](0)) ? ti.length["+"](i) : i]);
 
            "170";
 
            gti[(typeof j === "number" && j["<"](0)) ? gti.length["+"](j) : j]=gti[(typeof j === "number" && j["<"](0)) ? gti.length["+"](j) : j]["+"](ti[(typeof j === "number" && j["<"](0)) ? ti.length["+"](j) : j]);
 
            "171";
 
            cnts[(typeof i === "number" && i["<"](0)) ? cnts.length["+"](i) : i]=cnts[(typeof i === "number" && i["<"](0)) ? cnts.length["+"](i) : i]["+"](1);
 
            "172";
 
            cnts[(typeof j === "number" && j["<"](0)) ? cnts.length["+"](j) : j]=cnts[(typeof j === "number" && j["<"](0)) ? cnts.length["+"](j) : j]["+"](1);
 
            "173";
 
            mfp[(typeof i === "number" && i["<"](0)) ? mfp.length["+"](i) : i] = 0;
 
            "174";
 
            mfp[(typeof j === "number" && j["<"](0)) ? mfp.length["+"](j) : j] = 0;
 
            "175";
 
            tiref[(typeof i === "number" && i["<"](0)) ? tiref.length["+"](i) : i] = t;
 
            "176";
 
            tiref[(typeof j === "number" && j["<"](0)) ? tiref.length["+"](j) : j] = t;
 
            "177";
 
            ptot = p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i]["+"](p[(typeof j === "number" && j["<"](0)) ? p.length["+"](j) : j]);
 
            "178";
 
            posi = apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i];
 
            "179";
 
            posj = apos[(typeof j === "number" && j["<"](0)) ? apos.length["+"](j) : j];
 
            "180";
 
            vi = p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i]["/"](mass);
 
            "181";
 
            vj = p[(typeof j === "number" && j["<"](0)) ? p.length["+"](j) : j]["/"](mass);
 
            "182";
 
            vrel = vj["-"](vi);
 
            "183";
 
            a = vrel.mag2;
 
            "184";
 
            if ((a === 0 || typeof a === "object" && RS_equals(a, 0))) {
 
                continue;
 
            }
 
            "185";
 
            rrel = posi["-"](posj);
 
            "186";
 
            if (rrel.mag["<"](Ratom)) {
 
                "188";
 
                continue;
 
            }
 
            "191";
 
            dx = dot(rrel, vrel.hat);
 
            "192";
 
            dy = cross(rrel, vrel.hat).mag;
 
            "195";
 
            value = dy["/"](2["*"](Ratom));
 
            "196";
 
            if (value[">"](1)) {
 
                value = 1;
 
            }
 
            "197";
 
            if (value["<"](1["-u"]())) {
 
                value = 1["-u"]();
 
            }
 
            "198";
 
            alpha = asin(value);
 
            "199";
 
            d = 2["*"](Ratom)["*"](cos(alpha))["-"](dx);
 
            "200";
 
            deltat = d["/"](vrel.mag);
 
            "204";
 
            posi = posi["-"](vi["*"](deltat));
 
            "205";
 
            posj = posj["-"](vj["*"](deltat));
 
            "207";
 
            mtot = 2["*"](mass);
 
            "208";
 
            pcmi = p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i]["-"](ptot["*"](mass)["/"](mtot));
 
            "209";
 
            pcmj = p[(typeof j === "number" && j["<"](0)) ? p.length["+"](j) : j]["-"](ptot["*"](mass)["/"](mtot));
 
            "210";
 
            rrel = norm(rrel);
 
            "211";
 
            pcmi = pcmi["-"](2["*"]((await pcmi.dot(rrel)))["*"](rrel));
 
            "212";
 
            pcmj = pcmj["-"](2["*"]((await pcmj.dot(rrel)))["*"](rrel));
 
            "213";
 
            p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i] = pcmi["+"](ptot["*"](mass)["/"](mtot));
 
            "214";
 
            p[(typeof j === "number" && j["<"](0)) ? p.length["+"](j) : j] = pcmj["+"](ptot["*"](mass)["/"](mtot));
 
            "215";
 
            apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i] = posi["+"](p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i]["/"](mass)["*"](deltat));
 
            "216";
 
            apos[(typeof j === "number" && j["<"](0)) ? apos.length["+"](j) : j] = posj["+"](p[(typeof j === "number" && j["<"](0)) ? p.length["+"](j) : j]["/"](mass)["*"](deltat));
 
            "217";
 
            (await interchange(vi.mag, p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].mag["/"](mass)));
 
            "218";
 
            (await interchange(vj.mag, p[(typeof j === "number" && j["<"](0)) ? p.length["+"](j) : j].mag["/"](mass)));
 
        }
 
        "219";
 
        ncoll=ncoll["+"](len(hitlist));
 
        "220";
 
        sigma = pi["*"](GS_power((2["*"](Ratom)), 2));
 
        "221";
 
        gmfp0 = k["*"](T)["/"](P)["/"](sigma["*"](GS_power(2, .5)));
 
        "222";
 
        MFP = 0;
 
        "223";
 
        Zco = 0;
 
        "224";
 
        for (var RS_Index12 = 0; RS_Index12["<"](Natoms); RS_Index12++) {
 
            i = RS_Index12;
 
            "225";
 
            if (cnts[(typeof i === "number" && i["<"](0)) ? cnts.length["+"](i) : i][">"](0)) {
 
                "226";
 
                MFP=MFP["+"](gmfp[(typeof i === "number" && i["<"](0)) ? gmfp.length["+"](i) : i]["/"](cnts[(typeof i === "number" && i["<"](0)) ? cnts.length["+"](i) : i]));
 
                "227";
 
                Zco=Zco["+"](cnts[(typeof i === "number" && i["<"](0)) ? cnts.length["+"](i) : i]["/"](gti[(typeof i === "number" && i["<"](0)) ? gti.length["+"](i) : i]));
 
            }
 
        }
 
        "229";
 
        z0 = Natoms["/"](V)["*"](sigma)["*"](sqrt(2))["*"](sqrt(8["*"](k)["*"](T)["/"](pi)["/"](mass)));
 
        "230";
 
        if ((nsteps === 0 || typeof nsteps === "object" && RS_equals(nsteps, 0))) {
 
            print("    Time    Coll. freq. Mean free path");
 
        }
 
        "231";
 
        if (RS_equals(nsteps["%"](500), 0)) {
 
            print(t, ncoll["/"](t)["/"](Natoms)["*"](2), z0, MFP["/"](Natoms), gmfp0);
 
        }
 
        "233";
 
        for (var RS_Index13 = 0; RS_Index13["<"](Natoms); RS_Index13++) {
 
            i = RS_Index13;
 
            "234";
 
            loc = apos[(typeof i === "number" && i["<"](0)) ? apos.length["+"](i) : i];
 
            "235";
 
            if (abs(loc.x)[">"](L["/"](2))) {
 
                "236";
 
                if (loc.x["<"](0)) {
 
                    p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].x = abs(p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].x);
 
                } else {
 
                    p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].x = abs(p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].x)["-u"]();
 
                }
 
                "239";
 
            }
 
            if (abs(loc.y)[">"](L["/"](2))) {
 
                "240";
 
                if (loc.y["<"](0)) {
 
                    p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].y = abs(p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].y);
 
                } else {
 
                    p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].y = abs(p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].y)["-u"]();
 
                }
 
                "243";
 
            }
 
            if (abs(loc.z)[">"](L["/"](2))) {
 
                "244";
 
                if (loc.z["<"](0)) {
 
                    p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].z = abs(p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].z);
 
                } else {
 
                    p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].z = abs(p[(typeof i === "number" && i["<"](0)) ? p.length["+"](i) : i].z)["-u"]();
 
                }
 
            }
 
        }
 
    }
 
};
 
if (!__main__.__module__) Object.defineProperties(__main__, {
 
    __module__ : {value: null}
 
});
 
 
;$(function(){ window.__context = { glowscript_container: $("#glowscript").removeAttr("id") }; __main__() })})()
 
// END JAVASCRIPT
 
 
//--><!]]></script>
 
</div>
 
 
</body>
 
</html>
 

Latest revision as of 09:23, 29 May 2023

Here you will find useful jupyter notebooks on this subject.

You can run the notebooks at the following URLs:

Jupyter Notebook