آموزش تعریف جهت جریان در یک مدل MODFLOW با پایتون و Flopy :: بیسین - سایت تخصصی مهندسی آب

عضويت در خبرنامه ايـميـل پايگاه بيسيــن - عضويت پس از کليک بر روي لينک فعال سازي که براي شما ارسال خواهد شد تکميل مي شود




آموزش تعریف جهت جریان در یک مدل MODFLOW با پایتون و Flopy


نشان دادن مسیر جریان آب زیرزمینی برای درک شرایط واقعی و پیش بینی شده رژیم جریان آب زیرزمینی مفید است. این جهت و بزرگنمایی جهت و  چشم انداز سریع جریان های اصلی آب زیرزمینی و بین خطوط منابع و نقاط تخلیه را نشان می دهد. بردارهای جریان ویژگی های بسیار رایج در مدل سازی آب های زیرزمینی هستند که با استفاده از پشته منبع باز تا زمانی که توسعه کتابخانه Flopy وجود ندارد، دارای یک ابزار ویژه برای ارائه است.


این آموزش روند گردش کامل را برای تعیین مسیرهای جریان از یک مدل MODFLOW انجام شده با Model Muse نشان می دهد. اسکریپتینگ یک تصویر پسزمینه، georeference مدل از پارامتر صادر شده به عنوان خروجی، و استخراج شکل نتیجه به عنوان یک فایل PNG است. آموزش در Python 3 در نوت بوک Jupyter انجام می شود.


برای یافتن تمامی مطالب مرتبط با این مطلب در سایت از جستجوی سایت در حاشیه سمت راست و بالای صفجه استفاده فرمایید.


لیست دیگر آموزش های مرتبط

ورود به بخش آموزش های متنی GMS

ویکی نرم افزار GMS

انجمن بحث و گفتگو GMS

کلاس های بین المللی GMS

منابع آموزشی نرم افزار GMS


آموزش های ویدیویی فارسی GMS

آموزش های ویدیویی انگلیسی GMS


دانلود آخرین نسخه نرم افزار GMS


دریافت کرک نرم افزار GMS

دریافت لایسنس ارزیابی (14 روزه)


برای سفارش انجام مدل سازی اینجا کلیک کنید


فایل ورودی

شما می توانید فایل های مورد نیاز برای این آموزش را در این لینک دانلود کنید.

Code

This is the complete Python script for this tutorial:

Import the required libraries

From numpy, matplotlib and flopy as well as Python core libraries.

%matplotlib inline
import sys, os, re
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import flopy
import flopy.utils.binaryfile as bf

Set a background image for the figure

This is not mandatory, but it helps to locate and analyse groundwater flow with respect to geomorphological and geographical features. Backgroundmap can be generated from QGIS by exporting the canvas that actually comes with the world file (.pgw or similar), this world file allows the georeferenciation of the image. There are options to improve the graphics with contour lines and the representation of boundary condition, please check the flopy examples: https://github.com/modflowpy/flopy/tree/develop/examples/Notebooks

wrlFile = open('../Rst/BackgroundImage.pgw').read().split('\n')
cellsize = float(wrlFile[0])
bcgImg = mpimg.imread('../Rst/BackgroundImage.png')
left = float(wrlFile[4])
right = float(wrlFile[4]) + bcgImg.shape[1]*cellsize
bottom = float(wrlFile[5]) - bcgImg.shape[0]*cellsize
top = float(wrlFile[5])

Create our modflow model as an object

Basic setup of a modflow model in flopy

#Model
modPath = '../Model/'
modName = 'SingleLayerModel'
exeName = '../Exe/mf2005.exe'   
ml = flopy.modflow.Modflow.load(modName+'.nam', model_ws=modPath, 
                                exe_name=exeName,check=False)

Import some geospatial parameters from the model

Model Muse inserts some geospatial parameters as comments on the DIS file. We have to import it by opening the DIS file and apply the parameters to the model object. Note: The EPSG code have to be set by hand since it is not written on the DIS file.

#Open the DIS file and extract the spatial parametes
spatialpar = open(modPath + modName + '.dis').readlines()[:6]
ul =  re.findall("\d+\.\d+", spatialpar[1])
lr =  re.findall("\d+\.\d+", spatialpar[4])
xul, yul = float(ul[0]), float(ul[1])
xlr, ylr = float(ul[0]), float(ul[1])
rotation = -float(re.findall("\d+", spatialpar[5])[0])

#Assign parameters to the model object
ml.dis.sr.set_spatialreference(xul=xul, yul=yul, rotation=-rotation)
ml.dis.sr.proj4_str= 'EPSG:32718' #### Defined by the user
ml.dis.sr.attribute_dict

ml.dis.sr
xul:199558.1423; yul:8807344.096; rotation:0; proj4_str:+init=EPSG:32718; units:meters; lenuni:2; length_multiplier:1.0

Import the output heads

h = flopy.utils.formattedfile.FormattedHeadFile(modPath+modName+'.fhd',model=ml)
head = h.get_data(totim=1)

head[0,30:33,30:33] #Sample of the heads values
array([[24.3446, 26.4447, 28.8097],
       [23.7384, 25.8897, 28.1835],
       [23.2935, 25.5388, 27.3164]], dtype=float32)

Create a figure

The figure is generated as a matplotlib figure, where flow direction vectors overlay the background image. There are options to filter the number of arrows with the istep/jstep, this is highly recommended to enhance the representation and user experience.

fig = plt.figure(figsize=(16, 10))
ax = fig.add_subplot(1, 1, 1, aspect='equal')

modelmap = flopy.plot.ModelMap(model=ml)
cbb = bf.CellBudgetFile(modPath+modName+'.cbc')

frf = cbb.get_data(text='FLOW RIGHT FACE', totim=1)[0]
fff = cbb.get_data(text='FLOW FRONT FACE', totim=1)[0]

lc = modelmap.plot_grid(linewidth=1, color='gray',alpha=0.3)
vectors = modelmap.plot_discharge(frf, fff, head=head,istep=2,jstep=2,normalize=False,color='cyan')

image = plt.imshow(bcgImg, extent=(left, right, bottom, top), alpha=0.7)

ax.set_xlabel('Este', size=14)
ax.set_ylabel('Norte', size=14)
fig.tight_layout()

fig.savefig('../Output/FlowDirection.png')












نظرات (۰)

فرم ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی

درباره بهترين هاي بيسيـــن بدانيد...

Bird

يکي از مهمترين اهداف اين سايت تهيه آموزش هاي روان از ابزارهاي کاربردي علوم آب است.

اهميت مطالعات محيطي با ابزارهاي نوين در چيست؟

امروز با فارغ التحصيلي جمع کثير دانشجويان سالهاي گذشته و حال، با گذر از کمي گرايي ديگر صرف وجود مدارک دانشگاهي حرف اول را در بازار کار نمي زند؛ بلکه سنجش ديگري ملاک؛ و شايسته سالاري به ناچار! باب خواهد شد. يکي از مهم ترين لوازم توسعه علمي در هر کشور و ارائه موضوعات ابتکاري، بهره گيري از ابزار نوين است، بيسين با همکاري مخاطبان مي تواند در حيطه علوم آب به معرفي اين مهم بپردازد.

جستجو در بيسين
سایت مهندسی آب

بیسین - سایت تخصصی مهندسی آب

سایت بیسین با معرفی مهم ترین و کاربردی ترین نرم افزارها و مدل های شبیه سازی در حیطه مهندسی آب، تلاش به تهیه خدمات یکپارچه و محلی از محاسبات هیدرولوژیکی و هیدرولیکی می کند

اطلاعات سايت

  • www.Basin.ir@gmail.com
  • بهزاد سرهادي
  • شناسه تلگرام: Basin_Ir_bot
  • شماره واتساپ: 09190622992-098
  • شماره تماس: 09190622992-098

W3Schools

W3Schools