Hot answers tagged

5 votes
Accepted

Common nodes in two FEM grids

Hashing floating-point numbers can indeed lead to weird results, especially if the node positions can be perturbed by some small amount or if there are denormalized values. You included the Python ...
Daniel Shapero's user avatar
5 votes

What makes a good computational grid?

From a performance view, you are always interested in preserving as much 'structure' in your grid as possible. Computations on a simplex- or a hexaedral mesh, where every cell looks like the next will ...
MPIchael's user avatar
  • 2,621
4 votes
Accepted

Grid dependence of a numerical model

Your numerical solution is probably just getting more accurate as you increase the number of grid points. Do you know or have you tried to derive the analytic (exact) solution for this problem? By ...
Savithru's user avatar
  • 343
4 votes
Accepted

Generating a non-uniform grid

You achieve this with equidistribution to a mesh density function $\rho(x)$. If you consider $x$ as a continuous map from $\xi \in [0,1]$ into your domain $[0,L]$, then the statement $x$ ...
Steve's user avatar
  • 541
4 votes

Dynamically ending ODE integration in SciPy

The solution is https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html From the documentation : ‘RK45’ or ‘RK23’ method for non-stiff problems and ‘Radau’ or ‘BDF’ for ...
q than a's user avatar
4 votes

Choice of grid generation for FDM discretisation methods

Your question mentions both space and time discretization and the problems that can arise due to different choices of one or the other. I think that you might be conflating problems that come from the ...
Daniel Shapero's user avatar
3 votes

Access optimized data structure for representing integer lattice

In essence, you are asking whether you can enumerate the integer lattice sites within your domain from $1$ to $N$ in such a way that accessing the east/west/north/south neighbors of a location $n$ ...
Wolfgang Bangerth's user avatar
3 votes
Accepted

Is there an advantage of using a staggered grid over a regular one when combined with high order methods?

Let me formulate my remark as an answer (and make it more precise): My experience and knowledge is that to use collocated grids with any standard (lower or higher order) methods for this problem, ...
Peter Frolkovič's user avatar
3 votes

Alternative to messy grid node indexing within multiple layers of loops

This is not a good way to do modern programming for many reasons. First of all, as you pointed out, this kind of code is hard to read and maintain. Secondly, this tends to be done in old versions of ...
Chris Rackauckas's user avatar
2 votes

Quadtree type Grid

Writing C++ code from the ground up for adaptive mesh refinement (as part of a PDE solver) is a relatively complicated endeavor and can easily involve thousands of lines of code for even simple ...
James's user avatar
  • 1,869
2 votes
Accepted

Converting mass density to point mass approximation on a grid

It seems like you are inventing Barnes-Hut-type algorithm, which is a fundamental accelerated algorithm for n-body simulations. It follows a similar logic: you combine masses on a grid. But, it is ...
Anton Menshov's user avatar
  • 8,592
2 votes

Grid mapping from Tchebyshev

In the section about adaptive Methods Chapter 16. in "Chebyshev and Fourier Spectral Methods" from John P. Boyd several different coordinate transformations together with their application in ...
Bort's user avatar
  • 1,275
2 votes

Finite Difference Grid Spacing and Scaling

Let's assume the following heat transient heat transfer equation in 1D : $$ \frac{\partial T} {\partial t} = \alpha \frac{\partial^2 T}{\partial x^2} $$ If we take its finite difference ...
BlaB's user avatar
  • 1,147
2 votes
Accepted

How to refine the tetrahedron if exist two longest length edge?

The easiest thing is to ensure a consistent (although arbitrary) tie-breaking scheme. If your nodes/vertices indexed, this usually means preferring the split edge with the lowest index of its lowest ...
Alex's user avatar
  • 231
2 votes

Mapping derivative information in uniform to non-uniform grid

Use the chain rule to get the derivative on the non-uniform grid, $\frac{dy}{d\zeta}$: $$ \begin{align} \frac{dy}{d\zeta} &= \frac{dy}{dx} \frac{dx}{d\zeta}\\ &= \frac{dy}{dx} \cdot 2 \zeta \...
Savithru's user avatar
  • 343
2 votes

Access optimized data structure for representing integer lattice

You can probably speed things up a little bit by storing the array in 4x4 square subarrays so that each of them fit in cache line (64 bytes = 4x4 32-bit integers). This changes the probability ...
Ark-kun's user avatar
  • 131
2 votes

What makes a good computational grid?

The best choice for a numerical grid is the one that will most accurately approximate the solution to your problem (without being too computationally expensive). But beyond that the specific features ...
Superbee's user avatar
  • 211
2 votes

Grid Independence Study

You've almost certainly got to reduce the timestep to maintain stability due to the CFL condition imposed by your explicit timestepping method choice. That being said, for benchmarking purposes, I'd ...
Bill Barth's user avatar
  • 10.9k
2 votes
Accepted

Overlapping 1D grids

Assuming that the arrays are passed already sorted (which is a reasonable assumption since you are starting from two 1D grids), I have a solution which is $\mathcal{O}(n+m)$ where $n$ and $m$ are the ...
Abdullah Ali Sivas's user avatar
2 votes
Accepted

Restriction in (geometric) multigrid for vectors of non-even length

I have found what I was looking for in Wesseling's book: An introduction to multigrid methods. For vectors with an even number of elements, a cell-centered approach is employed where coarser grid ...
lightxbulb's user avatar
2 votes
Accepted

Grid walk vs. uniform random weights for bounded grid

Not every method that seems reasonable leads to an algorithm that is competitive. In your case, if you want to draw uniform random numbers from $[0,1]^2$, you could use a method that is based on ...
Wolfgang Bangerth's user avatar
1 vote

Calculations on discontinous grids

I am not an expert on this question (I used finite elements mostly as a student) but I did use finite differences with a 2D uneven grid recently. My intuition is that, if you use the right ...
PC1's user avatar
  • 436
1 vote

can you give me some information of tools for load reblance

I found the ParMetis have what I want and easy to use.
Xu Hui's user avatar
  • 323
1 vote

Grid Independence Study

As pointed out in the comments, the CFL condition dictates how big timestep can be. Therefore as we progressively refine in space, we would be required to take smaller time steps if an explicit ...
Sudharsan Madhavan's user avatar
1 vote

Is it possible to resample grid in such a way so that continuous objects remain continuous?

I think the problem is that you've lost the topology upon the first rasterization: | 0 | 1 | 1 | 0.5 | 0 | could be ...
iliar's user avatar
  • 253
1 vote
Accepted

Good C, C++ library for efficient grid search / tuples, ideally with bindings to Eigen

I would second the opinion expressed in the context. For that small problem and limited usage, you don't need a library. Generation of a structured grid and retrieving points can be coded up in at ...
Anton Menshov's user avatar
  • 8,592
1 vote

Three dimensional irregular grid data interpolation to regular grid

For scattered data at points with no structure, try inverse-distance-weighted-idw-interpolation-with-python. This combines scipy's fast K-d_trees with inverse-distance aka radial kernels: $\qquad ...
denis's user avatar
  • 912
1 vote
Accepted

Efficient Representation of (spatially sparse) spatial time series

The dataset is huge. So I would like to be more memory-efficient. The main point to consider is the following: […] most of the cells will be “unactivated”, i.e most of the elements of the matrix will ...
Wrzlprmft's user avatar
  • 2,022
1 vote

Balancing core load when number of particles in cells vary (PIC on GPU)

You ought to be interested in this preprint in which we discuss exactly the sort of questions you seem to be having: https://arxiv.org/abs/1612.03369
Wolfgang Bangerth's user avatar
1 vote
Accepted

Finite Volume Polar Discretization: Lengths

Your cells are not infinitesimally small so it will be a bit more complicated than either formulation you have there. (The ``width'' of your finite volume cell varies nontrivially over the cell, so we ...
nukeguy's user avatar
  • 158

Only top scored, non community-wiki answers of a minimum length are eligible