Dear All,
This question of applying material properties to elements comes up on occasion. It is not something which you would ever truly want to do within COMSOL, or within any finite element code for that matter. Let's think about why:
A finite element problem must, by its very definition, be convergent with respect to mesh refinement. (www.comsol.com/multiphysics/mesh-refinement) Roughly speaking, as you decrease the element size (and increase the number of elements used to mesh a problem) a correctly-posed finite element model converges towards the exact solution.
Now, lets think about what would happen if in fact we did define different material properties within each mesh element. Let's suppose that we have a mesh (call in Mesh 1) with a different material property in each element. We can solve this model and get an answer. But how do we verify this answer? Through the process of mesh refinement. We will need to introduce a second mesh (Mesh2), and a third (Mesh 3), and so on and monitor how the solution converges. But the higher numbered meshes must represent the same material distribution, so these refined meshes can only be subdivisions of the original mesh. (Think about one quadrilateral element, it can get subdivided into 4,9, 16, etc... smaller quad elements.)
So we can see that our desire to apply different material properties to different elements is actually (at least in the COMSOL terminology and usage) just the desire to have a bunch of domains that happen to look like elements. Each of these domains has different properties, and as you perform a mesh refinement study you increase the number of elements in each domain. So by all means, if you want to have different material properties in different areas, do so, but just sketch a bunch of domains, apply different materials properties in each, and then perform a mesh refinement study (starting with the coarsest possible mesh where you only have one element per domain) to verify your solution.
And as some of our colleagues have pointed out, you can enter materials properties that vary as function of spatial dimensions, so expressions such as density = 1000[kg/m^3]*(1+x/0.1[m]) would make density increase with x-direction. This would introduce a spatial variation between elements, but this same expression can be used regardless of the mesh.
Lastly: With respect to topology optimization. You can, if you want to, use a discontinuous constant discretization within each element. However, within our examples we use instead a linear discretization of material properties within each element. This makes is possible to introduce a gradient-based smoothing of the fields to avoid checkboarding or mesh dependency. (see, for example: www.comsol.com/model/topology-...timization-of-an-mbb-beam-7428) Although you could introduce a discontinuous constant discretization of the material property distribution if you really wanted to, you would then need still need to address the possibility of checkerboarding and come up with a technique to avoid it and demonstrate convergence of your solution with mesh refinement.
Best Regards,
This question of applying material properties to elements comes up on occasion. It is not something which you would ever truly want to do within COMSOL, or within any finite element code for that matter. Let's think about why:
A finite element problem must, by its very definition, be convergent with respect to mesh refinement. (www.comsol.com/multiphysics/mesh-refinement) Roughly speaking, as you decrease the element size (and increase the number of elements used to mesh a problem) a correctly-posed finite element model converges towards the exact solution.
Now, lets think about what would happen if in fact we did define different material properties within each mesh element. Let's suppose that we have a mesh (call in Mesh 1) with a different material property in each element. We can solve this model and get an answer. But how do we verify this answer? Through the process of mesh refinement. We will need to introduce a second mesh (Mesh2), and a third (Mesh 3), and so on and monitor how the solution converges. But the higher numbered meshes must represent the same material distribution, so these refined meshes can only be subdivisions of the original mesh. (Think about one quadrilateral element, it can get subdivided into 4,9, 16, etc... smaller quad elements.)
So we can see that our desire to apply different material properties to different elements is actually (at least in the COMSOL terminology and usage) just the desire to have a bunch of domains that happen to look like elements. Each of these domains has different properties, and as you perform a mesh refinement study you increase the number of elements in each domain. So by all means, if you want to have different material properties in different areas, do so, but just sketch a bunch of domains, apply different materials properties in each, and then perform a mesh refinement study (starting with the coarsest possible mesh where you only have one element per domain) to verify your solution.
And as some of our colleagues have pointed out, you can enter materials properties that vary as function of spatial dimensions, so expressions such as density = 1000[kg/m^3]*(1+x/0.1[m]) would make density increase with x-direction. This would introduce a spatial variation between elements, but this same expression can be used regardless of the mesh.
Lastly: With respect to topology optimization. You can, if you want to, use a discontinuous constant discretization within each element. However, within our examples we use instead a linear discretization of material properties within each element. This makes is possible to introduce a gradient-based smoothing of the fields to avoid checkboarding or mesh dependency. (see, for example: www.comsol.com/model/topology-...timization-of-an-mbb-beam-7428) Although you could introduce a discontinuous constant discretization of the material property distribution if you really wanted to, you would then need still need to address the possibility of checkerboarding and come up with a technique to avoid it and demonstrate convergence of your solution with mesh refinement.
Best Regards,