I'm working on a project for which I have inherited some FEM code. This implemented FEM calculates, given some force field, displacements on a discretised square using square elements and assumes a homogeneous isotropic and linear material.
I want to do away with the assumption homogeneity. I would like to assume a spacial dependent Young's modulus $E(x) = r(x) E_0$, where $E_0$ is some fixed quantity and $r(x)$ is a scaling quantity which can be different for every element.
I use the $E_0$ as the Youngs modulus in creating the element stiffness matrices using the material matrix $D$ $$ D= \frac{E_0}{1-v^2} \left(\begin{matrix} 1 & v & 0 \\ v & 1 & 0 \\ 0 & 0 & \frac {1}{2}(1-v) \end{matrix}\right). $$ In the assembly of the stiffness matrix I do the following. Suppose we are adding the element matrix $K_e$ corresponding to element $e$, I then add $r(e) K_e$ to the global stiffness matrix. Here $r(e)$ is just $r(x)$ evaluated on some point of the element $e$.
Is this a valid approach for modelling non-homogeneous materials? If not, can someone point me to a source that does explain how to model such materials in detail?
If relevant: I have a mathematics background, but am new in using FEM in structural problems.