instruction
stringlengths
43
28.1k
I would like to calculate the Adjugate matrix of a given matrix $A$, and its updates in the diagonal: $B=A-\lambda I$, where $I$ is the identity matrix, $\lambda$ is a scalar. To this end, I am using the algorithm explained here, using a decomposition $A=XDY$. Unfortunately, the matrix $A$ or $B$ could be singular. Is ...
I want to detect chords on a guitar as early as possible, but my approach with a sliding window and a filter bank seems to introduce too much lag. Would required observation time decrease by using a model where there are only a finite number of tones possible and only a finite number of simultaneous tones? (I.e. the di...
I need to have a sparse matrix whose elements are not simple numbers, but objects, e.g. a couple of floating point values and a bunch of integer indices. I am wondering if Eigen has something similar, beyond its Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex > class template (the only sparse matrix I have found ...
Are there interesting examples of (systems) of equations where it is known to be harder to find a solution (in terms of scaling with respect to problem size) than verifying a provided solution for correctness? A non-expert may find it surprising that Stein, Riccati, Sylvester matrix equations with $d\times d$ matrices ...
Thanks for note! So I have an optimization problem with simple form but the decision variable is a large-scale matrix. My problem is similar to a existing problem here about multinomial manifolds and my objective function is simpler than the counterpart in that problem. The decision variable $\mathbf T \in {\bf R}^{130...
In a machine learning code, that computes optimum parameters $\theta _{MLE}$ of a linear regression model, by maximum likelihood estimation: $$ \boldsymbol \theta^\text{ML} = (\boldsymbol\Phi^T\boldsymbol\Phi )^{-1}\boldsymbol\Phi^T\boldsymbol y $$ Where $y$ is the target vector and $\Phi$ is the polynomial feature mat...
I write the following fast Fourier transform code into my Python notebook expecting to see a plot wherein there's a spike at $1/2\pi$ since that's the frequency of the sin function, but instead I get the plot below. Any ideas as to what's going on? import math import matplotlib.pyplot as plt import numpy as np from sci...
I want to study the dynamics of a 2d linear flow, whose dynamical equation is- $\begin{pmatrix} \dot{x_1}\\ \dot{x_2}\\ \end{pmatrix}=\begin{pmatrix} 1 & 1\\ 4 & -2\\ \end{pmatrix}\begin{pmatrix} x_1\\ x_2\\ \end{pmatrix}$. Now I have tried to solve and plot y vs. x of this coupled differential equation using RK4 in py...
Say I have a directed graph given as an adjacency matrix $A$ in CSR format represented by the arrays ia (row indexes) and ja (column indexes). In my application the graph serves as the underlying spatial connectivity for an RBF-FD discretization of a PDE. The graph originates from finding the $N$-nearest neighbor stenc...
I need to solve the following equation for $x$ in [0, 1]. Assume $0<\alpha<1$ and $0<\lambda$. $$(1 - x)^{\alpha+1} - \lambda (x+1)^{\alpha+1} = -2\lambda (\alpha + 1) x^\alpha$$ Would very much appreciate any kind of help!
As far as I understand, you need to define boundary conditions in time and space to select a unique solution to a PDE and make it solvable. However, in ODEs I only need to specific the initial value in time which I think of as a boundary condition. If I now use the method of lines to transform a PDE into a system of OD...
I have two masses, and two springs which are atattched to a wall on one end. For context I attached the system of equations. How can I add a command to see my analytic solution for my system of equations? I want to be able to compare the numeric vs analytic. I think it would be something like (t, answer, t, answer). T...
I have created a program to solve 2D, time-dependent PDEs with the finite element method and get reasonable looking results for the 2D acoustic wave equation. Now I would like to go further and solve a PDE with a known exact/analytic solution to compare against. However, I have a lot of trouble finding a suitable equat...
It is well known that unpreconditioned Krylov subspace methods applied to the finite-difference-discretised Poisson equation with $n$ grid points per direction require $O(n \, |\log(\varepsilon)|)$ iterations to reduce the error in the initial guess by a factor $\varepsilon \in (0,1)$. This is typically a prohibitively...
We have challenge in my current assignment where we need to modify/minimize an existing logical expression to another new logical expression. But the result should be the same. For eg: the ask to convert (1 AND (2 OR 9 OR 10) AND (3 OR 4 OR 5) AND (6 OR 7) AND 8) OR (1 AND (2 OR 9 OR 10) AND (11 OR 12) AND 8) into 1 AN...
According to the Wikipedia article on Singular Value Decomposition, the asymptotic complexity of computing the SVD of an arbitrary m×n matrix M with m>n by the popular Householder QR methods is O(mn2). Are there any algorithms (perhaps Householder QR) that provide better asymptotic guarantees for fixed-rank matrices? I...
We want to start a new project to solve a large-scale inverse problem (O(10^6) number of parameters) to invert for subsurface wave speeds. We will use FEM to solve forward and adjoint PDEs. In our project, we will need to have both sparse and dense solvers. Previously in similar projects, we were using PETSc library bu...
We are comparing two techniques in computer science. We want to say X has "significantly high latency" when executed on system Y. Is there a better one-word term we can use for the above to mean the same as 'significantly high latency'? e.g., slow <-- but a better word than slow?
I am converting some MATLAB code in to python and have the encountered the error "ValueError Traceback (most recent call last) in 1 for ig in range(nbas): ----> 2 psi[:,ig] = np.polyval(np.array(pp[ig,:ig]),nodes) ValueError: could not broadcast input array from shape (56,1) into sh...
I have been granted access to a cluster running PBS and I'd like to run a Evolutionary Algorithm (EA) on it. To those unfamiliar with EAs, Wikipedia summarizes it as: Part One: Generate the initial population of individuals randomly (first generation). Part Two: Repeat the following steps until termination: Evaluate t...
The Problem I would like to determine the gradient of a least squares objective function which depends on a vector of 40 parameters $p$, and the solution of a system of 32 differential equations. In specific, let the aforementioned system be: $$\dot{y} = f(t,y(t,p),p) \tag{1}$$ then the least squares objective functio...
Suppose I have solved an ODE $v'(t) = f(t,x)$ via some adaptive stepper, such as RK4 or Dormand-Prince, generating a list of points $\{(t_i, v_i, v_i' = f(t_i, v_i))\}_{i=0}^{n-1}$. I wish to use this data structure to compute the curvature and torsion of the ODE solution, however, computation of curvature requires acc...
I would like to find the contours of a scalar function $u(x,y)$ available as a discrete set of function values $u_i = u(x_i,y_i)$ over a scattered set of points $(x_i,y_i), i=1,...,N$. In my case, the scattered data comes from a numerical solution to a PDE using the RBF finite difference method, however interpolation o...
I want to implement the Lax Wendroff method for a non linear advection equation which is $$\frac{u_{i}^{n+1}-u_{i}^{n}}{t} + \frac{f(u_{i+1}^{n})-f(u_{i-1}^{n}) }{2h} -\frac{t}{2h} \left( F_{i+1/2}^{n} \frac{f(u_{i+1}^{n})-f(u_{i})^{n}}{h}) - F_{i-1/2}^{n} \frac{f(u_{i}^{n})-f(u_{i-1}^{n})}{h} \right)=0$$ for the probl...
I want to solve an underdetermined system of linear equations $A x = b$ with $A \in \mathbb{R}^{n \times r^2}, x \in \mathbb{R}^{r^2}, b \in \mathbb{R}^n$. The matrix $A$ has the following additional structure: each row of $A$ takes the form $v_i \otimes v_i$ for some $v_i \in \mathbb{R}^r$ (here $1 \le i \le n$). (I.e...
I'm very new to computational Physics and am finding conflicting statements on whether the velocity Verlet algorithm, defined as: $\begin{align} x_{n+1} &= x_n + v_n \Delta t + \frac{1}{2} a_n \Delta t^2 \tag{1}\\ v_{n+1} &= v_n + \frac{1}{2}(a_n + a_{n+1}) \Delta t \tag{2} \end{align}$ is time-reversible. From my unde...
There are $N$ particles with positions $x_i(t)$ and velocities $v_i(t)$ and mass 1. There is a potential function $U_{i,j}(x_i, x_j)$ between each pair of particles, which is $0$ unless the particles are close enough. I want to update the simulation so that total energy $\sum_{i,j} U_{i,j}(x_i, x_j) + \sum_i \frac{1}...
I am solving a structural mechanics problem that involves setting constraints, and I use Lagrange multipliers to set it. Consequently, some diagonal entries of the tangent stiffness matrix vanish, and I couldn't solve the system using the KSP solver. I will appreciate any help.
I need to solve linear equations system Ax = b, where A is a sparse CSR matrix with size 500 000 x 500 000. I'am using scipy.bicgstab and it takes almost 10min to solve this system on my PC and I need to repeat this calculations in loop so there's a need to speed up the calculations. Is there a way to somehow paralleli...
I am currently facing some challenge implementing a less traditional PDE which take a form similar to the Navier-Stokes equation, except that the continuity equation is modified such that: $$\epsilon \nabla \vec{u} + \vec{u} \cdot \nabla \epsilon + \frac{d\epsilon}{dt} = m $$ where $\epsilon(t,\vec{x})$ is known at all...
Are there any well-known algorithms for partitioning a dense tensor into block-sparse form? In other words, I need to find a set of non-overlapping blocks that contain all non-zero entries of the tensor, while trying to minimize both the number of blocks and the the number of zeroes in each block. The tensor in questio...
Define an "image differential linear system" as a linear system $A\mathbf{x}=\mathbf{b}$ wherein $\mathbf{x}$ contains the ($\mathbb{R}$) pixels of an image and each row of $A$ constrains the difference between pixels that neighbor each other (vertically or horizontally) in the image. Such a linear system: has entries...
I want to plot the 100,200 and 400 iterations of this function of non homogeneous parabolic pde def solver(L, Nx, Nt, T, theta=0.5): x = np.linspace(-L,L, Nx+1) # mesh points in space dx = (L-(-L))/(Nx-1) dt = 1/Nt Nt = int(round(T/float(dt))) t = np.linspace(0, T, Nt+1) # mesh points in ...
The statistical physics literature is replete with papers describing simulations of lattice models, such as the Ising model. Typically, these are done through Monte Carlo methods, such as the Metropolis algorithm. A major concern in these studies is whether the algorithm has reached equilibrium. If the dynamics are not...
We are given the 2D coordinates of 2 points: the first point is where the ray starts and it goes through the second point. We are given another ray in the same way. How do we determine if they have a point of intersection? I would like to know the general algorithm and its explanation, don't mind about the extreme case...
I am currently working on a DNS turbulent solver and I would like to compare my IHT simulations to papers. Those papers show the Probability Density Function of the velocity field: I would like to reproduce this figure from data. I have access to all the velocity fields at any point during the simulation. I don't unde...
Fluid simulations solving the hydrodynamic (HD) or the magneto-hydrodynamic (MHD) equations are very useful in physics, the latter being particularly useful for modeling plasmas. Of course these equations are highly nonlinear and solving them accurately is difficult. My first question is, in the general case what some ...
For simpilcity, consider a single quad linear elasticity finite element in 2D. The Dirichlet boundary conditions on node 1 and node 2 are easy to implement and can be handled in the standard way. However, the Dirichlet boundary condition on node 3 is more general and is of the form: $$ au_{3x} + bu_{3y} = 0 $$ where $...
I tried implementing the algorithm in Aasen's 1971 paper on factorizing symmetric indefinite matrices. I've translated the code verbatim from Algol into Python, and I used the test example given in the paper. Their print-out from the test example matches mine. I've tried to extract the output into a usable form: A trid...
Basically, I'm trying to use Least-Squares to estimate the parameters of a DC motor. My system can be modeled by the following matrix equation: $$\begin{bmatrix}V_{input}(t)\\0\end{bmatrix}=\begin{bmatrix}\frac{\text{d}i}{\text{d}t}(t) && I(t) && \omega(t) && 0 && 0 \\ 0 && 0 && -I(t) && \frac{\text{d}\omega}{\text{d}t...
I've implemented the version of Aasen's algorithm described in the book Matrix Computations 4th Edition. The version there doesn't have pivoting. The book's description of how to add pivoting is a bit sketchy for me. Can someone illustrate with actual code how to add pivoting? I should add that my implementation has su...
In MATLAB's ODE suit, there seem to be two basic methods of controlling the Local Truncation Error (LTE) of the ODE which the user can choose from, namely: The absolute error control (default), |e(i)| <= max(RelTol*abs(y(i)),AbsTol(i)) The norm error control (setting option normcontrol, on), where norm(e(i)) <= max(Re...
I have an optimization problem of the following form: $$\min_y\left[\max_x f(x,y)\right].$$ It is fairly straightforward to minimize $f(x,y)$ over $y$ with $x$ fixed, and similarly to maximize $f(x,y)$ over $x$ with $y$ fixed. If it helps, my $x$ problem is concave---but while I can solve the $y$ problem in closed-f...
I am having trouble with implementing the method of subspace iteration to find the eigenvalues and vectors of a random, symmetric matrix, A that is mxm with m = 10. The function that I have written to perform this task is def subspaceiterate(A,V,v,j): if j == 0: return v else: v_jm1 = V[:,j-1] ...
I am reading the Chapra and Canale book on numerical methods, and was working through the chapters on solving linear systems. Now the book goes through direct methods including Gaussian Elimination, as well as LU factorization, versus iterative methods like Jacobi iteration, Gauss-Seidel, and conjugate gradient methods...
I'm trying to parse the following expression (Eq. 35 in The Magnetic Field in the Vicinity of Parallel and Twisted Three-Wire Cable Carrying Balanced Three-Phased Current) in Python and calculate its sum over indices (...-5, -2, 1, 4, 7...). Relations between Bessel functions explains that these are the modified Besse...
I have a problem with computing a derivative of a Gauss function using FFT and IFFT from NumPy library. I use the fact that $$ \begin{equation} \frac{d}{dx}f(x) = \frac{1}{\sqrt{2\pi}}\int{ike^{ikx}\mathscr{F}(f(x))(k)dk}, \end{equation} $$ where $\mathscr{F}(f(x))(k) = \frac{1}{\sqrt{2\pi}}\int{f(x)e^{-ikx}dx}$. $$ \\...
Consider the half-planes $\{x \leqslant 2\}$ and $\{x+y \leqslant 3\}$. These two half-planes are coded with the R package 'rcdd' as follows: library(rcdd) A <- rbind( c(1, 0), # x c(1, 1) # x + y ) b <- c(2, 3) H <- makeH(A, b) And we can get a representation of their intersection as follows: V <- scdd(H) whic...
Basically, I'm trying to use Least-Squares to estimate the parameters of a DC motor. My system can be modeled by the following matrix equation: $$\begin{bmatrix}V_{input}(t)\\0\end{bmatrix}=\begin{bmatrix}\frac{\text{d}i}{\text{d}t}(t) && I(t) && \omega(t) && 0 && 0 \\ 0 && 0 && -I(t) && \frac{\text{d}\omega}{\text{d}t...
Given an anti-Hermitian and sparse matrix $X$, I am using Python (NumPy and SciPy) to compute the matrix exponential $f(t) := e^{tX}$ for many values of $t$. The method I am currently using is to essentially compute the exponent with the following function: X = SomeSparseMatrix def f(t): return scipy.sparse.linalg...
The initial wave of reviews for Apple's M1 hardware are out, and there's lots of generic benchmarks and data on workflows on professional programs for creative users, but I haven't seen anyone talking about the experience of using something like the scientific computing ecosystem in Python or R. Does anyone have direct...
I want to use vectorized computation (with python and numpy) to do some calculation involving bessel functions. As is often the case, I need to calculate the sums of bessel functions of (infinit) differnt order. I need to do that for a whole vector field, and would like to use vectorized computation. Actually, both, th...
I'm studying iterative methods for solving linear system, and I find the following setting in Wikipedia: Consider a matrix splitting $A = M-N$, where $A,M,N$ are all symmetric and positive definite matrices. Define iteration matrix $C=I-M^{-1}A$. We aim to show that the condition number $\kappa(I-C)=\kappa(M^{-1}A)$ is...
I am interested in finding preconditioner to solve the problem for one dimensional problem $u''(x)=\sin(x), u(0)=u(1)=0$ using Dirichlet-Neumann method. The preconditioner $M$ coming from Dirichlet-Neumann method is $\theta^{-1} S_2$, where $\theta$ is the relaxation parameter use in Dirichlet-Neumann method with $0<\t...
I am studying some computational methods and I am trying to program simples equations to understand how the methods work... Particularly, I am trying to understand how multiorders ODE's work. I've tried to program the ODE $y''=y'+x$, with conditions $y(0)=0$ and $y(h)=-h^2/2-h$, ie, the function $y=-x^2/2-x$. So, I've ...
Assume we have an IVP $y'(t) = f(t,y)$, and that $\partial_t f$ and $\nabla f$ are cheap to compute. Assume further that more derivatives are not cheap to compute, or inaccessible for some reason, perhaps API related. What are the best ODE steppers for this case? Taylor series methods are available with $O(h^3)$ error,...
This question is related with this other question: Trying to model a simple second order ODE. On this other question, I get some useful comments on why the simulations are so terrible. However, I have another question: Why time-step smaller is not better? Thank you in advance. h=0.05 %h=0.5; max=100; np=max/h; u=[]; y=...
I want to know summation of some small numbers, such as {e^-1000, -e^1001, e^1002...} If all numbers are positive, I can use log-sum-exp algorithm. But unfortunately, negative numbers are also included in numbers. Is there any method to calculate the sum of such numbers?
Suppose $a_i,b_i$ are $d\times 1$ matrices, $y_i$ is scalar, and I need to find least-squares solution $w$ of the following system of $n$ equations: $$y_i=(a_i^T\otimes b_i^T)w$$ Is there a specialized approach for this system? Converting to normal equations and applying Cholesky to solve for $w$ takes takes $O(d^6)$ o...
I got an assignment where it asked to implement (in MATLAB) the gradient descent algorithm in order to resolve an ill posed least square problem: $$ \min_u \Vert Gu - f \Vert $$ where $u$ is the reconstructed image, $G$ is the blur applied to $u$ and $f$ is the blurred image. I have successfully implemented it with MAT...
I'm solving two-dimensional four-component compressible Navier-Stokes equations with finite-difference WENO approach. The equations are pretty standard: $$ \frac{\partial U}{\partial t} + \frac{\partial F}{\partial x} + \frac{\partial G}{\partial y} = 0; $$ $$ U = \left( \begin{array} {c} \rho \\ \rho u \\ \rho v \\ E...
I'm doing CFD simulations for blood flow in unstructured grids. My boundary condition at the outlets is called three-element Windkessel which basically calculates the pressure by solving this ODE: $$R_{2}C\frac{dP}{dt} + P(t) = C R_{1}R_{2}\frac{dQ}{dt} + (R_{1}+R_{2})Q(t)$$ Where $P(t)$ is the pressure at the outlet, ...
I am writing a simulation for a discrete stochastic dynamical system. Since the simulation is stochastic, I need to run the simulation multiple times and then average the values of each timestep. I have some simple julia code below to demonstrate the process. My question was really about numerical stability when averag...
I have a set of points $(x_i,y_i,u(x_i,y_i))\in\mathbb{R}^3$, $i=1,\dots N$, over a surface $S$ (from experimental data). I need to calculate the integral of a function $F$ over that surface. If the points were points over a volume I could use some mesh software (tetgen, for example) and build a mesh, and after that ca...
I'm trying to solve Unsteady Stokes equations on a moving domain, using an ALE formulation, that is $$\frac{\partial \mathbf{u}}{\partial t} - \mathbf{w}\cdot \nabla\mathbf{u} = \nu\Delta\mathbf{u} - \nabla p$$ where $\mathbf{w}$ is the velocity of the mesh. I'm starting from the simple case of a rigid sphere translati...
Language: Python3 Problem: I have a matrix Q of shape [51200 rows x 51200 cols] stored in a binary file, each of the element in this matrix has a data type of complex64. To load the data into memory I therefore need ~20GB of RAM, checked from getsizeof(Q). I do have access to a server with 120GB of RAM in a LINUX machi...
I have a linear system $$ \dot x(t) = Ax(t), \quad x(0)=x_0 \tag{*} $$ with $A$ being Hurwitz (i.e. the solutions may oscillate but will eventually tend to zero) but really stiff. $A$ might be large, but I can do explicit solves. I want to integrate it in time. Since it is coupled with a flow solver, stability is my pr...
Is there any book or site available with Finite element Method for partial differential equations with python code apart from Fenics?
I'm currently looking at the PDE \begin{align*} u_t + \left[x(1-y) - (1-x)\right]u_x - (1-y) u_y + (z-xy) u_z = (z-xy) u_{xy} - (1-x)u& \\ \end{align*} with \begin{align*} u(x,y,z,0) = 1& \\ (x,y,z) \in [0,1]\times [0,1] \times [0,1]&, \end{align*} which I found via the conversion of a chemical master equation. The s...
I'm trying to simulate the motion of a projectile taking into account aerodynamic drag. The code works perfectly if the aerodynamic drag is zero. However, if the drag coefficient or velocity is too high, the trajectory starts to bend towards the negative x axis. I used this source to help me create the simulation. Here...
Suppose I have a linear inverse problem of the form: \begin{align} Ax=b \end{align} I would like to reconstruct $x$ from the measurement $b$ via the objective $$\min_x\{\vert\vert Ax-b\vert\vert^2_2+\lambda\mathcal{R}(x)\}$$ With $\mathcal{R}(x)$ being the regularizer and $\lambda$ being the regularization parameter. I...
Please let me know if this is not the appropriate site for this question. I found questions regarding EFIE/MFIE/CFIE on this site, so I thought my question might fit. I am studying the paper by Putnam & Medgyesi on the CFIE method for BoR targets with junctions. In Section V (second paragraph) of the paper, the authors...
I am struggling with a rather basic numerical integration task: Using Python's scipy.integrate.solve_ivp module to integrate an ODE sytem backwards in time. As a test, I am using the following ODE system (an SEIR model for an infectious disease): \begin{align*} \frac{dS}{dt} &= - \beta SI \\[4pt] \frac{dE}{dt} &= \beta...
Does anyone know of any strategies for creating a preconditioner $P^{-1}_\sigma \approx (A+\sigma I)^{-1}$ given a preconditioner $P^{-1} \approx A^{-1}$, preferably such that the precomputation doesn't depend on the value of $\sigma$?
I have a simple graph $G=(V,E)$ that is not necessarily a complete graph. If I compute the shortest distance between every pair of vertices (let say with Floyd-Warshall algorithm) I get a complete graph $G_c=(V,E_c)$. Considering that the distance between two vertices in a simple graph is the number of edges in its sho...
It is required to solve a linear system $Ax=b$, where the matrix $A$ is symmetric, all the variables and coefficients are real. The structure of $A$ is \begin{equation} A = \begin{pmatrix} A_{11} & A_{12} \\ A_{12}^T & A_{22} \end{pmatrix}, \end{equation} where $A_{11}$, $A_{12}$ and $A_{22}$ are banded square blocks o...
I am looking for references, pointers to CUDA code that runs particle simulation in parallel, calculating particle trajectories, handling collisions, etc. I've seen some in NVidia source base, but was curious if any parallel code experts know more. Thanks,
I have a mesh of a 3D surface composed by triangles, and I have the value of a function $u(x,y,z)$ in every vertex of the mesh (every vertex of each triangle). I need to calculate the following integral: $\iint_S u_{xx}dA$ Normally, I calculate this integral as a sum over each triangle supposing that $u$ is linear on e...
I want to compare the field of two electrical currents and compare the resulting field to a magnetic dipol field and find magnetic momentum that minimizes the difference of the two fields. My current approach is to calculate the field of the two currents (by superimposing the fields of the two individual currents) and ...
I need to (computationally) solve a system of equations, for the purposes of an interior point method, of the form $$ \left[\begin{array}{cc}B & A^T \\ A & 0\end{array}\right] \left[\begin{array}{c}x\\y\end{array}\right] = \left[\begin{array}{c}c_x \\ c_y\end{array}\right] $$ where $A$ and $B$ are large and sparse, and...
So currently I am studying about the Runge Kutta Second Order Method used to estimate first order ordinary differential equations. The following show the formulas. $$ y_{i+1} = y_i + (a_1k_1+a_2k_2)h $$ $$ k_1 = f(x_i,y_i) $$ $$ k_2 = f(x_i + p,y_i + q_{11}k_1h) $$ $$ a_1 + a_2 = 1 $$ $$ a_2p_1 = \frac{1}{2} $$ $$ a_2q...
I was wondering if anyone could recommend a good book or resource on numerical methods for solving integro-differential equations? Of course I am familiar with the methods for solving ODEs and PDEs numerically, so no problem there. But I don't have any frame of reference on the stability of numerical schemes when solvi...
I have a mesh already partitioned into disjoint groups of cells. What I want to achieve is the following. Obtain the adjacency graph for the cell groups. Partition the mesh, i.e. generate submeshes from the cell groups in such a way that cells among the interfaces (boundaries of the cell groups) are no longer connecte...
I have a C++ code performing some Armadillo computations in a loop. I'd like to parallelize this loop with OpenMP. But Armadillo automatically uses OpenMP for some computations. So, would the OpenMP parallelized loop cause an issue if I don't disable the automatic Armadillo parallelization ? Or can I safely use the par...
If I wanted to perform an optimization using a Newton-based solver where the Hessian and gradient of a function are known analytically, and then use a package such as Adept to compute a Jacobian matrix ("reverse mode") with respect to the optimization parameters, would that be possible? Would there be excessive memory...
By using the Legendre-Gauss-Lobatto (LGL) quadrature formula (QF) and LGL nodal points one achives a diagonal mass-matrix for finite element problems. (More specifically, the spectral element method.) Setting the $n$ quadrature points as nodal points, the polynomials of the ansatz and test space are of degree $n-1$. Th...
I'm trying to implement a C++ code for the evaluation of the solution of an N-body system of ODE. I've started with a 2-body problem just to set the methods properly. I'm comparing the results of a 4 stages Runge-Kutta (RK4), a 4 steps Adams-Bashforth (AB4) and velocity Verlet method. The solutions I get have the corre...
I have a curve fitting problem of the form: $$ \textbf{y} = f(\textbf{x}, a,b,c,d) + \varepsilon $$ $$ f(x, a,b,c,d) = \frac{b}{e^{x\cdot a}+c}+d $$ with the constraint \begin{equation} \begin{aligned} \arg\min_{a,b,c,d} \quad & \sum_{i=1}^{n}{(f(\text{x})_i-\text{y}_i)^2}\\ \textrm{s.t.} \quad & -c-\frac{b}{d}-1 =...
I am trying to solve 6 ODE equations coupled with 1 DAE one. The ODE equations have been discritized in space domain and ode15s MATLAB solver is used to solve the equations in time domain. I have defined a diagonal mass matrix including unity elements for ODEs and zero values for DAE equation. Assuming that "n" is the ...
I'm trying to solve a system of ODEs using the BDF order 4 method. I find the first 3 points using RK4, then for the implicit part of the BDF, I use Newton-Raphson iteration. Unfortunately my solution blows up but I can't figure what I'm doing wrong. I assume it's something to do with the Newton iteration since I'm not...
I am interested in numerical solutions of a linear, time-dependent ODE of the form $$ \dot y = A(t)y - Ry, $$ A good model is the following problem in $\mathbb R^2$: $$ A(t) = \begin{bmatrix}0 & -\omega(t)\\ \omega(t) & 0\end{bmatrix} \\ R = \begin{bmatrix}R_1 & 0\\ 0 & R_2\end{bmatrix}, \\ $$ The full problem is in $\...
I need to simulate a 3D fluid-structure problem where the obstacle is an elastic and very thin structure (then I want to consider this structure as a surface). I need to solve this problem using numerical methods, like finite volume or finite element method. But if I try to generate a mesh of the obstacle, it has too t...
I have a kind of general question about approximation schemes in nonlinear functional analysis. Given a nonlinear map $\Phi$ from an open set (in an infinite dimensional Banach space) of functions to itself, I try to find fixed points of this map $\Phi(f)=f$, or equivalently to solve the roots of of $\Phi'=\Phi-{\bf 1}...
I don't have a background in numerical modeling so this question is rather broad. What I am interested in is modeling the propagation of an ultrasonic acoustic wave in 3d space. The basic 3d wave equation is tractable to me but I don't understand how boundary interaction is computed or how to get accurate simulations o...
To simulate the physical process necessary to solve the arising systems of linear algebraic equations. The SLE matrix has a highly sparse form. There are a couple dozen non-zero elements in the string, including the diagonal. And all unknown a couple of million. During the simulation, the matrix retains its portrait, b...
I'm looking for an open-source automatic meshing tool or library able to generate full or dominant hexahedral mesh starting from a provided arbitrary model i.e. a surface triangular mesh stored in STL file. What I have found is snappyHexMesh embedded in OpenFOAM. Are there some other tools that fit my purpose? Someone ...
I'm quite new to GPU or in general parallel programming. I am working on a Lattice-Boltzmann simulation that should be parallelized on GPU's. I wanted to asked more experienced people how to attack such a project. Would it be more beneficial to first implement all necessary features (basic algorithm with some extension...
I'm numerically modelling flows around various geometric 2D shapes. Is there a good source/cookbook of equations that approximate these? Some examples are Rectangle: $(x-a)^n+(y-b)^n < r^n$ where $r$ is side length and $n$ is even. The larger $n$, the sharper the corners. Also e.g. $\text{max}(500 (x-a), 55 (y-b)) < ...
I need to implement a numerical scheme for the solution of the one-dimensional advection equation $$\\\frac{\partial u}{\partial t} + C(x, t) \frac{\partial u}{\partial x} = 0 \\\\$$ $$ \\ C(x,t) = \frac{\pi\cos(2 \pi t) + 3.5}{2\pi - \pi\sin(\pi x)} \\\\$$ $$\\ 0 \leq x \leq 1, \quad 0 \leq t \leq 1\\\\$$ with Crank–N...
I work on computational geometry. A huge number of two-dimensional and three-dimensional data are found in my project. Coordinates of polygon and polyhedrons vertices consisted of two-dimensional and three-dimensional data, respectively. Indeed, polyhedrons face data are also founded. Storing and retrieving them is nes...