使用Scipy.integrate.odeint集成矢量场线

时间:2017-10-25 14:06:22

标签: python python-3.x math matplotlib plot

我正在绘制磁场分量Bx和Bz作为X和Z的函数。我的主要目标是获得与我给出的任何X点相交的点(X,0)的流线。我正在使用integrate.odint来绘制流线。流线仅出现在Z的负值上,不会继续向上(参见附图)。 对于Z = 0的给定交叉,我如何得到全磁场线(Z> 0和Z <0)?也许我应该做一个向后整合? 这是我写的代码:

db.products.aggregate([
    {
        $unwind: {
            "path": "$prices"
        }
    },
    {
        $lookup: {
            "from": "locations",
            "localField": "prices.sublocationid",
            "foreignField": "sublocations._id",
            "as": "locations"
        }
    },
    {
        $unwind: {
            "path": "$locations"
        }
    },
    {
        $unwind: {
            "path": "$locations.sublocations"
        }
    },
    {
        $addFields: {
            "keep": {
                "$eq": [
                    "$prices.sublocationid",
                    "$locations.sublocations._id"
                ]
            }
        }
    },
    {
        $match: {
            "keep": true
        }
    },
    {
        $addFields: {
            "price": {
                "_id": "$prices._id",
                "sublocationid": "$prices.sublocationid",
                "sublocation": "$locations.sublocations.sublocation",
                "price": "$prices.price"
            }
        }
    },
    {
        $group: {
            "_id": "$_id",
            "product": { "$first": "$product" },
            "prices": { "$addToSet": "$price" }
        }
    }
]);

以下是我获得的结果:

https://i.stack.imgur.com/ckPaY.png

0 个答案:

没有答案