instruction
stringlengths
43
28.1k
I understand the basic idea of imaginary time propagation method: The wavefunction $\psi(x,t)$ as a superposition of energy eigenstates $\phi_m(x)$: $$ \psi(x,t)=\sum_m \phi_m(x)e^{-iE_mt/\hbar} $$ In imaginary time, ${t}\rightarrow{-it}$, $$ \psi(x,-it)=\sum_m \phi_m(x)e^{-E_mt/\hbar}=e^{-E_ot/\hbar}\bigg(\phi_o+\phi_...
I would like to know if I should switch to OPENFOAM for my task. I work only with Cartesian grids, right now in 2d, rectangular domains only. If $\mathbf{w} = (w_1, w_2)$ and suppose I want to solve $\partial_t(\mathbf{w}) = \nabla(\mathrm{div} \mathbf{w}) = \mathbf{f}$ subject to Dirichlet boundary condition and an...
Given some equally spaced data for a function on an interval, we can use line segments (pictured below), quadratic functions, various cubic schemes, and increasingly higher order polynomials to approximate the function using this equally spaced data. For the linear scheme I show as an example in the figure above, as ...
I wanted to know the procedure of starting up a water vapor calculation in LAMMPS. I want to calculate properties of water (i.e. in vapor state) at a higher temperature than 100 Celsius. Currently I am setting up the simulation same as liquid water but with the density of $0.001\, \text{g/cm}^3$. Initially my box has ...
I am curious about how much one loses in terms of computational cost when complex numbers are used instead of real numbers? I guess the number of floating-point operations and memory doubles, but I am not sure if the wall time doubles necessarily. I am especially asking this for matrix factorizations, $LU$, or $LDL^T$...
I would like to use the Eigtool of professor Trefethen for pseudospectra but I have a generalized eigenvalue problem to solve: $$ \lambda M x = K x. $$ It seems that Eigtool takes only one matrix as input. Is it possible to use the Eigtool my case too? I.e. having two matrices as input? In addition, my matrices are r...
Can I start parallel run of LAMMPS from inside a C++ code. Is it possible to compile my code and then do mpirun with my compiled code. I also have one system command inside the code, which starts parallel instances of LAMMPS with mpirun.
I am looking at a very simple problem, but can't quite find the best solution. I need to accept a lat/lon coordinate and based on that coordinate find all the points within roughly ~1km (accuracy is not too important to me). It will always be ~1km searches as well (fixed). I now face how to store these coordinates in m...
I am self teaching myself python and computational physics via Mark Newmans book Computational Physics the exercise is 5.17 of Computational Physics. I have to shift the limits of integration for an improper integral after a change of variables so that Gaussian quadrature method gives a more accurate result. I am suppo...
Typically I have seen P2/P1 elements used for Stokes equation, but I want to use P2/(P1+P0) and P2/P0 elements because I want to ensure local mass conservation. When I say P2/(P1+P0), I simply mean the concatenation of the basis for P1 and P0 separately. I ran simple problems in FEniCS with both element pairs and while...
I have a set of four non-linear ODEs representing a negative feedback. I have done parameter variation by random sampling to study the sensitivity of steady state and other dynamic properties to parameter fluctuations. From the analytical expressions of steady state I have calculated jacobian and its eigenvalues for ea...
I have an inverse problem in which the optimal positions for a variable number of injections needs to be determined. If the number of injections was fixed, I could easily imagine implementing Simplex or Genetic Algorithm (or really any optimisation algorithm). With a changing number of variables, however, it seems tha...
I'm looking for an open-source (to use and learn from) software which computes Bessel functions of integer order of real argument to double precision the fastest among all such implementations. Currently I've tried Boost.Math and GSL. From these GSL appeared to be faster for smaller arguments and much slower for larger...
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) : : z24 = sqrt(14)*(15*(x^2+y^2)^2-20*(x^2+y^2)+6)*(x^2-y^2) I am not using 1st since it is piston; so I have these 24 two-dim ANALYTICAL functions expressed in X-Y Cartes...
I know that the Nitsche's method is a very attractive methods since it allows to take into account Dirichlet type boundary conditions or contact with friction boundary conditions in a weak way without the use of Lagrange multipliers. And its advantage, which is to transform a Dirichlet boundary condition into weak term...
would you please help me to solve following problem $$x^*= \text{argmin}\ xLx^T+ |P^Tx|$$ $x$ is binary $P$ is a known vector (with positive and negative values) $L$ is Laplacian matrix I have limited knowledge on optimization. As I read on the web, I can solve the problem with quadratic MILP if there was no absolu...
Assume I have 3 levels of grids. Finest Grid = level 2, Coarser Grid = level 1, Coarsest Grid = level 0. Relax $u$ on $Au = b$ at level 2 for 3 times. Find residual $r2$ at level 2, then restrict to level 1 Relax $e$ on $Ae=r$ at level 1 for 3 times. Find residual $r1$ at level 1, then restrict to level 0. Solve $Ae=r...
I am solving a linear stability problem using finite element discretization. Then, I have a generalised eigenvalue problem: $$ \lambda M x = J x.$$ I obtain complex eigenvalue and eigenvectors from Arpack using inverse shift method. I would like to compare the eigenvectors obtained with different meshes. To do this it ...
Consider the approximation of a function by a truncated (finite) Fourier series, using complex notation: \begin{equation} f(x) \approx F_M(x) = \sum_{\alpha = -M}^{M} \hat{f}_{\alpha}e^{-i\alpha x} \quad (1) \end{equation} Where $\hat{f}_{\alpha}$ are the Fourier coefficients, which would be computed as: \begin{equatio...
I have tried it with Lis, Intel mkl and PETSc. Everywhere you need to pass an actual matrix to GMRES or other similar iterative solver, while I want to pass just function which multiplies my matrix on vector (my matrix is having special structure and forming it completely is inefficient). There is no problem for me...
I would like to write the most optimized program for array manipulation in Fortran (e.g. matrix multiplication of large matrices, squaring large matrices, etc.) So, using the fortran compilers on the market today (e.g. gfortran), how does F77 measure up against F90/95 (or F03)? Is there a particular compiler I should u...
Currently I am using the EIGEN C++ library to try to solve $x$ from the equation $Ax$ = $b$. One problem I encountered is that the matrix $A$ is a correlation matrix with size > 5000 and can sometimes be rank deficient and have small, even negative eigenvalues. As a result of that, the matrix tends to have huge condit...
Issue Hello everyone, I have got a program (from the net) that I intend to speed up by converting it into its parallel version thru the use of pthreads surprisingly though, it runs slower than the serial version. Below is the program: # include <stdio.h> //fast square root algorithm double asmSqrt(double x) { __asm...
I have to solve numerically a differential equation in C. The equation is: How can I write some code to solve it? Are there some numerical methods (Runge-Kutta maybe?) to solve it? A colleague proposed to me to use the exact discretization method, but I don't think it's the smartest way to do, especially in programmi...
i need to get a Givens-Rotation, which zeros a matrix entry when multiplied from the right side. I did already look at this Topic https://math.stackexchange.com/questions/945736/givens-rotation-from-right-side but i could not really understand the process of getting there. Some more details: I have to matrices, A and B...
I would be really glad to get some specific advise on how to implement a simple MCMC algorithm (in Matlab, if possible). I'm not yet too familiar with optimization methods. My problem goes as follows: The function $s(c_1,c_2)$ is a simulation which depends on the two constants $c_1$ and $c_2$, and $f(s(c_1,c_2))$ is th...
In thin plate bending problems, it would be very nice if we could model a thin rectangular plate with a mesh of many elements in the transverse directions, but only a single element in the longitudinal direction. However, when try to model a plate this way and use piecewise linear polynomials, the resulting numericall...
I'm trying to do an integral of the form $\int_C f(u,v) $, where $C$ is a set of contours in $u$ and $v$. In particular, each variable's contour starts at $-\infty+i \epsilon$, goes around a branch cut at $-2g$ (where $g$ is a parameter of the problem), then goes below the real line and out to $-\infty-i \epsilon$ befo...
I have this map showing the geography of Europe (below), and I wish to convert it to a matrix in python that would be a 2D approximation of this image where 0's would represent the ocean and 1's would represent landmasses. I plan to subsequently to do a biased random-walk on the resulting grid where walkers are more l...
I saw many examples of application of FFT for computation of convolutions and solving PDEs ( like Poisson equation ). It is very strightforward and efficient if I work with rectangular (orthogonal) lattice. However, I don't see how exatly modify the transformation if the lattice is sampled along non-orthogonal lattice ...
Consider the following differential equation \begin{equation} p(t) = \frac{\partial q(t)}{\partial t} \end{equation} where $t \in (0,\infty)$. I have a build a code that spits out values of the function $p$ for the variable $t$. Now, I'm looking for a scheme that will analyse these values of $p$ in order to determine ...
I am trying to do a simple parallel sparse matrix vector multiplications using PETSC. My sparse matrix is a simple tridiagonal laplacian matrix, which is distributed over multiple processors using PETSC. My main question is that if I do the same operation by simply iterating over the vector and updating each value A[i]...
Currently, I am working on an unconstrained energy minimization function, but I need to add some constraints. My system is a 2D lattice with a force applied to it, and I want the sides to be able to move, but the length of each side to be constant. I know that using a Lagrange multiplier could make the terms I want to ...
I don't have an high-end machine on which run my simulation (Python + C extensions, based on numpy for calculations) Thus I intend to run the program on my PC, for several hours. I won't use the computer during the simulation, but many other processes run in background anyway Will those other processes running on my W...
I have been looking for stability analysis of general reaction-diffusion problems, of the form $\frac{\partial u}{\partial t}=\nabla\cdot D\nabla u-k\,u$ , to be solved using the standard Finite Element in 2D with an explicit Euler time stepping. I haven't found any estimate or proof for the stability criteria for $\D...
Given a linear BIP $$\text{Minimize}\;\;\;c^Tx$$ $$\hspace{6.5mm}\text{Subject to}\;\;\;Ax\leq b$$ $$\hspace{38mm}x\in\{0,1\}^n$$ We can in theory convert the constraints to the convex hull constraint $Hx\leq d$ which allows us to perform a linear relaxation and find the solution to the linear BIP that way. Is there a...
Originally posted on stats.stackexchange, I'll pair the post down to something a bit more general. Suppose I have vectors $\{\mathbf{\delta}, \mathbf{x}_1, \ldots, \mathbf{x}_J\}$, where $\delta \in \mathbb{R}^{J}$ and $\mathbf{x}_i \in \mathbb{R}^{I}$. Furthermore, let $\mathbf{A} \in \mathbb{R}^{I\times J}$ be such t...
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 calculate such initial velocities using a uniform random number generator with range [0,1)?
UPDATE: The problem turned out to be the step (refer penultimate paragraph below) where I was factoring out a small value from the vectors of the numerator and denominator and then computed dot products/norm-square. Computing these terms in straightforward manner resulted in CG steps converging with almost same number ...
A canonical form of primal linear program is $$ \text{minimize } c^T \cdot x \\ \text{subject to } Ax = b, x \geq 0 $$ The dual is $$ \text{maximize } b^T \cdot y \\ \text{subject to } z \equiv c - A^T y \geq 0 $$ As far as I know $y$ are called Lagrange multipliers. How do you refer to the other terms,...
I have multiple CSV files with point-coordinates and, possibly, multiple data values attached to them, i.e., the rows look like x y z data1 data2 ... Is there any possibility to display say 10 of those CSV files in a "time" series in Paraview?
I just implemented an Algebraic Multigrid solver for a Mixed Dirichlet-Neumann Boundary Value problem and was surprised to see the speed-up as compared to a simple iterative solver for a large problem like 2048x2048 and 4096x4096. My next step is to implement it in parallel. If Multigrid is so useful, I am sure people ...
Given a triangulation (geometry), are there known algorithm in finding common side of triangles, that is O(N) or better?
I need to solve a non-linear set of three equations using scipy. However, I do not have any clue on which algorithm is suitable for my problem from a mathematical point of view (stability, convergence behaviour), since scipy provides a huge variety of different algorithms in the scipy.optimize module such as: scipy.op...
I have a 2D mesh of triangles used in Finite Element method to discretize the domain. I want to calculate the midpoints of all the edges because I want to use $\mathbb{P}^2$ elements. I am using MatLab. The data that I have is: Matrix containing nodes coordinates, $x$ and $y$. The size is $N\times 2$, where $N$ is the...
I want to solve linear hyperbolic system using Chebyshev collocation method. As this method puts severe constraint on the time step for the explicit time integration, I decided to switch to implicit time integration (backward Euler). I use time integrator vode with options method='bdf' and order=1 from Python package s...
I am trying to replicate the MATLAB simulation presented in this paper. More specifically, I have to code the solution to this equation $$\frac{a}{2R_i}\frac{\partial^2 V_m}{\partial x^2} - \left[g_\text{Na}m^3 h(V_m - E_\text{Na}) + g_\text{K} n^4(V_m - E_\text{K}) + g_\text{S}(V_m - E_\text{S})\right] = C_m \frac{\...
I am trying to learn Gmsh and Fenics and was looking at an example which shows the application of Boundary conditions on a simple Poisson problem. Here is the link: http://fenicsproject.org/documentation/dolfin/1.3.0/python/demo/documented/bcs/python/documentation.html The example defines the domain Ω to be a model of...
For an assignment I have to implement a 1D Poisson PDE with inhomogeneous Dirichlet BC's $$\Delta_1 u = f, \quad u(a)=g(a), \: u(b) = g(b) $$ I have managed to make it work, but I am not seeing the expected convergence behaviour. I used the standard (?) discretisation on the unit interval [0,1], $$-u_{j+1} + 2u_j - ...
I am trying to understand the DG FEM methods, but I got lost in their definitions. In some papers I read that the "C0 penalty method" is one example of the DG method, but sometimes they are separated and handled as two different methods. Can someone explain what's the difference between them? Edit: There is a paper de...
Is there a natural way to find the solution to $$AX = B, X^TX = C \enspace \text{?}$$ $X$ is a matrix and has a small number of rows, and $A$ is sparse. An approximate solution would be fine.
I am attempting to simulate fluid flow through a porous foam. I would like to have no-slip boundary conditions on part of the boundary and free flow conditions on the inlet and outlet. Right now I am using the Darcy-Brinkman equations: $-\mu\Delta\mathbf{u} + \mathbf{K}\mathbf{u} + \nabla p = \mathbf{0}$ $\nabla\cdot\m...
I'm Looking for an implementation of the IAPWS-IF97 water properties on C/C++. I'm aware of the library freesteam. However freesteam does not include all the properties I'm looking for. Particularly I need differential properties like dh/dp, dv/dp and in certain regions. I use a similar implementation for Octave/Matlab...
I'm currently conducting research into subway paths, but stand in front of a problem, with no programming knowledge and an extremely short time-limit. Probably the question I am asking is trivial, but I would be very happy if you could point me in the right direction or to the right forum! Having generated all possibl...
I am in the process of writing a finite element code to solve the Navier-Stokes equations using the theta method for time stepping (basically Crank-Nicholson for diffusion and forward Euler for nonlinear terms). To find the pressure I use the pressure correction method. Once I find the pressure I need to update the vel...
I wrote a program that calculates the best fit in VBA excel for the following model $$ y_k=c_1x_k+c_0+c_{-1}(x_k)^{-1} $$ solving for the best fit parameters $c_1$, $c_0$, and $c_{-1}$. However I wrote several custom subroutines to accomplish this. One subroutine calculates the moments of $x$ and $y$, another builds th...
I am trying to find the most optimized way to perform Matrix Multiplication of very large sizes in C language and under Windows 7 or Ubuntu 14.04. And searching led me to BLAS, LAPACK and ATLAS. However, I couldn't tell which one I can use? I mean BLAS Level 3 DGEMM seems like the function for my case but I couldn't f...
I am trying to predict y(t+1) of a function by using a feedforward neural network with Matlab. The inputs are the previous 3 previous values (y(t-2), y(t-1), y(t)) and the training output is the actual value I want to predict y(t+1). The "prediction" seems perfect! The output seems like a perfect copy of the original g...
I have an infinitely long cylinder defined using radius a point in 3d Axis defined using a 3d vector I have a set of points with 3d coordinates placed in a grid. I want to wrap this grid of points around the curvature of my cylinder. How to do it
Is there any (efficient) algorithm to select subset of $M$ points from a set of $N$ points ($M < N$) such that they "cover" most area (over all possible subsets of size $M$)? I assume the points are in 2D plane. The naive algorithm is simple, but prohibitive in terms of time complexity: for each subset of N points ...
I am not sure if my question is on topic but I have a piece of Fortran code that is used to perform successive over relaxation. Prior to performing successive over relaxation the author is calculating the spectrum of the matrix.There is very little documentation so I am just trying to figure out all the details for doc...
I am interested in a reference in the literature that discusses the performance of Dense Linear Algebra (blas routines) and dense linear algebra (sparse blas routines). I am interested in knowing for what combinations of size and density sparse routines outperform dense routines. I am mainly interested in a shared mem...
Given 2 vectors $\mathbf{u}$ and $\mathbf{v}$ the following are equivalent: $\mathbf{u}\cdot\mathbf{v}$ $\mathbf{u}^T \mathbf{v}$ $u_i v_i$ $v_i u_i$ $\mathbf{v}\cdot\mathbf{u}$ $\mathbf{v}^T\mathbf{u}$ Given a second order tensor (matrix) $\mathbf{A}$ and a vector $\mathbf{b}$, are the following also equivalen...
I am trying to reproduce Tang & Othmer paper which is related to excitations and oscillations in G-protein model in Dictyostelium discoideum, an amoeba species. The mathematical model in the paper is like below: where $w_1,w_2,w_3,w_4,w_5,u_1,u_2,u_4$ are biochemicals and other parameters are constants associated with...
I'm trying to implement 1D advection solver using WENO and ENO schemes. \begin{equation} \frac{\partial u}{\partial t} + \frac{\partial f(u)}{\partial x} =0 \end{equation} where: \begin{equation} f(u) = C\,u \end{equation} Discretized as: \begin{equation} \frac{u^{n+1}_j-u^{n}_j}{\Delta t} + \frac{F_{j+1/2}-F_{j...
Given a set $Q$ of $n$ points, we want to find the subset $S_\max \subset Q$ of $k$ elements that maximize the total distance between them. $$S_\max = \max_S \sum_{\substack{ i,j\in S\\ i \neq j}} d(x_i,x_j)$$ where in my case $x_i$ is a boolean vector and the distance considered is the Manhattan/Hamming distance. Is t...
I have a system of differential equations with some unknown parameters and I need to find the optimal parameter set that fits best with the data I have. For each parameter set choice (using for loops), my code solves the system of DE numerically, then extracts from the time vector a time subvector that agrees with data...
I need to invert a matrix. Of course, I'm not the first person in this situation, and I know that there's a wealth of powerful libraries out there, of which I only know a couple. That being said, there is a twist: I know that matrix inversion is (in general) numerically unstable, and I need a solution that is absolutel...
I am setting up a simple model that uses recursion to iterate between known constraints - relaxation, in other words. I need a spreadsheet that allows: A0 50 A1 =(A0+A2)/2 A2 =(A1+A3)/2 A3 =(A2+A4)/2 A4 100 It should be simple, but OpenOffice and Apple Numbers specifically forbid this. If you know of configuration...
Lets say in Graph $G$ we have two vertices $v$ and $u$, each vertex is connected to several neighbors by edges describing the distances $d_{ij}$ from these neighbors. The neighbors themselves are also connected to more vertices by such edges. If a vertex has relatively short edges and is connected to neighbors that als...
Lets say we have two things as input, $N$ scalars (measurements) that we know are erroneous to some degree (i.e. the correct values are somewhat similar). In addition, we also have a roughly more reliable order $O$ among the measurements. Using the ordering: $O = <u_1, u_2, u_3 ... u_n>$ we can deduct that with some k...
I am interested in computing only the generalized singular values, and was wondering if this was faster (and by how much?) than computing the full GSVD. In particular, I was wondering what the fastest algorithms are for computing the generalized singular values (ideally the pairs $(\alpha_i, \beta_i)$ instead of just $...
I am currently writing a small Python script to estimate the pulse duration from the optical spectrum. At the end, the idea is to observe the effects of the spectral phase on the pulse duration and shape. But for now, I cannot retrieve a well-known result without taking into account spectral phase. Indeed, a time-bandw...
To give you some context, I am currently implementing a simple finite element solver in Julia. I am getting run-times that are 70% of a Matlab code. (Both codes are essential equivalent in structure.) I've run some profiles on my Julia code and I find that most of the run-time is taken up by the linear system solver (e...
I have a PDE optimization problem, and a scalar field (which I am optimizing over) is supposed to be nonnegative everywhere in the domain. Since I am working in Fourier space for solving this problem numerically, I need to convert this non-negative constraint into Fourier domain (i.e. constraint on Fourier coefficients...
I tried using Python's matplotlib on the logarithm and here is what I got, a kind of starburst pattern. Since the angle jumps between $\theta = 0$ and $\theta = 2\pi$, contour assumes there is a contour line between those those two points. Here in in fact $\bbox[#EEEDAA,1pt]{0=2\pi}$ Perhaps instead of matplotlib.p...
I am interested in proving or obtaining a counterexample to the following conjecture. Let $\Omega\in \mathbb{R}^d$ be a bounded open domain. Let $u_d\in H^{1/2}(\partial\Omega) \times \mathbb{R}^+$. Suppose $u\in L^2((0,\infty); H^1(\Omega))$ is the weak solution of $$ \left\{ \begin{align*} u_t- \nabla \cdot \nabl...
I have four partial differential equations representing mass conservation of two compressible fluid phases (marked by subscripts $p1$ and $p2$) in two different continuum media (marked by subscripts $c1$ and $c2$) and they are coupled together by the term $T_{c1c2}$ as shown below. Continuum 1: $$\begin{align} \text{P...
Consider the following situation: There are two boundaries -- one is denoted using grey lines, and the other is denoted using black lines. The boundaries are numerically represented using "vertices", with edges assumed to be connecting these vertices, but otherwise not necessary for the calculation. At a given vertex ...
Basically, I am trying to solve the 2D poisson problem in order to learn implementation of IPDG methods. The problem states $-\nabla a(x)(\nabla u)=0\ \text{in} \ \Omega$ with $U=0$ on Dirichlet boundary $\Gamma_D$. The weak DG formulation gives find u such that $$a_{\epsilon}(u,v)=l(v)$$ where $$a_{\epsilon}(u,v)=\...
I tried to write an analysis program in python for the Millikan experiment based on a paper from Jones "The Millikan oil‐drop experiment: Making it worthwhile" However, I cannot reproduce the calculated values of this paper for the radius of the oil drops and the charges when using an iterative Cunningham correction ap...
I have created a 4-dimensional array (cell) of arrays called "a" where a{i,j,k,l} = [ v_1 v_2 v_3 v_4] for some vector v. each of the index variables runs from 1 to 10 in steps of 1. I have a total of 10000 entries in the cell. I want to reshape this cell into another cell whose dimensions are 1x10000. I want the first...
I am trying to find the minimum of this function. But I receive the following error when I run the script. What am I doing wrong: % pre allocating x=zeros(10,4); mu=zeros(10,1);% process parameter T=zeros(10,1);% spike times y=zeros(10,1);%number of spikes ...
I have been experimenting with using Autodesk CFD to investigate facade/ cladding pressures on a (rectangular) building, comparing results with cladding/ facades pressures pressures from design codes and wind tunnel results. I understand the complexities and difficulties in what I am doing generally and am really expl...
Problem Summary I am trying to estimate the (x,y) coordinates of each node in a graph, where I know the distances between connected nodes. For example Given this graph, I can define an equation for the length of each link simply using the Pythagorean theorem. $$L_{AB}=\sqrt{(X_B-X_A)^2+(Y_B-Y_A)^2}$$ $$L_{AD}=\sqrt{(X...
The Method of manufactured is commonly used for verification of computational science codes. I want to use the method for verification of Navier-Cauchy (elasticity) equations with periodic and Bloch-periodic boundary conditions. In this case, the coefficients of the PDE (material propertise) are periodic, and the form ...
I am attempting to write a matrix multiplication routine because I need to do some analysis in CUDA and I want to validate it with CPU code. I am trying to use dgemm to do this, but I seem to be doing it wrong. My matrices are constructed as 1D arrays since the same thing is done in CUDA kernels, so I am attempting to ...
I'm interested in solving an electrostatics problem in 2d case in some domain with a conductor placed inside the domain. From a mathematical point of view, I have to solve a Poisson equation with user-defined boundary conditions (let us consider a rectangular domain for simplicity) and a certain region in the domain...
When using the pressure projection method to solve the incompressible Navier-Stokes equations do we apply Neumann boundary conditions for pressure only where there are associated no-slip velocity boundary conditions? For example suppose we were trying to solve the vortex shedding problem. The velocity boundary conditio...
Objective: I am trying to simulate the following advection-diffusion-reaction equation in 2D space (x,y) and time. $$\begin{align} \text{ADR Equation: }\frac{\partial C}{\partial t} + \nabla\left(v.C - D\nabla{C} \right)= \alpha.C \end{align}$$ I discretized the above ADR equation in 2D using finite-difference implic...
Could someone please explain what is meant with e.g high precision low resolution flux. Does it mean, that I use some higher order method (still first order) but with a more complex stencil and consequently lower resolution ? While low precision and high resolution means essentially a forward or backward difference for...
Am implementing a monte carlo integration routine to compute this double integral in eqn 0.3 of page 2 of this paper 'Mobius energy of knots and unknots', Annals of Mathematics, http://www.math.ucsb.edu/~zhenghwa/data/research/pub/Mobiusenergy-94.pdf in a case where both the integrals run over a circle. $$ E(\gamma)=\i...
I am new to this community as well as to scientific programming. I programmed a simple 4th order Runge-Kutta for the 1-D Cahn-Hilliard Equation for some first simple calculations on pattern forming systems. It turned out to be extremely sensitive to the change of the size of the spatial grid. With 100 grid elements the...
I have a problem fitting a $N\times N$ ($32\times 32$ in this case) matrix in Matlab. Here is the deal I have this image, and I want to create 1 dimensional fit between the points and then be able to interpolate it in order to make it smoother. Does anyone have any idea if that can be done?
I have the following function that I want to implement in scipy.integrate.odeint def numericSolver(rv_,t,alpha=1.,gamma=1.): BVal = B_f(alpha,gamma,t) #this function returns a vector BdotVal = Bdot_f(alpha,gamma,t) #this function returns a vector matDynamics = np.array([[0.,1.,float(BdotVal[2]),0.,0.,0.], ...
Let us consider a smooth initial condition and the heat equation in one dimension : $$ \partial_t u = \partial_{xx} u$$ in the open interval $]0,1[$, and let us assume that we want to solve it numerically with finite differences. I know that for my problem to be well-posed, I need to endow it with boundary conditions a...
Let us say that I have a function like so: def f(x): return g(x)*h(x) Now, g(x) and h(x) are such that when g(x) produces a result large enough to cause overflow errors, h(x) produces a number that is approximately zero. So, the result provided by f(x) should be $0$. Would it be enough to write f(x) as follows: de...
I have a 3-D structured grid that I am trying to convert over to an unstructured grid. Here is a picture of the 2-D structured grid with the nodes shown. It is axisymmetric about the x axis (y = 0). I will rotate this to make it 3-D. My main concern in this conversion is that I need to output the volume of every cell...
I have been wrestling with how to properly deal with bonded (1-2 1-3 and 1-4) particle neighbor interactions, or whether they have to be dealt with, in the long range electrostatic solver codes (PME, SPME, etc). For instance, in the short range calculation, these interactions are typically excluded by omitting them fro...
I have a recurrence relation $$P_{n} = A_{n} P_{n-1} - B_{n}P_{n-2}$$ with given $P_{0}$ and $P_{1}$. Numerically, each $A_{n}$ and $B_{n}$ is calculated with some precision. The same applies to the $P_{0}$ and $P_{1}$. How can one estimates the error for the $n$-th term?