Skip to content

New tutorial: two-scale mechanics problem on a 3D notch component #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions two-scale-notch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Two-scale notch
permalink: tutorials-two-scale-notch.html
keywords: Macro-micro, Micro Manager, CalculiX, FANS, FE-FFT
summary: We solve a two-scale notch problem with a micro-structure based material. One macro simulation is coupled to several micro simulations using the Micro Manager.
---

{% note %}
Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/two-scale-notch). Read how in the [tutorials introduction](https://precice.org/tutorials.html).
{% endnote %}

## Setup

This tutorial solves a linear elastic static problem on a 3D notch geometry which has an underlying micro-structure. The notch is fixed at one end and has a force boundary condition at the other end.

<img class="img-responsive" src="images/tutorials-two-scale-notch-mesh-with-boundary-conditions.png" alt="Von Mises stress on macro scale" width=60% height=50%/>

The micro-structure is a 3D sphere enclosed in a unit square box.

<img class="img-responsive" src="images/tutorials-two-scale-notch-micro-structure.png" alt="Micro structure" width=30% height=40%/>

The micro-structure needs to be evaluated to obtain the stresses and the material stiffness matrix, both necessary for solving the problem on the macro scale. This leads to a two-scale problem with one macro-scale simulation and several micro-scale simulations.

At each Gauss point of the macro domain there exists a micro simulation. The macro problem is one participant, which is coupled to many micro simulations. Each micro simulation is not an individual coupling participant, instead we use the [Micro Manager](https://github.com/precice/micro-manager), which controls all the micro simulations and is itself a coupling participant.

## Configuration

preCICE configuration (image generated using the [precice-config-visualizer](https://precice.org/tooling-config-visualization.html)):

![preCICE configuration visualization](images/tutorials-two-scale-notch-precice-config.png)

## Available solvers and dependencies

* The macro notch problem is solved using [CalculiX](https://www.calculix.de/), so it required the [CalculiX adapter](https://github.com/precice/calculix-adapter).
* The micro problem is solved using [FANS](https://github.com/DataAnalyticsEngineering/FANS/tree/develop). FANS needs to be compiled in a Python-wrapped library form, check the [documentation](https://github.com/DataAnalyticsEngineering/FANS/blob/develop/pyfans/README.md) on how to do this.
* The [Micro Manager](https://precice.org/tooling-micro-manager-installation.html) controls all micro-simulations and facilitates coupling via preCICE. Use the [develop](https://github.com/precice/micro-manager/tree/develop) branch of the Micro Manager.

## Running the simulation

You can find the corresponding `run.sh` script for running the case in the folders corresponding to the solvers you want to use.

Run the macro problem:

```bash
cd macro-calculix
./run.sh
```

Check the Micro Manager [configuration](https://precice.org/tooling-micro-manager-configuration.html) and [running](https://precice.org/tooling-micro-manager-running.html) documentation to understand how to set it up and launch it. The Micro Manager can be run via this script in serial or parallel. Run it in serial:

```bash
cd micro-fans
./run.sh -s
```

## Running the simulation in parallel

```bash
cd micro-fans
./run.sh -p <num_procs>
```

The `num_procs` needs to fit the decomposition specified in the `micro-manager-config.json` (default is serial). See the documentation on [how to set domain decomposition](https://precice.org/tooling-micro-manager-configuration.html#domain-decomposition) in the Micro Manager configuration.

**NOTE**: When running `micro-fans`, even though the case setup and involved physics is simple, each micro simulation is a FANS simulation with a mesh of 32x32x32 nodes, which usually has a moderately high computation time. If the Micro Manager is run in serial, the total runtime is approximately 30 minutes.

## Post-processing

The final von Mises stress on the macro scale look like

<img class="img-responsive" src="images/tutorials-two-scale-notch-von-mises-stress.png" alt="Von Mises stress on macro scale" width=30% height=10%/>

The result is generated by converting the CalculiX `.frd` output file to a VTU or VTK file using [ccx2paraview](https://github.com/calculix/ccx2paraview), and visualizing it in ParaView.
11 changes: 11 additions & 0 deletions two-scale-notch/clean-tutorial.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh
set -e -u

# shellcheck disable=SC1091
. ../tools/cleaning-tools.sh

clean_tutorial .
clean_precice_logs .
rm -fv ./*.log
rm -fv ./*.vtu

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions two-scale-notch/macro-calculix/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
set -e -u

. ../../tools/cleaning-tools.sh

clean_calculix .
9 changes: 9 additions & 0 deletions two-scale-notch/macro-calculix/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
participants:
Notch:
interfaces:
- elements-mesh: notch-mesh
patch: Eall
read-data: [stresses1to3, stresses4to6, cmat1, cmat2, cmat3, cmat4, cmat5, cmat6, cmat7]
write-data: [strains1to3, strains4to6]

precice-config-file: ../precice-config.xml
Loading