|
1 | 1 | # Linear Single Crystal |
2 | 2 |
|
3 | | -This example uses simple test problems to illustrate how to set up a single job or a suite of jobs. The problems are single crystal, meaning there is just one material and a single orientation, so it's easy to set up problems where you know the answer. |
4 | | - |
5 | | -## Inputs |
6 | | -The first inputs are `suite` and `process`. The suite is the name for the whole group of simulations, `linear_single_crystal`. The process is the name of the process model; here it is `linear-elasticity`. |
| 3 | +This example uses simple test problems to illustrate how to set up a single job or a suite of jobs. The problems here are single crystal, meaning there is just one material and one orientation, so it's easy to set up problems where you know the answer. |
| 4 | + |
| 5 | +## Jobs |
| 6 | +To run a simulation, you will need to define a `inputs.Job` instance. A `Job` has six components. |
| 7 | +``` |
| 8 | +job = inputs.job.Job( |
| 9 | + suite = suite, |
| 10 | + process = process, |
| 11 | + mesh_input = mesh_input, |
| 12 | + material_input = material_input, |
| 13 | + polycrystal_input = polycrystal_input, |
| 14 | + deformation_input = deformation_input |
| 15 | +) |
| 16 | +``` |
| 17 | +The `suite` and the `process` are simple strings. They give the name of the suite of simulations and the name of the material process being modeled. In this example, we have: |
| 18 | +``` |
| 19 | +suite = "linear_single_crystal" |
| 20 | +process = "linear-elasticity" |
| 21 | +``` |
| 22 | +The other four components describe the mesh, the material, the polycrystal (microstructure) and the applied deformation. Each of these components will have `key` (hashable type) that can be used to generate the input. The key may be a string, a number or a tuple, or some combination of these. Each input is then built from the key. |
7 | 23 |
|
8 | 24 | ### Materials |
9 | | -In the `data` module, there is a dictionary of materials. It defines two isotropic materials and three cubic materials. All are abstract and do not reflect actual materials. |
| 25 | +In the `data` module, there is a dictionary of elastic materials. It defines two |
| 26 | +isotropic materials and three cubic materials. In this example, the materials are very simple and do not reflect actual materials. The material `key` is simply the name of the material. In this example, we set moduli that gives the identity stiffness matrix. |
| 27 | +``` |
| 28 | +matl_key = "identity-iso" |
| 29 | +``` |
10 | 30 |
|
11 | 31 | ### Polycrystal |
12 | | -A simple polycrystal is set up. It has one crystal and so one orientation. For the isotropic materials, the orientation doesn't matter at all (as long as it's a rotation matrix), but it does matter for the cubic materials. At this point, only the identity is used, but the mechanism to add more single orientaitons is there. The tuple `(axis, angle)` is the key to generate a rotation through a given angle about one of the coordinate axes. As mentioned above, only `(0, 0)`, representing the identity, is used currently. |
13 | | - |
| 32 | +In this example, we use a very simple polycrystal. In face, it is a single crystal. The only thing we need to assign is the crystal orientation. We chose to use a rotation through somae angle about one of the coordinate axes. The polycrystal key is a pair of numbers, the first being the axis of rotation: 0, 1, or 2. The second is the angle of rotation. So for example, if the key were `(1, 45)`, that would represent a single crystal rotated 45 degrees about the y-axis. In this example, the material is isotropic so the orientation doesn't matter. This gives an orientation matrix of the identity. |
| 33 | +``` |
| 34 | +poly_key = (0, 0) |
| 35 | +``` |
14 | 36 | ### Meshes |
15 | | -These are simple box meshes, and the tuple of divsions is used to generate the mesh. These are purposely small since we are running problems with an exact answer. |
16 | | - |
17 | | -### Deformations |
18 | | -For the test problems, we set up the problem data to have exact solutions of the for `u = Ax`. We use nine choices for `A`; each one has zeros in all positions except for 1 spot, which has value 1. Body forces are zero. We apply several types of boundary conditions: |
19 | | -* full displacement (Dirichlet) boundary conditions on the whole boundary |
20 | | -* traction boundary conditions on the top surface and displacement everywhere else |
21 | | -* traction boundary conditions on the top in the z-component only, and displacements everywhere else |
22 | | -* traction boundary conditions on the top in the `xy` directions only, and displacements everywhere else. |
23 | | - |
24 | | -## Single Job |
25 | | - |
26 | | -To set up a single job, you just create `Job` instance named `job`. It takes the names of the suite and the process. Then there are the four inputs described above. To run the single job: |
27 | | - |
28 | | -```mpirun -n 2 pxx_job linear_single_crystal``` |
29 | | - |
30 | | -## Batch Job |
31 | | -To run in batch, use the `pxx_suite` script. In the `batch` module, an iterator is set up to generate various combinations of the various inputs. The iterator generates keys that are used to create the job, and a `get_job(key)` function is used by the processing script to generate the actual job. Run like this: |
32 | | - |
33 | | -```pxx_suite -n 2 linear_single_crystal.batch``` |
34 | | -# Linear Single Crystal |
35 | | - |
36 | | -This example uses simple test problems to illustrate how to set up a single job or a suite of jobs. The problems are single crystal, meaning there is just one |
37 | | -material and one orientation, so it's easy to set up problems where you know |
38 | | -the answer. |
39 | | - |
40 | | -## Inputs |
41 | | -The first inputs are `suite` and `process`. The suite is the name for the |
42 | | -whole group of simulations, `linear_single_crystal`. The process is the name |
43 | | -of the process model; here it is `linear-elasticity`. |
44 | | - |
45 | | -### Materials |
46 | | -In the `data` module, there is a dictionary of materials. It defines two |
47 | | -isotropic materials and three cubic materials. All are abstract and do not |
48 | | -reflect actual materials. |
49 | | - |
50 | | -### Polycrystal |
51 | | -A simple polycrystal is set up. It has one crystal and so one orientation. For |
52 | | -the isotropic materials, the orientation doesn't matter at all (as long as |
53 | | -it's a rotation matrix), but it does matter for the cubic materials. At this point, only the identity is used, but the mechanism to add more single orientaitons is there. The tuple `(axis, angle)` is the key to generate a |
54 | | -rotation through a given angle about one of the coordinate axes. As mentioned |
55 | | -above, only `(0, 0)`, representing the identity, is used currently. |
56 | | - |
57 | | -### Meshes |
58 | | -These are simple box meshes, and the tuple of divsions is used to generate |
59 | | -the mesh. These are purposely small since we are running problems with an |
60 | | -exact answer. |
61 | | - |
| 37 | +These are simple box meshes, and the `mesh key` is the tuple of divsions is used to generate the mesh. These are purposely small since we are running problems with an |
| 38 | +exact answer. Here the mesh is a box with 40 subdivisions in each direction. |
| 39 | +``` |
| 40 | +mesh_key = (40, 40, 40) |
| 41 | +``` |
62 | 42 | ### Deformations |
63 | 43 | For the test problems, we set up the problem data to have exact solutions of |
64 | | -the for `u = Ax`. We use nine choices for `A`; each one has zeros in all |
65 | | -positions except for 1 spot, which has value 1. Body forces are zero. We apply |
| 44 | +the form `u = Ax`. We use nine choices for `A`; each one has zeros in all |
| 45 | +positions except for 1 spot, which has value 1.0. Body forces are zero. We apply |
66 | 46 | several types of boundary conditions: |
67 | 47 | * full displacement (Dirichlet) boundary conditions on the whole boundary |
68 | 48 | * traction boundary conditions on the top surface and displacement everywhere else |
69 | 49 | * traction boundary conditions on the top in the z-component only, and displacements everywhere else |
70 | 50 | * traction boundary conditions on the top in the `xy` directions only, and displacements everywhere else. |
71 | 51 |
|
72 | | -## Single Job |
73 | | - |
74 | | -To set up a single job, you just create `Job` instance named `job`. It takes |
75 | | -the names of the suite and the process. Then there are the four inputs |
76 | | -described above. To run the single job: |
| 52 | +In this example, we apply traction on the top surface, and the strain will be zero except for the xx-component. |
| 53 | +``` |
| 54 | +defm_key = ("zmax-traction", 1, 1) |
| 55 | +```e |
| 56 | +## Running a Single Job |
| 57 | +To run a single job, use the `pxx_job` script. |
77 | 58 |
|
78 | 59 | ```mpirun -n 2 pxx_job linear_single_crystal``` |
79 | 60 |
|
|
0 commit comments