I want to know if there is any way to define the test and trial function in the way that I want instead of using the default functions. So if I want define the polynomial and basis and coefficient, how can I do it in Fenics? Here is the concept in general:

I am trying to solve stochastic partial differential equation which is like $$\Pi(x,t,w;u)=f(x,t;w)$$ $$x \in \Re^d \qquad t \in [0,T] \qquad w \in Ω $$ where is the solution is $U:=U(x,t;w)$ and $f(x,t;w)$ is the source term. We can discretize the stochastic space using a finite number of independent random variables. $$\xi(w)=\{\xi(w_1),\ldots,\xi(w_n)\}$$ This allows us to rewrite the governing equation as a dimensional differential equation in the strong form: $$\Pi(x,t,\xi;u)=f(x,t;w)\qquad (\xi,x)\in \Gamma \times D$$ Thus the solution which is regarded as a stochastic process, can be expanded by the generalized polynomial as: $$u(x,t;w)=\sum_{i=0}^P u_i(x,t) \phi_i (\xi)$$ where $P$ is the number of GPCE terms.

Then we substitute $U$ into the weak form. Choosing the test function the same as the generalized polynomial in order to let the residual to be orthogonal to the subspace, thus minimize the error, we obtain: $$ \left\langle \Pi\left(x,t,\xi;\sum_{i=0}^P u_i(x,t) \phi_i (\xi)\right),\phi_k (\xi)\right\rangle = \left\langle f(x,t;\xi),\phi_k (\xi) \right\rangle $$ $K=0,1,.. P$

Results in a set of coupled deterministic equations. One can employ e.g. classical finite element methods to seek the deterministic coefficients.

In order to make the problem more clear there is well defined problem related to 2D Poisson Equation: here on page 7.

Since we only have one random variable, the number of random dimensions is 1. Polynomial chaos expansion value for my problem with polynomial of order of 3 will be a PCE=3*3 by matrix.


I need to modify the V = VectorFunctionSpace(mesh, "Lagrange", 1)so in this problem in order that V will be the Kronecker tensor product of V and PCE which will lead to a 10*3 ,10*3, 10*3 and based on that matrix I can modify my equation to calculate the statistics of the solution. Is there any way that I can calculate the Kronecker tensor product of V and another matrix and replace it with my V?

More specifically I am trying to solving this equation with uncertain location load with this method.

Here is the my deterministic code,Fenics: Result of Steady state dynamic linear elastic doesn't match with actual values how I can make this deterministic code to stochastic with modifying test and trial function in Fenics.

  • $\begingroup$ You should enhance an explanation of the method to increase the chance of getting answer. Now it seems quite unclear and notation inconsistent. $\endgroup$ May 30 '13 at 11:08
  • $\begingroup$ @JanBlechta thank you for suggestion. I tried to make my question more specific that how I can replace the VectorFunctionSpace with Kronecker tensor product of V*matrix and I added a reference. $\endgroup$
    – Bahram
    Jul 22 '13 at 21:43
  • $\begingroup$ What about TensorFunctionSpace. $\endgroup$ Jul 23 '13 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.