Non-constant coefficients in NGSolve

Hello,

I am a relatively new user of NG Solve and was curious how one defines non-constant coefficients. I am trying to solve a PDE with a coefficient that is piecewise constant. From following the tutorial on solving Poisson’s equation, I have x and y coordinates, however, from looking at the documentation, it does not allude to how to loop through the x and y coordinates and change the value of the coefficient accordingly.

Hi Fritz,

you can use the IfPos(x,if,else) or multiples of these to do this. See also the documentation

Best wishes,
Henry