This topic contains 4 replies, has 3 voices, and was last updated by James Bowen James Bowen 1 month, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6157
    James Bowen
    James Bowen
    Participant

    I would like to run EFDCplus from within a Matlab script. I have an existing Matlab script that does automated calibration based upon many runs of EFDC. Is it possible to run EFDCplus from within a windows command line? I can do it w/ the single threaded version of the code that I’ve compiled and run on my Mac, I but haven’t gotten it working on the PC. I’ve experimented w/ copying the .exe and some .dll files to the folder w/ the .inp files. There seems to be a license file missing. Can you advise if I can do this, and if so, how?
    Thanks,
    Jim Bowen

    #6158
    Tom Mathis
    Tom Mathis
    Moderator

    Hi Jim,

    You can definitely do that by having your MATLAB script run a simple batch file using the Windows command line. A few things:
    – The EFDC+ executable does not need to be in the same folder as the model input files, just leave it in the directory it was installed to. This will ensure that your license works.
    – You can run an EFDC+ model from the folder with the model input files by creating a batch file which calls the EFDC+ in it’s installed location.
    – When the model starts running, an empty file called 0run will be created in the same folder as the model input files. This file will be deleted if the user ends the run, or if the run is completed. However, if the model crashes due to an error then the 0run file will not be deleted.

    An example of the batch file for EFDC+, which would reside in the same folder (the file created by EFDC_Explorer is always called 0run_efdc.bat):
    SET KMP_AFFINITY=granularity=fine,compact,1,0

    TITLE D:\Projects\Portland Harbor RM 4-7 Group\temp\Hyd_00
    D:
    CD “D:\Projects\Portland Harbor RM 4-7 Group\temp\Hyd_00”
    “C:\EEMS\x64\EFDCPlus_100_OMP_190802_SPx64.exe” -NT2

    The first line sets the KMP offset, which helps you run multiple models efficiently on the same processor. More info here: https://eemodelingsystem.atlassian.net/wiki/spaces/EEREF/pages/2387021/KMP+Offset

    The next line is the title of the run, this is the folder with the model input files.

    The next 2 lines tell the command line to change the current directory to the folder with the model input files.

    The last line calls the EFDC+ executable (make sure this matches the original install path, so that your license will work), and sets the number of threads for the run. In the example I gave above, the run would have used 2 processor cores for the simulation.

    Hope that helps. Let me know if you have any more questions.

    Tom Mathis

    #6159
    James Bowen
    James Bowen
    Participant

    Thanks Tom for the quick response. Duh, it should have occurred to me to try running the batch file instead of the .exe file. I have seen those files in the folders. I opened a command window to test running one of those batch files. It worked fine. I think I should be good to go. Thanks for the info on the batch file. I will be creating them inside the matlab script so it’s good to know what each lines does. I will let you know when I’ve got the whole thing working.
    Thanks,
    Jim

    #6175
    Dimitri Kouom
    Dimitri Kouom
    Participant

    Hi James,
    Please can you share your Matlab script for the automatic calibration ? Actually, with my colleagues we are planning to investigate this interesting path. So we are kindly interested to work in collaboration with you in order to make it possible.
    We appreciated !

    Thanks

    Regards

    Ralph

    #6210
    James Bowen
    James Bowen
    Participant

    Ralph, I might be able to share the MATLAB code sometime, but not right now, as it’s set up very specifically for how we do things. I just don’t have time to adequately set it up and document it for someone else’s use until I get this project report in at the end of the year.

    FYI, what the system requires is a way to run EFDC+ many times, with an assessment of calibration performance occurring we each run. The system must be able to vary EFDC+ parameters for each run by editing the WQ3DWC.INP file. In my code that is done w/i the MATLAB code. Assessment of calibration performance is also done w/i the MATLAB code. In the system we’ve got going now we’re doing Latin Hypercube sampling of parameters, with the computing work shared by a computer cluster that work cooperatively to make and analyze the runs. I’ve used the system before w/ CE-QUAL-W2 to do a full factorial analysis of parameters. Check out the paper we wrote (Bowen and Harrigan 2018) for more info. We can talk next year if you’re still interested.
    JB

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.