# subdomain

### Syntax

```
subdomain {grain_id subdomain_number}
```

`grain_id`

,`subdomain_number`

= positve integer

### Examples

```
subdomain {1 1}
subdomain {1 2} {2 3}
subdomain {1 1 2 1 3 1}
```

### Description

This command sets the number of subdomains in each grain. Note that the curly brackets `{`

and `}`

in the syntax/examples are to separate different grains, the number of which is `grain_number`

; all brackets should not be included in preparing `cac.in`

.

In CAC, a unit is either the primitive unit cell of the lattice (for the atomistic domain) or a finite element (for the coarse-grained domain). Finite elements of different sizes are different types of unit. In a CAC simulation cell, each spatial region consisting of the same type of unit is a subdomain, as illustrated in the figure below:

Note that in this figure, which is Fig. 4 of Xu et al., 2018, the atoms in subdomain i/grain I and subdomain i/grain III are employed to fill in the otherwise jagged interstices, because either `boolean_y`

= *f* or `y`

= *p*.

The size of each subdomain and the unit type in each subdomain in each grain is specified in the unit_num and unit_type commands, respectively. The grains and subdomains are stacked along a prescribed `direction`

. The three examples above correspond to the three examples in the unit_num and unit_type commands:

- In the first example, there is one grain designated by the first
*1*, which has one subdomain designated by the second*1*. - In the second example, there are two grains: the first grain has two subdomains designated by the first
*2*, the second grain has three subdomains designated by*3*. - In the third example, there are three grains, each of which has one subdomain, designated by the second
*1*, the third*1*, and the fourth*1*, respectively.

The maximum `grain_id`

must be larger than or equal to `grain_number`

. All information related to `grain_id`

that is larger than `grain_number`

is discarded.

### Related commands

In the unit_num and unit_type commands, the maximum `subdomain_id`

in each grain must equal the corresponding `subdomain_number`

.

This command becomes irrelevant when `boolean_restart`

= *t*, in which case there is no need for the subdomain information.

### Related files

`box_init.f90`

### Default

```
subdomain 1 1
```