Questions tagged [computational-physics]
Computational physics is the study and implementation of numerical algorithms to solve problems in physics for which a quantitative theory already exists.
461
questions
42
votes
6
answers
9k
views
Are there simple ways to numerically solve the time-dependent Schrödinger equation?
I would like to run some simple simulations of scattering of wavepackets off of simple potentials in one dimension.
Are there simple ways to numerically solve the one-dimensional TDSE for a single ...
40
votes
23
answers
10k
views
Good examples of "two is easy, three is hard" in computational sciences
I recently encountered a formulation of the meta-phenomenon: "two is easy, three is hard" (phrased this way by Federico Poloni), which can be described, as follows:
When a certain problem is ...
25
votes
5
answers
6k
views
What language should I use when teaching an undergraduate course in computer programming?
Going to teach students of undergraduate level a course titled Introduction to Computer Programming. I am confused a bit. In Computational Physics scientists use C/C++ or Python or Fortran,CUDA etc.......
16
votes
1
answer
3k
views
Why is leapfrog integration symplectic and RK4 not, if the latter is more accurate?
In a system where energy theoretically should be conserved, the most accurate simulation would conserve energy (as well as giving accurate positions, velocities and etc). RK4 is more accurate than ...
14
votes
1
answer
2k
views
Conserving Energy in Physics Simulation with imperfect Numerical Solver
I am creating a C++ Physics Simulation where I need to move an rigid body through an acting force field.
Problem: simulation does not conserve energy.
Quesiton: abstractly, how is conservation of ...
14
votes
2
answers
450
views
Quality of linear congruential generators for random numbers
I'm doing some simulations of the Langevin equation, for various external forces. Being told that C's rand() from stdlib.h can ...
11
votes
2
answers
11k
views
How do I plot the surface of a 4D plot?
I am trying to plot the wave function for a particle in a 3D box. This requires me to plot 4 variables: x, y, z axes and the probability density function.
The probability density function is:
...
10
votes
3
answers
4k
views
Calculating the log-determinant of a large sparse matrix
I need to calculate $\log(\det (\mathbf M_i))$ where the $\mathbf M_i$'s are large sparse matrices, which are real, symmetric and positive semi-definite. I hope to have between $10$ and $100$ of ...
9
votes
4
answers
658
views
Finite-difference software for solving custom equations
Are there any good, easy to use, software for simulating the evolution of systems of generic differential equations? I know there are custom programs for various specific circumstances (such as ...
9
votes
3
answers
5k
views
Galerkin method: Test functions vs. Basis functions
I'm a novice to finite element and I'm finding quite hard to find the actual difference between Test function(s) and Basis function(s).
I would be glad if somone could explain me that and point out ...
9
votes
3
answers
2k
views
What are the differences between CFD simulations and realistic ocean/atmosphere model simulations?
The field of computational fluid dynamics (CFD) is dedicated to solving the Navier-Stokes equations (or some simplification of them). A subset of CFD, ocean and atmospheric models numerically solve ...
8
votes
3
answers
12k
views
Calculating partial trace of array in NumPy
A simulation I'm doing requires me to calculate the partial trace of a large density matrix. I am trying to calculate it using tools from numpy, but my code seems to be having some problems. For ...
8
votes
0
answers
580
views
DIIS method to accelerate SCF convergence for stretched geometries
I am implementing from scratch an Hartree-Fock calculation in the STO-3G basis set to perform Born-Oppenheimer molecular dynamics. I have a Restricted Hartree-Fock procedure that can reproduce very ...
7
votes
4
answers
1k
views
Euler integration of the three-body problem
Me and one of my colleague are trying to simulate the three-body problem with a C++ program in order to compare different integration schemes. At the moment we are trying to use the Euler's method, ...
7
votes
4
answers
807
views
Introductory book on computational physics [duplicate]
I'm currently working on my MS in CS and have developed an interest in astrophysics. Luckily one of my professors is a astrophysicist and is currently doing research through computational physics and ...
7
votes
1
answer
311
views
Why should I renormalize physical variables?
I am working with legacy physical codes and I develop new ones based on the output of them.
They all use their own internal normalization of variables (for example all distances are divided by the ...
7
votes
2
answers
5k
views
Efficiently finding all (x,y,z) points within certain distance of point P
I am using Python, and I have a Pandas dataframe with hundreds of thousands, if not millions, of $(x,y,z)$ coordinates. I am looking to find an efficient method to index the original dataframe so that ...
7
votes
1
answer
850
views
Putting N hard spheres randomly in given volume
I need to put $N$ spheres with given radius $R$ randomly in a Volume $[-0.5,0.5]^3$, without any overlap of spheres.
If I choose values so that all the spheres will occupy ~57% of the total volume, I ...
7
votes
1
answer
583
views
Solving a simple Schroedinger equation with Fast Fourier Transforms
While trying to solve a stochastic Gross-Piaevskii equation I have found a problem that can be tracked down to something buggy occuring in the simplest Schrodinger equation possible:
$\partial_t \psi ...
7
votes
0
answers
201
views
Is a complete bacteria simulation with an exascale supercomputer possible?
Will it be possible to simulate a complete (at least simple) bacteria atom by atom on an exascale supercomputer? or is it possible already today with the largest systems?
Here, I've read that ...
6
votes
4
answers
303
views
In Matlab, how can I be consistent with units?
I am modeling some aerodynamics equations and am using meters / centimeters, kilograms, and seconds.
I've heard that, "matlab doesn't know units". So, how can I make sure that it does? Just ...
6
votes
1
answer
698
views
Consumer hardware for scientific computing?
I'm interested in problems around probability, statistics, and statistical mechanics, and often I find it useful to perform simulations to get some sense of the underlying phenomena. Example ...
6
votes
1
answer
11k
views
How do I generate Maxwell-Boltzmann variates using a uniform distribution random number generator?
I am doing a molecular dynamics simulation. I need to assign initial velocities to the atoms. I want to assign the initial velocities which follow the Maxwell-Boltzmann distribution. How do I ...
6
votes
1
answer
2k
views
How are rigid bodies implemented in finite element codes
I am writing a finite element code for structural analysis, and I want to implement rigid bodies. How is this usually done? Say that I have a square mesh, with one half of the mesh being defined rigid ...
6
votes
1
answer
170
views
Eigenvalue problems with extremely small gaps
I'm interested in numerically diagonalizing a class of structured, symmetric eigenvalue problems with potentially extremely small eigenvalue gaps. The question I have is how to design a numerically ...
6
votes
1
answer
281
views
Pressure definition/convergence issues for the Incompressible Navier-Stokes when using a stabilized P1-P1 finite element formulation
I believe this might be a recurring topic, but i have not found a post that directly related to this issue.
I come from a finite volume background and my experience is more with predictor-corrector ...
6
votes
1
answer
2k
views
How to get proper parameters of SPH simulation?
I'm implementing basic fluid flow simulator using SPH method basing on e.g. https://www10.informatik.uni-erlangen.de/Publications/Theses/2010/Staubach_BA10.pdf.
EDIT (dead url): https://www10.cs.fau....
5
votes
2
answers
2k
views
Difference between MoM and FEM
Method of Moments and Finite Element Methods are two of the most used methods in computational electromagnetics to solve electromagnetic equations.
As it is known, in FEM sparse matrixes are used ...
5
votes
1
answer
1k
views
What determines the usual chemistry textbook plots of atom orbitals?
In elementary chemistry textbooks you often have pictures like the following one:
Are there any conventions how to get them?
I am not sure, but I guess that it are contour plots with only one iso-...
5
votes
1
answer
177
views
Mass matrix and BDF time integration
I have a system of nonlinear equations on the general form:
\begin{align}
\mathbf{M}(\bar{y})\dot{\bar{y}} =\bar{f}(\bar{y},t)
\end{align}
Where $\mathbf{M}(\bar{y})$ is a matrix and $\bar{f}$ is a ...
5
votes
1
answer
394
views
How can I apply Euler's Method to predict a point in time rotating around multiple axis'
I am xposting this from my original stackoverflow question where I was presented with a coding challenge that I have been able to narrow down extensively and I think it lies with Euler's Method.
Here'...
5
votes
1
answer
632
views
H(curl) conforming Nédélec-Elements to satisfy div(B)=0
Most authors are very clear that it's very dangerous to just use $\mathrm{H}(curl)$ conforming edge elements, which are divergence free, to satisfy $\mathrm{div}(\mathbf{B})=0$ and implement this ...
5
votes
1
answer
266
views
Are Python/MATLAB/Mathematica numerical eigenvectors affected by eigenvalue degeneracies outside region of calculation?
I have a discretized 2D mesh over which I calculate eigenvalues and eigenvectors of some
Hermitian 2 x 2 matrix at each point along a closed loop parameterized by parameter t. The eigenvectors are ...
5
votes
2
answers
1k
views
A Question About the Rhie-Chow Interpolation Used for Solving the Incompressible Navier-Stokes Equations on Unstructured Grids
When using the SIMPLE method on a mesh with a collocated variable arrangement, the following interpolation is used for the advecting velocities:
\begin{equation}
u_f = \overline{u}_f - \overline{D}_f\...
5
votes
1
answer
941
views
Help with Fourier beam propagation method
I am working on implementing the Fourier beam propagation method in C++. I am really more of a programmer than a physicist but I think I have a good understanding of what I am trying to do. Here is ...
5
votes
1
answer
586
views
General case Kutta condition
I'm working on a 2D inviscid fluid simulation using a "panel method", with Potential being used to enforce the no-through boundary condition. I'm trying to incorporate the Kutta condition, which says ...
4
votes
2
answers
1k
views
Why is it not computationally possible to accurately predict the weather that would occur after 14 days?
As per wikipedia, scientists have not been successful to accurately predict the whether which is 2 weeks ahead.
Here is the excerpt:
The atmosphere is a chaotic system, as a result, small changes ...
4
votes
3
answers
194
views
combination of field and particle methods for fluid dynamics
In numerical fluid dynamics there are field methods like finite-volume, finite-element, etc. and particle methods like Smoothed-Particle-Hydrodynamics – SPH and others. Both approaches have advantages ...
4
votes
1
answer
1k
views
How can I make velocity verlet algorithm more stable?
The answer to this question implies that reducing the time step would make it more stable. However I have tried reducing the time step but the system is still unstable(the total energy increases to a ...
4
votes
2
answers
165
views
Redefining velocity field to make it divergence free on the grid level
I am currently working with convection equation $\frac{\partial C}{\partial t}+u\frac{\partial C}{\partial x}+v\frac{\partial C}{\partial y}=0$. I assume that the velocity field is incompressible i.e. ...
4
votes
1
answer
662
views
Is my differential equation solving code wrong?
I am trying to simulate LLG equation without damping. The equation is
$$\frac{d\vec{m}}{dt} = \vec{m}\times\vec{H}$$
I am solving in spherical coordinates as LLG equation is known to have problems in ...
4
votes
1
answer
495
views
Absence of Discontinuity in Specific Heat Plot Simulated by Ising Model
I am working on 2D Ising model, when I plot "specific heat vs temperature", I can't see any discontinuity at critical temperature around Tc ~ 2.7K. I am enclosing results of all other thermodynamic ...
4
votes
1
answer
134
views
Rank-1 correction of matrix exponential
I need to approximate the following in $O(d)$ time for $d\times d$ diagonal $A$ and rank-1 $B$
$$u^T \exp(-A+B) v$$
Here $u,v$ are vectors in $\mathbb{R^+}^d$, $A,B$ are positive semi-definite and $B$ ...
4
votes
2
answers
2k
views
Time Reversibility of Velocity Verlet Algorithm
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 \...
4
votes
1
answer
118
views
Symplectic Algorithms for Hamilton’s Equations as opposed to just Volume-Preserving
this might be a silly question, but if we’re trying to numerically solve Hamilton’s equations with some discrete scheme, sometimes when the scheme preserves phase space volume (Hamilton’s eqns are ...
4
votes
1
answer
174
views
How to force potential boundary conditions in the Yee scheme for solving Maxwell's equations?
Assume that we have a 2D electromagnetic field (in the sense that: $E=(E_x,E_y,0)$, $B=(0,0,B_z)$, and all derivatives with respect to $z$ are $0$), and that we are considering a system made up of two ...
4
votes
3
answers
183
views
Mixing some particles together - "Game physics for engineers"?
I'd like to simulate how several particles mix together. For example, how do they settle when you throw them in a bucket? How do they assemble in zero-gravity? I might also want that they are "sticky" ...
4
votes
2
answers
356
views
Computational cost comparison of DNS and SPH
I may be incorrect, but it seems like commercial graphics codes typically use smoothed particle hydrodynamics (SPH) to produce stunning simulations and not continuum based methods. Why is this? Is SPH ...
4
votes
2
answers
2k
views
How to simulate basic semiconductor models using the Drift-diffusion model on Python?
I'm trying to simulate basic semiconductor models for pedagogical purposes--starting from the Drift-diffusion model. Although I don't want to use an off-the-shelf semiconductor simulator--I'll be ...
4
votes
2
answers
2k
views
Numerical Sensitivity in Density of States of Tight-binding model
I'm working with the tight-binding model, and I'm trying to learn the basics of how to compute the Density of States (DOS) $N(E)$ numerically.
The DOS is given by
$$N(E) = \frac{1}{N}\sum_k \delta(...