instruction
stringlengths
43
28.1k
I meet a problem when I try to develop an iterative method for discrete inverse problem $$Ax+e=b$$ where $A\in\mathbb{R}^{m\times n}$ and $e$ is a noise. I want to approximate the true solution $x_{true}$ by using a nonlinear regularization term $R(x)$. Since $m,n$ is very large, the optimal regularization parameter is...
I try to detect interference fringes in a bunch of pictures. I projected on one axis, and I was able to detekt the peaks that indicate one of the fringes. So now I'm having a list with points (e.g. $(100, 165, 220, 275, 341, 461, 519)$. In the choosen example, the sought for periodicity is 60, the points scatter around...
I have not found any relevant information in the literature on the following rather simple problem: How to combine (geometric) multigrid preconditioned conjugate gradient (MGPCG) with an additional jacobi preconditioner ? Background: Large (symmetric, diagonally dominant) linear system A*x=b arising from discretized in...
For the sake of the rest of the question, I'm interested in the porous medium equation $$S\frac{\partial\phi}{\partial t} = \nabla\cdot K\phi\,\nabla\phi$$ where $S$ and $K$ are spatially-variable coefficients and $\phi$ (the hydraulic head) is the field to be solved for. This is a parabolic PDE, but it's degenerate si...
I am looking to compute the derivative of the following expression: $$\frac{\partial}{\partial X}\mathrm{tr}\left[A\exp(X)\right]$$ where $A$ is both a symmetrical and positive-definite matrix and $X$ is a symmetrical matrix. As a result, $\exp(X)$ is symmetrical and definite-positive. Just as a reminder, the matrix ex...
In many cases, an algorithm can be designed and implemented to prove/disprove a mathematical axiom, but could it be accepted as proof or refutation by rigorous mathematicians?
(This is repost of a question first asked on Mathematics. Hopefully there are more people here who have a copy of Golub and Van Loan to hand) In the 4th edition of "Matrix Computations", Golub and Van Loan present "Algorithm 5.1.1 (Householder Vector)". The first couple of lines (translated into MATLAB-syntax) read: m ...
I tried to solve a simple Kepler problem numerically. I have discrete time steps, a starting position $(x_0,y_0)$ and starting velocity $(u_0, v_0)$. I used this iteration by calculating the forces and applying Newton's law: $$F = k/r^2 = k/(x^2+y^2) $$ $$F_x = F \cdot x/\sqrt{x^2+y^2}$$ $$F_y = F \cdot y/\sqrt{x^2+y^2...
In my research on topology optimization of fluid-structure interaction problems (2D), I am using a geometrically nonlinear model to represent the structure. Body/surface forces are extracted from the fluid solver and applied to the structure under plane strain conditions. I am facing a problem with severe, yet localize...
I tried to solve a simple Kepler Problem numerically. I have discrete time steps, a starting position $(x_0,y_0)$ and starting velocity $(u_0, v_0)$. I used this iteration by calculating the forces and apply Newton's law: $$u_{i+1} = u_{i}+ F_x/m \cdot \Delta t$$ $$v_{i+1} = v_{i}+ F_y/m \cdot \Delta t$$ $$x_{i+1} = x_...
I am going to model the moisture air inside an energy tower, therefore. I formulated the following equation to calculate the fraction of water vapor, Y in the moist air, where $\rho_w$ is the water vapor density,$\rho$ is the total density $T$ is the temperature, $R_a, R_w$ are the gas constant in dry air aid water vap...
Once a method is implemented in a computer program, then does learning the theory become less useful use of time? This has confused me. I used to view that all things should be studied from first principles, but lately I've thought that this might well be uneconomical. For example, consider FreeFEM or something. Once i...
CSV (even though once opened it does not contain a traditional CSV format I think it contains JSON data)[![1], when I try to open it as a TXT file I got this as shown in the first screenshot. When I open it in Excel sheet I got this as shown in second screenshot As you may see in a better view (TXT file) I want to conv...
I'm trying to build a DNS so simulate non-Newtonian turbulent channel flow using the Lattice Boltzmann Method. Most of the papers I use initialise the system using the analytical solution of the laminar flow (which describes a parabolic flow profile in the flow direction) and ad divergent free random fluctuations to it...
I have a functional $S$, $$S = \int_{x_0}^{x_b} dx \frac{1}{z(x)^d} \sqrt{1 + \frac{z'(x)^2}{f(z)}}, \qquad f(z) = 1-\left(\frac{z(x)}{z_h}\right)^{d+1} $$ where $d=3$ is the dimension and $z_h$ is some constant. We can solve the equation of motion through the Euler-Lagrange equation which is a nonlinear second-order d...
By reading the CVX users' guide, I frequently came across with the term "atom library", which I suppose to be a set of functions that one must use to construct mathematical expressions on solvers. But this definition is not clear to me, let alone how the atom library relates with the DCP ruleset.
I am currently dealing with exponential decay (of muons). The PDF is the following: https://wikimedia.org/api/rest_v1/media/math/render/svg/fdacadb747bac9932ffd02ee35cf3cbd0bc0b4c8 And I am told that mouns have a theoretical mean lifetime $\tau=2$. Also lifetime below $tmin=1$ or above $tmax=10$ is not possible, becaus...
I am trying to reformulate this optimization problem in order to get a DCP-complaint expression on Julia (I am using the Conjex.jl package) $$ \text{Minimize}\;\;\; \mid\log(x)\mid $$ The code p = Variable() f = abs(log(p)) Prompts to a warning WARNING: Expression not DCP compliant. Trying to solve non-DCP compliant ...
There exists a FFT-based method to solve the poisson equation in inhomogeneous Dirichlet boundary condition using the sine-transform. For example, Which fourier series is needed to solve a 2D poisson problem with mixed boundary conditions using Fast Fourier Transform? I expect similar approach could be applied to Schro...
Whilst googling I see reverse mode automatic differentiation (AD) tends to be used when optimising neural networks. Would it not be better to use forward mode and treat your input as a single variable, then use matrix calculus to optimize the weights. For example: $$u_{1} = x$$ $$u_{2} = W u_{1}$$ $$u_{3} = \sigma(u_2)...
I have a nonlinear boundary ODE, $$y'' + 3 y y' = 0, \qquad y(0) = 0, y(2)=1 $$ I want to solve this using the finite-difference method. I obtained the result for the data set of $y(x)$ (including the boundary points), $$(y_0,y_1,y_2,y_3,y_4,y_5,y_6,y_7,y_8,y_9,y_{10}) = (0, 0.318993138, 0.581636081, 0.7641886486, 0.87...
Given a list of points that were randomly generated around two lines, find two new lines that match the original lines as closely as possible. Here's the function definition: getLinesOfBestFit(x: numpy.array, y: numpy.array) -> Tuple[Line, Line] Line = namedtuple('Line', [('m', float), ('b', float)]) I saw that there...
Almost all FEM libraries are good enough, but I want to start with a FEM package and stick to it for some time. Instead of trying all of them, or going with what everyone else is using, I want to benefit from other user's experiences and know: What are the pros and cons of the FEM libraries you have experience with? H...
I am trying to find the solutions for a probability density $p(x,t)$, governed by, $$ \frac{\partial p(x,t)}{\partial t} =\int_{-\infty}^\infty dx' \; \Lambda(x-x')\frac{\partial^2 p(x',t)}{\partial x'^2} $$ for any function $\Lambda(x)$, which can even be given numerically.
The algorithm for the inverse power iteration works as following : \begin{align} &v^{(0)} =\text{ some vector with }\|v^{(0)}\|=1\\ &\text{for }k = 1, 2, \ldots\\ &\qquad\text{Solve } (A - \mu I)w = v^{(k-1)}\text{ for }w\\ &\qquad v^{(k)}= w/\|w\|\\ &\qquad \lambda^{(k)} = (v^{(k)})^TAv^{(k)}\\ \end{align} However, If...
I try to solve the steady-Stokes equation numerically on , that is \begin{aligned} -\nabla \cdot \mathbb{T}(\mathbf{u}, p) & =\mathbf{f} \quad \text { on } \Omega=[0,1]*[-0.25,0], \\ \nabla \cdot \mathbf{u} & =0 \quad \text { in } \Omega, \\ u_1 & =e^{-y} \text { on } x=0, \\ u_1 & =y^2+e^{-y} \text { on } x=1, \\ u_1 ...
Assume we want to solve the Poisson eq. with the FEM on some Domain $\Omega$, i.e. $$\begin{cases} -\Delta u = f, \; \Omega\\ u = 0, \; \partial \Omega \end{cases}$$ For the sake of the discussion let $\Omega = [0,1] \subset \mathbb {R}$. Let $\Omega_h := \{x_0 =0, \dots, x_N =1 \}$ be some vertices of the discrete mes...
The Setup Using finite differences to discretize the 2d diffusion equation $$\partial_tu=\partial_x\left(A\partial_xu+B\partial_yu\right)+\partial_y\left(B\partial_xu+C\partial_yu\right)$$ we get a block-tridiagonal matrix ($n$ by $n$ blocks), in which each block is a tridiagonal ($m$ by $m$) matrix, with ($x$,$y$ depe...
the equation is $$ \left\{\begin{array}{l} -\nabla \cdot \mathbb{T}(\mathbf{u}, p)=\mathbf{f} \text { in } \Omega, \\ \nabla \cdot \mathbf{u}=0 \text { in } \Omega, \\ \mathbf{u}=\mathbf{g} \text { on } \partial \Omega . \end{array}\right. $$ where $$ \mathbf{u}(x, y)=\left(u_1, u_2\right)^t, \mathbf{g}(x, y)=\left(g_1...
I have two values $a$ and $b$ where $a \ge 0$ and $b \ge 0$ and I have to calculate the formula below. $$ \frac{1}{2}\int_0^1\text{abs}\left[\left( \frac{p_i^{(a - 1)} \times (1 - p_i)^{(b - 1)}}{\beta(a,b)} \right)- 1\right] dp_i $$ I have to calculate above value. I am facing below error while doing that. ... My equ...
Suppose $\mathbf{u}^1\in\mathbb{R}^n$ is an unknown and $\mu^1\in\mathbb{R}$ is a known parameter. Suppose we have solved the non-linear system of equation for $\mathbf{u}^1$ using Newton's iterations. $$ \mathcal{N}(\mathbf{u}^1;\mu^1)=0 $$ Using $\mathbf{u}^1$ as an initial guess for the Newton iterations, it is poss...
I have the following 1D (in space, that is) system of equations I would like to solve: \begin{equation} \rho_{fs}\frac{\partial x_{fs}}{\partial t} = h_m\left(W_a - W_{fs}\right) - D_{eff}\left(\frac{\partial \rho_v(T_{fr})}{\partial x} \right) \end{equation} \begin{equation} \rho_{fr}c_{p,fr}\frac{\partial T}...
I have a nonlinear 2nd order boundary value differential equation where I used finite-difference method (central finite-difference) to solve it. $$z''(x)-\frac{\frac{1}{100} z(x)^4 \left(2 z'(x)^2+12\right)-600 \left(z'(x)^2+1\right)-\frac{3 z(x)^8}{500000}}{20 z(x) \left(10-\frac{z(x)^4}{1000}\right)}=0$$ Boundary con...
My question may be very stupid, and trivial, but looking forward to some suggestions - As a visualization let's consider a rectangle with four vertices represented by [1,2,3,4]. Now I want to find a triplet of numbers from them like (1, 2, 3). ly = [1,2,3,4] triplets = [] for i in ly: for j in ly: for k in ...
Does anyone have any resources I could follow that explains how to compute the Nth derivative using both forward and backward autodiff I understand how to compute the first derivatives Any assistance would be appreciated thanks Edit: Could I compute the derivative normally then pass those values through the autodiff eq...
Consider the following expression: $$f(t) = B+\sum_{k=1}^{N} A_k\cos(\omega_kt)$$ where $A$ and $B$ are known. the frequencies are also known but are not multiples of a fundamental frequency. However, they are written this way (if there is any use in this information): $$\omega_k = a_k\alpha+b_k$$ with $a,b \in \mathbb...
This is related to my previous question How can I express the solution to a discrete Lyapunov equation as an eigenvalue problem?. Given the algebraic Riccati equation (ARE) $$A^T X + XA + XRX + Q = 0$$ The solution $X \in \mathbb R^{n \times n}$ that satisfies this equation is $X = X_2X_1^{-1}$, where $\begin{bmatrix} ...
I am solving a 1D diffusion-type equation with the finite-difference Crank-Nicolson (CN) scheme, and I need to densify the spatial grid around the central point. One could change the spatial variable and re-derive the whole equation in terms of the new variable. Alternatively, in principle it should be possible to do s...
I am solving a 1D diffusion-type equation with the finite-difference Crank-Nicolson (CN) scheme, and I need to densify the spatial grid around the central point. One could change the spatial variable and re-derive the whole equation in terms of the new variable. Alternatively, in principle it should be possible to do s...
It seems that FEMs are never seen to implement time discretization. Is time discretization via FEMs to solve ODEs ever possible?
I'm trying to do FEM for a very basic version of the linear full Stokes equations in two dimensions. Say we are working in the grid $[0,1]\times[0,1]$ in the $xy-$plane. To solve an FEM problem for a scalar function $u(x,y)$ in the past, I have used the 2D FEM basis function definition $\psi_{ab}(x,y) = \phi_{a}(x)\phi...
I am looking for Finite Volume Software that employs a method-of-lines like approach by constructing from the hyperbolic PDE of form $$\partial_t \boldsymbol u(t,\boldsymbol x) + \nabla \cdot \boldsymbol f\big(\boldsymbol u(t,\boldsymbol x)\big) = \boldsymbol 0 \tag{1} $$ the semidiscretized ODE $$ \frac{d }{d t} \bold...
Are there any open source implementations of the medial axis transform for vector shapes? I have searched without finding any useful results. It seems that CGAL library doesn't have it implemented nor the deal.ii library. Are there any impelementation? Note: Some examples of shapes I am interested in: Polygons with ho...
I have a problem where I heavily need to restrict the number of points at which I sample a function based on the values of a different function. I have two functions: $f:{\mathbb{R}\times [0,\infty)\times[0,\infty) }\rightarrow\mathbb{R}$, which is a probability density, generated on a set of data, using Gaussian kern...
The signed volume of the triangle formed by the points $p, q, r$ in the plane is defined to be $$\text{volume}(p, q, r) \equiv \det\left[\begin{matrix}q_1 - p_1 & r_1 - p_1 \\ q_2 - p_2 & r_2 - p_2\end{matrix}\right].\tag{1} \label{eq:1}$$ Whether the signed volume is positive, negative, or zero tells you if the input ...
As far as I understand there are two definitions of the complex inner product: $$(a,b) = b^H a$$ and $$(a,b) = a^H b$$ I know some linear algebra libraries such as BLAS and Eigen uses the second one. However, I've seen some papers, such as this one, that use the first one. I would like to know if using one instead of t...
I am currently adopting a Newmark algorithm, for which the system of equation is $$(M+{\beta}{\Delta}t^2{K}){d_i}=\beta{\Delta}t^2{F_i}+Md_{i-1}+{\Delta}tM\dot{d}_{i-1}+{\Delta}t^2M\left(\frac{1}{2}-\beta\right)\ddot{d}_{i-1}$$ Say I solve the problem for a given time step ${\Delta}t$ and find $d_{i}$. If I want to fin...
I am solving an L1 regularized least squares of the form like: $$ \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| A \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda {\left\| \boldsymbol{x} \right\|}_{1} $$ I saw that for the L2 norm case there are several methods to obtain the magnitude of $\lambda$ as seen ...
I am working on tomographic image reconstruction (radar regime) of the dielectric properties of objects. As part of my work, I have programmed a ray tracer. This ray tracer is, in a way, purely "analytical" in that rays are propagated from their current location to the next intersection with a surface of an object or t...
The numerical results may be like this:
I am interpolating a 2D dataset on a hemisphere, and I am currently using scipy.Rbf that I like for its simplicity. I am defining the norm of the interpolator with the haversine formula in order to respect the fact that I am on a hemisphere, and doing a cubic interpolation in order to have a $C^2$ function at the end, ...
Most FEM texts or tutorials apply FEMs on diffusion equations where the 2nd spatial derivative is integrated by parts during weak formulation. For convection diffusion equations, there is also a first spatial derivative term. I saw an example of solving the convection diffusion equation by a FEM where only the second s...
What is the space complexity of a semidefinite program (SDP)? What is the answer to the same question for convex optimization problems in general?
I am looking for an algorithm to select the largest subset of $M$ points from a set of $N$ points ($M < N$) such that no point is within a certain minimal distance d to any other point in $M$? I assume the points are in 3D space. I could exhaustively try every combination but I am wondering if there is a better method....
For my research, I need to evaluate the density of a random vector $\boldsymbol{X} \in \mathbb{R}^p$ using the multivariate inversion formula. Let the density function of $\boldsymbol{X}$ be $f (\boldsymbol{x})$. If the characteristic function of $\boldsymbol{X}$ is given by $$ \phi(\boldsymbol{t}) = \int_{-\infty}^{\i...
I am trying to implement the iTEBD algorithm for the $PXP$ model, i.e, the hamiltonian is $$H = \sum_iP_{i-1}X_iP_{i+1}.$$ Here $P$ is the projector onto the ground state and $X$ is the usual pauli x matrix. I aim to time evolve a certain initial state and record certain observables. To do so, I initialized my iMPS (in...
I am solving an initial value problem using solve_ivp. The problem consists of computing the concentration profile of a set of reactions over time, given the initial concentrations and some of the reaction rate parameters. Furthermore, I have some experimental data of those concentration profiles at different temperatu...
I want to perform monte carlo simulation on a honeycomb lattice. Can someone please help me on how to define a matrix for these interactions and how many terms there will be while sampling the configuration? A honeycomb lattice has 3 first nearest-neighbors, 6 second nearest-neighbors and 3 third nearest-neighbors.
If $u_t+a \cdot u_x=0$ under a periodic boundary condition (to mimic an infinite domain) is solved by Discontinuous Galerkin (DG), how to implement periodic boundary condition and the other details in DG?
I am trying to solve the following complex-valued matrix differential equation backwards (i.e. not starting at $r=0$, but rather at $r > 0$): $F'' = 2ikF' + VF$. Here $F=F(r)$ and $V=V(r)$ are 2x2 matrices. $F$ can have complex entries, $V$ cannot. The boundary conditions are $\lim_{r \to \infty} F(r) = \mathbb{1}_2$ ...
I have solved the Time Independent Schrodinger Equation using the Numerov method and diagonalizing the Hamiltonian, in 1 - 3 dimensions. I suppose I could time-evolve it by multiplying every element in it by $e^{\frac{iEt}{\hbar}}$ to time evolve it (unless I cant). But I need an even more dynamical solution for what I...
Consider the following equation on $(0,1)$, with Dirichlet boundary conditions on both ends. $$ \frac{d}{dx}\left(k(x)\frac{du}{dx}\right) = 0 $$ Let us solve this using simple linear finite elements. The computed displacement $u$ is linear between nodes and is globally piecewise linear. Between nodes, we can take one ...
Given a set of filter taps $\{h_n\}_{n=0}^{m-1}$, define a scaling function $\phi$ by $$\phi(x) = \sqrt{2}\sum_{n} h_n \phi(2x-n).$$ In keeping with the notation from Daubechies "Ten Lectures on Wavelets", define $$m_0(\xi) := \frac{1}{\sqrt{2}} \sum_{n=0}^{m-1} h_{n}\exp(-in\xi).$$ The Fourier transform of the scaling...
I'm a PhD working in the mechanical engineering community. I constantly use open-source FEM libraries to solve my problems. Up to now I didn't really care about the performance of my codes, mainly because I rely on external C++ libraries and I know/assume that the core features were highly optimised. Just to make a pop...
I am using interior penalty discontinuous Galerkin to solve a simple Laplace problem: \begin{align*} \nabla u=0 \end{align*} with prescribed 0 and 1 Dirichlet boundary conditions on opposite edges of a unit square. The other edges have 0 Neumann. You'll see above that I have an image of the solution and it's gradient...
In FEM with bubble functions, the field ($\boldsymbol{u}$) is approximated as a linear combination of the standard one ($\tilde{\boldsymbol{u}}$) plus the bubble field ($\boldsymbol{u}^b$). That is, \begin{equation} \boldsymbol{u} = \tilde{\boldsymbol{u}} + \boldsymbol{u}^b. \end{equation} Considering the addition of n...
If you have a nonlinear second-order boundary value problem where the domain of the problem is $x \in [a,b]$, the boundary conditions imposed are the Robins condition at $x=a$ and the Dirichlet condition at $x=b$, we can use the finite difference method to solve this. For example, \begin{equation} \frac{d^2z}{dx^2} = f...
I'm currently revisiting some FDM schemes for convection-diffusion equations in 1D, 2D and 3D and getting up to speed with the industry-standard methods again. The application is derivatives pricing, the equation is more or less the "Black-Scholes-PDE" in various forms and flavors. In higher dimensions, I'm currently l...
I'm regular with optimization process, but this time, I would like to optimize a multiobjective function with reinforcement learning, using python. Of course I already have some testing functions (mathematical or more realistic), but I have no idea on how to proceed with RL. I would like to compare results with more "t...
Consider a convex polygon in $\mathbb{R}^2$ with multiple convex holes in it and suppose that, for now, we have a 2D triangular mesh of the polygon, which is represented by $\mathcal{T} \equiv\{T_i\}_i$, a set of triangles in $\mathbb{R}^2$. My question is, given a triangle $T$ that lies at the exterior boundary of the...
In discontinuous Galerkin time domain (DGTD) method, a critical concept is the numerical flux that is used to link neighbouring elements. The numerical flux is however not unique. The popular choices include centered and upwind ones. I see in many articles and books describe their different numerical behaviours, but a ...
I've seen that many people are using matrix-free fem codes in my community (mechanical engineering). I have to admit that I googled a bit and I didn't manage to find a good reference for the subject. Even a quick look to the books cited in this question Matrix free finite elements method for visualization in process to...
I'm looking for an alternative formulation of Quasi-Minimal Residual (QMR) from Freund and Nachtigal (1994) based on a Lanczos process for complex valued matrices based on $A^H$ instead of $A^T$. Specifically, I'm not quite sure how algorithm 7.1 would change if one where to use $A^H$ instead of $A^T$. Is there some ar...
I have what it may be a ridiculous question (since I don't know much about wavelets), but here I go. I am using different Discrete Wavelet families to extract texture features from images. I plan to use them to train a ML model to solve some classification problems. My question arises because I have decided to use 10 d...
I am solving a large system of equations using scalapack. Some systems that should run with no problem failed, apparently due to lack of memory in an mpi call. After investigating with execute_command_line("free -m"), I found that I'm losing large amounts of available RAM after every call to PZGETRS. By large, I mean O...
I have the following expression $$ \frac{a^{(k)}}{k!} $$ where $a^{(k)}$ is the rising factorial. Is it better to evaluate it using floating-point arithmetic separately, that is, call a function that returns the numerator and another function that returns the denominator, and then divide? Or should I evaluate it by exp...
I am trying to simulate a hyperbolic PDE with some control given by the following: $$u_t(x, t) = u_x(x, t) + \theta(x) u(0, t)$$ with boundary conditions: $$u(1, t) = U(t) = \int_0^1 k(1-y) u(y, t)dy$$ We use the finite difference scheme with initial condition $u(x, 0) = c$ with $c > 0$. $i$ is discretization in time a...
Given two floating point numbers $a,b$ with $a > b$ and an integer $n$, what is the most accurate way to compute $$ a^n - b^n $$ ? We can assume both $a,b$ are between 1 and 2. Lets assume both $a^n$ and $b^n$ can be represented in floating point arithmetic. If I compute the expression as written would I lose accuracy ...
I am trying to solve the Heat equation with Robin Boundary condition: $$ u_t(x,t) = u_{xx}(x,t), \\ u(x,0) = g(x), \\ u(0,t) + u_x(0,t) = h_0(t), \\ u(1,t) + u_x(1,t) = h_1(t)$$ for $ 0\leq x\leq1$ and $t>0$, by using twice the composition of a fourth-order compact finite difference (CFD) approximation of the first der...
Problem Background I'm trying to find a solution to the following passenger matching problem: The network is represented by graph $G=(V,E)$. $V$ is the set of nodes/stations. $p_{ij}$ is the profit of traveling through an edge $(i,j)$. Let $N$ be the number of vehicles, all the vehicles have the same capacity $c$. At e...
I am using python API of Gmsh to generate a mesh for a rectangular domain. I am really new at this. My code looks like this, import sys import gmsh gmsh.initialize() gmsh.model.add("t1") lc = 1e-1 gmsh.model.geo.addPoint(-1, 0, 0, lc, 1) gmsh.model.geo.addPoint(1, 0, 0, lc, 2) gmsh.model.geo.addPoint(1, 1, 0, lc, 3...
I am attempting to solve differential algebraic equations using SUNDIALS with a Python interface. I am having trouble learning to actually use sundials, and cannot seem to find any tutorials online that show some python examples. Would anyone have any links?
I recently needed to solve a second order boundary value problem and noticed that both scipy.integrate.solve_bvp and Matlab's bvp4c and bvp5c do not seem to support the passing of known parameters to the function odefun defining $\frac{dy}{dx}$ or the residual function which determines the boundary condtions bcfun. The...
As is known to all, the discontinuous Galerkin method (DG) was first used to solve the equation $u_t+u_x=0$. Now I have the following system of PDEs: $$ \begin{cases} u_t=f(u,v,\nabla{v}),\\ \Delta{v}=0. \end{cases}$$ I want to approach the equation $u_t=f(u,v,\nabla{v})$, where $f$ doesn't depend on $\nabla{u}$, by D...
I was trying to solve the following equation numerically, $$\frac{\partial P}{\partial t}+\frac{\partial}{\partial x}\left(P^{5/3}\right)=0$$ I adopted the Godunov approach for discretising the equation numerically, $$\frac{P_{i}^{n+1}-P_{i}^{n}}{\Delta t}=-\frac{\mathcal{F}_{i+\frac{1}{2}}^{n}-\mathcal{F}_{i-\frac{1}{...
Eliminating the half-step velocity, this algorithm may be shortend to Why can we eliminate the half-step velocity and all the math behind the velocity Verlet to what Wikipedia shows?
Using GRFs, one generates samples $x \sim N(m,K)$ with arbitrary mean $m$ and covariance matrix $K$ using a scalar Gaussian generator as $x = m + Lu$, where $L$ is a lower triangular matrix, such that $K =L^TL$ and $u \sim N(0,I)$. I would like to generate samples, such that the first and last elements of x has a certa...
Can someone point me to where the Navier-Stokes equations in 2D, both compressible and incompressible are written in semi-discrete form? I'm doing reduced order modelling and I need to write them down in the form $$ \frac{d\mathbf{x}}{dt} = f(\mathbf{x},t,\mu) $$ Where $\mu$ is some parameter and $\mathbf{x}$ is a high...
$$ \begin{cases} u_t=f(u,v,\nabla{v}),\\ \Delta{[g(u)v]}=0. \end{cases}$$ I want to solve the above PDE system by a mixed FEM, that is, $u_t=f(u,v,\nabla{v})$ by discontinuous Galerkin (DG), where $f$ doesn't depend on $\nabla{u}$, and $\Delta{[g(u)v]}=0$ by continuous Galerkin (CG). The key is that in the true soluti...
I wish to solve an equation like the following, $$\frac{\partial f}{\partial t}+\frac{\partial}{\partial x}\left(A(x)f\right)=S(x,t)f$$ where $A(x,f)f$ and $S(x,t)f$ are the advection and the source terms. When I naively try to incorporate the source term while discretizing the advection part via an upwind scheme, for ...
When we solve some boundary value problem by Finite Element Method, the appropriate system of linear equations is built, $$Ax=b.$$ Usually we use the solution x just for plugging it into some inequalities describing conditions which need to be satisfied, $$F(x)>0.$$ The solution itself does not interest us. And what if...
I have just learned basic FEM for 2D N-S euqation, now my teacher let me to do the following problem, the document of this problem is in large fluid problem, the system of equations is listed in that page, I don't even know what is the boundary condition, could you please recommend some textbooks or papers for solving ...
I am studying Numerical Methods for incompressible flows. part of the tasks is to model the lid driven cavity problem in 2D using the SIMPLE method. I have been provided with Fortran code that is working solved, however is for a channel flow problem. I was informed that by modifying the boundary conditions I can conver...
I created a simple model of cylindrical container to perform heat transfer simulation using FreeCAD for CAD modelling. I exported the model in stl format along with domain boundaries and faces. I have attached all the files here. I have been trying to mesh the container domain. I am using cyclic blockMesh first to crea...
I have been dealing with some conceptual flaws in my understanding of modelling, which I will elaborate herein. I am modelling conjugate heat transfer of a reciprocating fluid, which flows with velocity $u_{0} \sin(2 \pi f t)$, over a thick heated (heat input $Q$) solid of length $L$ and width $W$. I am initially model...
For example, if I have a matrix differential equation; $\frac{\partial y}{\partial t}=A(t).y$. Here my jacobian is the A(t) matrix. But what is derivative across the column or derivative across the row as it is mentioned in 'col_deriv'? I have tried both col_deriv=0 and col_deriv=1, but the result does not change.
I recently tried the isosurface extraction algorithm provided by the C++ library CGAL. This is new to me. It is based on Delaunay triangulations. I have some experience with the marching cubes, I tried to compare these two methods but it is not easy to conclude. Regarding the speed, I have the impression that there's ...
Let's consider two finite difference schemes for PDEs/ODEs. One is conditionally stable, the other is unconditionally stable. People always prefer unconditionally stable ones to conditionally stable ones because for the former one can take large steps. However, one needs to take small steps to get higher accuracy anyw...
Consider the advection/transport equation in 1D with constant velocity $a(x) \equiv 1$ $$u_t(t,x) + u_x(t,x) = 0$$ on a, say, periodic domain. On uniform grids $$ \{x_i\}_{i = 1, \dots, N}, \quad x_{i +1} - x_i = \Delta x, \forall \:i = 1, \dots N-1 $$ first order Finite Difference with Upwind approximation/Backward Fi...
So I have implemented central finite difference method for solving the 2D heat equation. When I leave all initial and boundary conditions as 0s, but apply an input uniform across the entire space or grid, I am only noticing temperature response at the boundary. I am not sure exactly what is causing this. The code is he...