-
-
Notifications
You must be signed in to change notification settings - Fork 3
Flow over plate Code_Aster Tutorial
Now that you have Code_Aster, preCICE, 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.
To get the files to run this test-case, install and unzip bouyantSimpleFoam-aster.zip
.
This package contains, among others, the following files:
- solid.export - For a Code_Aster test-case, one always creates an export file that links all the separate files of the test-case. It specifies their functionality and the path to their location. The export file also sets some other variables which are system dependent, therefore the export file must be generated on your system using ASTK.
-
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.
-
solid.mess
-
solid.mmed
-
solid.rmed
The test-case is run by initiating the runall.sh script. This script runs the following command that initiates the Code_Aster test-case:
as_run --run solid/solid.export
Running the script by using ./runall.sh
will, however, not work yet. We must first generate the correct export files.
The solid.export file that is included in the zip file is not configured to your local system. You can do this by starting ASTK from your terminal by typing $astk
and simply hitting enter. From within ASTK open a file, and navigate to solid.astk which is in the solid folder.
In the Base path field, set the path to the solid folder. Create solid.mess, solid.resu, solid.rmed. For the .comm files, make sure that adapter.comm has UNIT=1, def.comm has UNIT=91 and config.comm has UNIT=90. adapter.comm is the command file that is installed with the Code_Aster-adapter. For the other files ASTK will give the default UNIT values. Make sure that these correspond with the values in the image below. Lastly, make sure that in ASTK the nodebug mode is toggled. Now that you have updated the solid.astk file, save and export it. Overwrite the solid.export file, and check if solid.export contains values and paths that correspond to your system.
Because the Code_Aster command files can be supplemented by python code, the Code_Aster-Adapter is written in python. preCICE is written in c++. This means that you will need to set the python bindings for preCICE. The file adapter.py has to be copied into the source code for Code_Aster. In your directory for Code_Aster, navigate to Code_Aster-14.4/14.4/lib/aster/Execution. You should see the following files: e.g. command_text.py, decorators.py, etc. Here are the python files that are executed when Code_Aster us ran. Please paste adapter.py into this directory.
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.).
- In config.comm change the base-path in line 2 to the path of the tutorial folder on your local system.
Everything is now set for your first OpenFOAM-Code_Aster coupling. Run runFluid.sh and runSolid.sh in two separate terminals.
More information on precice.org. Subscribe to the preCICE mailing list.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Please use "precice.org" for the attribution.
We moved these pages to the preCICE website: https://www.precice.org/adapter-code_aster.html