How to run Modflow 6 models on the background with Flopy, Linux and Nohup – Tutorial

Hydrate

If by chance you ended up working with large scale models with long execution times on JupyterLab you might find some restrictions related to the interface itself. Since the model execution is related to the session your computer can go into suspension before the process has finished or you need to keep a tab open to ensure the process is running smoothly. We have explored alternatives to run the model on the background, having some resources to reach the simulation progress and monitoring the process.

This tutorial shows the process to turn the Jupyter notebook into a Python script and run it with Noup.

You would need the MODFLOW executables compiled for Linux:

hatarilabs.com/ih-en/a-place-to-find-modflow-executables-for-any-operating-system

Tutorial

Code

This is the Nohup sentence to run the model on the background:

nohup python -u modelSplitter.py > flopyLog.txt

The code used to read, change workspace, write simulation, and runs the model.

#!/usr/bin/env python
# coding: utf-8

# In[1]:


import os
import sys
import time

import flopy
import matplotlib.pyplot as plt
import numpy as np

from flopy.mf6.utils import Mf6Splitter
from flopy.plot import styles
from flopy.utils.geometry import LineString, Polygon


# In[2]:


simulation_ws = os.path.abspath("../model/Update")
sim = flopy.mf6.MFSimulation.load(sim_ws=simulation_ws)


# In[ ]:


print("Create new workspace and write simulation")
workspace = os.path.abspath("../model/Work")
sim.set_sim_path(workspace)
sim.exe_name = '../bin/mf6'
sim.write_simulation()


# In[ ]:


print("Start model simulation")
startTime = time.time()
sim.run_simulation()
endTime = time.time()

print(("--- %s seconds ---")%(startTime - endTime))

—————
TRANSCOM ISPFree Sigma HSE Email
Level 6 Domain Names are FREE – Register Now.

Related Posts

Hydrate

Dear User or Dear Explorer,Here we aim to summarize some of the material related to GEOframe-NewAGE. The main source is certainly the GEOframe blog:The GEOframe

Boost Inflight Internet- Business Hosting- Secure Email Account- Dropcatch Domain Names- Antisnoop Email- Free Secure Email- Cheap VOIP Calls- Free Hosting and Email- Aero Connectivity- Premium Domains for Sale- Transcom Telecom- Satphone Airtime- Mobile Plans- Free Domain Names- Organic Products- Aviation News
Transcom ISP - Transcom VOIP - Free Secure Email - Dropcatch Software - FastApn Inflight - Aero Connect - Premium Domains