Hello,
Please I work in time dependent PDEs problems and i need to set an initial condition as a square function using fenics like this :
u_0=Expression(‘exp(-a(pow((x[0]+0.8),2)+pow((x[1]),2)))’,element=V.ufl_element(), a=1.).
This is an gaussian function for me i need function that make a square.
Thank you so much
Hi, something like
u_0=Expression("fabs(x[0], 1) <= 0.5 & fabs(x[1], 2) <= 0.5 ? 1.0 : 0.0", degree=1.)
generates a function which is 1 inside a square of size 1x1 centered at x[0]=1, x[1]=2 and 0 outside.
2 Likes