New answers tagged

2

Disclaimer: I wrote this answer in a rush, may not be up to the standards. Also, I don't have enough information about your problem to give more detailed advice. However, the information presented here should be enough to get you going. I will suggest you to use MINRES with an appropriate preconditioner. For a moment, let's assume that this is not a twofold ...


4

For both schemes: I am going to lump $B$ and $C$ into a single matrix $B$ for convenience of communicating the idea. Likewise, $y$ and $z$ are now $y$, and $F_y$ and $F_z$ are $F_y$. $Ax+B^Ty=F_x$ or $x = A^{-1}(F_x-B^Ty)$ $Bx=F_y$ or $BA^{-1}(F_x-B^Ty)=F_y$ $BA^{-1}B^Ty=BA^{-1}F_x-F_y$ Note that $BA^{-1}B^T$ is symmetric and invertible, and can be ...


2

All-over this is a nicely structured code. The main problems are related to the Runge-Kutta solvers, where the first-order system was not uniformly applied to the computation. What is obviously wrong can be found in the first lines of the solver file def rk2_derivatives(edo, qk, pk, dt, bodies): k1 = dt * edo(qk, pk, bodies) k2 = dt * edo(qk + (dt * k1), ...


3

Using the typical expansion functions (1-forms/edge-elements for E, and 2-forms/facet-elements for B) the formulations are basically the same after spatial discretization and you'd expect more or less the same accuracy. I do think they express slightly different opinions about time integration. The mixed E/B formulation nudges you in the direction of ...


1

Here is a commonly used alternative: Let's assume that your probability density $f(x,y,v_x,v_y)$ lives in a domain $\Omega$ that is bounded and that you can subdivide into "cells" $\Omega_i$. In one of the comments, you mention that $\Omega$ is simply a 4-dimensional box, and then the $\Omega_i$ could simply be subdivision into a regular mesh ...


2

Simply redoing my earlier comment with a bit more space ... Depending on the particulars, a simple acceptance-rejection method might be a good place to start. Suppose you know $f$ never gets bigger than $f_{\text{max}}$. Generate $X$ uniformly between $x_{\text{min}}$ and $x_{\text{max}}$, then similarly $Y$ from between $y_{\text{min}}$ and $y_{\text{max}}$ ...


Top 50 recent answers are included