1. Trang chủ
  2. » Ngoại Ngữ

Manual of Gene flow Model from Pollen Dispersion(Revised by Xiufen Cui on 12_16_2014)

25 1 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

Manual of Gene Flow Model from Pollen Dispersion How to run the program .2 Locations of concentration and deposition detectors 2.1 The coordinate system 2.2 Locations of concentration detectors 2.3 Location of deposition detectors 10 Program structure .10 3.1 Function of OnPredictionAperiod 10 3.2 Function of CalculationOfDispersion1 12 3.3 Function of FlyFromCircularSource 13 3.4 Function of OneCircularSourceGridFly 14 3.5 Function of Load3DData 15 3.6 Function of OpenGLRendering 16 How to adjust program parameters 23 4.1 Model precision 23 4.2 Settling speed .23 4.3 Horseweed and field plant characteristics 23 4.4 Detector size and number 23 4.5 Output graph parameters 24 4.6 Other parameters 24 Project Source Codes Location 24 References 24 How to run the program The model is to calculate pollen dispersion, deposition and potential outcrossing (Pollen”, you will see Figure In this window, please select the simulation type, you may select “Single Hours” type to the simulation for only one period, or you may select “Whole Season” type to the simulation of whole season Figure 1.2 The window of selecting simulation type 3) If you choose to “Single Hours” simulation type, you will see the following window in Figure You are asked to input the simulation date, the start simulation time and the end simulation time, then click “Ok” button to continue If you select “Whole Season” simulation type in step 2, you needn’t to input simulation time, and will go into step directly Horseweed pollen is only released from August 10 to September 27 based on measured data in Tennessee in 2013 Figure 1.3 The window of inputting simulation time 4) In this step, you need to input the field related information, see Figure We provides four kinds of field types, which are “Bare Ground”, “Soybean”, “Sweet Corn” and “Grain Corn”, and we need you to input the field radius and the number of horseweed plants in the field Then click “Ok” to continue Figure 1.4 The window of inputting the field information 5) Then you need to input the weather data, which includes precipitation, radiation, temperature, mean wind speed and wind direction, see Figure Until now, you input all the input information, you need to input the names of the files which are used to store concentration, deposition, and outcrossing output data in next steps Figure 1.5 The window of inputting the weather data 6) Give the file name to save the concentration result, see Figure Figure 1.6 The window of inputting the file name for saving concentration result 7) Give another file name to save the deposition and outcrossing ratio result, see Figure Figure 1.7 The window of inputting the file name for saving deposition result 8) Finally, you will see the result graph, see Figure Figure 1.8 One result of gene flow model from pollen dispersion The result includes two parts: the left view shows the input information and some concentration values in the downwind direction; the right view shows five graphs, which are mean wind direction concentration graph (pollen grains/m 3), mean deposition graph (pollen grains/m2/s), total deposition graph (pollen grains/m 2), potential outcrossing ratio graph and outcrossed seed number graph 9) In addition, there are two output files, one is concentration result, and another is deposition and outcrossing result For the concentration output file, its format is as following x y z concentration -60.959999 -60.959999 0.000000 0.000000 -57.911999 -60.959999 0.000000 0.000000 -54.863998 -60.959999 0.000000 0.000000 -51.815998 -60.959999 0.000000 0.000000 There are four values per line in concentration output file, which are x coordinate value, y coordinate value, z coordinate value, and concentration value at (x, y, z) point The coordinate system we are using is taking the field center point as original, taking from north to south direction as x-axis direction, and from west to east direction as y-axis direction, and from ground to sky direction as z-axis direction For deposition and outcrossing output file, its format is as following x y meanDeposition totalDeposition outcrossingRatio seedNumber -60.959999 -60.959999 0.000000 0.000000 0.000000 0.000000 -57.911999 -60.959999 0.000000 0.000000 0.000000 0.000000 -54.863998 -60.959999 0.000000 0.000000 0.000000 0.000000 -51.815998 -60.959999 0.000000 0.000000 0.000000 0.000000 There are six values per line in deposition and outcrossing output file, which are x coordinate value, y coordinate value, mean deposition value, total deposition value, outcrossing ratio value and seed number at (x, y) point, the measurement height is set as 1.05m And we are using the same coordinate system as the concentration output file Locations of concentration and deposition detectors The model implements a 3D random walk model, and uses it to simulate the horseweed pollens’ dispersion, then calculates the concentration and deposition value of horseweed pollens at some locations where the concentration and deposition detectors locate So firstly let’s talk about the locations of detectors Before that, the coordinate system the program is using is given out 2.1 The coordinate system The coordinate system the model is using is shown in Figure 2.1 According to this figure, x-axis direction is from north to south, y-axis direct is from west to east In addition, z-axis direction is from ground to sky Figure 2.1 The coordinate system in horizontal plane 2.2 Locations of concentration detectors There are totally 40x40x40 concentration detectors by default, every concentration detector is a cube, whose side length is 0.5m by default Their layout is shown in Figure 2.2 and 2.3 Figure 2.2 shows the layout of concentration detectors in x-y coordinate plane, every coordinate plane includes 40x40 cubes, which exactly cover the whole field region According to the field radius, the distance between concentration cubes is different For example, if the field radius is 60m, then the distance between concentration cubes in x and y direction is 3m (60 x / 40) And for ease of calculation, we give all the cubes positive index value As shown in Figure 2.2, the left-bottom cube’s index is (0,0), the right-top cube’s index is (39,39), so the cube at the center of the field is (20, 20) Figure 2.2 only show a layer of concentration cubes, there are totally 40 layers in z direction, see Figure 2.3 Every layer’s cube layout is exactly same And the distance between layers is 0.5m by default, which means no distance among layers since the cube’s side length is 0.5m In this case, the total height of all the layers is only 40x0.5=20m In order to simulate the concentration value at higher height, the distance among layer can be set as bigger, for example, if this distance is set as 1m, then the concentration value between 0m and 40m can be gotten Figure 2.2 The concentration detectors' layout in horizontal surface Figure 2.3 The 3D layout of concentration detectors 2.3 Location of deposition detectors Firstly, the shape of deposition detector is a rectangle, whose length is 1.5m and width is 1.5m by default The size of deposition detector can be changed according to field radius The deposition detector’s layout is exactly same as the layout of concentration cubes in horizontal plane, but there is only one layer So the total number of deposition detectors is 40x40 And the layer’s height is 1.05m by default Program structure The program uses VS2013 environment For graphs, the OpenGL classes were used The following figure shows the general structure Gene flow program Simulation codes OpenGL Classes Figure 3.1 The general structure of the model 3.1 Function of OnPredictionAperiod The 3D random-walk simulation codes are in the file of “ChildFrm.cpp” The program starts from function “void CChildFrame::OnPredictionAperiod()”, it is triggered when the user click the menu “Prediction->Pollen” This function calls the UI interface to let the user input the field and weather information The flowchart for the function is: Figure 3.2 The flowchart for “void CChildFrame::OnPredictionAperiod()” According to the above flowchart, the function “OnPredictionAperiod” has the following steps: Seed the random-number generator, the simulation codes use some random numbers generated by rand(), this step will make rand() generate different random number every time when the user runs the program Let user to select simulation type, there are two kinds of simulation, one is “single hours”, which allows the user to input the simulation time period, the program will only simulate the result in that period Another is “whole season”, which makes the program simulate the concentration and deposition result in whole season If the user selects “Single hours”, then the user needs to input the simulation information, which includes simulation date, start simulation time and end simulation time Based on the measured data in Tennessee, horseweed pollen is only released from August 10 to September 27 in 2013, so the simulation date should be some day during this period If “whole season” is selected, the function will go to step directly Let user to input the field information, which includes field type, field radius and the number of horseweed in the field Let user to input weather parameters, which includes precipitation, radiation, temperature, wind speed and wind direction If precipitation > 0, that means there are rain drop in that period, so no pollens are released, the program exits If precipitation = 0, the program will continue to ask user to input the name of the concentration result file 7 Let user to input the name of the deposition and outcrossing result file Set up the plant characteristics of horseweed and field plant by calling the function “SetUpCanopy()” Get the views for showing the result graph 10 Run the thread procedure to call the function “CalculationOfDispersion1()” which does the simulations 3.2 Function of CalculationOfDispersion1 The function “CalculationOfDispersion1()” prepares the parameters, then call the simulation function, output the result into the output file, and finally call the OpenGL classes to show the output graphs Its flowchart for is as the follows: Figure 3.3 The flowchart for “void CChildFrame:: CalculationOfDispersion1 ()” Call the function “CalculateLUStar()” to calculate obukhov length and UStar using the weather parameters the user inputs Calculate the wind speed above the plant, and calculate how long the horseweed pollen can fly away from the field, use this period as the simulation time period Call “FlyFromCircularSource()” to simulation with source strength Since the concentration and deposition result is directly proportional to the source strength value So the program can easily get the real concentration and deposition result with any source strength value Calculate the average source strength during the whole simulation duration The source strength values per minute from 08/10/2013 to 09/27/2013 measured in Tennessee are saved in the big array TNHorseweedSourceStrength in the file “TNHorseweedSourceStrength.h” By multiplying the result with the average source strength value, the final concentration and deposition results are obtained Be worth to note, the unit of source strength in array TNHorseweedSourceStrength is “grains/m2/min”, so we need to transfer it into “grains/m2/second” by dividing by 60 Output all the concentration values into the output file Set up the parameters for drawing the output graph Only the concentration value in down wind direction will be shown So the variable “ Dispersal” only saves the concentration value in down wind direction According to the deposition result got in step 4, calculate the total deposition result, outcrossing ratio result and seed number result, and output them into the output file Call view class to draw the output graphs 3.3 Function of FlyFromCircularSource The function “void FlyFromCircularSource(float SourceRadius, BOOL IfFinalResult)” in the file of “ChildFrm.cpp” does the simulations SourceRadius is the radius of the source, which is got according to the number of horseweed plants in the field in the function “OnPredictionAperiod” IfFinalResult is a Boolean variable which is set to “TRUE” to save the simulation results The following flowchart shows the function of “FlyFromCircularSource” Figure 3.4 The flowchart for “FlyFromCircularSource()” Firstly, initialize the residence time array and deposition accumulator array using zero According to the source radius, separate the source region radially and angularly into some subsectors 3 For every subsector, call the function “OneCircularSourceGridFly()” to simulate the pollen random walk model, and get the pollen residence time and deposition accumulator value After the simulation of all the subsectors finish, calculate the concentration and deposition value 3.4 Function of OneCircularSourceGridFly The function of “OneCircularSourceGridFly(float SourceGridArea, float RealX, float RealY)” implement the random walk model, and calculates the residence time and deposition accumulator for every subsector Where the SourceGridArea is the subsector area where the particles were released, RealX and RealY are the coordinates of the subsector which reflect the location of the subsector corresponding to the whole source region The flowchart for “OneCircularSourceGridFly” is as the follows: Figure 3.5 The flowchart for “OneCircularSourceGridFly” For every sector, the program give it a certain number of released pollen (Np, which is 320 by default) For every released pollen, we will the following steps: Set i = 0, “i” is the counter of the released pollen 2 For every pollen, calculate the initial coordinates of the pollen, the program assumes both x and y coordinates are always related to the subsector But z coordinate varies between the horseweed flower height and horseweed plant height All pollens released from this subsector are divided into groups, every group’s pollens have different z coordinate value between horseweed flower height and horseweed plant height Call the function “FieldEquilibriumWind()” to calculate the wind speed and UStd, VStd and WStd in the source field since the pollen is always released from the source field at the beginning Call the function “SetLeafData()” to set the horseweed plant characteristics as the current characteristics Calculate Dt by calling the function “CalculateDt()”, which is the first flight time of the pollen Every time, we check if the simulation time is out (Time Period < 0), if yes, then go to the next released pollen Calculate the flight displacements Dx, Dy and Dz in Dt duration Calculate the new coordinates of the pollen, and transfer the coordinates from the wind coordinate system into the coordinate system the program is using Check if the flight path of the pollen intersects with any concentration cubes using the function “cube_line_intersection()”, if yes, calculate the residence time in the corresponding cubes and save it into the array Continue to check if the flight path of the pollen intersects with any deposition detector, if yes, calculate the deposition accumulator and record it into the array 10 Check if the pollen flies away from the field, if yes, go to the next pollen Otherwise, set the plant characteristics according to the new location of the pollen 11 Furtherly, check if the pollen deposits on the ground or the plant, if yes, go to the next pollen 12 If the pollen doesn’t deposit on the ground or the plant, then it will continue to fly So calculate the new wind speed, UStd, VStd, WStd and Dt by calling “FieldEquilibriumWind()” and “CalculateDt()” 13 Decrease the time period by Dt, go to check if the simulation period is out This function returns only when all the released pollens by this subsector finish its random walk Until now, the main functions of doing simulation are introduced The functions which draw the output graphs will be introduced next 3.5 Function of Load3DData The function “void CGLDemoView::Load3DData( char type, DispersalArg Dispersal)” is in the GLDemoView.cpp” The function transfers and grids the data for graph show Where the Dispersal is a structure which stores the simulation results The “type” is a parameter which was set to “C” for showing the graph This function calls the function “void COpenGL3D::Load3DData( char type,DispersalArg& Dispersal)” in the file “OpenGL3D.cpp” Then the function of “Load3DMultipleMapsData( type, Dispersal)” is called which in fact does the gridding and data transferring See its following flowchart Figure 3.6 The flowchart of the function of “Load3DmultipleMapsData” The function “Load3DMultipleMapsData()” the following steps: Generate the surface grid for all simulation data in order to show them in output graphs There are output graphs: mean wind direction concentration graph, mean deposition graph, total deposition graph, outcrossing ratio graph and seed number graph To grid the simulation data, Structure “ScatData” was used for defining the arrays storing the simulation data The structure “SurfaceGrid” was used to define the arrays which store the future gridded data The function “SetNext()” sets the simulated data in arrays for future gridding The function of “Xpand()” does the gridding work The structures and the two functions were adapted from W John Coulthard Details are in files of Xpand.cpp, surfacegrid.cpp, and scatdata.cpp “Init3DdataSet ()” function is in the file “OpenGL3D.cpp” The function initializes the parameters for the future graph show Load the gridded data to pointer array The function of “Normalisation()” in the file of “OpenGL3D.cpp” is for normalizing the data for future graph show Finally, the m_pDS pointer points to the normalized arrays and the future graphs show function will use the data the pointer points to 3.6 Function of OpenGLRendering The “OnDraw()” function draws the simulation graphs using the functions “OpenGLRendering()” and “Show3DForm(Dispersal1)” The function “OpenGLRendering()” is in the file “GLDemoView.cpp” The function calls the “void COpenGL::OpenGLRendering ()” in the file of “OpenGL.cpp” The following flowchart shows the function structure Start Set background Exists simulation results? Y N Draw background by OpenGLDrawBanner() GDIDrawBanner() Draw the graphs by OpenGLDraw Map() End Figure 3.7 The flowchart of “void COpenGL::OpenGLRendering()” In above flowchart, “OpenGLDrawbanner()”and “GDIGLDrawbanner()” draw the background graph which is in “OpenGL3D.cpp” The two functions are in the file of “OpenGL3D.cpp” In above flowchart, the “OpenGLDrawMap()” draws the simulation graphs which is in “OpenGL3D.cpp” The following shows the flowchart for this function, and it does the following steps Figure 3.8 The flowchart of “OpenGLDrawMap()” Before drawing, save the current drawing configuration Set up the new drawing settings for output graphs Call “DrawAxis()” to draw the coordinate systems, wind direction, field boundary, graph title and so on Call “DrawFlat(0)” to draw the mean deposition graph and call “ DrawLegend()” to draw its legend Call “DrawFlat(1)” to draw the total deposition graph and call “DrawLegend()” to draw its legend Call “DrawFlat(2)” to draw the outcrossing ratio graph and call “DrawLegend()” to draw its legend Call “DrawFlat(3)” to draw the seed number graph and call “ DrawLegend()” to draw its legend Call “DrawLegend()” to draw the legend of mean wind direction graph and call “DrawConcentrationFlat()” to draw the concentration graph Restore the original drawing configuration and exit The function “DrawAxis()” draw the coordinate system, wind direction, field boundary, graph title and so on, whose flowchart is in Figure 3.9 Figure 3.9 The flowchart of “DrawAxis()” The function of “DrawFlat()” defined in “OpenGL3D.cpp” draws the mean deposition graph, total deposition graph, outcrossing ratio graph and seed number graph according to the input parameter, its flowchart for the function as the following Start Load the normalized current deposition flux j=0 j>the maximum column No? N End i=0 i>the maximum row No? N j++ the data point and neighbor points in receptor Y Draw the point and the neighbor points i++ Figure 3.10 The flowchart of “DrawFlat()” The function “DrawConcentrationFlat()” defined in “OpenGL3D.cpp” draw the mean wind speed concentration graphs The function structures are similar to the function of “DrawFlat()” The function of “DrawLegend()” defined in “OpenGL.cpp” draws the legends for the graphs The flowchart is as the following Start Save the current drawing settings Set new settings Draw the legend square Show the legend values by "Legend(rt)" function Restore the saved drawing settings End Figure 3.11 The flowchart of “DrawLegend()” In the above flowchart, the function “Legend(rt)” defined in “OpenGL3D.cpp” draws the values of the legend The following shows the flowchart for this function Start Initialize the minimum legend value i=0 N i

Ngày đăng: 18/10/2022, 16:30

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w