# All Questions

9,335 questions
Filter by
Sorted by
Tagged with
5 views

### Algebraic multigrid as solver and as preconditioner

My question is around the efficiency of AMG. In which case AMG can perform better,as solver or as a preconditioner(for example a Krylov space method as CG)? Assume the case of elliptic pdes.
8 views

11 views

### How to convert this code to scan random datas instead of binned datas?

I am new to fortran and I am trying to write a code using random datas instead of binned datas in x, y, z as shown in my sample code. ...
32 views

### Implementing Dirichlet BC for the Advection-Diffusion equation using a second-order Upwind Scheme finite difference discretization

i am implementing a Matlab code to solve the following equation numerically : $$(\frac{\partial c}{\partial t} =-D_{e} \frac{\partial^2 c}{\partial z^2} +U_{z}\frac{\partial c}{\partial z})$$ with ...
22 views

### Estimating the Jacobian in Harmonic Balance Method

I am trying to solve a set of ODEs using the Harmonic Balance method. In order to do this, I need to compute the Jacobian of the set of equations. However I am very confused regarding the dimensions ...
26 views

### “This DAE appears to be of index greater than 1” daeic12 (line76) error code

Hi I am trying to solve a set of pde converted into ODE and DAE using central finite difference method. I have used the MATLAB 'solve' command to determine the coefficients of fictitious nodes for ...
98 views

### Exponent log to compute reciprocal power?

A MATLAB library seems to overcomplicate a computation: exp( (log(a) - log(b))/b ) which is mathematically equivalent (assuming real & positive ...
93 views

### Quick way to find a common basis of eigenvectors between 2 matrices : valid or not?

Following the advise of @Federico Polonion a previous post, one suggested, to find a basis of common eigen vectors between 2 matrices, to simply do : Generate 2 ...
29 views

### Calling scipy.integrate.odeint, solve_ivp, or any possible python solver in matlab

Do you know any way to call scipy.integrate.odeint, solve_ivp, or any python solver directly within a Matlab code? I have tried ...
54 views

### Understand the need for Welford's online algorithm

I am puzzled by the Wikipedia entry discussing many online algorithms for computing the sample variance, including the Welford's online algorithm. In particular, the sample variance $s_n^2$ can be ...
26 views

### What is the issue with my Code here? [closed]

I am trying to read in a CSV file for one of my boundary condition in OpenFoam, but for some reason OpenFoam is not reading the file. There is no error message or anything, it just not showing the ...
66 views

### Compute 1st derivative with backward difference approximation in python

I am trying to write a function to compute 1st derivative with backward difference approximation. $u'(x_i) = \frac{u(x_i) - u(x_i - \Delta_x)}{\Delta x} \equiv D_- u(x_i).$ And for the first point, ...
133 views
+100

### Matlab - Compute approximative common eigenvectors basis between two matrices as a function of tolerance

I am looking for finding or rather building common eigenvectors matrix X between 2 matrices A and B such as : ...
57 views

### Technique to find the CFL condition using the Galerkin method in space and finite-difference in time?

I am using the Galerkin method (Discontinuous to be precise) to discretize in space the scalar linear wave equation and the explicit second order centered finite difference scheme to discretize in ...
55 views

### Backwards Difference Implicit Method for Nonlinear Parabolic PDE in Python

Original Stack Overflow Question: https://stackoverflow.com/questions/65683788/indexerror-index-31-is-out-of-bounds-for-axis-1-with-size-31?noredirect=1#comment116218335_65683788 PDE: u_t = u_xx + u(...
36 views

### Integrating a wavelike equation with absorbing boundary conditions

I am trying to numerically solve the following equation: $\frac{\partial^{2} \phi}{\partial t^{2}}-\frac{\partial^{2} \phi}{\partial x^{2}}+V(x) \phi(x, t)=0$ On some domain, with: $\phi(x, 0) = I(x)$ ...
61 views

### Gauss Integration of $\sqrt(x)$

I want to construct a gauss integration for the weight function $w(x) = x^{1/2}$ for $$\int_{0}^{1}x^{1/2}f(x)dx = a_{1}f(x_{1})+a_{2}f(x_{2})$$ Solving \begin{align*} a_{1}+a_{2} =& \int_{0}^{...
49 views

### 3D Matrix (Tensor) Operating On a 1D Vector

Say you have a tensor $T$ and the components are represented by a 3 by 3 by 3 matrix. And you want to use that tensor to map a vector $u$ into a new vector $s$, both of which are 3 by 1 column vectors....
21 views

### Help in agglomerating a mesh with Metis?

I have got a mesh of triangles (for a finite element code) that I'd like to partition into polygons, much better if convex. I tried metis and it is very complicated but powerful if one knows about ...
24 views

### Split classroom sizes in half linear integer programming

I work for a school who is looking to split students into two groups for COVID related reasons. Ultimately we need to split the students by class section and try to keep families to be in the same ...
125 views

### Parametric nonlinear programming

I believe, I have a parametric nonlinear optimization problem. The non-convex constraints depend on some parameters, and I seek a solution that satisfies these constraints for all parameters in a ...
104 views

### Solving PDEs in parallel

I have read different approaches on how to solve pdes in parallel which are discretized using finite element method. For example: Non-overlapping domain decomposition approach as mentioned in https://...
44 views

### Error too large in leapfrog method for solving the wave equation of a vibrating string

I have been trying to figure out what I did wrong for the last two days. I do not know if I actually did something wrong or if the error is supposed to be this large in usual leapfrog problems. I ...
36 views

### Finite element analysis software for acoustic and electrostatic

I need to do a simulation for my thesis project involving some piezoelectric nanoparticles in a fluid beamed with ultrasounds. I'm looking for a software for such simulation and for now it seems me ...
82 views

### Efficiently compute a projection matrix from Householders reflectors

Let $A \in \mathbb{R}^{m \times n}$ where $m \geq n$. Let $B$ and $\tau$ be the result of applying LAPACK's dgeqrfp method (R on the upper right triangle, and the ...
52 views

### Interpolation of a Concave Mesh

I would like to have an algorithm that interpolates the values attached to nodes in a concave mesh mesh. To be me precise, assume we have a point cloud P (e.g. in 3 dimensions) and a list of edges E ...
13 views

### How to define "Characteristic length in Ansys CFX Power Syntax script?

I am trying to evaluate Reynolds number in Ansys CFX 2020 R2 using CCL/Perl script on different domains in a radial turbine. But for that, I need to define the Characteristic length. So I define the ...
9 views

### Different values of Gaussian Integration in Pracma library in R

I want to construct a gauss integration for the weight function: $$w(x) = x^{1/2}$$ $\in(0,1)$ of the form: $$\int_{0}^{1}x^{1/2}f(x)dx = w_{1}f(x_{1})+w_{2}f(x_{2})$$ \begin{align*} w_{1}+w_{2} =...
34 views

### N-body correct scaling

I realized an usual way to scale an N-body problem for an N-body simulation is by choosing units such that gravitational constant $G = 1$, but I'm probably doing it the wrong way. Suppose I simply ...
56 views

### How to compute gradient of each node in finite element method?

I have a problem with computing gradient of each node in finite element method. I can get the value of each node. But how can I get the gradient? I know $u = \sum u_i \phi_i$ where $\phi_i$ are the ...
134 views