Building and using MFront on Windows is more complex than on other systems for the following reasons:

This page is dedicated to show how this issues can be overcome and ease the MFront experience on Windows. We will focus on coupling with Cast3M 2017 which is packaged with a version of the MinGW compiler suite. This tutorial makes the assumption that the user have installed the developer version of Cast3M.

This tutorial will show that:

This tutorial is mostly based on bat scripts that can be downloaded here.

Notes on the installation directory

For information, the author use the following convention: the scripts are decompressed in C:\tfel-master\src.

By default, the previous scripts will install TFEL and MFront in C:\tfel-master\install-castem2017. The user is, of course, free to choose another installation location: he simply has to edit the scripts accordingly.

Notes on bat scripts

Executing bat scripts is fairly easy: in Windows Explorer, right-click on the script and select Open.

Modifying bat scripts is also easy: in Windows Explorer, right-click on the script and select Modify. By default, this action will open the script in Notepad, but any text editor will do.

About binary packages

Various binary packages can be downloaded on the github website. Those binary packages are built against specific versions of Cast3M. When installing thoses packages, the user have the choice to modify the PATH variable globally.

This tutorial can nevertheless be usefull: small scripts wrapping calls to MFront can be a viable choice in the Windows environment, rather than relying on the command line. Be careful that modify the examples appropriately to reflect where TFEL and MFront have been installed.

Decompressing the archive

As said before, this tutorial is mostly based on bat scripts that can be downloaded here.

The archive contains the following files:

The two first scripts are not mandatory: the user can directly download an archive from the github website (https://github.com/thelfer/tfel/releases).

It also contains a directory called test. The usage is those scripts is fully detailed in the following sections.

The other files contained in the archive will not be used in this tutorial.

Prerequisites

In the following, we will suppose that:

Notes

In the following, it is expected that those prerequisites are located in directories listed in the PATH variables. If this is not the case, the scripts must be modified to update this variable appropriately.

Getting the sources using git

This section can be skipped if the user wants to use a packaged version of tfel (https://github.com/thelfer/tfel/releases).

Cloning the repository

The git.bat will clone the git repository on your machine in the current directory. The directory containing the repository is called tfel.

Updating the repository

After the git repository has been cloned, the git-update.bat script can be used to synchronize our local repository with the official repository and follow the latest developments.

Compiling MFront

The compil-castem2017.bat can now be used to compile and install TFEL using the MinGW compiler delivered with Cast3M 2017.

Changing the location of Cast3M 2017

The script assumes that Cast3M 2017 is installed in C:\Cast3M\PCW_17. If this is not the case, edit the script and change the following line appropriately:

set PATH=C:\Cast3M\PCW_17\MinGW\x86_64-6.3.0-posix-sjlj-rt_v5-rev1\mingw64\bin;%PATH%

Changing the location of the sources

By default, the script assumes that the sources are in the tfel subdirectory. This is the case if the user cloned the git repository as explained before.

If the user has downloaded an archive from the github website, the name of the directory can be different and the user must update the following line:

cmake.exe ..\tfel -G "MinGW Makefiles" ...

For example, if you have downloaded version 3.0.1, the name of the archive is tfel-3.0.1.tar.bz2. Assuming that this archive is decompressed in the same directory than the scripts, the name of the directory containing the sources will be tfel-3.0.1. The previous line can thus be udpated as follows:

cmake.exe ..\tfel-3.0.1 -G "MinGW Makefiles" ...

Changing the installation directory

The installation directory is passed to cmake through the CMAKE_INSTALL_PREFIX variable. The default install directory is C:\tfel-master\install-castem-2017. The user can modify this value to fit its needs.

A simple test showing how to perform Cast3M 2017 simulations with a MFront behaviour

The test directory contains an example showing how to perform Cast3M 2017 simulations with a MFront behaviour. It contains:

Compilation the MFront behaviour

Launch the mfront.bat script. This script is basically a wrapper around the following call to MFront:

mfront.exe --obuild --interface=castem LogarithmicStrainPlasticity.mfront

This command:

There is one trick here: the name of make utility in the MinGW compiler suite is mingw32-make. For MFront to call the appropriate program, the MAKE environment variable must be set. This is done in the script at the following line:

set MAKE=mingw32-make

Launch the Cast3M 2017 simulation

The Cast3M solver can be used directly because it can’t find the TFEL libraries automatically. The launch-castem.bat script thus first updates the PATH variable and then launches the Cast3M solver script.

Launch the launch-castem.bat script to perform the simulation.