Most Popular

1500 questions
13
votes
2 answers

How to work with function pointers in Fortran in scientific programs

Here is a typical usage of function pointers in C. I would like to do something similar in Fortran. I have some ideas, but I would like to know if there is some canonical way to do so. The function pointers and contexts passed in by the user are…
Ondřej Čertík
  • 2,930
  • 18
  • 40
13
votes
1 answer

What are possible methods to solve compressible Euler equations

I would like to write my own solver for compressible Euler equations, and most importantly I want it to work robustly in all situations. I would like it to be FE based (DG is ok). What are the possible methods? I am aware of doing 0th order DG…
Ondřej Čertík
  • 2,930
  • 18
  • 40
13
votes
2 answers

Why can ill-conditioned linear systems be solved precisely?

According to the answer here, large condition number (for linear system solving) decreases the guaranteed number of correct digits in the floating point solution. Higher order differentiation matrices in pseudospectral methods are typically very…
Zoltan Csati
  • 822
  • 4
  • 21
13
votes
5 answers

What are the benefits and drawbacks inherent to using classes to encapsulate numerical algorithms?

Many algorithms used in scientific computing have a different inherent structure than algorithms commonly considered in less math-intensive forms of software engineering. In particular, individual mathematical algorithms tend to be highly complex,…
Ben
  • 1,493
  • 1
  • 12
  • 29
13
votes
2 answers

Solving a least squares problem with linear constraints in Python

I need to solve \begin{alignat}{1} & \min_{x}\|Ax - b\|^2_{2}, \\ \mathrm{s.t.} & \quad\sum_{i}x_{i} = 1, \\ & \quad x_{i} \geq 0, \quad \forall{i}. \end{alignat} I think it is a quadratic problem which should be solvable with CVXOPT, but I can't…
tillsten
  • 324
  • 3
  • 9
13
votes
4 answers

Efficient interpolation method for unstructured grids?

I would like to know a good method for interpolating data between two unstructured grids, where one grid is a coarser version of the other. Efficiency is very important to me since I'm solving a transient PDE problem where I need to transfer data…
Bernardo M. R.
  • 673
  • 5
  • 9
13
votes
5 answers

How can I approximate an improper integral?

I have a function $f(x,y,z)$ such that $\int_{R^3} f(x,y,z)dV$ is finite, and I want to approximate this integral. I'm familiar with quadrature rules and monte carlo approximations of integrals, but I see some difficulties implementing them with…
Paul
  • 12,045
  • 7
  • 56
  • 129
13
votes
1 answer

Non-monotonic convergence in fixed-point problem

Background I am solving a variant of the Ornstein-Zernike equation from liquid theory. Abstractly, the problem can be represented as solving the fixed point problem $A c(r)=c(r)$, where $A$ is an integro-algebraic operator and $c(r)$ is the solution…
Endulum
  • 735
  • 3
  • 9
13
votes
2 answers

Which Runge-Kutta method is more accurate: Dormand-Prince or Cash-Karp?

I simply want to know whether the Dormand-Prince Numerical Method or the Cash-Karp Numerical Method is more accurate.
ABBC
  • 233
  • 2
  • 6
13
votes
4 answers

Is C slower than Fortran on the spectral norm shootout (using gcc, intel and other compilers)?

The conclusion here: How much better are Fortran compilers really? is that gfortran and gcc are as fast for simple code. So I wanted try something more complicated. I took the spectral norm shootout example. I first precalculate the 2D matrix A(:,…
Ondřej Čertík
  • 2,930
  • 18
  • 40
13
votes
3 answers

Blaze linear algebra library?

The paper "Expression Templates Revisited: A Performance Analysis of Current Methodologies" in SIAM Journal of Scientific Computing references the "Blaze" linear algebra library. I haven't heard of it before, and can't seem to find online…
cjordan1
  • 805
  • 6
  • 16
13
votes
3 answers

Is it usual to have no convergence checking in Multigrid?

I just read Chapter 3 in "A Multigrid Tutorial" by Briggs/Henson/McCormick, link. The text is about Multigrid cycles such as V-cycle, mu-cycle, FMG. What caught my eye: In most iterative procedures one checks whether it has converged to the desired…
Michael
  • 1,463
  • 11
  • 22
13
votes
1 answer

Can an approximated Jacobian with finite differences cause instability in the Newton method?

I have implemented a backward-Euler solver in python 3 (using numpy). For my own convenience and as an exercise, I also wrote a small function that computes a finite difference approximation of the gradient so that I don't always have to determine…
Stephen Bosch
  • 231
  • 1
  • 6
13
votes
3 answers

Finite elements on manifold

I'd like to solve some PDEs on manifolds, say for example an elliptic equation on a sphere. Where do I start? I'd like to find something that use preexisting code/libraries in 2d , nothing so fancy (for the moment) Added Later : Articles and…
J.C.
  • 133
  • 5
13
votes
4 answers

Visually appealing ways to plot singular vector fields with matplotlib or other foss tools

What is the best way to get a visual appealing plot of a singular vector field (if you want to visualize also the field strength). As an example I am playing with the electric fields of two point charges as in the following example: from pylab…
Julia
  • 293
  • 1
  • 5
  • 13