Clear Filters
Clear Filters

Creating an interface between MATLAB and MSC NASTRAN that is run on a server

32 views (last 30 days)
Hello everyone,
I am looking for a way to interface MATLAB with MSC NASTRAN that is run on a server. I need to find a way to run Monte Carlo simulations on a complex model, so building a MATLAB code that could talk to NASTRAN on that external server to launch a large number of simulations and save result files automatically would be an ideal solution. But I'm not sure if it's doable.
I don't have much info on the server where NASTRAN is being used, but basically it's a supercomputer with Linux as OS, I access it through my Windows computer through Putty to access the inferface (basic terminal window) and WinSCP to exange files. Through the terminal window I can run the model by launching a DAT file, the results are then saved as a .f06 file in the same directory (which I can access with WinSCP).
I'd like to know if it's possible to do something like that (and if it is how to do it) ? If it's not possible I'll have to quickly find an alternative so if someone has faced a similar problem before I'll gladly take some advice !
Thanks in advance,
Jeremy

Answers (1)

V San
V San on 26 Aug 2020
Edited: V San on 26 Aug 2020
Hi Jeremy
This is a late reply, but leaving it for others checking for something similar. This is definitely doable. Load Matlab and Nastran modules through your job submission script for the cluster (More info on job submission script here and checking info about modules here). When you submit this script, all requested modules are loaded, so that whenever Nastran is called in the Matlab code, the remote node is ready to execute (i.e. the loaded Nastran module recognizes the .bdf file and proceeds to execute). The command in the job submission script should look something like this:
module purge
module load matlab/R2018a nastran/2014.1
NOTE: You would have to check with your HPC administrator about the job scheduler they are using on your cluster. The above examples and commands may be in a different job submission format. Usually they will provide you with a sample file and you would only need to edit in details like: required modules, time and resources, account name, etc. Also, make sure you are using the software version installed in your cluster.
If you already have the Nastran input file generated, you can directly use the command below in your Matlab code. For more info and debugging, check here and here.
call_NASTRAN_BDF=[nastran ' ' [file_name '.bdf'] ' memory=estimate' ' sdir=' run_directory_name];
system(call_NASTRAN_BDF);
But in complicated analysis, probably you would need to automatically generated Nastran input files with updated parameters. You can refer to my answer here to a previous question regarding this. Hope this helps!
  1 Comment
Boby Alexander
Boby Alexander on 26 Mar 2024
Edited: Boby Alexander on 31 Mar 2024
Dear V San
I have same problem with Jeremy. Could you explain in details how to write the 'run_directory_name' in the matlab code.
I have nastran bdf file name as test_matlab.bdf and store it in D:\Boby_Folder\PATRAN\ .
And I follow your code above like this:
call_NASTRAN_BDF=[nastran ' ' [test_matlab '.bdf'] ' memory=estimate' ' sdir=' c:\MSC.Software\MSC_Nastran\20190\bin\nastran.exe];
system(call_NASTRAN_BDF);
But it said error in this part: ' sdir=' c:\MSC.Software\MSC_Nastran\20190\bin\nastran.exe];
Matlab said invalid use of operator. How to correct this problem. Please help me. Thank you.

Sign in to comment.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!