# Set dimensions for shared parameter

**URL:** <https://forum.mimiframework.org/t/set-dimensions-for-shared-parameter/309>\
**Category:** Uncategorized\
**Created:** [September 7, 2024, 2:13am UTC](https://forum.mimiframework.org/t/set-dimensions-for-shared-parameter/309 "2024-09-07T02:13:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![emilywen2001](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.mimiframework.org/emilywen2001/32/116_2.png) [@emilywen2001](https://forum.mimiframework.org/u/emilywen2001)\
**Post date:** [September 7, 2024, 2:13am UTC](https://forum.mimiframework.org/t/set-dimensions-for-shared-parameter/309/1 "2024-09-07T02:13:45Z")

</div>

Hi, there

I’m trying to add a new shared parameter for my modified Mimi-RICE model. I’ve read the how\_to.md and the tutorial shows that if I want to set dimensions for the parameter, I need to write like this `add_shared_param!(m, :shared_param, [1,2,3,4,5,6], dims = [:time])`.

However, I don’t know how to add 2-dimensional shared parameter. I’ve tried several approaches such as `dims = [time, regions]` and `dims = [:time, regions]`, but it doesn’t work for me. If anyone knows the solution to this problem, please don’t hesitate to help!

---

<div class="post-metadata">

**Author:** ![lrennels](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.mimiframework.org/lrennels/32/6_2.png) [@lrennels](https://forum.mimiframework.org/u/lrennels)\
**Post date:** [September 8, 2024, 5:53am UTC](https://forum.mimiframework.org/t/set-dimensions-for-shared-parameter/309/2 "2024-09-08T05:53:40Z")

</div>

Hi @emilywen2001 could you post what your error message is? That would be helpful in diagnosing the problem. Looking at what you wrote, I think the issue might be that your data dimensions do not match the size of the `values` you enter, but again the error message would be really helpful to see here.

* * *

Here’s a simple example that works for my machine. I add a component with a `Parameter` `my_param` with two dimensions, `time` and `regions`, to my model and then add a shared `Parameter` `my-shared_param`. Finally I connect `my_shared_param` to `my_param` and run the model.

```julia
using Mimi

m = Model()

set_dimension!(m, :time, [2000, 2001, 2002])
set_dimension!(m, :regions, ["A", "B", "C"])

values = rand(3,3)

@defcomp my_comp begin
    my_param = Parameter(index = [time, regions])
end

add_shared_param!(m, :my_shared_param, values, dims = [:time, :regions])

add_comp!(m, my_comp)
connect_param!(m, :my_comp, :my_param, :my_shared_param)

run(m)

```

---

<div class="post-metadata">

**Author:** ![emilywen2001](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.mimiframework.org/emilywen2001/32/116_2.png) [@emilywen2001](https://forum.mimiframework.org/u/emilywen2001)\
**Post date:** [September 8, 2024, 10:22am UTC](https://forum.mimiframework.org/t/set-dimensions-for-shared-parameter/309/3 "2024-09-08T10:22:00Z")

</div>

Hi @lrennels , I have tried your example and it works for me. Maybe I used the wrong way of declaring the `dims` value, thanks for your help!

---

<div class="post-metadata">

**Author:** ![lrennels](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.mimiframework.org/lrennels/32/6_2.png) [@lrennels](https://forum.mimiframework.org/u/lrennels)\
**Post date:** [September 9, 2024, 5:34pm UTC](https://forum.mimiframework.org/t/set-dimensions-for-shared-parameter/309/4 "2024-09-09T17:34:45Z")

</div>

@emilywen2001 glad to be of help!
