Skip to content

Flow over plate Code_Aster Tutorial

Gerasimos Chourdakis edited this page Jan 20, 2020 · 36 revisions

Now that you have Code_Aster, preCICE, the preCICE Python bindings, and the Code_Aster adapter up and running, it is time to run our first coupling tutorial. In this tutorial we will simulate flow over a heated plate with a fluid and a solid solver. We will use Code_Aster for solving the heat transfer in the solid domain, and OpenFOAM for solving the heat transfer in the fluid domain. Therefore, please also install OpenFOAM and the openfoam-adapter before continuing with this tutorial.

This tutorial is meant to also give some insight in the workflows of Code_Aster and preCICE. For those who wish to get a quick coupling working, please jump to Quick Tutorial.

Case Description

TODO: Add details

TODO: Add reference

Required Files

You can find the tutorial files in the tutorial repository (TODO: Move case and add link). This directory contains, among others, the following files:

  • solid.export - In a Code_Aster case, there is always an export file that links all the separate case files, specifying their functionality and their location. The export file also sets additional, system-dependent variables, therefore the export file must be generated on your system using ASTK, as described below.

Code_Aster works with command files, which are the basis of every simulation case. The command files define the problem, the boundary conditions, the mesh that is used, and more parameters. In the Code_Aster-Adapter, we use three command files:

  • adapter.comm - This is the main command file of the test-case. Code_Aster starts at this command file, which wraps the solver call in a loop and triggers the coupling operations. Through the INCLUDE command, invoked at the beginning, the other command files are included.

  • def.comm - The test-case is defined in this command file. It is in charge of setting the mesh, model, materials, initial and boundary conditions.

  • config.comm - This file is used to configure the coupling.

We additionally need:

  • solid.mess: TODO

  • solid.mmed: TODO

  • solid.rmed: TODO

Configuration

Generating the Export file

The solid.export file that is included in the tutorial needs to be configured for your local system. You can generate this file using ASTK:

  1. Start astk from your terminal.
  2. Click "File > Open..." and select the file solid/solid.astk.
  3. In the Base path field, set the path to your solid/ directory.
  4. Select (under D) the files solid.mess, solid.resu, solid.rmed.
  5. For the .comm files, make sure that adapter.comm is assigned to UNIT=1, def.comm is assigned to UNIT=91, and config.comm has UNIT=90. The adapter.comm is the command file that comes with the Code_Aster adapter. For the rest of the files, ASTK will give the default UNIT values. Make sure that these correspond to the values in the image below (TODO: Add image). Lastly, make sure that in ASTK, the nodebug mode is selected.
  6. Now that you have updated the solid.astk file, save and export it.
  7. Click "Run" to generate the rest of the files.

System-specific paths

Before you can run the test-case, some paths need to be changed:

  • In solid/solid.export, change the paths in lines 38 to 44 respectively to your local system. Make sure to leave the codes after the paths (e.g. D 20, R 6, etc.). For example:
    F comm /path/to/code_aster-adapter/cht/adapter.comm D  1
    F mmed /path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.mmed D  20
    F comm /path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/../config.comm D  90
    F comm /path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/def.comm D  91
    F mess /path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.mess R  6
    F rmed /path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.rmed R  80
    F resu /path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.resu R  8
    
  • In config.comm, change the base-path in line 2 to the path of the tutorial folder on your local system. For example:
    {'base-path': '/path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster',
    

Running the coupled simulation

Everything is now set for your first OpenFOAM-Code_Aster coupling. Run runFluid.sh and runSolid.sh in two separate terminals to start the coupled simulation.

The runFluid.sh prepares and runs the OpenFOAM case, as described in the respective OpenFOAM-OpenFOAM tutorial. The runSolid.sh scripts starts Code_Aster:

as_run --run solid/solid.export

Quick Tutorial

TODO