Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
84 views

Indexing Nested Loops in C [closed]

I am having trouble indexing correctly the below statement in C inside a function and then returning it as a pointer. The returning part should not be confusing - hopefully - however the indexing is a ...
2
votes
1answer
91 views

Monte Carlo Metropolis method - trial step algorithm

I'm working on a Magnetization simulation and writing an algorithm using the metropolis method. I am using a change in energy and a Boltzmann distribution, but, my question is about the trial step. ...
7
votes
1answer
359 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 ...
0
votes
1answer
278 views

The condition for stability using the leapfrog method

I have the ODE below $$\frac{d}{dt}\pmatrix{x\\ y} = \pmatrix{0 &1\\-a &0}\pmatrix{x\\ y} \enspace .$$ The $m=1$ leapfrog method is defined as: $$y_{n+1} = y_{n-1} + 2f_nh \enspace .$$ For ...
1
vote
1answer
416 views

Shooting method - Matlab ODE

I'm trying to solve these equations of hypersonic adiabatic flow over a flat plate. I did all the simplifications and got these equations for the stagnation point flow. $$\left(Cf''\right)' + f f'' = \...
1
vote
0answers
322 views

Is this the correct way to calculate the Madelung constant?

I'm trying to compute the Madelung constant of the ZnS lattice. The method is as follows: The lattice is a face-centered-cubic with basis $S^-: (0,0,0)$ and $Zn^+: (1/4,1/4,1/4)$. The Madelung ...
2
votes
1answer
288 views

ground state from the Schroedinger equation with a central potential what happens to the origin

I have code that attempts to implement a solution to the Schrödinger equation where there is a central potential (more or less im thinking of hydrogen), in 1-D using the numerov method to construct ...
7
votes
0answers
401 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 ...
4
votes
1answer
260 views

Fast Multipole Method in 3D

I am writing a FMM (Fast Multipole Method) algorithm in 3D. I generated the mesh and, currently, I am developing the expansion and the three (M2M, M2L, L2L) translation operators using spherical ...
3
votes
1answer
265 views

Efficient Implementation of Taylor Series for Sine

I am trying out a few forms of polynomial expression optimization, and I'd like to improve of what I've got, if anyone has anything they know is better. Implementation 1: $$x-\frac{x^3}{3!}+\frac{x^...
2
votes
2answers
300 views

2d Euler manufactured solutions

Where can I find manufactured solutions for the 2d Euler equations, with the complete analytical terms, including the Jacobian of the source term ?
3
votes
0answers
51 views

Coupled Diff Equation from Bose Einstein distribution

I am a student doing physics hons and have had very little experience in programming. This semester we are supposed to do a computational project in thermodynamics. I have to solve these two coupled ...
1
vote
2answers
86 views

Propagation of error using Euler's first order method [duplicate]

I was estimating a falling object's position versus time by using a simple first order step function, where ...
3
votes
1answer
312 views

How to model the mixing of two fluids in a container?

In the context of a research project of mine, I am faced with the difficult task of modeling the mixing of two fluids in a container. I would like to achieve the following: Given a container (...
1
vote
0answers
78 views

Time dependent self-consistent equations

I am facing the following problem. I need to solve numerically a set of coupled equations $$i\frac{d}{dt}f_{n}^{(i)}(t) = \left[U\cdot n(n-1) + \mu\cdot n\right]f_{n}^{(i)}(t) - \sqrt{n+1}\Phi_i^{*}\...
1
vote
0answers
668 views

BiCopter simulation in Matlab

I derived a bicopter dynamical model with two servos and two BLDC motors. And now am trying to simulate it using Matlab. As base for simulation I used this paper and this code Unfortunately, the ...
6
votes
2answers
3k 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 ...
2
votes
0answers
240 views

Implementation of no-slip boundary conditions in lattice Boltzmann method fluid simulation

My faculty advisor recommended that I take a look at the lattice Boltzmann method as an introduction to scientific computing and potentially an undergraduate honors thesis topic. I cooked up a some ...
2
votes
1answer
264 views

I need to scale variables to solve a 2D PDE. What are the physical considerations of scaling?

I am solving a boundary value problem in 2D via an implicit finite difference scheme. Unfortunately, although the problem is well-posed and should have a unique solution, the condition number of the ...
2
votes
0answers
68 views

Method for calculating the stopping distance using only integers

I am trying to find how much an engine would turn until it stops accelerating with an acceleration of $a = A \sin^2(x)$. Acceleration Integrating the acceleration I get velocity $v = A(x/2 - \sin(...
3
votes
1answer
250 views

Finite Difference Beam Propagation Method problem

I am trying to implement the finite difference beam propagation method to study the propagation of a TE light signal through a waveguide. However, my solutions are exponentially growing, and display ...
1
vote
0answers
72 views

fixed point iteration to find out second order non-linear diff equations

I am working on some model analysis, getting two diff equations and after I convert them into matrix form, I have equations looks like $$ [A][X]=C\times\big(\exp([B][X])-1\big), $$ where $C$ is a ...
3
votes
2answers
112 views

Boundary conditions for solving Poisson's Equation with Experimental Data

I want to numerically (with Matlab) solve Poisson's equation : $ \frac{\partial^2u}{\partial x^2} + \frac{\partial^2u}{\partial y^2} = f(x,y)$ On a rectangular domain using experimental data. From ...
3
votes
1answer
107 views

Solve implicit ODE numerically in orbit simulation

I'm trying to plot the orbit of a compact binary star system where general relativistic effects become important. I'm using post-Newtonian approximation and I want to solve the orbit numerically based ...
5
votes
1answer
340 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 ...
4
votes
1answer
5k 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 ...
0
votes
1answer
105 views

How many sample points are needed when re-constructing linear combination of 2D polynomials defined over unit circle?

I have a set of first 25 Zernike polynomials. Below are shown few in Cartesin co-ordinate system. z2 = 2*x z3 = 2*y z4 = sqrt(3)*(2*x^2+2*y^2-1) : : ...
3
votes
1answer
798 views

Computer Build for Scientific Computing

I am currently a .NET software developer(SQL Server, ASP.NET, C#, MVC & Web Forms). In my spare time I'm researching different areas of environmental science. E.g.(Hydrology, Ecology, Atmospheric ...
2
votes
0answers
574 views

Precession of Mercury Python simulation

I was trying to simulate the precession of Mercury based on the perturbed solution: $$\frac{1}{r}=\frac{m}{B^{2}}(1+e\cos\phi+3\frac{m^{2}}{B^{2}}(1+e\phi \sin\phi +e^{2}(\frac{1}{2}-\frac{1}{6}\cos2\...
1
vote
0answers
99 views

Conservation at grid interface in adaptive mesh refinement

I am using adaptive mesh refinement to solve one dimensional inviscid Burgers equation. However I am facing some difficulty to handle grid interfaces which are not uniform (coarse-fine grid interface)....
3
votes
2answers
1k views

GPU-enabled Lattice Boltzmann solvers?

Is anybody aware of any GPU-enabled Lattice Boltzmann solvers (preferably on C++/OpenCL and open-source) that would be recommended? I have found Advanced Simulation Library, but it seems to be very ...
0
votes
0answers
93 views

How to keep velocities in check in molecular dynamics simulation?

I am trying to make a very simple molecular dynamics simulator with Reflective Boundary Conditions. I am assigning the initial positions in a cube randomly while making sure they are not too close to ...
3
votes
1answer
422 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 ...
1
vote
0answers
529 views

radially averaged power spectrum of a binary image does not look like power law

It has been known that Fourier power spectrum somehow obeys power law therefore the slope of the spectrum can be used to calculate the fractal dimension of an image. Many people have used it for ...
5
votes
2answers
643 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\...
2
votes
0answers
176 views

Modeling simple laser induced population transfer via adiabatic passage in python

I'm trying to model adiabatic passage between two levels in a three-level atom interacting with two laser fields using Scipy and Numpy.. I'm not sure if my model is wrong due to my incorrectly ...
0
votes
1answer
79 views

Mechanics - Rotational Inertia

I am facing a problem solving a mechanical system which is shown in the scheme below. We assume that coupling of the two shafts is done with a clutch Equations: $$J1*\frac{d\omega1}{dt} + Td(\...
3
votes
1answer
78 views

Is there any numerical application whose performance heavily depends on the division operation?

I am an undergraduate student majoring in computer science. Recently, I am interested in the division operation, which is not directly supported by some architectures. While some architectures ...
1
vote
0answers
222 views

Spin-spin correlation functions in the Ising Model Monte Carlo

I'm using the Metropolis algorithm for 2D up to 5D for the Ising Model and I want to compute the spin-spin correlation function. $$c(r)=<s_is_r>−〈s_i〉〈s_r 〉$$ but I'm not sure how to estimate $...
0
votes
1answer
114 views

Solving differential equations in MAPLE (ballistic curve problem) [closed]

TASK: Make a simple animation of an object shot from a catapult. Object is moving through a medium. The problem must be solved in MAPLE. NARROWING OF THE PROBLEM: 2D problem consider atmospheric ...
4
votes
2answers
522 views

Manufactured solution for pressure based 3d incompressible Navier-Stokes solver with wall boundaries

I already successfully verified my solver (SIMPLE-type FVM-method) with the following manufactured solution (3d Taylor-Green vortex) on the solution domain $[-1,1]^3$ with Dirichlet boundary ...
2
votes
0answers
128 views

Arbitrary Choosing of the Solution Domain - Navier Stokes and Manufactured Solutions

I want to verify a finite-volume solver (SIMPLE-Algorithm) for the incompressible Navier-Stokes equations by using a manufactured solution. I use Dirichlet boundary conditions for the velocity at all ...
4
votes
1answer
343 views

Is solving Verlet constraints parallelizable?

I am a computer science student and I came across the Verlet Cloth simulation. An implementation is here. I was interested in how such computation would lend itself to parallelization. The problem ...
3
votes
0answers
90 views

Tracking the speed of 2D oscillations on a lattice

I wrote a Monte Carlo simulation of the 2D Lotka-Volterra model on a discrete lattice (with periodic boundary conditions). A video that I produced (which images the system after some number of monte ...
0
votes
1answer
67 views

Unexpected behavior, values tend to converge instead of fluctuate. (MD)

I am writing a molecular dynamics program to create an lattice and populate it with atoms/molecules. These then are given random velocities and the system is initialized. Then throughout time the ...
1
vote
0answers
567 views

Can you provide me with the source code of DMRG writen by C++?

I want to study the Density matrix renormalization Group(DMRG). Can some one provide me with the souce code which is writen by C++ for study purpose only? The code is not necessiary very professional, ...
0
votes
1answer
114 views

MAX-SAT and MAX-cut

I have been using MAX-SAT solver to obtain the exact ground state of ising spin glass model: For 1D periodic model, for systems with 50 binary variables and interaction range of 15th nearest ...
1
vote
0answers
280 views

Two Dimensional Nozzle Flow

I've been looking at the book "Computational Fluid Dynamics - The Basics With Applications", by John D. Anderson, and his solution for the one-dimensional subsonic-supersonic nozzle flow using the ...
2
votes
1answer
91 views

Adjusting Keplerian orbits for thrust with numerical stability

I'm writing a mod for a game that models orbital physics (Kerbal Space Program, or KSP). I'm attempting to model the effects of thrust on spacecraft in certain states where the game only models them ...
1
vote
1answer
88 views

How to calculate collision force with no future knowledge

For a personal project, I am attempting to write a fairly realistic collision simulator (for relatively large objects, not quantum stuff). As I was consulting my physics textbook and various online ...