REGARDING LINKING OF MODFLOW AND MATLAB

379 views
Skip to first unread message

Sunny Gupta

unread,
Mar 13, 2018, 11:46:33 AM3/13/18
to MODFLOW Users Group
HELLO Everyone,
I am working on the topic planning of groundwater development by linked simulation optimization method.

and i am facing problem in linking MODFLOW & MATLAB.
as i am going to optimize maximum pumping rate keeping drawdown as constraint and OUTPUT FILE OF HEAD FROM MODFLOW .
FOR that i have to link matlab and modflow/.
can you please help me with the issue as i have to complete my project till march.
while going through i got this link for Modflow linked with Matlab below:
but i am not getting anything from this link about how to link these softwares
if you help me with this problem it would be great help for me

hoping for a favourable response

Richard Winston

unread,
Mar 13, 2018, 10:43:58 PM3/13/18
to MODFLOW Users Group, MODFLOW Users Group
If your goal is to optimize a modflow model, consider using modflow-gwm or gwm-vi.

Sent from BlueMail

ashutosh singh

unread,
Mar 13, 2018, 10:44:22 PM3/13/18
to mod...@googlegroups.com
Honestly I do not think you have to link the software and Matlab. 
All you need to know is to how to run modflow inside a matlab code. There are ways to do it depending upon the OS.
Matlab reads the output from a modflow file, processes it for optimization and then changes the parameters (calculated by matlab) inside a file which is read by modflow.
I used shell scripts because it was easier for me but everyone has his/her own way of doing things.

Hpc




--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+unsubscribe@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modflow.
For more options, visit https://groups.google.com/d/optout.

Chris Russoniello

unread,
Mar 15, 2018, 12:02:37 AM3/15/18
to MODFLOW Users Group
Sunny,

As HPC said, I don't think you have to link the code, which I imagine would be quite difficult. You'll probably spend a lot more time doing that than running some sort of recursive script to hone in on your optimized value.

For similar tasks, I've used something along the lines of this code:


load(intitalValues.mat,'MFInputParams'); %load an initial set of modflow input parameters from a file

keepRunning=1; %initialize
while keepRunning==1 %run until desired criteria are met - you may want some error handling to prevent an infinite loop. You could also set this up as a parfor loop if you wanted to multithread.
    generateModflowInputFiles(i); % this runs a series of functions to generate dis,nam,chd,etc files
    dos('RunModflow.bat') %this runs modflow
    [keepRunning,MFInputParams]=MakeDecision(readModflowOutput()); %this reads the output and decides whether the desired criteria have been met, and if not, creates a new set of modflow input parameters
end

good luck.

Sunny Gupta

unread,
Mar 30, 2018, 6:35:39 AM3/30/18
to MODFLOW Users Group
sir can you please help me regarding how .NAM file is generated.

Chris Russoniello

unread,
Mar 31, 2018, 12:01:28 AM3/31/18
to MODFLOW Users Group
Sunny,

I've never needed to make one with a script, because they don't change much between model runs, and I just use the one I generate with a GUI or edit it with a text editor if necessary.

But, it would be really easy to write a script to generate one. Look at any .nam file that you already have and use that as an example. The numbers next to the files refer to the Fortran "unit" in which the data for that package will be stored.

That said, if you're having trouble generating a nam file, your issue may be more basic/conceptual about how Modflow works? If so, I recommend checking out the Modflow documentation.

-Chris

Ashutosh

unread,
Mar 31, 2018, 12:01:41 AM3/31/18
to mod...@googlegroups.com
Whenever you make a modflow model using Modemuse, it generates a nam file when you run the model.
If you are using visual modflow classic then find out the batch file in the directory and run that batch file. 
For other softwares I am not the best person to answer.


Hpc
--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+u...@googlegroups.com.

Sunny Gupta

unread,
Apr 1, 2018, 11:16:43 AM4/1/18
to MODFLOW Users Group
Sir i am using Visual modflow classic for modflow simulation.Is it posssible to use gwm-vi
Reply all
Reply to author
Forward
0 new messages