instruction
stringlengths
43
28.1k
Given that some of the mass lumping techniques, for example, row-sum lumping does not produce practically viable lumped mass matrices for all the element shapes, what are the techniques used for mass lumping for higher-order elements? I am particularly interested in applications in CFD. I know that deal.ii has a tutori...
I'm trying to integrate the following SDE system from Dekker et al. [1] $$\begin{cases} \frac{dx}{dt}=a_1x^3+a_2x+\phi+\zeta_x\\ \frac{dy}{dt}=b_1z+b_2(\kappa(x)-(y^2+z^2))y+\zeta_y\\ \frac{dz}{dt}=c_1y+b_2(\kappa(x)-(y^2+z^2))z+\zeta_z \end{cases} $$ To do that I'm using the Euler-Maruyama method which is basically a ...
I'm having a problem with sensitivity to initial conditions in an MINLP problem with Gekko. My test case is finding $a$ and $b$ such that $\pi^a/b = \pi^2/6$. So the solution is $a=2$ and $b=6$. I set the initial values of $a$ and $b$ to $a0$ and $b0$ in the code. But i get different solutions depending on what these i...
I am figuring out how to attack a problem (the Usadel equations of superconductivity) in which I need to solve a set of nonlinear PDEs for the fields $\{G_i (r)\}$ $$ U(G_i(r), \nabla G_i(r), \Delta(r) ) = 0\,, $$ together with a (nonlinear, algebraic) self-consistency condition $$V({G_i (r)}, \Delta(r) ) = 0\,.$$ The ...
Some equations (such as the non-linear schrödinger equation for pulse propagation) are more easily solved in the spectral form, but still need a representation in the temporal domain to calculate physical parameters such as the energy of the electric field. This results usually in the following steps (with $E$ the elec...
I used to be more of a numerical linear algebra and computational science person, but recently, I've crossed into stats and machine learning. For this discussion, let's focus on matrices that are not theoretically singular, but "numerically singular," which is what I typically use to describe high condition number syst...
whenever I read papers on OR that use an LP/MIP approach, they include the time solver used, as well as the version and the year. I would like to know how much faster the same experiment would be nowadays with the current advances in both hardware and software (solvers). So for example, if an experiment was done on CPL...
Given with a generalization using adaptive times-stepping as then is it still reasonable to assume that to ensure stability of the Euler’s forward method we need the growth factor for all n to be obey
So, I have written both a C and python code to solve the 2D Cahn-Hilliard equation: \begin{equation} \frac{\partial c}{\partial t} = \nabla^2\left(c^3 - c - \kappa\nabla^2c\right) \end{equation} Taking its Fourier transform yields the following ODE: \begin{equation} \frac{\partial \hat c}{\partial t} = \underbrace{-k^2...
Im trying to solve the 1d Wave Equation on $x \in \mathbb{R}, t > 0$: $$u_{tt} = c^2u_{xx}, \hspace{5mm} u(x,0) = \cos(4 \pi x), \hspace{5mm} u_t(x,0) = 0$$ with $c = 1$ and a periodic boundary condition $$u(x,t) = u(x+1,t)$$ Im using central difference in time and space: $$\frac{u_j^{n+1} - 2u_j^n + u_j^{n-1}}{k^2} = ...
$$ ||I- H_{k}^{BFGS}\nabla^{2}f(x_{k})||_{2}$$ , where $H_{k}$ is the inverse of hessian approximation at each iteration. I am given this expression to assess the error in Hessian approximation in BFGS method. I know that if the approximation of Hessian converged to the actual Hessian, then the second term would be equ...
Suppose that we are given a time-independent quantum mechanical system whose wavefunction depends on three space coordinates. Let $F$ be the Fock operator of the system. Suppose also that we have a set of functions $f_k : \mathbb{R}^3 \to \mathbb{C}$, $k \in \mathbb{N}$, so that $$\mathrm{clos} \;\mathrm{span} \{f_k : ...
I want to solve the system of Schrodinger-Poisson equations numerically: \begin{align} \chi_1''(r) + \frac{2}{r}\chi_1'(r)&=2U(r)\chi_1(r) \\ \chi_2''(r) + \frac{2}{r}\chi_2'(r)&=2\left(\frac{m_2}{m_1}\right)^2U(r)\chi_2(r) \\ U''(r)+ \frac{2}{r}U'(r) &= \chi_1^2(r) + \left(\frac{m_2}{m_1}\right)^2 \ch...
My question relates to looping in Python. I have an original $6$-sized vector, $F(n,t=0)=[1,0,0,0,0,0]$ Hence, the $n$-values range from $0 \rightarrow 5$. This output for the original vector is just a series of values such as $F(0,0)=1, F(1,0) = 0$ , $F(2,0) = 0 $ etc... This relates to a formula: $$F(n,t+1) = -(l+(kn...
I'm calculating basically a multidimensional random walk problem. To get more accuracy, I need larger systems (more dimensions), which requires longer time. To speed up the calculation, I'm delving into parallel computing for the first time. I call the fortran random number generator frequently. It occurred to me...
Background I am working with chapter 2 in LeVeque's book: https://faculty.washington.edu/rjl/fdmbook/ I have build my own solver in Python to solve the 2 point BVP: $$ \epsilon u''+u(u'-1) =0 , \\ u(0)=\alpha, u(1)= \beta $$ I have followed the axact steps as described by the answer by VoB in this post: Non-linear Boun...
Is there a way to have an estimate of the error propagated on an ode numerical solution by the error of the initial conditions? I suppose this depend on the numerical method used and on the problem features, but is there some theorem or general treatment that could be adapted to the problem and the method used?
Are there some programs with packages that help to list all zero-divisors of the ring we desired? especially for the ring of Gaussian integers modulo $n$, $\mathbb{z}_n[i]$. Also want to find which of the product of ring elements will result in 0. I wish to get the details if any. I am new to programming languages, thi...
Im trying to solve the following 2D wave equation: $$u_{tt} = u_{xx} + u_{yy}, \hspace{3mm} u(x,y,0) = \cos(4 \pi x) \sin(4 \pi y), \hspace{3mm} u_t(x,y,0) = 0$$ with the periodic boundary condition in both spatial directions $$u(x+1,y,t) = u(x,y,t), \hspace{3mm} u(x,y+1,t) = u(x,y,t)$$ which has analytical solution $$...
Background We know a function $f$ on the vertices of a regular hexagon, as follows $$\left( 1, \ 0, \ f_{0}\right), \ \left( \frac{1}{2}, \ \frac{\sqrt{3}}{2}, \ f_{1}\right), \ \left( - \frac{1}{2}, \ \frac{\sqrt{3}}{2}, \ f_{2}\right), \ \left( -1, \ 0, \ f_{3}\right), \ \left( - \frac{1}{2}, \ - \frac{\...
given the following ODE: $$\frac{d^{4}w}{dx^{4}} + B\frac{d^{2}w}{dx^{2}} = 1$$ with boundary conditions $w(0) =0 , w(1) = 0,w'(0) = 0,w'(1) = 0$ its possible to solve analytically but I am attempting to solve it numerically so I can plot and see how the graph changes as I vary the parameter $B$. in order to solve it n...
I'm trying to estimate the percentage error in computing the integral of a Gaussian via composite trapezoidal rule versus via an exact formula. To do this I've generated a gaussian with mean 0, standard deviation $\sigma = 1$ and amplitude $A = 1$ in Python (plotted below), on a grid of $N$ points in the range $[-2\sig...
I am studying the proof of the Arc Length method in section 2.2 of this thesis. In equation (2.2) the author introduces the supplementary conditions $$ (\Delta {\bf u} + \delta {\bf u})^T \cdot (\Delta {\bf u} + \delta {\bf u}) + \psi^2(\Delta \lambda + \delta \lambda)^2 \cdot ({\bf q}^T \cdot {\bf q}) = \Delta L^2 $$ ...
Let's suppose I need to numerically solve a 3D steady-state transport equation of the form $$ \nabla \cdot (\mathbf{u} c) = \nabla \cdot (D \nabla c) - \lambda c + S $$ where $c$ is the transported quantity, $\mathbf{u}$ is a velocity field, $D$ is the diffusivity (optionally varying with position), $\lambda$ is a unif...
I am solving a parabolic equation in the form: $$ \left( {M \over\tau_j} + A \right) u^{j+1} = M f^j + {u^j \over \tau_j}, $$ where $A$ and $f$ are a dense stiffness matrix and the right hand side of the fractional diffusion problem from this paper: [Acosta, Gabriel & Bersetche, Francisco & Borthagaray, Juan. (2017). A...
I am looking for help to find a somewhat stable FD numerical scheme for the advection diffusion equation posed on a curve $(x(r),y(r))$. The equation becomes $$u_t=\alpha(r) u_r +\beta(r) u_{rr}+f(r,t),$$ where $\alpha(r)= \phi(r)\phi'(r)+\phi(r) $, $\beta(r)=\phi(r)\phi(r)$, and $\phi(r)=\frac{1}{\sqrt{x'(r)^2+y'(r)^2...
What available solvers are there for linear equation solver over GF(2) (Boolean), capable of dealing with large sparse systems (in the 10k - 100k variables range)?
I've been trying to estimate the two-parameter (a,b) Weibull distribution (loc. param. = 0). $$f(t;a,b)=\frac{b}{a}\left(\frac{t}{a}\right)^{b-1}\exp(- \left(\frac{t}{a}\right)^b) $$ To find the estimates I am using maximum likelihood and NR method. t = np.array(list(range(1, 1000))) #data input def gradient(a,b): ...
Assume solving the linear system $A \textbf x = \textbf b$, with an $A$ so large that nothing but iterative methods may be employed. Assuming $A$ induces a norm, I realized that it is often desired to minimize the residual in the norm induced by $A$ (and not, for instance, 2-norm). Why is that the case? What is the adv...
I'm trying to understand the Convergence of the mean part of the Step-3 tutorial in deal.II. The authors say that $\frac{1}{|\Omega|}\int_{\Omega} u_h(x)dx$ converges with $\mathcal{O}(h^2)$, but I really can't understand the following sentence: "Again, the difference between two adjacent values goes down by about a fa...
I am having a problem that was also mentioned at the accepted answer to this question by Wolfgang Bangerth. I need to calculate, as it was specified at the question at the link, F1 integral and for that I need to calculate u1 at gauss points of the new mesh but with a certain accuracy so I do not loose overall converge...
I'm looking at solving systems with the FEM discretization $$ -\int_\Omega (\Delta u) v = \int_\Omega \nabla u \cdot \nabla v - \int_\Gamma (n\cdot\nabla u) v. $$ without applying Dirichlet- or Neumann-type boundary conditions. The resulting matrix is generally not self-adjoint (except in for 1D meshes). The kernel con...
Using FEM, I want to approximate the Laplacian $$u = \nabla \cdot \nabla h \, ,$$ where $h(x,y)$ is an FEM approximated scalar field on the same mesh, i.e. piecewise differentiable. I am using MOOSE to solve the following (hopefully correct!) weak formulation of the above equation: $$\int_\Omega uw_i \, \text{d}\Omega ...
I'm trying to write an integrator for the 2 and 3-body problem. I choose to start from a generalisation to N-body problem so I can just pass my bodies to the same integrator in the two cases. I'm using Hamiltonian mechanincs, the Hamiltonian I get for the N-body problem is the following, $$ \mathcal{H} = \sum_{i=1}^N \...
I am recently working on the code based on the stick-slip phenomenon in Python. It's the stick-slip oscillator (chapter 3.4) in https://www.sciencedirect.com/science/article/pii/S0888327020301205. And my aim is to achieve the plot as in the Fig. 9. The problem is that after some calculations I keep getting the followin...
I am interested in solving many linear systems $Ax = b$, where $A$ is symmetric positive definite and small (i.e. less than 25,000 rows) --- $b$ will be changing. We can assume that $A$ arises from the FEM discretization of the elasticity equation in 3D on an unstructured mesh for an arbitrarily-shaped domain. I am loo...
I am currently trying to understand what WENO schemes are and most of the literature on web talks about cell-face reconstruction. What I am unable to understand is the origin of these discontinuities at the cell-faces. Can anyone explain where exactly does a WENO scheme come into picture and why is it used?
I am trying to solve the ODE : $\frac{d^2T}{dx^2} = \omega_1 T+\omega_2 T^2$ + using different numerical methods. I have tried the following discretizations so far and none of them seem to be grid independent: Finite Difference Method $\frac{T_{i+1}^k + T_{i-1}^k - 2T_i^{k+1}}{\Delta x^2} = \omega_1(T_i^2)^k+\omega_2T_...
I am writing a project about the Finite element method for use in high-frequency solutions of Maxwell's equations. This could be for use in antenna design and similar. I have some trouble understanding how to choose the form of the maxwells equation to solve. It seems that for high-frequency problems people use the sec...
Briefly stated, I would like to find "all" local minima / critical points of a function. This function comes from the discretization of a continuous problem with infinitely many degrees of freedom (dofs), but after discretization, there remains actually rather "few" dofs. Let's say, n_dof ~ 1000 - 10k. This function (l...
I am interested in knowing some efficient techniques for solving the following extended Saddle point problem. \begin{align} \begin{bmatrix} A & B^T & C^T \\ B & 0 & 0 \\ C & 0 & 0 \\ \end{bmatrix} \begin{Bmatrix} x \\ y \\ z \\ \end{Bmatrix} = \begin{Bmatrix} F_x \\ F_y \\ F_z \\ \end{Bmatrix} \end{align} x is...
In the mathematical field of linear algebra and convex analysis, the numerical range or field of values of a complex $n\times n$ matrix $A$ is the set $$W(A)=\left\{{\frac {{\mathbf {x}}^{*}A{\mathbf {x}}}{{\mathbf {x}}^{*}{\mathbf {x}}}}\mid {\mathbf {x}}\in {\mathbb {C}}^{n},\ x\not =0\right\}$$ where $\mathbf...
I have a system of non linear differential equations in the form : $$\frac{dy_i}{dt}=\sum_j a_{ij} y_i y_j $$. I first tried to solve it with Python suing scipy.integrate.odeint but it is very slow. I'd like to solve it with an Euler method : $$y_i(t+\delta t)=y_i(t)+\frac{dy_i}{dt}\delta t $$. How should I chose the v...
I am working on a non-linear least squares problem with standard form, in which I need to calibrate a parameter vector $\Theta$ to a set of inputs $\mathbf{x}$ and outputs $\mathbf{y}$: $$\begin{align} & \min_\Theta ||R(\mathbf{x},\mathbf{y};\Theta)||_2^2 \\[4pt] &\quad \text{st: } R(\mathbf{x},\mathbf{y};\Theta):=\mat...
I'm trying to plot the solution of a numerical method using a vtk file in paraview. The structure is very simple, and I going to explain with an example. I have a mesh of the unit square [0,1]x[0,1] consisting on 4 squares (CELLS) of equal dimensions, and then this mesh has 9 POINTS. I have a constant solution on each ...
I have the velocity (vector) and pressure (scalar). This solution is constant in each CELL (square) of the mesh. I don't know why does not appear the pressure information when I open the file in paraview. I write an example of a mesh of the unit square [0,1]x[0,1] consisting on 4 squares (CELLS) of equal dimensions, an...
The idea of the method is to decompose the Navier-Stokes equation into the solenoidal and irrotational parts. $$\frac{\partial u}{\partial t}+u(\nabla \cdot u)=-\frac{1}{\rho}\nabla p+\nabla ^2 u$$ Discretizing the transient term and initializing the intermediate velocity $u^*$. $$\frac{(u^{n+1}-u^*) + (u^*-u^n)}{\Delt...
I've seen two different optimizers being used, but both with a different solver. One uses PULP_CBC_CMD and the other uses GLPKSolverMIP() can someone explain to me the difference in these two optimization strategies? Both of these optimizers are using to optimize daily fantasy sports lineups. It's basically a knapsack ...
I need to simulate a network of nodes. The weights of the edges are being given in a matrix . Due to the non-zero distances between the nodes, we consider time-delays, which are computed given the distances and an arbitrary velocity. The delay values have already been calculated. Given that $A$ is symmetric, for a $n$...
I was reasoning about the behaviour of the methods I'm using for my simulation and I noticed that, considering $h_s$ as the timestep over which I have unstable solutions and $h_a$ as the timestep where I start to have the expected accuracy, there's an interval of timesteps $h_a < h < h_s$ for which I don't have the exp...
Two random variables $X$ and $Y$ are distributed according to \begin{align} f_{XY}(x,y)= \begin{cases} x+y & 0\leq x \leq 1, 0\leq y \leq 1 \\ 0 & otherwise \end{cases} \end{align} I want to generate rvs of the given function using python. Is there any way to do it ?
Apologies if this is a trivial question. If that is the case I imagine I would benefit from someone explaining where my understanding is lacking. I am having some trouble interpreting the (putatively optimal) spherical codes listed on the website of N. Sloane here. For example, the first coordinate for the best known s...
I am trying to write an if statement that checks if 2 numbers are divisible before running some commands. The problem is, the rem function is giving some wrong results for certain number (2 is definitely divisible by 0.5, 0.4, 0.2 and 0.1 but the function says otherwise). A reproduction of the error is posted below t=2...
I am trying to get the structured mesh as shown in the figure. I have used the transfinite surface and curve to achieve the same. Though I get the structured mesh but I do not know how to do for body-of-revolution elements. May I ask, How to generate structured mesh for body-of-revolution elements using gmsh?
I have written a Matlab code to solve the equation $-u'' = f$ with conditions $u(0) = u'(1) = 0$ on the domain $x \in [0,1]$. I tested the code with $f(x) = -2, \forall x\in [0,1]$. I check the plot with one of element $n=8$, and the result $u = u^{h}$ agrees: However, I am testing the convergence error $L_{2}$ for th...
A spherical code, specified by the parameters $(n,N,t)$, is a set of $N$ coordinates on the $n$-dimensional unit hypersphere such that the set of dot products between any two unit vectors from the origin is larger than or equal to $t$. What algorithms can be used to generate candidate spherical codes? So far my google ...
Im working in comsol and needed help figuring out the objective function for the following situation (Comsol does have multiple objective function option as min max or sum of) I have 7 batteries connected in parallel all at the same voltage discharging. I need the current from each as uniform as possible with the maxim...
I was looking for the fastest converging method to integrate a family of functions. After some tries, an old-school colleague suggested me a method that he used to use in excel to perform such task. It relies on a simple procedure: sample the function at log-spaced sample such that $x_i = x_0 \alpha^i$ for $i=0...N$ c...
I wrote a program which iteratively transforms data using matrix multiplications. To minimize the number of large memory allocations, I use two roughly equal-sized std::vector<double>'s data and temp_data to store the current data and the new data respectively. For the matrix operations, I wrap each buffer into an Eige...
I am working on 1-D mass transient diffusion in a radial domain (spherical object) using finite volume method. My equation reads $$\frac{\partial C}{\partial t} = D\left[\frac{\partial^2 C}{\partial r^2} + \frac{2}{r}\frac{\partial C}{\partial r}\right]\, .$$ In a sense of conservative mass within the the radial domain...
I am playing with Galerkin Least-Squares stabilization to solve advection diffusion problem in the context of the finite element method. This works very well for steady-state advection-diffusion equation, even in the High Péclet limit, when the problems are solved in the steady state. The equation we solve is : $$\frac...
There are many rows of data in a database table, each of which contains many columns. ID (numeric - 12345, 12378, etc) Name 1 - AAA,BBB,CCC Name 2 - dd, ee, ff Name 3 - Ggg, Hhh, Iii The objective is to come up with rules based on a combination of these values to map to a set of groups. Group ID 1 - 1,000 There ...
I am trying to find the top k leading eigenvalues of a NumPy matrix (using python dot product notation) L@L + a*X@X.T, where $L$ and $X$ are a symmetric $n \times n$ and an $n \times d$ matrix, respectively, and $a$ is a scalar. According to the below text from this paper, I should be able to calculate these leading ei...
In this article: https://www.geometrictools.com/Documentation/IntersectionOfCylinders.pdf the writer says: "If you plan on using cylinders for bounding volumes in a real-time graphics engine—think twice. A better alternative to a cylinder is a capsule." Well, I am planning on bounding surfaces with cylinders (actaully ...
Normally, this boards sees a lot of traffic about the most efficient and most powerful solvers for huge linear equation systems. But this time, I have the opposite problem: I need to implement a solver for a linear equation system in a very limited programming system that offers only basic array functionality and no li...
Im trying to solve the Poisson equation in 1D: $$-u_{xx} = f(x), \hspace{6mm} u(a) = d1, \hspace{2mm} u(b) = d2$$Assuming a uniform partition such that $x_n = a + nh$, where $h = (b-a)/N$ and $n \in [0,N]$, and then discretising the problem with linear finite elements to obtain a linear equation system $\mathbf{A u} =...
I am analyzing the stability of 1D convection (advection) equation as shown in the picture. When I derive the equations as shown I want to get rid of the complex number. I`m asking if those stability plots make sense or not I want to get rid of a complex number
I have a scipy.sparse.linalg.LinearOperator object. I'd like to check if its associated matrix is symmetric without actually instantiating the matrix in the most computationally efficient way possible. Does anybody know a good way to do this?
I'm studying the dealii tutorial number 4,5 and I understand the workflow. I've also been able to find the EOC by using manufactured solution where $f$ is a smooth r.h.s. and $\alpha(x)$ smooth too. Now I'm interested in checking the EOC when $\alpha(x)$ is discontinuous (link to Doxygen docs of dealii) Let's say I hav...
I want an element as the one shown following. Nodes 6 and 8 are in the quarter position. Whether eight node quadrilateral element or six node triangle function can be used directly? If not, how to build a new shape function?
Can you please suggest a tool (software or online tool) that can analyze a submarine hull shape and give the total drag at a specific velocity. A simplified tool would work too, where I select a general geometry, then input the dimensions and speed, and get the drag force. I'm reading Submarine Hydrodynamics by Martin ...
Are there iterative methods for the solution of nonsymmetric linear systems $Ax=b$ that can take (theoretical or practical) advantage from knowing that $A+A^T$ is positive definite? These matrices are always nonsingular, but does this help the solution process, at least for some methods?
Question Is there any estimate for the scaling of the number of function calls in BFGS-optimization with the dimensionality of the search space? Specifically I am assuming a (free) expression for the gradient is supplied by the user so that no function calls are made in its evaluation. Note the gradient is only availab...
Consider the problem $$ \left\{\begin{array} {rcl} -\Delta u & = 0 & \text{ in } \Omega \\ u & = 0 & \text{ on } \Gamma_D \\ \frac{\partial u}{\partial n} &= g &\text{ on } \Gamma_R \\ \frac{\partial u}{\partial n} &= 0 &\text{ on } \Gamma_N \end{array}\right. $$ Where $g$ is a trace of a $H^{1+\varepsilon}(\Omega)...
We are currently in the process of implementing ports in our EM FEM simulation SW. We have come across the definition of boundary conditions for the ports, and we do not understand the equation for the boundary. In the book “The Finite Element Method in Electromagnetics” they start from the understandable idea of it be...
We know in Strang splitting that the splitting error in the steady state solution is proportional to $h^2$. I want ask 2 things: If this error in the steady state solution is the global error? If we are in in a previous step before the steady state solution for example $t=0.3$ sec (with $t_{total}=1$ sec) will be the s...
Suppose I know a function $f(t)$ and all its derivatives in $t$ in closed form. Given $a(0)$ and some $t_0>0$, I'm looking for an explicit integrator that can estimate $a(t_0)$, where $a(\cdot)$ satisfies the ODE: $$\frac{da(t)}{dt}=e^{-a(t)}f(t).$$ I'm willing to compute (in closed-form) any derivatives $f^{(k)}(t)$ ...
Are there any optimization algorithms aimed at finding a coinciding root and a (local) minimum of a multi-variable function f. Say it is known analytically that these should coincide for the function. I am interested in any such algorithm but more specifically for the case where f is continuous, at least twice differe...
$\frac{\partial C}{\partial t} + u \frac{\partial C}{\partial x} + w \frac{\partial C}{\partial x} = D \left(\frac{\partial^2C}{\partial x^2}+\frac{\partial^2C}{\partial y^2}\right)-C \cdot \left(\frac{\partial u}{\partial x}+\frac{\partial w}{\partial z}\right)$ How to avoid the negative concentration using FDM scheme...
I write to you all today in order to clarify if I implemented my model correctly into MATLAB. I will outline the following: analytical governing equations, my discretization for the equations and boundary conditions, and outline the implementation into ode15s. Ultimately, my problem with implementation is that steady-s...
I've noticed that some heuristics for it on my problem which work surprisingly well. I guess it ought to be systematically studied although I cannot find guides or overviews for it.
I have a bunch of ODEs I am trying to solve using ode45 in MATLAB. I have hidden the details of the equations to keep it simple (so as to build a general algorithm)! \[\frac{dR}{dt}= F_{1}(R,N) \quad\text{........................(Eq.1)}\] \[\frac{dN_{1}}{dt}= F_{2}(t) \quad\text{.............................(Eq.2)}\] ...
Crank Nicholson is a time discretization method (see 4th equation here). From what I see around, you can use different space discretization, such as Finite elements. But for the linear advection-diffusion equation, I see on books the von Neumann stability proof only when second-order centered spatial finite differences...
The Eigen::Map documentation here (https://eigen.tuxfamily.org/dox/classEigen_1_1Map.html) mentions the following: This class represents a matrix or vector expression mapping an existing array of data. It can be used to let Eigen interface without any overhead with non-Eigen data structures, such as plain C arrays or s...
I`m Analyzing the 1D convection equation (PDE) for stability, consistency, and accuracy. I know Both upwind schemes (explicit and implicit) show better stability with a higher number of waves for courant number less than one. The upwind scheme, in general, overcomes the problem of stability in the centered difference s...
When calling a kernel function, the number of threads per block should ideally be a multiple of the warp size. This yields more efficient use of resources and lower processing times. However, there seems to be another factor that periodically decreases the processing time. Shown below, the processing time gets offset e...
The Numerical Recipes Forum http://numerical.recipes/forum/ is closed, so I will record a tiny typo here for the benefit of others who may wonder about this. (This typo is not in the software, but only in the text, and is currently in the online version of the textbook at http://numerical.recipes/book): In Eq. 9.4.6 (...
I have implemented the heat method for geodesics: https://www.cs.cmu.edu/~kmcrane/Projects/HeatMethod/paperCACM.pdf When I run it I am getting a solution that, visually, seems correct: In this image, the arrows are the negated gradient, and the color is the distance, meaning that as a point's color goes towards white ...
The following question is about the implementation of molecular dynamics simulations with neighbor lists. In cases where the paths of individual particles are (i) stochastic and (ii) somewhat rough, without well-defined velocities, it seems reasonable (for performance' sake) to maintain neighbor lists in a way that ma...
In my C++ code, I need to evaluate the confluent hypergeometric function ${}_1F_1(a,b;z)$ with complex arguments in a special case. More precisely, I have to compute $$ e^{-i\phi}{}_1F_1(\ell+1+iZ,2(\ell+1),2i\phi)\, , $$ where $Z,\phi$ are real parameters and $\ell\geq 0$ is an integer. I know that this expression is ...
I have a rectangular matrix $A \in \mathbb{R}^{m \times n}$ import numpy as np import matplotlib.pyplot as plt from scipy.linalg import svdvals ,schur A = np.array([[0, 2, 2,4], [0, 1, 2,4], [1, 0, 1,4], [0, 2, 2,4], [0, 1, 2,4], [1, 0, 1,4], ...
I noticed that in most theoretic literature (Braess, Ciarlet, ...) for Finite Elements, the method is only described in a detailed way for simplex triangulations, while other forms of hexahedral methods are often omitted or only briefly mentioned. Is there any theoretical differerence between FEM theory of simplices an...
I am trying to model a 1-d advection-convection numerically, using an upwind scheme. I'm using the following equation to calculate the value of internal cells: $$C_x^{t+1} = C_x^{t} + D\frac{\Delta t}{\Delta x^2} ( C_{x-1}^t-2 C_{x}^t+C_{x+1}^t) + u\frac{\Delta t}{\Delta x}(C_{x+1}^t-C_{x}^t)$$ and I'm using the Robin ...
For the first-order explicit upwind scheme, it can be easily shown that, if one keeps the same grid size and progressively decreases the time step below the max allowed one (i.e. below CFL~1) the numerical diffusion increases with $(1-CFL$), see eq. 11.11 here). If I recall correctly, the same is also true for centered...
I have tried to solve the driven cavity problem with incompressible Stokes flow using the standard Crouzeix-Raviart non-conforming P1/P0 element (linear velocity, constant pressure, velocity-nodes at the midpoint of the edges). The velocity $u = (u_1 \; u_2) = (1 \; 0)$ on the top side of the domain and zero on the oth...
This is a belated follow up to my question here, because I didn't want to tack questions onto questions. According to the Mosek documentation here, one possibility for expressing $t \leq log(det(X))$, where $X$ is a symmetric positive semidefinite matrix variable to be optimized, as a semidefinite programming constrain...
I have two black boxes (representing some multi-physics but that does not matter), where box #1 takes some quantity T as input and produces some quantity P as output; and box #2 takes P as input and produces T as output. Suppose there is a steady-state equilibrium point $P_0,T_0$, and I can study the linear response fo...
When we work in numerical analysis, when the matrix is too big the computer runs out of memory (i guess it's ram memory). But how much space does a matrix of numbers (integer, single, double) use? I would like to know this to be able to determine how large the matrices can I compute in my laptop.
I am trying to do eigenvalue decomposition for a huge matrix larger than 788000×788000 for medical image analysis. The matrix is not sparse and every element in the matrix has a real value. And, for example, I want to obtain the first 20 largest eigenvalues and their 20 corresponding eigenvectors. The computer is not a...
I have to solve the equality between 2 matrixes 12x12 containing a lot of symbolic variables and with which I perform inversion of matrix. There is only one unknown called "SIGMA_O". My system is solved fastly when I take for example 2 matrices 2x2, the inversion is pretty direct. Now, with the case of 2 matrixes 12x12...