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
3
votes
1answer
331 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 ...
1
vote
1answer
286 views

1-D turbulent energy spectra in homogeneous direction (non-isotropic)

I am trying to compute the one-dimensional energy spectra for my channel-flow simulation. I have already written a post-processing script to achieve this; however, I need to validate my code before ...
-1
votes
1answer
41 views

Smoothed Particle Hydrodynamics: Weird clustering of particles. Is that normal?

I implemented a rather simple SPH simulation using a cubic-spline-kernel and a simple non-iterative pressure solver as described in this PDF in equation 9. I followed algorithm 1 of that paper (...
1
vote
1answer
63 views

Manual for library Libxc

Where can I find the manual for software library Libxc for exchange-correlation functionals? Links with domain www.tddft.org don't work.
0
votes
0answers
25 views

solving electron motion in undulator by Boris method

I am trying to use Boris scheme to solve the electron trajectory in undulator. The undulator field I used is: $$B_x = b_0\sin(2\pi \tfrac{z}{\lambda_u})$$ where $b_0 = \dfrac{2\pi c_{0}K}{q m_{e} \...
1
vote
1answer
69 views

Runge-Kutta fourth order method. Integrating backwards

I am using a Runge-Kutta fourth order method to solve numerically the usual equation of motion of a background scalar field in curved spacetime with a quartic potential: $\phi^{''}=-3\left(1+\frac{H^{...
1
vote
1answer
84 views

For a determined (known) Space charge density, what are the conditions to obtain the Electric potential/field distribution? (COMSOL, MATLAB)

Theoretic part From the theory, in Electrostatics inside a real dielectric material between real conductors, in a simple 1D plane geometry between points $P1$ and $P2$, according to the current ...
3
votes
1answer
520 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(...
1
vote
1answer
51 views

Should the derivative of an array be calculated array by array or element by element in CFD codes?

I am making my own finite difference computational magnetohydrodynamic code in Fortran 90. Looking at other codes they appear to calculate for example their $x$-derivatives, bb of their variables, e.g....
4
votes
1answer
547 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 ...
1
vote
1answer
344 views

Difficult bug in my 2D Compressible Euler solver

For the past few days, I have been writing a numerical solver for the 2D compressible Euler equations for an ideal gas. My numerical method has been the Local Lax Friedrichs or "Rusanov's method." ...
0
votes
1answer
60 views

ISING2D with Mathematica. Searching a correct way to compute the heat capacity (mean values over several iterations)

I'm trying compute the heat capacity $C_v$ out of my simulation for the 2D-Ising model which is given by $C_v = \frac{\langle E^2 \rangle - \langle E \rangle^2}{T^2N^2}$ ($E$: Energy, $T$: ...
2
votes
0answers
85 views

Heisenberg Model python : Specific heat capacity for spin 2

I have the correct plot for specific heat capacity when I am using the formula which is $C_V$ = differentiation of entropy with respect to temperature. However, When I try to calculate $C_V$, by using ...
1
vote
0answers
34 views

Pseudospectral method for Rayleigh-Benard with constant temperature gradient

$$ \nabla\cdot \mathbf{u} = 0 \\ \frac{\partial \mathbf{u}}{\partial t}+\left(\mathbf{u}\cdot \nabla\right)\mathbf{u} = -\nabla p+\nu\nabla^2\mathbf{u}+\alpha g\theta\mathbf{e}_z\\ \frac{\partial\...
2
votes
0answers
35 views

What is the best methodology for physics simulators of large floating base rigid body systems?

I want to implement a physics simulator for large floating base rigid body systems from scratch. The Rigid Body Dynamics Systems (RBD) should typically have the following characteristics: About ~50 ...
1
vote
1answer
108 views

Problem concerning a part of a simulation for the Ising Model

I was wondering if anyone could help me with a simulation in Python (there is a small part of the code where I have a question) about the Ising model. First, I wanted to get the magnetization $M$ ...
29
votes
16answers
9k 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 ...
0
votes
0answers
48 views

Simulate friction arround steady-state point

When simulating a friction dynamic system, I have come to a problem when approaching steady-state. In the example below, a box moves along a surface with a certain friction coefficient: ...
0
votes
1answer
77 views

Computer build for scientific or big data computing [closed]

I'm wanting to build a computer for scientific or big data computing (Python, Fortran, Matlab) and I was hoping to get some advice on the type of processor, memory, graphics, etc I would need. I ...
2
votes
1answer
70 views

Langevin equation in 4th order Runge-Kutta

I'm trying to figure out how to translate a piece of code from Velocity Verlet to Runge-Kutta, while treating the time step dependence of the thermal noise correctly. The Langevin equation for my ...
0
votes
1answer
31 views

How to implement the Impulse Based Dynamics for the rigid body dynamics simulation?

I am having hard time learning the method of impulse based dynamics developed by Mirtich for rigid body dynamics simulation. Please help me out if any body has any example code(algorithm) of it. ...
0
votes
0answers
27 views

A preconditioner for self-consistent iteration

I tried to derive a preconditioner for self-consistent iteration similar to section IX in arXiv:0804.2583. For simplicity, consider here only one orbital (one or two electrons) systems. Suppose that ...
0
votes
0answers
63 views

Computing a double Integral using two Riemann sums & graphing multiple isosurfaces

I'm trying to compute the potential and electric field of a uniformly charged spherical shell and plot the results in the space outside the shell using MATLAB. I've tried everything from for loops to ...
1
vote
0answers
73 views

Solved : Damped spring-mass system, wrong position, correct speed and acceleration

I am modulating a spring-mass system with gravitation and aero drag, with python programming. The spring is hanging vertically and attached a weight. The user then selects a length to drag it down ...
3
votes
1answer
105 views

Doubt about Python code for calculation of Energy Conditions in General Relativity

In General Relativity, one possible way to decide if a space-time [i.e. a Lorentzian Manifold $(\mathcal{M}, \textbf{g})$ where $\textbf{g}$ is an arbitrary metric tensor.] is a "resonable physical" $[...
3
votes
1answer
443 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 ...
0
votes
0answers
27 views

How can I implement the Invaded Cluster Algorithm for a network of Ising spins?

My primary concern is about finding the percolating cluster for any given network. For a lattice it is straight forward : When the size of a cluster reaches the length of the lattice, then it is said ...
0
votes
0answers
11 views

Compute cell values and isosurface constant from density values of particles

I am trying to reconstruct the surface for a fluid simulation based on a list of particles using the Marching Cubes algorithm. From different resources, such as http://paulbourke.net/geometry/...
0
votes
1answer
44 views

How to do Weierstrass-transform in MATLAB?

I have a diagonalization problem. I have the eigenstates correctly, and I want to do a Gaussian-smearing (Weierstrass-transform) on them. So I have the wave functions ($\Psi$), and the continuous ...
-1
votes
1answer
55 views

Simulating magnetic particles in a field free point generated by two opposing magnets

This is probably a long shot with such a short time, but I've been trying to get theoretical data for a project I'm working on. The project involves using a very simplified version of magnetic ...
6
votes
1answer
6k 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
224 views

Poincare map for Arnold-Beltrami-Childress Magnetic Field in Python

I want to plot the Poincare map for Arnold-Beltrami-Childress magnetic field for parameters $A=1, B=0.816, C=0.5773$ in Python for the Poincare section $z=0$. Also, I am not able to understand what ...
1
vote
1answer
522 views

Proper boundary conditions for potential flow around cylinder

I am computing the stationary, incompressible, inviscid and irrotational flow around a circular cylinder using a discretization in general coordinates. I derived a PDE and proper boundary conditions ...
0
votes
0answers
79 views

Double mach reflection at a inclined wedge

I am running into a strange problem when solving the 2D compressible Euler equations on a inclined wedge. To elaborate, my top boundary condition seems to emitting some type of instability. I have ...
0
votes
1answer
70 views

Stability of PDEs

I am currently trying to solve some PDEs with FiPy. At page 56, the manual mentions (https://www.ctcms.nist.gov/fipy/download/fipy-3.0.pdf). The largest stable timestep that can be taken for this ...
1
vote
0answers
31 views

Why does the correlation function of this stochastic differential equation starts at different points?

I am working with the following differential equation: The equation is $$x=\beta +\sqrt{2D} \xi(t)$$ where $\xi(t)$ is a white noise term, with a reflecting wall boundary conditions. After solving ...
0
votes
0answers
40 views

Time sampling changes solution

I'm currently trying to solve a problem using numerical methods. The set-up is rather long, so I apologize in advance... TL;DR: My solutions change depending on how big my steps are and I don't know ...
1
vote
1answer
44 views

How to obtain and form a 1st order differential equation for leapfrog integration from second order one in this example of coulomb drag

I am currently doing a computational physics homework which asked us to use leapfrog to give the relations between timevelocities and time-distance of these two objects. The full question is as ...
1
vote
0answers
33 views

How to numerically calculate the transition dipole integral in periodic systems?

Now I have wave functions $\psi_a$ and $\psi_b$ of two states in Gaussian CUBE format. I'd like to evaluate the transition dipole moment integral $\pmb\mu$ between these two states. As my simulation ...
1
vote
2answers
2k views

Solving the 1D Particle-in-a-Box using C++

I've just finished learning the physics behind the problem and would like to write a program in C++ than can solve the problem. I'm actually stuck at the start. I've quite a bit of research, the ...
0
votes
2answers
87 views

Overrelaxation with w < 0

Are there any circumstances under which using a value $w < 0$ would help us find a solution in over-relaxation faster than we can with the ordinary relaxation method? Over Relaxation Method: $$x'=...
0
votes
0answers
30 views

3D Tollmien-Schlichting Waves Imposed in a Channel Flow (Are Physics correct?, etc)

So I am trying to do some further tests on a 2nd-order code Incompressible Navier Stokes equations, by studying transition to turbulence in a Poiseuille flow. Specifically, I'm interested to see ...
1
vote
0answers
82 views

Grid Data Interpolation

What are the most sophisticated methods for interpolating a scalar field say Electric or Magnetic Field on a 3-D grid? I have scalar data on a meshgrid with equal spacing. I would like to use an ...
1
vote
1answer
51 views

Anisotropic invariant expansion

I am trying to calculate the second and third invariants for a turbulent flow. I have the second order statistics (both transient and averaged). i.e $uu$, $vv$, $ww$, $uv$, $vw$ and $uw$. These are ...
3
votes
2answers
117 views

Finite volume discretization of non-conservative linear hyperbolic equation

Problem. Consider the one-dimensional adjoint Euler equations for $(x,t) \in \Omega \times [0,T]$ with $\Omega \subset \mathbb{R}$ and $T > 0$ $$ \varphi_t + \Big(\frac{\mathrm{d}F}{\mathrm{d} U}(x)...
5
votes
1answer
162 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'...
2
votes
1answer
126 views

Do there exist “frameworks” as to how computational scientific experiments claim validity? Scientific method for computed science?

Do there exist "frameworks" as to how computational scientific experiments claim validity? Like "scientific method for computed science"?
4
votes
1answer
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-...
0
votes
0answers
32 views

Compute a Boltzman partition function

I'm trying to calculate total energy of a system $$ E(v, h) = -\sum a_iv_i - \sum b_jh_j - \sum_{i,j} v_ih_jw_{ij} $$ Python equivalent looks like this ...
0
votes
0answers
48 views

Determining the pseudo-time period of a system of $n$-pendulums via Kane's method in Python

We can use Kane's method to integrate the equations of motion for a system of $n$ pendulums with arbitrary masses and lengths (see derivation). In particular, if $(x_i,y_i)$ denotes the Cartesian ...