# FLAC2D custom contour plot?

**URL:** <https://forum.itascainternational.com/t/flac2d-custom-contour-plot/1607>\
**Category:** FLAC2D\
**Created:** [July 31, 2024, 11:49pm UTC](https://forum.itascainternational.com/t/flac2d-custom-contour-plot/1607 "2024-07-31T23:49:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdamL](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.itascainternational.com/adaml/32/1156_2.png) [@AdamL](https://forum.itascainternational.com/u/AdamL)\
**Post date:** [July 31, 2024, 11:49pm UTC](https://forum.itascainternational.com/t/flac2d-custom-contour-plot/1607/1 "2024-07-31T23:49:18Z")

</div>

Hi All,

A quick question: Is it possible to create a custom contour plot? And if so, how/where do I do it? I’m currently working through FISH tutorials, but I’ve yet to see an example of how it is done.

I’m trying to get a contour plot of the spalling limit, which is just s1/s3.

Cheers,  
Adam

---

<div class="post-metadata">

**Author:** ![AdamL](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.itascainternational.com/adaml/32/1156_2.png) [@AdamL](https://forum.itascainternational.com/u/AdamL)\
**Post date:** [August 1, 2024, 6:52am UTC](https://forum.itascainternational.com/t/flac2d-custom-contour-plot/1607/2 "2024-08-01T06:52:55Z")

</div>

Crisis averted, figured it out. See below, with spalling\_limit called after ‘model solve’.

```auto
; Spalling limit
fish define spalling_limit
    loop foreach adr zone.list
        local sxx = zone.stress.xx(adr)
        local syy = zone.stress.yy(adr)

        zone.extra(adr, 1) = sxx / syy        
    endloop
end

```

---

<div class="post-metadata">

**Author:** ![apyatigorets](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@apyatigorets](https://forum.itascainternational.com/u/apyatigorets)\
**Post date:** [August 1, 2024, 4:14pm UTC](https://forum.itascainternational.com/t/flac2d-custom-contour-plot/1607/3 "2024-08-01T16:14:07Z")

</div>

@AdamL, yes you can create a contour plot of any variable stored as an extra parameter for a zone or gridpoint (as you figured this out). For this, create a new Zone plot, and select the following parameters (this plot shows a contour of sxx/syy generated using your code):

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/itasca/original/2X/e/ed0e866a22d7411c97da5c147627ee1f2d710b21.png)

I would advise adding an extra check into your function for the case when syy = 0.0. For example:

```auto
fish define spalling_limit
    loop foreach adr zone.list
        local sxx = zone.stress.xx(adr)
        local syy = zone.stress.yy(adr)
        if (syy != 0.0) then
            zone.extra(adr, 1) = sxx / syy
        else
            zone.extra(adr, 1) = 0.0
        endif
    endloop
end

```
