instruction
stringlengths
43
28.1k
Von Newman stability analysis for acoustic wave equation explicit centered differences: 2nd order time and space (N 2)'th order: \begin{eqnarray} U_{jk}^{n+1} = \left( \frac{\Delta t V_{jk} }{\Delta s} \right) ^2 \left( \sum_{a=-N}^N w_a U_{j+a k}^n + \sum_{a=-N}^N w_a U_{j k+a}^n \right) + 2 U_{jk}^{n} - U_{jk}^{n...
I have a cost function: $f(x,y,z) \rightarrow \mathbb{R}$ it is very expensive to evaluate $x,y,z \in \mathbb{Z}$ 0 < x < 10 0 < y < 30 0 < z < 100 I thought it was convex, not sure now based on @Brian's commentary. $f$ can only be evaluated at integers ( I pondered trying to evaluate at real's but it would be fairly ...
Are stabilization techniques for convection-dominated flows like SUPG+PSPG, interior penalty methods, etc. able to handle turbulent flows without tubulence model being employed, at least up to some Reynolds numbers? Conversely is stabilization needed for turbulent flow being resolved by some RANS model when Reynolds nu...
I want to save a matlab source code into a string format in matlab. Does anyone know how to do this? For example, type xxx.m can display the source code of xxx.m. Then using what command am I able to save it into a string?
Having mesh = UnitSquareMesh(2, 2) Q = FunctionSpace(mesh, 'DG', 0) this works as expected R = mesh.ufl_cell().circumradius R = project(R, Q) but this fails h = mesh.ufl_cell().max_facet_edge_length h = project(h, Q) when compiling generated code with error: 'facet_area' was not declared... Does max_facet_edge_lengt...
I have been given the task of implementing SVD using the Lanczos method. As I understand it only helps to find eigenvalues using a sequence of tridiagonal matrices, but i don't know how to apply this to actually computing the SVD. Do I need to approximate the given matrix with tridiagonal and then compute SVD with diff...
We are working on an optimization problem in which we can approximate the eigenvalue calculation by assuming a constant eigenvector, using the formula: $$ \tilde{\lambda}=\frac{\{\phi_0\}^T[K]\{\phi_0\}}{\{\phi_0\}^T[K_{G_0}]\{\phi_0\}} $$ where $\{\phi_0\}$ is the already calculated eigenvector, $[K_{G_0}]$ is the alr...
Neumann boundary conditions are implemented by introducing ghost points outside the domain and then using the boundary conditions to eliminate the ghost points. For example, see this question. I have a set of three equations in variables $(u,v,w)$ which are one dimensional functions of $x$, and I cannot see how to eli...
My heat equation is $$ \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2}, \quad x \in [0,1], \quad t \in (0,0.1] $$ with initial condition $u(x,0)=\sin(\pi x)$ and homogeneous Dirichlet boundary conditions $u(0,t) = u(1,t) = 0$. The exact solution is $u(x,t) = e^{-\pi^2t}\sin(\pi x)$. I approximate the...
I am trying to model a flow past a cylinder using the projection method. I am a bit confused on how to define the circular cylinder in my computational domain. I know that the cylinder has the coordinates $(x-a)^2 + (y-b)^2 = r^2$ but what is the best way to define that in terms of x(i,j), y(i,j) coordinates such that ...
With the move away from launchpad I hope this is the right place for this question. Is there a way to initialize the DOFs for a function? generated by u = Function(V) When I run a code which I will put in at the end I get the fenics error: *** Error: Unable to initialize vector of degrees of freedom for fun...
I am looking to port some code that resolves a set of partial differential equations (PDE) by the finite volume method in IMPLICIT form (for the time discretization). As result there is a tridiagonal system of equations in x,y,z directions which is handled by the ADI/TDMA scheme. I can not seem to find anything regardi...
I would like to compute the decomposition of a real symmetric positive definite matrix $\mathbf{A} = \mathbf{UDU}^\top$. LINPACK seems to have it as DSIFA, but I cannot find an equivalent routine in LAPACK. It also doesn't appear to implemented in Eigen. What other packages and routines support this decomposition? Ba...
I need to solve a real generalized eigenvalue problem $Ax= \lambda Bx(*)$ A and B are calculated from equations below: $$A=\sum_{i,j=1}^{N}W_{ij}(K_{i}-K_{j})\beta\beta^{T}(K_{i}-K_{j})^{T}$$ $$B=\sum_{i=1}^{N}D_{ii}K_{i}\beta\beta^{T}K_{i}^{T}$$. where $W$ is a real symmetric $N*N$ matrix with diagonal entries being $...
I'm using Eigen (a C++ library for numerical linear algebra) to solve a linear equation with the the bi-conjugate gradient BICGSTAB algorithm with Incomplete LU preconditioner. However, the result bg.error()("estimated error") becomes -1.#IND after 1 iteration. The size of the linear system is $N=20000$. Could anyone h...
I am trying to implementing a nodal discontinuous Galerkin spectral element method for linear and non-linear systems of equations. The solution at each time step is given at N nodes, which are located at the integration points for Legendre-Gauss/Legendre-Gauss-Lobatto quadrature. For visualization purposes I would like...
I'm working on a time integration scheme for my research. As a result, I have come across an interesting phenomenon. Somehow, the total energy of the scheme oscillates. At any given time the total energy of the system could be increasing or decreasing but does so in a oscillatory fashion. Interestingly enough, for what...
I have a physical problem governed by the Poisson equation in two dimensions $$ -\nabla^2 u = f(x,y), \; in \; \Omega $$ I have measurements of the two gradient components $\partial{u}/\partial{x}$ and $\partial{u}/\partial{y}$ along some part of the boundary, $\Gamma_m$, so would like to impose $$ \frac{\partial{u}}{...
In my courses on numerical analysis, I have been taught that the main and principal motivation for preconditioning linear systems of equations is to increase the convergence rate of iterative solvers for that LSE. But, is there any effect on the precision of the computed solution? I can remember a result on the precisi...
Which turbulence model is suitable for resolving incompressible buoyancy-driven flow of a fluid within an cylindrical ampoule? I prefer turbulence model which is sufficiently simple so that fully coupled (UFL) variational form of Navier-Stokes-Fourier is changed in way that each added term is treated by Newton solver,...
I need a little help with Matlab code for the method mentioned in this paper for computing the inverse of the matrix. In this paper, the author presented scaled Newton iteration given by $X_{k+1} = \alpha_{k+1}(2I - X_{k}A)X_{k}, k = 0, 1, 2, \ldots$ for a given matrix $A$. Initial approximation $X_{0} = \alpha_{0}A^t...
Long time ago I came across with a paper that covered early theoretical work (first half of 20th century) in the field of inverse problems. I remember there was a reference to a paper which proved that inverse problem can be solved uniquely for a spherical domain with infinitely many sources and very precise receivers ...
Edit: I made a test model with 2 bodies. The sun and earth or w/e. But I now have the problem of zero divisions every time that one of the coordinates is zero. import numpy as np from numpy import exp, sqrt, pi, linspace from time import clock,time import pylab as pylab S1 = 1E3 #Mass Star M1 = 1 ...
The integral I need to evaluate is: $$ \int_x^{\infty} \frac{t^n}{e^{t} -1} dt $$ After some research I found a paper saying, The numerical values of the two integrals [...] are easily calculated either directly or through series expansion. It's easy to evaluate, right? So I try plugging this into my 32bit 7.7.0.471 ...
I read in a paper and also at wiki that we can solve the system $$Ax=B$$ by Fast Fourier Transform, where $A$ is a circulant matrix. The solution is $$x=\mathtt{ifft}(\mathtt{fft}(B)/\mathtt{fft}(a))$$ where $a$ is first column of $A$, ifft is the inverse of fft and $/$ denotes component-wise division. For example, th...
I'm relatively new in the CFD modelling and I'm making a VOF model of a rectangular box ($l \times w \times h = 120\times 80 \times8$ m) with an inlet ($w\times h = 10\times 8$) at the long side. The pressure outlet is the upper face of the box ($l\times w=120\times 80$m). The box is initially filled with $5$m water. ...
I have probably a very stupid problem. I can't solve a simple Poiseuille flow in a straight 2-D channel driven by a pressure drop. Results are complete nonsense. (Setting zero pressure on the outflow gives trivial solution/no flow. Taking pressure on the outflow non-zero (but still having some pressure drop) gives a so...
I am getting into computational fluid dynamics (CFD). One of my professors mentioned that a cylindrical wake would be a good starting point to learn about turbulence modelling when using CFD software. I'm not a native speaker, so I googled cylindrical wake CFD but the results confuse me (also the translations of my ...
My question is basically the best way to compute the matrix exponential in parallel. I've got a sequential code written in Python (https://github.com/hadsed/AdiaQC) and I need to extend it to run in a high performance environment (cluster, supercomputer, maybe GPU). The code simulates adiabatic quantum computation, and...
I'm still pretty new in the CFD modelling world. Can anyone advise me how to define a inlet for a tidal basin in Fluent? The water level and the velocity at the inlet vary in time due to the tide cycle.
I'm trying to analyze the complexity of MATLAB code I wrote. I'm trying to figure out how much (in terms of $O$ or $\Theta$) to give functions like find, matrix * operator, matrix .* operator, and others. Is there a way to calculate this? Or a reference?
Suppose I had a boundary value problem: $$\frac{d^2u}{dx^2} + \frac{dv}{dx}=f \text{ in } \Omega$$ $$\frac{du}{dx} +\frac{d^2v}{dx^2} =g \text{ in } \Omega$$ $$u=h \text{ in } \partial\Omega$$ My goal is to decompose the solution of this coupled problem into a sequence of uncoupled PDE's. To decouple the system, I'm ...
When FEM-discretizing and solving a reaction-diffusion problem, e.g., $$ - \varepsilon \Delta u + u = 1 \text{ on } \Omega\\ u = 0 \text{ on } \partial\Omega $$ with $0 < \varepsilon \ll 1$ (singular perturbation), the solution of the discrete problem will typically exhibit oscillatory layers close to the boundary. Wit...
I'm interested in finite-difference approaches to the incompressible Navier-Stokes equations that can handle complex geometry without the use of an unstructured mesh or a non-Cartesian grid. To be clear, I'm aware of standard approaches, e.g. Chorin's projection method, to solving the Navier-Stokes equations on a recta...
For the numerical integration of reaction terms in my PDE on a 2D triangular mesh, I would like to use the scheme $$ \int_T \Phi(x) \approx \frac{|T|}{3} (\Phi(x_0) + \Phi(x_1) + \Phi(x_2)) $$ where the $x_i$ are the triangle nodes. How to specify this when assembleing the system?
I am trying to simulate a metal-organic framework in LAMMPS using the UFF potential. It's working quite well for some structures where all molecules have an occupancy of 1. However, when I have a solvent molecule that has an occupancy of 0.5, what I do is randomly select one of the two positions for each unit cell. T...
The explicit 4th order discretization for the 2D scalar wave equation is given by: \begin{eqnarray} U_{jk}^{n+1} = \left( \frac{\Delta t V_{jk} }{\Delta s} \right) ^2 \left( \sum_{a=-N}^N w_a U_{j+a k}^n + \sum_{a=-N}^N w_a U_{j k+a}^n \right) + 2 U_{jk}^{n} - U_{jk}^{n-1} \nonumber \\ U_{jk}^{n+1} = \left( \fra...
Motivation: In isogeometric analysis, state variables(e.g. displacement) are defined in the parametric domain, which can be mapped to the physical domain by $\boldsymbol{\xi}\mapsto \boldsymbol{x}$ as shown beneath. However the quantity related to displacment such as stress, strain are spacial derivatives of displaceme...
I am still a fairly new graduate student, and I am having trouble simulating a metal-organic framework. I am currently using UFF (I implemented it for LAMMPS), and it works well for some MOFs, but does not give empirically accurate results for others. What I mean by this is that I have a CIF file for the experimental...
At work, I essentially function as an independent consultant. For management and customers, I need to estimate the amount of time it will take to develop software as part of my computational science research. However, my time estimates are usually off. I know that there are methods to estimate the time it takes to deve...
In one of my PETSc programs, I need a processor to access values from another processor. So in the PETSc FAQ's this issue has been briefly addressed here. To create a local vector, I tried this Vec local; ierr = VecCreateSeq(PETSC_COMM_WORLD,10,&local);CHKERRQ(ierr); where 10 is the size of the local vector I wish ...
I am trying to understand the advection equation with variable velocity coefficient a bit better. In particular I don't understand how the equation can be conservative. The advection equation, $$ \frac{\partial u}{\partial t} + \frac{\partial}{\partial x}(\boldsymbol{v}u) = 0 $$ Let's interpret $u(x,t)$ as being the co...
Note: this question was also posted in StackOverflow and math.stackexchange. I have a set of 3D points defining a 3D contour, as shown below. The points in this contour lie in their best-fit plane and I want to obtain a 3D triangular mesh representation of the surface inside this contour. Doing some research I found t...
I'd like to program a trajectory planner, let's say for a robot, and I can pass acceleration commands to the robot, the robot can move in one dimension. The outcome of the planner is now a vector with accelerations, for example 10 accelerations, and since I set the accelerations with a frequency of 2, this will be suff...
This title certainly needs some clarification: I need to compute parameters $a_i$ for a helper function $f(\vec{a};k)$ (for grid interpolation) which is fitted to a number of values $y_k$ which are subject to evolution dictated by a system of ODE's $d y_k/d t = F_k(t,\vec{y})$. The Levenberg-Marquardt fit of the values...
When SUPG/PSPG stabilization is added to momentum equation of flow problem, is needed stabilization for energy equation also? I would guess that when stabilization for velocity works fine so one gets velocity without spurious wiggles and assuming that thermal diffusivity is large enough then answer is no. How are these...
I'm trying to model a spring damper system from a tutorial that I've found on this site. If I use the exact same parameters as the ones in the tutorial the system is not stable. I've downloaded the code and verified that the parameters were the same as mine. a = (k * u) - (d * v); v = v + a; s = s + v; jsfiddle availa...
Following on from the earlier question I am trying to derive a finite-difference scheme for the advection equation which is conservative. It was suggested that for advection equation with variable velocity, $$ \frac{\partial u}{\partial x} + \frac{\partial}{\partial x}\left( \boldsymbol{v}(x)u\right) = 0 $$ that the ch...
I have obtained some data from neutron diffraction for some material samples. The "rawest" form of the data is the structure function $S(Q)$. We can choose a variety of different Q-maxes when Fourier transforming the data into $g(r)$, along with applying something like a Lorch function to smooth it out. Right now the...
I am continuing my dive into computational fluid dynamics. I would like to build a simple test case for modelling the flow around a cylinder in FEniCS and then continue to model turbulence in order to observe the Karman vortex street. I am a newby in both FEniCS and CFD. I have started to go through the FEniCS book and...
while executing my script i get this error Traceback (most recent call last): File "/media/oss/Fenics/demo/box_3delasticity.py", line 33, in mesh = Box (0, 0, 0, 1, 1, 1, 1, 1, 1) File "/usr/lib/python2.7/dist-packages/dolfin/cpp/mesh.py", line 8698, in init _mesh.Box_swiginit(self,_mesh.new_Box(*args) I d...
I am doing a small project at school. I have done my code implementations in CUDA and did some performance measurements with real values, i.e. running the program with different number of threads, changing the size of the problem, changing both, etc. The results of (time, speedup) look really nice. But then I was asked...
My system is a symmetric FE problem with lagrange multipliers (e.g. incompressible Stokes' flow): \begin{pmatrix}A & B^T \\ B & C\end{pmatrix} where $C = 0$ is the typical case (I have even made sure that the equations are numbered so that the Lagrange multipliers appear last ). The system is quite large (+100k lines)....
It seems that people usually use the Single Active Electron (SAE) approximation to deal with a multi-electron system, transforming the problem into a single electron problem. For example, in numerically solving the problem of a helium atom interact with laser fields, people usually approximate include the electron-elec...
I just went through the Fenics book to get the nodal displacements and tried this code .... u_nodal_values = U.vector() u_array = u_nodal_values.array() coor = mesh.coordinates() center = (0.5,0.5,0.5) print U(center) if mesh.num_vertices()==len(u_array): for i in range(mesh.num_vertices()): print ’U(%8g,%8g...
I am about to test my algorithms for solving optimal control problems of type: Find an input $u$, such that for a time interval $(0,T]$ the cost functional $$J(v,u) = \mathcal M(v(T)) + \int_0^T\mathcal K(v(t),u(t)) dt, $$ becomes minimal, where $v$ is the velocity of flow modelled by the incompressible Navier-Stokes ...
This is not a technical question, and is asked just out of curiosity. Are computational fluid dynamics (CFD) simulations used in animation movies? (something like shallow water equations, explosion problem etc.) In other words, can computational simulations of real world problems be used in art? (I have tagged the qu...
Sunny day today, isn't it? Please, I need help with my problem. I have written a program to do 2D ray tomography, according to this paper. For the result, I use formula (4.15) from the paper. Now I need to do SVD regularization on the result, in order to get good results for lower count of rays (lets say I will have $N...
In a elastodynamics problem, I define the stress as def sigma(v): return 2.0*mu*sym(grad(v)) + lmbda*tr(sym(grad(v)))*Identity(v.cell().d) I have computed the displacements at the nodes. Now I want to compute the stresses elementwise. Can anyone help?
In practice, the runtime of numerically solving an IVP $$ \dot{x}(t) = f(t, x(t)) \quad \text{ for } t \in [t_0, t_1] $$ $$ x(t_0) = x_0 $$ is often dominated by the duration of evaluating the right-hand side (RHS) $f$. Let us therefore assume that all other operations are instant (i.e. without computational cost). If ...
`I am working on a problem found here " http://www.caesarsystems.co.uk/NAFEMS_benchmarks/le10.html" ..I am really confused about the boundary conditions and tried my level best to compute it but result is totally different here is my bcs` class Left(SubDomain): def inside(self, x, on_boundary): return (between (x[1...
I'm trying to use periodic boundary conditions within a Raviart-Thomas finite element space in Fenics (dolfin 1.2.0) in a Ubuntu 12.04 (amd64) machine (with python 2.7). If other FE space is used, everything works fine, but if a Raviart-Thomas is considered, python crashes (due to libdolfin errors). In what follows, it...
I am just wondering where the term Umbrella Sampling came from. Is there another meaning of literal "umbrella" in physics or mathematics?
I am trying to optimize some force-field parameters in a molecular framework so that the result of simulation comes as close as it can to the experimental structure. In the past, I have written a genetic algorithm where I essentially randomly sample the parameter space, select the combination that works best, create se...
I am confused most of the time with the application of boundary conditions in Fenics. Suppose I have an xml mesh for a rectangular beam and want to apply Dirichlet BC ($u =0$) on the left side of the beam in my mesh file. Can anyone tell me how can I achieve this? I know another way of doing it by defining subdomains l...
Is there a code for the equation $$ \frac{\partial^2u}{\partial x^2}+\frac{\partial^2u}{\partial y^2} = \sin(u) $$ or for the sine gordon equation in two dimensions because I want to change some boundary values to see the results?
I'm solving the Helmholtz equation using PETSc. I found with the PETSc configure option --download-f-blas-lapack my program runs twice as fast over running it with MKL. Is this a common trend or are there other factors at play? I'm using gcc and Open MPI with PETSc.
My program (in Python, using FEniCS): mesh=UnitSquareMesh(16,16) U_h = VectorFunctionSpace(mesh, "Lagrange", 1) B = VectorFunctionSpace(mesh, "Bubble", degree=3,dim=2) Mini_h = U_h + B Boundary definition (for example, u0_boundary and u1_boundary are part of square, respectively): w0 = Constant("0.0") bc0 = DirichletB...
I generated a mesh file in gambit and wanted to convert it to xml format. I tried the code below, but there is no output. from dolfin import * from dolfin_utils import meshconvert dolfin-convert cylinder6.msh out.xml can anyone tell me how to convert using dolfin??
I'm looking for sparse SPD matrices with right hand side? There is UF collection of sparse matrices, however, I'm not sure how do I search of the matrices of these kind efficiently (I'm doing a naive search which hasn't given me any results so far and it takes arbitrary long for some of the matrices).
I plans to use CSDP to solve the following semi-definite problem: $$\min_{B, \beta}\operatorname{trace}(CB) \\ \text{s.t.} \ \operatorname{trace}(AB)=1 \\ \beta\geqslant 0 \\ \begin{bmatrix} 1 & \beta^{T}\\ \beta& B \end{bmatrix}\succeq 0$$ where $A$, $B$, $C$ are $M\times M$ matrices,and $\beta$ is an $M$-dimensiona...
I need to solve the following equation in FEniCS: $$ \boldsymbol{\nabla} \cdot \begin{pmatrix} f(y)\frac{\partial u}{\partial x} - g(x,y)\frac{\partial u}{\partial y} \\ - g(x,y)\frac{\partial u}{\partial x}+f(x)\frac{\partial u}{\partial y} \end{pmatrix}=0. $$ As far as I understand, the weak form will look like:...
Eventually, I would like to numerically simulate the transient compressible flow in an axial compressor during start-up. However, I know that this is a very challenging undertaking (to say the least). Nonetheless I would like to ask if there are recommendations for background literature, simple models, examples, frankl...
Full configuration interaction quantum Monte Carlo seems like it is poised to overtake DFT in some applications pretty soon. I am curious if there is any freely available implementation of the method, as I cannot seem to find one.
I'm conducting a molecular dynamics simulation for silica. Some time ago I turned to the fluctuating dipole model, and after much effort I'm still having problems implementing it. In short, all oxygen atoms in the system are polarizable, and their dipole moments depend on their position with respect to all the other at...
I am learning OpenFOAM as a hobby and using my Vespa racing as the topic to apply it to. The objective is to produce modifications that improve the top speed (as well as getting some values such as lift). I am basing my simulation on the motorbike tutorial. The motorbike tutorial uses the kOmegaSST turbulence model but...
I have a numerical ODE simulation that I computed at fixed time step $h$ using a 4-th order Runge-Kutta method (RK4), producing a series of results $(x_1,y_1), (x_2,y_2), (x_3,y_3) \dots (x_N,y_N)$. If I want to find an approximate solution $y$ at a location $x$ in between my intervals, I could use linear interpolati...
Hey there and thanks for giving time to look at my question. This is a updated version of my question which I posted earlier in physics.stackexchange.com I'm currently studying a 2D exciton spinor Bose-Einstein Condensate and am curious about the ground state of this system. The mathematical method of getting to the g...
I want to implement differential equations in C# from Open Cell cellml file. The mathematical model is described in this article. I have parsed xml, and calculate operations, but can't correctly implement the equations. I can not understand how to evaluate differential equations. The format of operations is content mat...
I'm trying to figure out if there is a faster way to compute all the eigenvalues and eigenvectors of a very big and sparse adjacency matrix than using scipy.sparse.linalg.eigsh As far as I know, this methods only uses the sparseness and symmetry attributes of the matrix. An adjacency matrix is also binary, what makes m...
Let's say you have a general matrix $A$, with diagonal entries $a_{ii} = d>0$. (No assumptions are made about the off-diagonal elements.) Then Jacobi preconditioning doesn't improve condition number, because $$ \kappa(A)= \left|\frac{\lambda_{\rm{max}}(A)}{\lambda_{\rm{min}}(A)} \right| $$ becomes $$ \kappa(M^{-1}A)= ...
I have such a problem - I would need to expand a discrete function in a sine fourier series but I would like to use exponential based library for FFT (I will use CUDA to compute it). What have I to do with the signal I'm sending to the procedure so this is treated as sine fourier? I think I should add zeros but I am no...
How can I convert matrices L and U output by dgssvx() of SuperLU to triples format (to matrix market format)? Also how can I convert input matrix A in triples format (in matrix market format) to the format required by SuperLU? What is the easiest way to perform these format conversions?
I am new to scientific computing. I am looking for a Fortran ( preferably f90) implementation of an Octree. My problem requires an Octree which divides my domain until there aren't more than some N particles(or sources where I know the density value which can be plugged in an integral equation method to solve an equati...
I would like to numerically find a mutual capacitance of two stripes of metal on the opposites sides of a cylinder. The problem is obviously a 2D Laplace equation. I would like to find the potential outside the cylinder as well. Therefore I have something like this: mesh = UnitCircleMesh(50) V = FunctionSpace(mesh, 'La...
I have a dataset of 3-dimensional points for which I'd like to construct a mesh, using python. All the software I've seen requires that you provide the edges. Is there a program in python which takes as the input a set of points in 3D and output a mesh? If possible, I'd like the meshing to be uniform.
In semiconductor simulation, it is common that the equations are scaled so they have normalised values. For example, in extreme cases electron density in semiconductors can vary over 18 order of magnitude, and electric field can change shapely, over 6 (or more) orders of magnitude. However, the papers never really give...
I carefully read all circa 70 pages of FEniCS tutorial and I still do not understand how to solve electrostatic problems when I have materials with different dielectric constant. The self contained system of equations in electrostatic $$ \mathrm{div}\boldsymbol{\mathcal{D}}=4\pi\rho,\\ \boldsymbol{\mathcal{D}}=\varepsi...
The advection equation needs to be discretized in order to be used for the Crank-Nicolson method. Can someone show me how to do that?
The title is the question. This technique involves using the "matrix of cofactors", or "adjugate matrix", and gives explicit formulae for the components of the inverse of a square matrix. It is not easy to do by hand for a matrix bigger than, say, $3\times 3$. For an $n\times n$ matrix, it requires computing the det...
I'm making a model of a square box where water comes in and the water level rises. I want it to be a transient, turbulent, VOF-model. The velocity of water entering changes in time ($-0.2$ to $0.2$ m/s). For now I use a steady, laminar inflow of $0.2$ m/s, a grid of $10,000$ cells (the geometry is roughly $100\times 10...
This presentation by the Imperial College in London has a nice example in it, on page 8, Burgers Equations. The first part of their code reads like this: from dolfin import* n = 30 mesh = UnitInterval(n) V = FunctionSpace(mesh, "CG",2) ic = project(Expression("sin(2*pi*x[0])"), V) u = Function(ic) u_next = Function(V)...
I have an ODE without a boundary condition: $\small\left(\frac{d}{dr}C(r)\right)^4-2C(r)\left(\frac{d^2}{dr^2}C(r)\right)\left(\frac{d}{dr}C(r)\right)^2+2\left(\frac{d}{dr}C(r)\right)C(r)^2\left(\frac{d^3}{dr^3}C(r)\right)-4\left(\frac{d^2}{dr^2}C(r)\right)^2C(r)^2+12C(r)^2\left(\frac{d^2}{dr^2}C(r)\right)-8C(r)^2=0$ I...
I was wondering if there exist any good (accurate/fast/easy-to-use) open-source FEM solvers for 3D time-harmonic Maxwell's equations. I am looking to simulate systems a few wavelengths large in the X/Y dimensions and tens of wavelengths in the Z dimension, so relatively small-size problems. All my dielectrics are homog...
I am trying to solve the 2D Poisson equation using the Discontinuous Galerkin method (DG) and the following discretization (I have a png file but I am not allowed to upload it, sorry): Equation : $$\nabla \cdot( \kappa \nabla T) + f = 0$$ New equations : $$q = \kappa \nabla T\\\nabla \cdot q = -f$$ Weak form with numer...
I've seen that there is a way to use the finite differences method, on a cartesian orthogonal grid, to perform calculations on potential flow about an obstacle without using the Neumann conditions, but only Dirichlet conditions. It is done using the stream function, i tested it and it seem to work. But this method has ...
I have this funny equation $$ \frac{\partial^2 u}{\partial t^2} = \frac{\partial^3 u}{\partial x^3}, \qquad x \in [0,1], \qquad t \in (0,T] $$ with initial conditions $u(x,0) = \sin(2\pi x)$, $\frac{\partial u}{\partial t}(x,0) = 0$ and periodic boundary conditions: $u(0,t) = u(1,t)$, $\frac{\partial u}{\partial x}(0,...
This is my first time using FEniCS. I am trying to solve an elliptic PDE, fairly similar to the Laplace equation, on a rectangle with two holes in it. The holes are level sets of an energy function, so I am not completely in control over their geometry. For a first approximation I can use ellipses, but I would like to ...
I want to calculate the unknown electrical potential distribution $\phi(x)$ (notice this is a function of $x$) from a known electric field distribution $\boldsymbol{E}(x)$ using the Poisson equation, $$ -\frac{\partial^2 \phi}{\partial x^2} = \frac{\partial\boldsymbol{E}}{\partial x} $$ I would like to do this numerica...
today I tried some evaluation on a DG function space (Fenics 1.2.0). In my calculations I need to use meshes with a large number of cells (~10mio). At the moment it takes a very long time to create a DG function space (in my distinct case a vector function space) for meshes which contains many cells. For example: from ...