instruction
stringlengths
43
28.1k
I'm trying to solve \begin{equation}\left\{ \begin{split} \frac{\partial u}{\partial t}+(u\cdot\nabla)u-\nu\Delta u+\frac1\rho\nabla p&=f\;\;\;\text{in }\Lambda\\ u&=0\;\;\;\text{on }\partial\Lambda\\ \nabla\cdot u&=0\;\;\;\text{in }\Lambda \end{split}\right.\tag1 \end{equation} on $\Lambda=(0,a)\times(0,b)$. Let \begi...
So, as the title of the post implies, I'm making an FEM code for a composite laminate plate using the Mindlin plate theory. And, as I am trying to get the mode shapes for the plate, I needed to make a mass matrix. Following some other examples and some past code someone gave me, I managed to make one. But the problem i...
I am modelling a soil medium in plane strain and would like to determine if paraview supports the 15-noded triangular element as shown on this link. On the documentation I am only seeing elements up to second order for an unstructured grid (please see VTK users guide pages 480 and 481. I also found some indication on t...
I wrote a simple 2D wave simulation using the following equations: $$\frac{\partial^2 u}{\partial t^2}=c^2\nabla^2u$$ Where $\nabla^2$ is the discrete laplace operator using a Von Neumann neighborhood lattice. $$\mathbf {D}^2_{xy} = \begin{bmatrix} 0 & 1 & 0 \\ 1 & -4 & 1 \\ 0 & 1 & 0 \en...
I have to write a solver for 2D equation: $$\partial_t u = u^2(\partial_x ^2 u + \partial_y ^2 u)$$ I try to use explicit method: $$\partial_t u = \frac{u_{i,j}^{k+1} - u_{i,j}^k}{\tau}$$ and $$\partial_x ^2 u = \frac{u_{i-1,j}^k - 2u_{i,j}^k + u_{i+1,j}^k}{h^2}$$ and tha same for $\partial_y ^2 u$ with points $j-1, j,...
Given two (here and below: single-precision, IEEE 32-bit floats) normalized floating-point numbers $x, y$ (perhaps of reasonable range: my counterexamples don't have unusual magnitudes), and another floating-point number $0\leq t\leq 1$, I would like to evaluate the linear interpolant $$ z_t = x(1-t) + yt $$ in such a ...
During the past few years several important areas of image processing and image classification or generation became dominated by convolutional neural networks. I'm interested if there are any methods coming from mathematical physics context (like methods designed for solving ill-posed problems, spectral analysis, image...
Are there sites for discussing more informally about computational modelling? Forum-style, rather than QA.
I'm attempting to solve a problem of the form: $$ \mathbf{a}^{(n+1)}(t) = \int_{0}^{t}d\tau e^{i\mathbf{H}\tau} \mathbf{D}(\tau)e^{-i\mathbf{H}\tau}\mathbf{a}^{(n)}(\tau) $$ Where $\mathbf{D}(\tau)$ is a oscillatory time varying matrix ($\mathbf{D}\cdot E(\tau)$), $\mathbf{H}$ is a diagonal matrix, and $\mathbf{a}^{(n)...
Id like to know methods for numerical computation of $L^2$ norm of a two dimensional trigonometric polynomial. I have the coefficients. If I want to compute the L^1 norm, I can do so by sampling in time at a rate greater than twice of the order of the trig polynomial (Shannon sampling theorem) and then doing summation...
I need to generate a discontinuous plot (piecewise in each triangle) in matlab, something like: This plot is from http://www.alecjacobson.com/weblog/?p=3616, but I don't understand how generate it. I have two matrices corresponding to a triangular mesh of a domain (typical of finite elements method, that is, no overl...
A common approach says an incompressible flow has velocity divergence of 0; use this to solve for pressure in the Navier Stokes momentum equation. Or, using the Helmholtz Decomposition "project" the zero divergence component of the velocity field. Instead, can we treat the positive/negative divergence as expansion/comp...
I've been trying to plot the following function in Python: $H(a,u) = \frac{a}{\pi} \int_{-\infty}^{\infty}\frac{exp(-y^2)}{a^2 + (u - y)^2}dy $ But I keep receiving the following error: File "//anaconda/lib/python3.5/site-packages/scipy/integrate/quadpack.py", line 383, in _quad return _quadpack._qagie(func,bound,infbo...
I am working with VTK legacy files containing vector information. The files have incremental extension representing a file series as defined by this link. When applying the filter "Plot Selection over Time", I get a nice curve as follows: However the x-axis does not show the realtime, rather it shows the actual time s...
I am referring to this paper:- "A Parameter-Free Generalized Moment Limiter for High- Order Methods on Unstructured Grids " by Michael Yang and Z.J. Wang. http://dept.ku.edu/~cfdku/papers/AIAA-2009-605.pdf They have implemented a general limiter which doesn't require any user input. In the process, they have represent...
Let $\mathbf{x}, \mathbf{y} \in \mathbb{R}^n$ and $\text{supp}(\mathbf{x}) \subset \{1,2,...,n\}$ denote the set of indices such that $\mathbf{x}$ is non-zero. What type of optimization problem can model the following constraint? $\text{supp}(\mathbf{x}) \ \cap \ \text{supp}(\mathbf{y}) = \emptyset$
Ordering of elements in an unstructured mesh is undoubtedly very important for the performance of computations. For example, it determines the structure of sparse matrices arising from PDE discretizations, which affects the performance of most linear algebra operations like matrix-vector product. Recently we used an un...
Orthogonal polynomials are often preferred as basis functions. Recently I learned selecting orthonormal basis further simplifies the mass matrix from diagonal to simply the identity matrix when used as modal basis. But I am confused how the normalizing factors are obtained. Say the orthonormal Legendre polynomials in e...
I have some "flat" triangles in my FEM mesh (angles for example 30°, 30°, 120°). I wonder whether this just decreases the mesh quality, or whether it will really cause problems. Why do I ask? When computing the matrix for the Laplacian for linear elements, the off-diagonal elements are positive, and the diagonal elemen...
I've been using Intel MKL's SVD (dgesvd through SciPy) and noticed that results are are significantly different when I change precision between float32 and float64 when my matrix is badly conditioned/not full rank. Is there a guide on the minimum amount of regularization I should add to make results insensitive to floa...
Although I've been looking everywhere, I have been unable to find an answer to my question so here it is. For a driven damped pendulum the equation of motion in dimensionless units is, $$\alpha(\omega,\theta,t)=-c\ \omega -\sin \theta +F(t).$$ My question is obtaining my next step $\omega(t + \Delta t)$. I know what ...
I am working on a method based on moving least square approximation where shape functions do not satisfy Kroneker Delta property. So Dirichlet boundary condition should be enforced. I usually used penalty method for that. In the error estimation based on residual I used the following for Poisson equation: \begin{align...
I am solving the one dimensional wave equation: $0=\Box\phi = -\partial_t^2\phi + \partial_r^2\phi ,$ using a Crank-Nicolson finite difference scheme, in the domain $r\in[0,R]$. First, I define $\xi\equiv\partial_r\phi$ and $\Pi\equiv\partial_t\phi$, so that the equations of motion can be written as follows: $ 0 = \pa...
I have solved Poisson equation on a 3d domain with neumann and dirichlet boundary condition. I get the potential, take the gradient for each element and integrate on a surface of an element, I do this for all elements on a surface enclosing an electrode I am interested in knowing the current through. This does not give...
I'm struggling now for several weeks with a very bizarre problem with a system of delay differential equations. First, here the system: $$\dot a = 1 - \Theta(b(t-\tau)-\kappa) \,- a(t) \\ \dot b = \,\,\,\,\,\,\,\,\,\,\,\Theta(a(t-\tau)-\kappa) - b(t),$$ where $$\Theta: \Bbb R \rightarrow \{ 0,1 \},\,\,x \mapsto \begin{...
I am trying to find the intersection points in images like the one posted below. The intersections I'm trying to find are circled in red in the image below it. My most succesful approach: Thin the image Perform a Hough transform, peak identify, and back project Identify peaks in the back projection and select those ...
In case B(size ~ 2k, complex double) is block-diagonal, where block size is small(e.g. 2), is there any more efficient way to compute this other than Lapack gesv?
Assume I have the following equation (light propagating in $z$-direction through the matter): $$id_zu+d^2_ru=0$$ with $u(z, r)$ being a complex wave. The time scale in this equation is $$t\equiv t_\text{lab}-zn_0/c$$ I know how to solve that equation using a Crank-Nicolson-algorithm: I can reformulate it with $$\part...
I tried some python optimization functions and some of them needed Jacobian matrix prior for faster convergence. I understand Jacobians are basically transformation matrices that data from one space to another or carrying gradients information. Can someone explain me with some literature references, how the speed up is...
I am working with an Eigen::SparseMatrix matrix of type double. I would like to find the largest and the smallest eigenvalues. A solution of the problem is to convert it to dense and then find its eigenvalues. Finally the maximum and the minimum in the spectrum. Is there a better efficient way to do it? Let say Possi...
I am computing some partitions in my work and would like to be able to extract informations in an automatic way when given a certain partition structure. To see what I have in mind, look at the photos attached below. Given the partition I can easily extract contours in 2D or triangulations of the surface of the cells...
First, $AX=B$ is solved, so I have the LU factorization of $A$ computed already. Now I need to solve $BX=A$. Is there any way to reuse this information (LAPACK gesv was used to compute LU of $A$)?
I'm trying to use newton-raphson method for nonlinear systems of equations as described in 'Numerical recipies' book in chapter 9.6 to solve the hydrostatic equation for a polytropic star. For each iteration, I change the radius vector as described in the book like x→x+Δx(Δ can be calculated for each iteration) but I c...
Based on page $35$ of the book: (W. Bangerth and R. Rannacher, "Adaptive Finite Element Methods for Solving Differential Equations", Birkhäuser, 2003,) for computing the error in dual weighted residual method we can use a higher order interpolation $Iu^{(2)}_{2h}$ of $u$, i.e. \begin{align} e\approx Iu^{(2)}_{2h}-u_h...
I have a non-negative function $f(x) \ge 0$ defined on the interval $[a,b]$. I would like to have a finite-dimensional approximation to this function that is guaranteed to be non-negative on $[a,b]$. What would be a good way to do this (say assuming $f$ is a smooth function)? The reason I want to do this is that I woul...
Is this is plausible at all? It seems the most obvious/naive approach, so there's probably good reasons why it's not used - what are they? Viscosity is not important. Starting with inviscid Navier Stokes: $$ \frac{\partial \mathbf u}{\partial t} + \mathbf u \cdot \nabla \mathbf u + \frac{1}{\rho} \nabla p = \...
I am trying to implement a fem code on tet10 elements. I do not prefer to use open source at the moment as I would like to have the basic feel over the algorithm. I closely follow the lecture notes for tet10 implementation at http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch10.d/AFEM.Ch10.pdf However whe...
This question is based upon a research article which I am trying to reproduce. One of the main result of this paper is the condition on transverse confinement of the Bose-Einstein Condensate(BEC) to make the black soliton solution stable. The equation governing BEC is the Gross-Pitaevskii(GP) equation, given by $i\hbar...
So I am trying a molecular dynamics simulation, and trying to populate a 3D rectangular volume with random particles which are uniformly distributed throughout the volume. Each molecule has a fixed radius r(sphere), where r can be different for each molecule. So I would want the sphere to be generated in the volume, an...
Consider the following steps for the $i$-th non-linear conjugate gradient iteration, in the context of 3D electromagnetic inversion, and as discussed in (Newman and Boggs, 2004): (1) set $i = 1$, choose initial model $\mathbf{m}_i$ and compute $\mathbf{r}_i = -\nabla\phi(\mathbf{m}_i)$ (2) set $\mathbf{u}_i = \mathbf{M...
I am using a parametrized natural spline to interpolate 2D curves. For example something like this: Where I parametrize both the x and the y coordinate with a parameter that increases by one between each of the given points. The interpolation looks very good, here the x coordinate as a function of the parameter t: Th...
I have the following function $$f(x,y) =\left(\frac{1}{\exp(x-E_f)+1}-\frac{1}{\exp(x-y-E_f)+1} \right)\frac{1}{\sqrt{4-xy}}$$ I want to integrate it using Python 3. The domain of the $y$ variable is from sampled data hence I cannot used something like quad. The $x$ variable comes from analytical formula so I can gener...
Let $d_1=1,d_2=2,a_{11}=\frac{5}{13},a_{12}=\frac{22}3,a_{21}=-2,a_{22}=\frac{6}7,\tau=\frac{5}7$, $\psi(t,x)=\cos^42x,\phi(t,x)=\frac{3}{13}x^4\sin^2 3x$, $\Omega=[0,200]$ How to solve: $$\left\{ \begin{array}{lc} \dfrac{\partial u(t,x)}{\partial t}=d_1\triangle u(t,x)+u(t,x)\left(r_1-a_{11}u(t-\tau,x)-a_{12}v(t,x)\r...
There is a paper called "Density-equalizing map projections: Diffusion-based algorithm and applications" by Michael T. Gastner and M. E. J. Newman, which explains their algorithm (which is based in diffusion equations) for generating value-by-area cartograms. While it explains the theoretical side of the mathematics in...
1s question: definition of stationary point for constrained optimization As far as I know, a stationary point of a constrained optimization problem is a stationary point of the Lagrangian (that has to be differentiable). Now consider the problem \begin{equation} \min_{x\in X} F(x) \end{equation} where $F:\mathbb{R}^p\t...
I have a question concerning the von Neumann stability analysis of finite difference approximations of PDEs. There seem to be a wealth of online source explaining the application of this stability analysis to a few example cases, most commonly the heat equation: ${\frac {\partial u}{\partial t}} = \alpha {\frac {\parti...
What's the best practice for naming output files from scripts that you're experimenting with? I'm trying different parameters in my data generation script and I'd like to keep track of which files correspond to which parameters. If I use the standard way of naming with timestamps I soon lose track of how the files were...
I know lot of density functional packages in fortran, including one which we are developing in our group (Fireball-DFT) but I don't like fortran very much and I would like something which is easier to integrate to other software. For example, I have idea to create some simple interactive tool with GUI based on DFT or...
I am working on a project with electrical circuits, where I am trying to compute the voltages at all the nodes of an electrical circuit. I know that the electrical circuit is a perfect grid, so each node only touches at most 8 other nodes. Which means that I endup trying to solve a system: L v = i where L is at least a...
I am working on a trajectory analysis project using python and its data science related libraries. I am planning to implement Quadtrees for for trajectory analysis, each trajectory has sequence of (x,y) coordinates along with timestamp, speed, dist between consecutive points, etc. I would kindly request if anyone who h...
I was reading these slides about preconditioners. I believe I grasp the idea of how they work but there is something that is still not making sense. If we have the system $Ax=b$ and use a preconditioner we end up with a system $M^{-1}Ax = M^{-1}b$. Now say I decide to use an $LU$ factorization, it means that I need to ...
I am new to C++. I am trying to set up a very basic TCG game (with only minion with no text). I think my issue might be linked with pointer. Below are the functions and attributes: Player *Game::Turn Board Player::getBoard() Card Card_collection::get(int i) int Card::m_has_been_played_this_turn Board inherits from Car...
I am making an n-body simulation in python. There are many different methods to numerically solve the system of differential equations governing the gravitational interactions between the $n$ particles; the challenge of n-body simulations is to find an integration scheme which is both accurate and fast. For the moment,...
This will be a vague question. When I was writing a finite element matrix assembly routine, a colleague noticed that I had a bug in my code because the sparsity pattern of the one of the blocks didn't look correct to him. He explained to me that the block operator is a Laplacian operator, which is the discrete analogu...
I wonder if there is any study that compares the performance of kd-tree vs brute-force nearest neighbor search on GPU. Post #4 on this page suggests that kd-tree may not be the optimal algorithm for GPU but I wonder if there is any data supporting this claim?
I need help programming a script, in MATLAB, that for assigned values compute the optimal transmission angle of a crank-rocker mechanism. The parameters are: $L$: crank's angle of oscillation, for example from -20° to 150° $m$: rocker's angle of oscillation, it's a fixed value. $t$: $\tan(L/2)$ $u$: $\tan((L-m)/2)$ $...
I'm about to get started trying to use Javaplex for the first time for some application in topological data analysis (TDA) and I want to use a custom defined metric. From looking over the documents, I can do this if I build the distance matrix for all of my points. My question is twofold: Can I do it by just defining ...
Being new to numerical analysis techniques, in particular RK2, I decided the best way to jump in is by using python to solve the well known mass-spring oscillator using RK2 techniques. My problem is that the step size seems to influence the period of my solution and I do know why and would appreciate it if someone cou...
I am using scipy.integrate.odeint to simulate the reaction of a system with known input signals via integration. The simplified code below illustrates what I'm doing. It simulates the response of a number of first order systems to sinusoidal inputs by first generating the data and interpolating to the data in the integ...
I have a PDE equation with Robin Boundary condition in an annulus system and I should solve it by finite volume method: \begin{align} \frac{\partial T_f}{\partial t} - k \left(\frac{\partial^2 T_f}{\partial r^2} + \frac{1}{r} \frac{\partial T_f}{\partial r} \right) = -Q \end{align} I do not...
From an old, wise engineering book Peterson's Stress Concentration Factors (http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470048247.html page 324) I've got the following problem: There is 2D infinite periodic structure with round holes of radius r with tension applied to it. The relation of maximum stress in th...
I want to evaluate the Surface force integral in an FEM procedure. The basic reference tet is shown in the figure. The faces are numbered corresponding to the node opposite to them. For example the nodes 2-3-4 which forms a face opposite to node 1 is labeled as 1, and so on... I now transform the tet into the volume c...
I am working on numerical simulation of breast model to evaluate the use of thermal imaging for breast cancer detection. To do this I need to construct an ellipsoid rotated 30 degrees around y-axis and cut from x–y plane. The outer major and minor semi-axis lengths of the ellipsoid are set to 0.08 m and 0.05 m, respect...
We know that \begin{align*} \|u\|_{0,\infty,\Omega}={\text{ess} \sup}_{x\in \Omega}|u|. \end{align*} Moreover, the nonconforming Crouzeix-Raviart finite element space is \begin{align*} V_h=\{ v|_K\in P_1(K),\ v ~\text{is continuous at the midpoints of edges and } v=0 \text{ at the midpoints on boundary edges}\}. \end{...
My coworkers and I have developed a c++ library implementing a "3D Geological Model" class. Goal of this library is to provide a data structure that is used in computational codes (such as Finite Element codes etc...) This model class contains "Entities" (i.e. Corner, Line, Surface, Volume). Each Entities own a Mesh, w...
I am trying to solve a 1D transient heat conduction problem using the finite volume method (FVM), with a fully implicit scheme, in polar coordinates. The governing equation is written as: $ \frac{\partial \rho C_p T}{\partial t} = \frac{1}{r}\frac{\partial}{\partial r}\left(kr\frac{\partial T}{\partial r}\right)$. Esse...
I want to simulate a system of random walkers (called A) with diffusion coefficient equal to D and other systems of random walkers (called type B) with diffusion coefficient equal to 1000 D. Second type of walkers are smaller than the first ones and are eaten by the first type. As diffusion coefficient of B walkers are...
Background I have a huge dataset consisting of points (on a plane) together with a timestamp for each point. This is a collection of car GPS measures, giving us the location (latitude/longitude) of some car and the time at which that car was there. I would like to store the time-series’ information on a grid. That is, ...
I would like some classical molecular mechanics forcefield library or super-simple program which does not have any external dependences, so that I can plug it into my software without worry of "dependency hell". Also I would like to modify it, so I would prefer something with simple and compact source code. It should d...
I need to to find a quick and dirty way to estimate the absolute error introduced by a series of agebraic operations of IEEE single precision floating point numbers, a pessimistic result is ok. The way I am doing it, is to evaluate the biggest possible value that can be obtained during the chain of operations, find the...
Let $C(u)$ be a B-spline curve depending on the parameter $u\in[0,1]$ $C(u) = \sum_{i=0}^n c_i \, B_i(u)$ with $n+1$ coefficients $\{c_i\}$ and B-spline basis functions $\{B_i(u)\}$. Edited based on origimbo's comment: We define the knots $\{\bar u_i\}$ to be fixed (and equidistantly spaced). Now, I would like to kno...
Context In the Portable, Extensible Toolkit for Scientific Computing (PETSc), the user often creates matrices and vectors. These objects are then used as input for other routines like iterative solvers. PETSc offers a routine for preallocating matrix memory by providing the number of nonzero entries in the diagonal sub...
can any one show the steps how I convert the summation to norm as below: $$ \sum_{j=1}^{M'} \big(\lambda_j (\mathbf{L}\mathbf{x})^2_j\big) = \|\mathbf{L}_\lambda \mathbf{x}\|^2, \qquad\text{where } \mathbf{L}_\lambda = \mathbf{\Lambda}^{1/2}\mathbf{L} \text{ and } \mathbf{\Lambda} = \mathrm{diag}(\lambda). $$ where $L$...
(I resume my question with a simple example) I want to create a struct in matlab/octave as follows c(1).x = [0 1]; c(2).x = [0 1]; ... c(100).x = [0 1]; One way is to do an for cycle: for i=1:100 c(i).x = [0 1]; end My question is, how can avoid the cycle for? (The reason is that everybody knows that we nee...
I am currently writing my masters thesis and my topic also touches on Stochastic Tomography for volume reconstruction presented in this paper. Now i understand most of the process described, but i just don't understand one aspect of calculating the objective function. On page 4 under "Evaluating the Objective Function"...
Suppose we know the SVD of matrix $\bf A$, and $\bf B$ is a slight perturbation of $A$ (e.g. $\|{\bf B}-{\bf A}\|_{\text F}$ is relatively small), then is there any method that can efficiently compute the SVD of $\bf B$? That is, can the knowledge of SVD of $\bf A$ be helpful for SVD of $\bf B$? I searched a little bit...
I am facing the following problem: Given is a line of length $L$ which I want to split into $N$ segments. The lengths of the first $(s_1)$ and last segment $(s_N)$ are given. You can assume that the first and the last segment are shorter than the average length $s_{ave} = \frac{L}{N}$ but they are not required to be e...
Suppose I have implemented an LP, where some constraint coefficients are implemented as the mean of some probability distribution. Now, I would like to solve the same problem but with stochasticity reintroduced based on the probability distributions. Can this still be solved using LP techniques? If not, what are the na...
I was reading about ellipse-ellipse intersection and I came across this article: https://math.stackexchange.com/questions/679622/intersection-between-conic-and-line-in-homogeneous-space/867428#867428 I wrote a program that implements this method and it works, but now I'm working to understand why. I understand how $D ...
My simulation creates a 2d grid of vectors and scalars (EDIT of velocity, depth etc), at 60 frames per second. Is it correct? It looks sort of right... but who knows? How can I tell what's happening - especially for debugging? Thoughts so far: Arrows for velocity field is difficult to see what's happening in small are...
I am working on a trajectory analysis project using python and its data science related libraries. I am planning to implement Frechet Distance algorithm for trajectory analysis, each trajectory has sequence of (x,y) coordinates along with timestamp, speed, dist between consecutive points, etc. I would kindly request if...
A boolean-valued monotonic function is defined in the set of positive integers, $\mathcal Z$. $$f(n) = \begin{cases} 0, &n_{min}\le n < n\ast\\1, &n\ast\le n\le n_{max} \end{cases} ; n \in \mathcal Z $$ The goal is to search for $n\ast$. The bounds $n_{min}$ and $n_{max}$ are known apriori. A salient property of $n\ast...
I have a system of equations that cannot be solved for in closed form: $F_1(x_1,x_2,\beta)=0 ~\&~ F_2(x_1,x_2,\beta)=0 $ I want to solve for functions $x_1=x_1(\beta) ~\&~ x_2=x_2(\beta)$ My approach so far: Fix $\beta=\beta_1$ Solve system numerically for $x^1_1,x^1_2$. Repeat for a different $\beta$ on some pre-def...
I've read that in modeling structures problems, the finite element method (FEM) is typically used. I am unfamiliar with FEM, but I am wondering, in particular, if using FEM, as opposed to finite difference/volume, alleviates some of the numerical stability issues that may arise due to the large structural constants? I...
I'm currently using ParMETIS and it is required to determine the halo region of the local elements in a parallel unstructured mesh. Assume that the mesh is large and cannot be stored on a single processor. My approach is to gather the global list of elements and their processor location in each processor. Then the neig...
How can one simulate diffusion of a particle which has a natural axis and diffusion coefficient of the particle in the direction of the axis is D_1 and in perpendicular to the axis is D_2? Could anyone provide a code?
I am simulating the propagation of a light pulse using the equation $$\frac{\partial}{\partial z}A=\frac{1}{2\cdot k_0}\nabla^2_rA$$ with $$k_0=\frac{2\pi}{\lambda_0}$$ The propagation with a step size of $dz$ is done using the equation $$\left(\vec{1}-i\cdot\frac{dz}{2}\nabla^2_r\right)A_{n+1}=\left(\vec{1}+i\cdot\fra...
I am trying to implement a fem code on tet10 elements. I follow the lecture notes for tet10 implementation given in http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch10.d/AFEM.Ch10.pdf I have validated my stiffness matrix with the example provided. The numerical values of the Jacobian at the Gauss point...
I am interested in the specific differences of the following methods: The conjugate gradient method (CGM) is an algorithm for the numerical solution of particular systems of linear equations. The nonlinear conjugate gradient method (NLCGM) generalizes the conjugate gradient method to nonlinear optimization. The gradie...
I would like to implement P2 (or even P3...) finite elements in Matlab. I need to be able to control the construction of the rigidity and mass matrices ($ \int \nabla \varphi_i\cdot \nabla \varphi_j$ and $\int \varphi_i \varphi_j$) (since I want to tackle some precision computation problems afterwards, and maybe go bey...
I am working on a trajectory analysis project using python and its data science related libraries. I am planning to implement Frechet Distance algorithm for trajectory analysis, each trajectory has sequence of (x,y) coordinates along with timestamp, speed, dist between consecutive points, etc. Following is the example...
I have two variations of an iterative algorithm. All the steps of both algorithms are equivalent except one. In this step: Algorithm 1 needs to compute the matrix $ABA^T$ for matrices $A \in \mathbb{R}^{p \times p}$ and $B \in \mathbb{R}^{p \times p}$; Algorithm 2 needs to invert the $p \times p$ matrix $C$. My ques...
I have a 3-dimensional domain D, with 3 types of BC which I am trying to solve the Poisson equation on. $$-\nabla \cdot (\sigma(x,y,z)\nabla u)=0$$ Insulator (Neumann BC) Electrode set at some potential (Dirichlet BC). Additionally I have some electrodes $E_l$ which are set to have a fixed current $I_l$, so on these th...
I don't know if anyone is using SGE anymore (what is the world of HPC using nowadays?), but I need to work on version 6.2u3, I believe, from sometime back in '11. I'm using it on a cluster of 64 nodes, 12 cores each. Thing is, I'm not sure what requesting X cores really means. Is it purely advisory? I've tried using bo...
In order to calculate the volume of the solid defined by $$\frac{51}{100} (\cos x \cos y+\cos x \cos z+\cos y \cos z)+\cos x+\cos y+\cos z+1\le0$$ where $x,y,z\in[0,2\pi]$ I used the following code (in MATLAB) f = @(x, y, z) double(1 + cos(x) + cos(y) + cos(z) + 0.51*(cos(x).*cos(y) + cos(x).*cos(z) + cos(y).*cos(z))...
I am writing a FEN solver on tet10 elements. I right now have a CFD grid gen tool (Pointwise) which generates tet4 meshes. From this I have the element connectivity list and the node list. How do I go about generating a tet10 mesh from this info. Is there any particular tool/code to do this.
In my code it often happens that I need to calculate values for a group. For example, suppose there is the following data: groups = [A, A, A, B, B, B] values = [1, 2, 3, 0, 1, 1] And I want to calculate the cumsum by group: cumsum = [1, 3, 6, 0, 1, 2] I always code this in the same way, as follows: from collections i...
I know that an easy way to solve the matrix problem $$A\cdot x=b$$ is the LU decomposition $$\begin{split} L,\,U&=\text{lu}(A)\\ y&=\text{solve}(L,\,b)\\ x&=\text{solve}(U,\,y) \end{split}$$ Thus I implemented the following code in matlab: r_num = 10000; r_rounds = 10000; A = -30*sparse(diag(ones(r_num,1),0))+16*spars...
I have a function of 3 variables like $V= f(r_1, p, r_2)$, I want to plot these 4 data in one graph to be able to capture the behavior of V with respect to all three variables. I searched a little bit and read about Sliceomatic but not sure how does it work and if it delivers my requirements. I would appreciate if some...
I have a very basic question, and I hope some of you might be able to help me: In Fluid Dynamics, a common equation turning up time and time again is the so-called continuity equation: $$\frac{\partial}{\partial x}(T\frac{\partial h}{\partial x}) + R = S\frac{\partial h}{\partial t}$$ Where $T$ is the transmissivity of...