Tutorial 1f – Fortran limit-state function
In this tutorial we formulate the limit-state function of the problem introduced in Tutorial 1 in
a Fortran library and use Fesslix to perform the reliability analysis.
Subset Simulation is employed to estimate the probability of failure.
This tutorial is based on Tutorial 1b.
Please perform Tutorial 1b before you start with this tutorial.
The code given in this tutorial (Tutorial 1f) replaces the code given in Section 1.3 of Tutorial 1b.
The code given in Sections 1.1 and 1.2 of Tutorial 1b precedes all code given in this tutorial (Tutorial 1f);
and the code given in Section 1.4 of Tutorial 1b succeedes all code given in this tutorial (Tutorial 1f).
Table of Contents
1 Step by Step Instruction
1.1 Create a Fortran-library
Step 1:
Download the template for compliling external Fortran-libraries with Fesslix from Source code downloads.
Step 2:
Replace the content of the file mylib.f90 with:
Download the template for compliling external Fortran-libraries with Fesslix from Source code downloads.
Step 2:
Replace the content of the file mylib.f90 with:
Fortran-file mylib.f90
DOUBLE PRECISION FUNCTION lsfcall(v, N) bind(C,name="lsfcall")
!DEC$ ATTRIBUTES DLLEXPORT::lsfcall
IMPLICIT NONE
DOUBLE PRECISION, dimension(N), INTENT(IN) :: v
INTEGER, INTENT(IN) :: N
INTEGER :: i
DOUBLE PRECISION :: s
s = -60.0d+0;
do i = 1, N
s = s + v(i)
end do
lsfcall = s
END FUNCTION lsfcall
!DEC$ ATTRIBUTES DLLEXPORT::lsfcall
IMPLICIT NONE
DOUBLE PRECISION, dimension(N), INTENT(IN) :: v
INTEGER, INTENT(IN) :: N
INTEGER :: i
DOUBLE PRECISION :: s
s = -60.0d+0;
do i = 1, N
s = s + v(i)
end do
lsfcall = s
END FUNCTION lsfcall
Step 3:
In the file CMakeLists.txt, replace all occurences of fortranlib4flx with lsflib4flx.
Step 4:
Configure and compile the source code of the library:
If you work in Linux, go to the directory containing the source code of the library and execute:
In the file CMakeLists.txt, replace all occurences of fortranlib4flx with lsflib4flx.
Step 4:
Configure and compile the source code of the library:
If you work in Linux, go to the directory containing the source code of the library and execute:
Terminal
mkdir build
cd build
cmake ../
make
cd build
cmake ../
make
Finally, you need to copy the library liblsflib4flx.so located in the build-directory to
the directory that also contains your Fesslix parameter file.
If you work in Windows, use CMake for configuration. Use your preferred build-environment to compile the code. Make sure to copy the created library lsflib4flx.dll into the directory that contains your Fesslix parameter file.
If you work in Windows, use CMake for configuration. Use your preferred build-environment to compile the code. Make sure to copy the created library lsflib4flx.dll into the directory that contains your Fesslix parameter file.
1.2 Fesslix parameter file
The Fesslix parameter file of this tutorial (Tutorial 1f) is equivalent to the one of Tutorial 1e.
Please read the relevant section in Tutorial 1e to create the parameter file.