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.

Filter by
Sorted by
Tagged with
0
votes
0answers
38 views

Does the leap-frog algorithm conserve energy for n-body problems?

The leap-frog algorithm is able to conserve to a certain extent the energy of a system, which flucutates as a cosine around a stable value. Is this true if we apply the algorithm to a n-body ...
0
votes
0answers
11 views

How to solve nonlinear second order ODE in Matlab? [duplicate]

I am working on simulating a car suspension system using Matlab. Specifically, I have to derive equation of motion using the Lagrange method and then use ode 45 to solve it. However, while using ...
2
votes
1answer
86 views

Changing randomly a unit vector

For studying a spin model on a lattice, I have to generate a random unit vector starting from a pre-exstisting one. There are multiple ways to do it, but the book I use suggests generating a random ...
1
vote
0answers
49 views

Reproducing a paper's result for Topological Insulators

For the past weeks I have been trying to reproduce Agarwala's results but I've been unsuccessful. From this paper I am trying to reproduce the first and last columns of Fig.2, by implementing eq.2; ...
1
vote
2answers
130 views

Dyadic operations, fourth order tensors and Tensor algebra

I am trying to understand the dyadic operation for a while since I am interested in Elasticity problems. I believe an intuitive understanding (rather than assuming) will give me good problem solving ...
0
votes
0answers
70 views

How to distinguish primary hosts (stars) and orbiting satellites (planets) and tertiary bodies (moons) by their mass and trajectory?

I posted this question in the astronomy stackexchange. There are no responses, and it was suggested that I pose the question here. The "too long, didn't read" was taken from a comment, and ...
0
votes
1answer
48 views

Is there a unit of measure for computational complexity; through quantum computers? [closed]

I'm concerned with trying to determine whether the same computational processes on a Turing computable algorithm can be ascertained for a quantum computer in some form of actual 'metric' for how many ...
3
votes
2answers
199 views

OpenMP: parallelizing calculation of pair interaction forces

I recently started to learn OpenMP. Albeit I have developed some intuition I still have some doubts on how to proceed under certain circumstances that are very useful for computational physicists. My ...
0
votes
0answers
52 views

Can I get a symbolic solution for these coupled ODEs?

I found this IPython notebook called ‘Roller Coaster’ from", "numfys.net, where they model the movement of a ball over a path described by a third-degree polynomial $y(x)$ with slope $\...
0
votes
0answers
40 views

Comparison of computational complexities of MD versus MC simulations

In my humble understanding MD simulations of systems with short-range(like LJ interactions) and long-range(electrostatic) has a computational complexity $O(N . log(N))$. What will be the computational ...
3
votes
2answers
107 views

Efficient schemes for solving the extended Saddle point problem

I am interested in knowing some efficient techniques for solving the following extended Saddle point problem. \begin{align} \begin{bmatrix} A & B^T & C^T \\ B & 0 & 0 \\ C & ...
3
votes
1answer
140 views

Finite element method for high-frequency electromagnetics

I am writing a project about the Finite element method for use in high-frequency solutions of Maxwell's equations. This could be for use in antenna design and similar. I have some trouble ...
0
votes
1answer
169 views

N-body problem with differents solvers (RK2, RK4, Euler symplectic, Stormer-Verlet) : planets drift to infinity

I'm trying to write an integrator for the 2 and 3-body problem. I choose to start from a generalisation to N-body problem so I can just pass my bodies to the same integrator in the two cases. I'm ...
1
vote
0answers
106 views

Solving coupled PDEs with self-consistency condition

I am figuring out how to attack a problem (the Usadel equations of superconductivity) in which I need to solve a set of nonlinear PDEs for the fields $\{G_i (r)\}$ $$ U(G_i(r), \nabla G_i(r), \Delta(r)...
2
votes
2answers
121 views

Generating particles from a distribution function using Monte Carlo

I have been given a 4D ($x, y, v_x, v_y$) distribution function, $f(x,y,v_x, v_y)$, generated by an external code. I want to generate a set of particles from this distribution function, say 10k ...
-1
votes
1answer
99 views

Implementation of Source Panel Method as Described in Katz Plotkin Book

I am currently trying to implement Source Panel method as described in Katz and Plotkin in Low Speed Aerodynamics. I have successfully implemented two previous methods. However, I am fully blocked on ...
0
votes
2answers
82 views

Integrate a function from samples using computer codes

I have a function $c ( I (\vec{r}) )$. Not a constant, $c$ doesn't denote a constant. So $c$ is a function of $I$ which is a function of $\vec{r}$. $I$ is an intensity (W/cm2). This $c$ is hard to ...
1
vote
2answers
166 views

How can I learn Scientific Python?

I am an intermediate user of Matlab and Mathematica, but I would really love to start learning Python language for scientific purposes (I am interested in Maths and Physics). Could please someone ...
0
votes
1answer
702 views

Saving Data in Multiple Columns with np.savetxt

I have managed to write the following code for the following problem: Projectile's horizontal and vertical displacement are given by: $$ x = v_0 \, t \cos(\theta) $$ $$ y = v_0 \, t \sin(\theta) - \...
0
votes
2answers
111 views

Numerically solving the equation of motion for inflation in cosmology

I want to solve the equation of inflation involving a scalar field numerically using Python libraries such as odeint or scipy. ...
0
votes
1answer
99 views

Good method for correlated samples and estimating autocorrelation times

I'm working on a Monte Carlo project similar to the Ising model. I've found many examples on which I've based my code. From some papers I read on binning analysis, the errors after each binning step ...
0
votes
0answers
52 views

Numerical dispersion in FDTD

I was reading the book "Computational Electrodynamics: The FDTD method" by Taflove and Hagness, probably the most cited book when it comes to the FDTD method in Electromagnetics. In the ...
1
vote
2answers
141 views

Diagonalization using LAPACK

Say, we have a Hamiltonian which for simplicity does not mix particle hole sectors. It is just a simple Hamiltonian in real space as shown, $H=\sum_{ij,\sigma} A(i,j)(c_{i\sigma}^{\dagger}c_{j\sigma} +...
2
votes
0answers
82 views

Finding the extrema of a transition probability function for a quantum walker on a graph

The goal Implement some Python code to find the extrema points of a function that is strongly oscillating. The background Let $G$ be a connected graph with $n$ points with Laplacian matrix $L(G)$. We ...
1
vote
1answer
62 views

Electrostatic Force - Simulate Trajectory of Test Particle using Runge Kutta - Force always Repels

In the center of a 2D-Plane a positive static charge Q is placed with position r_prime. This charge creates a static electrical Field E. Now i want to place a test particle with charge Q and position ...
1
vote
2answers
85 views

Numerical minimization of the action in python

I want to find the trajectory $x(t)$ which minimizes the action $S = \int_{t_i}^{t_f} L(x(t), \dot{x}(t)) \mathrm{d}t$ numerically. I am trying to do it by discretizing the action so it is more of a ...
0
votes
1answer
128 views

How can I implement second order derivatives of shape functions of a 3D elements?

I am developing an Abaqus UEL with 3D 8 nodes brick elements and I need second order derivatives of the shape functions, I have already mapped the first order derivatives from the element coordinates ...
0
votes
3answers
521 views

Draw magnetic field lines or vector field of a magnetic dipole - Python/Matplotlib

In the Wikipedia article on magnetic moments, subsection "Effects on environment" defines the magnetic field H of a magnetic dipole moment. Additionally the magnetic field lines of this ...
0
votes
0answers
95 views

Why does FDTD and FIT disregard Gauss's law?

This is a reformulation of a question I asked a couple of days ago. I'm posting it again because I believe the previous post was very unclear, I will probably delete the previous question. My question ...
3
votes
0answers
81 views

Python routine to calculate shape resonances of H2

I am currently doing a project in which my aim is to write a program that can be used to calculate single and multi-channel shape resonances. So I'm looking at bound states and quasi-bound states. ...
0
votes
0answers
49 views

Simulating a combustion process

I want to try simulation-(and not experimental)-driven approach to design custom fireplace fuel burners. What software applications, libraries, code and model templates can I use to model and ...
1
vote
0answers
47 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)$ ...
0
votes
1answer
84 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 ...
0
votes
1answer
74 views

Acoustic Simulation, how are boundaries handled?

I don't have a background in numerical modeling so this question is rather broad. What I am interested in is modeling the propagation of an ultrasonic acoustic wave in 3d space. The basic 3d wave ...
0
votes
0answers
46 views

Unsteady Stokes equations in ALE framework

I'm trying to solve Unsteady Stokes equations on a moving domain, using an ALE formulation, that is $$\frac{\partial \mathbf{u}}{\partial t} - \mathbf{w}\cdot \nabla\mathbf{u} = \nu\Delta\mathbf{u} - \...
-1
votes
1answer
38 views

Trouble Estimating Motor Parameters with Least Squares in MATLAB

Basically, I'm trying to use Least-Squares to estimate the parameters of a DC motor. My system can be modeled by the following matrix equation: $$\begin{bmatrix}V_{input}(t)\\0\end{bmatrix}=\begin{...
3
votes
2answers
146 views

Why are fluid simulations so hard?

Fluid simulations solving the hydrodynamic (HD) or the magneto-hydrodynamic (MHD) equations are very useful in physics, the latter being particularly useful for modeling plasmas. Of course these ...
0
votes
0answers
55 views

Why is perfect sampling not used in large-scale lattice model simulations?

The statistical physics literature is replete with papers describing simulations of lattice models, such as the Ising model. Typically, these are done through Monte Carlo methods, such as the ...
0
votes
1answer
141 views

Conserve energy by message passing?

There are $N$ particles with positions $x_i(t)$ and velocities $v_i(t)$ and mass 1. There is a potential function $U_{i,j}(x_i, x_j)$ between each pair of particles, which is $0$ unless the particles ...
3
votes
1answer
428 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 \...
1
vote
1answer
95 views

Solution of Coupled Differential equation for a 2d linear flow using RK4 method in python 3

I want to study the dynamics of a 2d linear flow, whose dynamical equation is- $\begin{pmatrix} \dot{x_1}\\ \dot{x_2}\\ \end{pmatrix}=\begin{pmatrix} 1 & 1\\ 4 & -2\\ \end{pmatrix}\begin{...
2
votes
1answer
93 views

Best practice for ADTs in computational science with Fortran

I have been writing a software package in Fortran for solution of the Vlasov-Poisson system in 2D2V. I want this software to be useful beyond its current application (e.g. systems with different ...
0
votes
0answers
124 views

Solving 1D wave equation with finite difference method

I've written a code in Python to solve the 1D wave equation with the finite difference method (the explicit and the implicit methods). I'm trying to perform a mesh convergence study to estimate the ...
3
votes
1answer
72 views

Cauchy Lorentzian simulation on FFT with oscillation

Recently I do simulation on Lorentzian Function with FFT Lorentzian Function is 2a/(x**2+a**2) ...
0
votes
1answer
67 views

Sum of random variables - Check your derived distribution against a numerical calculation/histogram

Consider independent random variates $X_0, X_1, . . .$ each uniformly distributed on the support $[0, 1)$ Let's say $Y = X_0 + X_1$, where $X_0$ and $X_1$ are independent uniform random variables with ...
1
vote
1answer
109 views

Trouble Making 3rd-Order Sympletic Integrator for Planitary N-Body Problem (A Hamiltonian System)

I am doing a solar-system simulation. I am using Ruth's 3rd order sympletic integrator to avoid the problem of Energy Drift (which I had with RK4), but the the planets quickly leave orbit, and energy ...
0
votes
0answers
26 views

Negative binomial expansion of general symbolic polynomial

Using Sympy, I would like to compute the negative binomial expansion of a general symbolic polynomial, e.g., $(x_1 + x_2 + x_3 + 4 x_4)^{-1}$. I understand that I can go by recursively partitioning ...
1
vote
0answers
59 views

Problems with simulation of a spatial filter 4f setup (Python)

I have a question about my code which computes numerically the output field of a 4f setup with a pinhole in the middle which works as a spatial filter. My setup consists of two lenses with 50mm focal ...
1
vote
0answers
201 views

More efficient way to calculate magnetic field using Biot-Savart

I am writing a program in python that is supposed to calculate the magnetic field along a conducting coil that is made up of a bunch of points, and the magnetic field is generated by other conducting ...
7
votes
3answers
365 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 ...

1
2 3 4 5
8