Skip to content

Commit

Permalink
Adapt documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwsch committed Jul 25, 2024
1 parent bc94bb8 commit 63cbc06
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 43 deletions.
8 changes: 7 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The Micro Manager manages many simulations on a micro scale and couples them to

![Micro Manager strategy schematic](images/docs-tooling-micro-manager-manager-solution.png)

The Micro Manager can also compute snapshots of micro simulations given macro input parameters in an offline manner without preCICE.

## What can it do?

The Micro Manager couples many micro simulations with one macro simulation. This includes ...
Expand All @@ -21,9 +23,13 @@ The Micro Manager couples many micro simulations with one macro simulation. This

## Documentation

To use the Micro Manager for a macro-micro coupling, your micro simulation code needs to be in a library format with a specific class name and functions with specific names. For a macro-micro coupled problem, the macro simulation code is coupled to preCICE directly. The section [couple your code](couple-your-code-overview.html) of the preCICE documentation gives more details on coupling existing codes. To setup a macro-micro coupled simulation using the Micro Manager, follow these steps:
To use the Micro Manager for a macro-micro coupling, your micro simulation code needs to be in a library format with a specific class name and functions with specific names. For a macro-micro coupled problem, the macro simulation code is coupled to preCICE directly. The section [couple your code](couple-your-code-overview.html) of the preCICE documentation gives more details on coupling existing codes. To set up a macro-micro coupled simulation using the Micro Manager, follow these steps:

- [Installation](tooling-micro-manager-installation.html)
- [Preparing micro simulation](tooling-micro-manager-prepare-micro-simulation.html)
- [Configuration](tooling-micro-manager-configuration.html)
- [Running](tooling-micro-manager-running.html)

To compute snapshots in an offline manner your simulation code also needs to be in a library format with a specific class name and functions with specific names. To set up a snapshot computation using the Micro Manager, follow these steps:

- [Snapshot computation](tooling-micro-manager-snapshot-configuration.html)
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ For more details on the interpolation see the [crash handling documentation](too

## Next step

After creating a configuration file you are ready to [run the Micro Manager](tooling-micro-manager-running.html/#micro-manager).
After creating a configuration file you are ready to [run the Micro Manager](tooling-micro-manager-running.html).
6 changes: 0 additions & 6 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ Unless already installed, the dependencies will be installed by `pip` during the
pip install --user micro-manager-precice[sklearn]
```

To perform snapshot computations, the optional dependency `h5py` is required. To install `micro-manager-precice` with `h5py`, run

```bash
pip install --user micro-manager-precice[snapshot]
```

preCICE itself needs to be installed separately. If you encounter problems in the direct installation, see the [dependencies section](#required-dependencies) and [optional dependency section](#optional-dependencies) below.

### Option 2: Install manually
Expand Down
26 changes: 0 additions & 26 deletions docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ keywords: tooling, macro-micro, two-scale
summary: Run the Micro Manager from the terminal with a configuration file as input argument or from a Python script.
---

## Micro Manager

The Micro Manager is run directly from the terminal by providing the path to the configuration file as an input argument in the following way

```bash
Expand All @@ -22,27 +20,3 @@ mpiexec -n micro-manager-precice micro-manager-config.json
### What happens when a micro simulation crashes?

If a micro simulation crashes and the Micro Manager is configured to [interpolate a crashed micro simulation](tooling-micro-manager-configuration.html/#Interpolate-a-crashed-micro-simulation), the Micro Manager attempts to continue running. The error message from the micro simulation, along with the macro location are logged in the Micro Manager log file. The Micro Manager continues the simulation run even if a micro simulation crashes. Results of the crashed micro simulation are generated by interpolating results of a certain number of similar running simulations. The [inverse distance weighed](https://en.wikipedia.org/wiki/Inverse_distance_weighting) method is used. If more than 20% of global micro simulations crash or if locally no neighbors are available for interpolation, the Micro Manager terminates.

## Snapshot Computation

The Micro Manager snapshot computation is run directly from the terminal by adding the `--snapshot` argument and by providing the path to the configuration file as an input argument in the following way

```bash
micro-manager-precice --snapshot snapshot-config.json
```

The Micro Manager snapshot computation can also be run in parallel

```bash
mpiexec -n <number-of-processes> micro-manager-precice --snapshot snapshot-config.json
```

where `<number-of-processes>` must be replaced with the number of processes to be used.

### Results

The results of the snapshot computation is written into `output/` in HDF5-format. Each parameter is stored in a separate dataset. The dataset names correspond to the names specified in the configuration file. The first dimension of the datasets corresponds to the macro parameter index.

### What happens when a micro mimulation crashes during snapshot computation?

If the computation of a snapshot fails, the snapshot is skipped.
60 changes: 51 additions & 9 deletions docs/snapshot_configuration.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
---
title: Configure the Snapshot Computation
title: Snapshot Computation
permalink: tooling-micro-manager-snapshot-configuration.html
keywords: tooling, macro-micro, two-scale, snapshot
summary: Provide a JSON file to configure the Micro Manager snapshot computation.
summary: Set up the Micro Manager snapshot computation.
---

> Note: To install the Micro Manager for the snapshot computation, follow the instructions in the [Micro Manager installation guide](tooling-micro-manager-installation.html).
> To prepare a micro simulation for the Micro Manager, follow the instructions in the [Micro Manager preparation guide](tooling-micro-manager-preparation.html).
> Currently, the Micro Manager Snapshot tool can not be used with an `initialize()` method.
## Installation

To perform snapshot computations, the in the coupled case optional dependency `h5py` becomes mandatory. To install `micro-manager-precice` with `h5py`, run

```bash
pip install --user micro-manager-precice[snapshot]
```

If you have already installed `micro-manager-precice`, you can install `h5py` separately by running

```bash
pip install --user h5py
```

## Preparation

To prepare a micro simulation for the Micro Manager, follow the instructions in the [Micro Manager preparation guide](tooling-micro-manager-preparation.html).

Note: The `initialize()` method is not supported for the snapshot computation.

## Configuration

The Micro Manager snapshot computation is configured with a JSON file. An example configuration file is

Expand Down Expand Up @@ -43,7 +61,7 @@ Parameter | Description
--- | ---
`parameter_file_name` | Path to the HDF5 file containing the parameter space from the current working directory. Each macro parameter must be given as a dataset. Macro data for the same micro simulation should have the same index in the first dimension. The name must correspond to the names given in the config file.
`read_data_names` | A Python dictionary with the names of the data to be read from preCICE as keys and `"scalar"` or `"vector"` as values depending on the nature of the data.
`write_data_names` | A Python dictionary with the names of the data to be written to preCICE as keys and `"scalar"` or `"vector"` as values depending on the nature of the data.
`write_data_names` | A Python dictionary with the names of the data to be written to the database as keys and `"scalar"` or `"vector"` as values depending on the nature of the data.

## Simulation Parameters

Expand All @@ -55,14 +73,38 @@ Parameter | Description

Parameter | Description
--- | ---
`post_processing_file_name`| Path to the post-processing script from the current working directory.
`post_processing_file_name`| Path to the post-processing Python script from the current working directory. Providing a post-processing script is optional

## Diagnostics

Parameter | Description
--- | ---
`output_micro_sim_solve_time` | If `True`, the Micro Manager writes the wall clock time of the `solve()` function of each micro simulation.
`output_micro_sim_solve_time` | If `True`, the Micro Manager writes the wall clock time of the `solve()` function of each micro simulation to the database.

## Next step

After creating a configuration file you are ready to [run the Micro Manager snapshot computation](tooling-micro-manager-running.html/#snapshot-computation).
After creating a configuration file you are ready to [run the Micro Manager snapshot computation](tooling-micro-manager-snapshot-configuration.html/#running).

## Running

The Micro Manager snapshot computation is run directly from the terminal by adding the `--snapshot` argument and by providing the path to the configuration file as an input argument in the following way

```bash
micro-manager-precice --snapshot snapshot-config.json
```

The Micro Manager snapshot computation can also be run in parallel

```bash
mpiexec -n <number-of-processes> micro-manager-precice --snapshot snapshot-config.json
```

where `<number-of-processes>` must be replaced with the number of processes to be used.

### Results

The results of the snapshot computation are written into `output/` in HDF5-format. Each parameter is stored in a separate dataset. The dataset names correspond to the names specified in the configuration file. The first dimension of the datasets corresponds to the macro parameter index.

### What happens when a micro simulation crashes during snapshot computation?

If the computation of a snapshot fails, the snapshot is skipped.

0 comments on commit 63cbc06

Please sign in to comment.