Tech Articles

MSC Nastran OpenFSI Overview


Tech Articles ID    KB8023478
Status:    Published
Published date:    06/04/2018
Updated:    06/04/2018
Reported In:   MSC Nastran (2017) - MSC Nastran - MD Implicit Nonlinear (SOL400)
Created with Version:   MSC Nastran (2017)
 

Abstract (Question)

What is OpenFSI and how can it be used?

Description (Answer)

OpenFSI Overview

OpenFSI is the MSC Nastran SDK base architecture to build your own interface to any fluid-type loading of the structural mesh. It enables existing coupling to CFD codes via MpCCI code coupler, or specific CFD vendors who have built an interface to it. Alternatively it can be used to connect to custom user loading, such as a formula or look-up table.


This introduction document details the different methods in which the OpenFSI service can be used:

  1. Custom (User code)

  2. Direct (User link to CFD)

  3. Indirect (Via MpCCI)

  4. Via scFLOW

For the Custom service, it will be shown how to set up the MSC Nastran service to run user code that applies a load onto the identified structure. This can therefore be seen not as just limited to fluid loading, but any non-standard input load onto a structure, such as:

  • Complicated time-dependant load formula

  • Spatially variable load based on current nodal positions

  • Time and Spatial Look-up tables

  • User CFD / Loads program

Essentially it is a user subroutine for loading, but which was specifically tailored around fluid loading applications.

 

An example is shown below that highlights the added insight that a fluid-structure interaction analysis can give the engineer. 

 

OpenFSI Example

Flexible attachment for a rear spoiler under acceleration

The simplified vehicle shape and CFD domain can be seen in the video below. The airflow is accelerated from 0 to 100km/h in 4 seconds and then from 100 to 200km/h the remaining 6 seconds, for a total duration of 10 seconds.

 

The structural analysis part consisted only of the rear spoiler and flexible attachment, with appropriate boundary conditions (rotations free, but translation fixed). 

 

The interaction surface between the FEA and CFD side was identified as the outer skin of the rear spoiler itself.

 

https://www.youtube.com/watch?v=R7T9ZeVIkZQ

 

Looking closer at the rear spoiler, the interaction between the airflow and deformation/displacement of the spoiler can be clearly seen.

 

https://www.youtube.com/watch?v=oBmrdcQljX0


The effect of this flexibility provided an interesting comparison between a fixed spoiler, one that is slightly flexible and the result above that is highly flexible. For both the drag and lift coefficient, the highly flex spoiler seems to be performing ideally, as the drag is lowered, while the downforce increases as the vehicle velocity increases. 

 

 

 

 

Building your own OpenFSI routine

Required Tools

The first thing is that for MSC Nastran 2012/2013 you must have installed:

  • Visual Studio 2010

  • Intel Fortran Compiler 12

  • MSC Nastran SDK (same version as MSC Nastran installed)

 

Setting up Build Environment

It is best to set up your own build environment and then create your custom services there as well to point Nastran to use these services.

Here I refer to three main directories where the information comes from:

  • build_root\ is your user location for your custom Nastran code environment

  • MSC_Nastran_SDK\ is the installed path of the MSC Nastran SDK downloaded from our download centre or other means

  • MSC_Nastran\ is the installed path of MSC_Nastran

 

You need three files in your build_root\ directory:

  • SConopts

  • SConscript

  • SConstruct

 

Plus a build_root\src directory where the source code would be stored with a copy of:

  • SConscript

 

You can copy these files from the *.example files in: MSC_Nastran_SDK\2013\Tools\RunTime\lib\python\SCASCons\ 

and then remove the .example extension

 

After you have compiled and built the source code, other folders will appear in your build root:

  • build_root\Apps

  • build_root\WIN8864_NASTRAN_OPT

 

The Apps directory has all the compiled libraries (.dll) and service name lists to use in the Nastran input.

Therefore you can set up the Windows environmental variables that Nastran uses to:

  • SCA_LIBRARY_PATH = build_root\Apps\WIN8664\lib

  • SCA_RESOURCE_DIR = build_root\Apps\res

  • SCA_SERVICE_CATALOG = build_root\Apps\res\SCAServiceCatalog.xml

 

Now your environment is all good to go and you can start building your own code to run automatically with MSC Nastran.


The benefit of this setup is that by just replacing the build_root\src with other source codes and building again, each build libraries are added to the build_root\Apps and appended to the SCAServiceCatalog.xml catalogue. Therefore multiple services can be created and stored in a single environment with just the Nastran input file pointing to the appropriate service to use. 

 

Building

To build code, you can either build the framework automatically as discussed in the documentation (using the SDK gensekeleton tool), or you can start from the examples provided in the Nastran installation at:

  • MSC_Nastran\20130\msc20130\nast\services\Implementations

 

To simplify things, I use a cshell windows script that sets up aliases for the SDK paths and the scons make tool. This would be valid for any system is set up as shown before:

 

set MSC_SDK=C:/MSC.Software/MSC_Nastran/SDK/2013

alias genskeleton $MSC_SDK/Tools/genskeleton.cmd

alias scons $MSC_SDK/Tools/scons.cmd

 

echo "**** NASTRAN SDK ENVIRONMENT ****"

echo " Using : " $MSC_SDK

echo "Commands :"

echo " genskeleton file.sdl"

echo "     do in src dir"

echo "     copy idl file from \solver\sdk\idl\SCA\MDSolver\..."

echo "     copy sdl file from \solver\nast\services\Implementations\..."

echo " scons"

echo "     do in home dir"

 

The main program to use to build the code is the scons tool, which is found in:

  • MSC_Nastran_SDK\2013\Tools\scons.cmd

 

This must then be launched from the build_rootdirectory and will compile and build the dll libraries and service catalogs etc as shown above. Some runtime c++ errors might occur, but can be ignored.

 

OpenFSI Code

The example code in MSC_Nastran\20130\msc20130\nast\services\Implementations\OpenFSI can be used as a starting point and copied to the build_root\src directory (excluding the \model Nastran example input files). Other service/user subroutines are then also to be found in the same \Implementation directory (More on this another time: Materials will include quick links to Digimat materials)

 

This therefore includes the files:

  • myOpenFSI.cdl

  • myOpenFSI.cpp

  • myOpenFSI.h

  • myOpenFSI.sdl

 

Looking at the myOpenFSI.cpp file, the current code implements a sinusoidal time-dependant loading on all the identified wetted element nodes:

 

  for (i=0; i< nWetNodes; ++i) {

    force_x = 0.01*(i+1);

    force_y =  0.01*sin( 2.0*PI * fsiTime / 2.0 )+0.01*(i+1);

    force_z = -10.0*cos( 2.0*PI * fsiTime / 2.0 );

    nodalForce.id = wetNodes[i];

    nodalForce.x = force_x;

    nodalForce.y = force_y;

    nodalForce.z = force_z;

    wettedNodeForces[i] = nodalForce;    

  }

 

So this is pretty much the business end of the code. 

Furthermore, the spatial location of the nodes can be identified (wettedNodeCoordinates) and used as input to loading calculation. At the end of the step, the resulting displacement (wettedNodeDisplacementsand velocities (wettedNodeVelocities) can be retrieved and passed on so that this can be used for CFD mesh updates etc.

 

After building you will see the service name listed in the SCAServiceCatalog.xml is “myOpenFSI” and it calls Test.OpenFSI. In the Nastran bdf file input, you will then connect to the servcice name:

    CONNECT SERVICE FSISRV1 'myOpenFSI'

 

In build_root\Apps\WIN8664\lib we then find a \Test directory which has the newly built OpenFSI libraries to be used for this service

 

Test Example

An example with a Nastran demo of a flat plate with the example OpenFSI load of a sinusoidal load can be downloaded below - it uses the example code that needs to be built as shown above. In all OpenFSI analyses, it is important to output Nastran Applied loads to see the fluid loading as generated by the code.

 

 

 

 

English Attachment

Plate_simple.7z
136K • < 1 minute @ 56k, < 1 minute @ broadband



Rate this Page
Rate the quality of this article from 5 (high) to 1 (low):
1
2
3
4
5
 
How can we improve this?

 

Please Sign In

Sign In Password Help | Start here

Get what you want from MSC more efficiently and effectively, either reactively through browsing and searching, or proactively through content subscriptions that you manage.

Click here for a tour of SimCompanion

Click image above for a tour of SimCompanion.