# How to use different material models in different fields?

**URL:** <https://community.geodynamics.org/t/how-to-use-different-material-models-in-different-fields/2859>\
**Category:** ASPECT\
**Created:** [March 14, 2023, 3:32am UTC](https://community.geodynamics.org/t/how-to-use-different-material-models-in-different-fields/2859 "2023-03-14T03:32:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Halley](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@Halley](https://community.geodynamics.org/u/Halley)\
**Post date:** [March 14, 2023, 3:32am UTC](https://community.geodynamics.org/t/how-to-use-different-material-models-in-different-fields/2859/1 "2023-03-14T03:32:59Z")

</div>

Hello!

I’m trying to combine different models in one case. For example, there are three fields. I want the first field uses visco plastic model, while the other two use Steinberger model.

But I have no idea how to do this.

Many thanks!

Regards,  
Halley

---

<div class="post-metadata">

**Author:** ![jbnaliboff](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jbnaliboff](https://community.geodynamics.org/u/jbnaliboff)\
**Post date:** [March 14, 2023, 4:03am UTC](https://community.geodynamics.org/t/how-to-use-different-material-models-in-different-fields/2859/2 "2023-03-14T04:03:12Z")

</div>

Hi Halley,

Welcome and thank you for posting to the forum!

The short answer is that it is not currently possible to select what material model is used for individual compositional fields and this functionality is unlikely to be present at anytime in the near future.

However, it may be possible to modify one of the material models to obtain the specific material behavior you are looking for. Can you outline specifically what you are aiming to achieve?

Cheers,  
John

---

<div class="post-metadata">

**Author:** ![Halley](https://avatars.discourse-cdn.com/v4/letter/h/bcef8e/32.png) [@Halley](https://community.geodynamics.org/u/Halley)\
**Post date:** [March 16, 2023, 3:04pm UTC](https://community.geodynamics.org/t/how-to-use-different-material-models-in-different-fields/2859/3 "2023-03-16T15:04:59Z")

</div>

Thank you for your reply! Specifically, I want to add a layer to a subducting plate and this layer’s viscosity is decided by a file that I input. The other fields still use visco plastic model.

Well, I am trying now!

---

<div class="post-metadata">

**Author:** ![jbnaliboff](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jbnaliboff](https://community.geodynamics.org/u/jbnaliboff)\
**Post date:** [March 16, 2023, 4:40pm UTC](https://community.geodynamics.org/t/how-to-use-different-material-models-in-different-fields/2859/4 "2023-03-16T16:40:36Z")

</div>

Hi Halley,

> Thank you for your reply! Specifically, I want to add a layer to a subducting plate and this layer’s viscosity is decided by a file that I input. The other fields still use visco plastic model.

In principle that should be feasible. My recommendation would be to write a material model plugin composites on top of the visco plastic model and does the following operations:

1. Read data from the files that sets the viscosity of the layer in question
2. Updates the viscosity of that layer using the loaded data

Below is documentation on how to write a plugin and a few examples:

1. [How to write a plugin](https://aspect-documentation.readthedocs.io/en/latest/user/extending/write-a-plugin.html?highlight=plugin)
2. [Example of material model that “composites” on other material models](https://github.com/geodynamics/aspect/blob/main/source/material_model/replace_lithosphere_viscosity.cc)
3. [Cookbook using a plugin](https://github.com/geodynamics/aspect/tree/main/cookbooks/finite_strain)

Some additional thoughts:

- I would be curious to know what viscosity law the aforementioned layer needs to follow. It may be easier to write a material model plugin that uses a different viscosity formulation versus reading in data from a file
- I’m not sure how well the “read viscosity data in approach” would work for time-dependent models, where the location of the layer would evolve?

Cheers,  
John
