PROGRAM FOR THE CALCULATION OF COMPLEX EDGE EFFECT FIELDS IN ECOLOGICAL PATCHES


Developed by C. Fernández1, F.J. Acosta1, G. Abellá1, F. López1 and M. Díaz2 (1999)

1Departamento de Ecología, Facultad de Biología, Universidad Complutense de Madrid, 28040 Madrid, Spain. E-mail (F.J. Acosta): bieco04@emducms1.sis.ucm.es

2Departamento de Ciencias Medioambientales, Facultad de Ciencias del Medio Ambiente, Universidad de Castilla-La Mancha, 45071 Toledo, Spain.



This program accompanies —as an appendix- the theoretical contents of the parallel paper "Complex edge effect fields as additive processes in patches of ecological systems" (by the same authors), published in Ecological Modelling.

All equations are labelled with an A ("appendix"), to diferentiate them from the equations in the paper.


Calculation of the edge effect field generated by a patch border

The edge effect field generated by a patch border in the area under its influence can be expressed as the result of the sum of point edge effects -e- exerted through every infinitesimal segment of the border -dl. The effect of every dl on any given point P in the area under influence is a function of the distance -d- between both of them:

e (dl, P) = f (ddl, P) (A1)

When this influence is referred to a segment -s- of the border length -L- comprised between two points (s0, s1), it is useful to establish a definition of such segment that suitably allow to tackle with the punctual character of equation (A1). Any segment of the border can thus be parametrically defined as:

r(s) = xL(s) i + yL(s) j   s0 £ s £ s1    (A2)

For each value of the parameter s, the end of vector r(s) is placed in a point of the border { xL(s), yL(s)} or, in other words, each point of the border is thus defined by a value of s. It is evident that equation (A2) is also a valid expression for the complete border as a whole (being only necessary to change the parameter s in the corresponding range of the border).

The distance -d- between any given point -P (x, y)- of the area under influence and the infinitesimal segment of the border -dl- defined by the parameter s, will be given by the expression:

d(x,y,s)=     (A3)

The total edge effect of a border segment on any given point in the area under influence will be the sum of point edge effects along the border:

E(x,y) = L e(x,y,s) dl   (A4)

where dl is given by:

   dl =   =    (A5)

Equation (A4) can thus be expressed as:

   E(x,y) = e(x,y,s)    (A6)

Using MATHEMATICA software (version 3.0) for the implementation (http:/www.wolfram.co.uk), we show below a procedure that allows to find numerical solutions for equation (A6) in every point (x, y), regardless of the complexity of border geometry or the point edge effect function.

This procedure is broken down in several programs that can be directly used by simply typing (or cutting and pasting) them in MATHEMATICA software, not being necessary to have a previous knowledge on this software system. In addition to the computation and execution lines, every program features some "comment" lines, i.e., explanative text (which is not computed or executed), enclosed within parentehesis with asterisks (MATHEMATICA code for this type of text). Additional information that has to be completed (parameter values) is indicated with question marks, which should be all solved before running the program.

The functioning of the program is exemplified here with a linear function of decreasing point edge effect (f(d)=Max[e0(1-d/Dmax),0]). The program can be run with any other functions by simply changing the equation in the proper place (indicated in the program). The other two point edge effect functions implemented in the paper have been:

f(d) = Max [e0 (e-bd/ Dmax),0]

f(d) = Max [e0 (1 — e b(d-Dmax)/Dmax),0]

Program for the calculation of the edge effect field generated by a patch border: general case

(* Equation (A2) has to be made explicit -indicating its parameter values- and its bounds to be set with regard to parameter s, being s0£s£s1: *)

xL = fx [s, px1, px2, ... , pxn];

yL = fy [s, py1, py2, ... , pyn];

s0 = ?

s1 = ?

(* The equations that define the patch border (xL and yL) may be dependent upon several parameters, other than s. In this case, these parameter values have to be indicated: *)

px1= ?

...

pxn= ?

py1= ?

...

pyn= ?

(* To obtain a plot of the patch border: *)

gBorder = ParametricPlot[{xL, yL}, {s, s0, s1}, PlotStyle->Thickness[.009]]

(* Calculation of dl -equation (A5): *)

BorderDerivative = Sqrt[(D[xL, s])^2 + (D[yL, s])^2];

(* The distance between a point in the patch border (xL, yL) and a point in the area under its influence (x, y) -equation (A3)- is given by: *)

distance[x_, y_]:= Sqrt[(xL - x)^2 + (yL - y)^2];

(* Assuming a linear decrease with distance, the equation that lends the edge effect on that point (x, y) -equation (A1)- will be:*)

PointEdgeEffect[d_]:= f[d, parameter1, ... , parametern]

(* Definition of parameters involved in the point edge effect model: *)

parameter1 =?

...

parametern =?

(* Total edge effect in a point (x, y) -equation (A6): *)

TotalEdgeEffect[x_,y_]:= NIntegrate[PointEdgeEffect[distance[x,y]]BorderDerivative, {s, s0, s1}];

(* Continuous function -obtained by means of interpolation- of the value of the edge effect field at any point in a region of the space bounded as: x0£ x £ x1; y0£ y£ y1: *)

x0 = ?

x1 = ?

y0 = ?

y1 = ?

Field=FunctionInterpolation[TotalEdgeEffect[x,y],{x,x0,x1 },{y,y0,y1}];

(* Plot of the continuous function of the edge effect field: *)

gField=ContourPlot[Field[x,y],{x,x0,x1},{y,y0,y1}, PlotPoints>60,DisplayFunction->Identity];

Show[gField, gBorder,DisplayFunction->$DisplayFunction]

(* To run the program, press SHIFT + ¬ *)


Program for the calculation of the edge effect field generated by a patch border: circular patch border and linear point edge effect

(* The relative size of the patch (as expressed by its radius, r) in relation to the maximum distance of penetration of the edge effect inside the patch (Dmax) is implemented below according to one of the examples shown in figure 2 (Dmax = 0.8 r). Any other situation can be easily simulated by simply modifying the values of the radius or the maximum distance. *)

(* Parameterization of the patch border. Every point of the border is defined by a value of parameter s, being 0£s£2p (equation (A2)). "C" indicates "circular": *)

xC = r Cos[s];

yC = r Sin[s];

s0 = 0;

s1 = 2p;

(* Radius of the circular patch: *)

r = 10;

(* Plot of the patch border: *)

gCircularBorder =ParametricPlot[{xC, yC}, {s, 0, 2Í}, PlotStyle->Thickness[.01], AspectRatio->Automatic, DisplayFunction->Identity];

(* Calculation of dl -equation (A5): *)

CBorderDerivative = Sqrt[(D[xC, s])^2+(D[yC, s])^2];

(* The distance between a point in the patch border (xC, yC) and a point in the area under its influence (x, y) -equation (A3)- is given by: *)

distance[x_, y_]:= Sqrt[(xC - x)^2 + (yC - y)^2];

(* Assuming a linear decrease with distance, the equation that lends the edge effect on every point (x, y) caused by a point s of the patch border -equation (A1)- will be: *)

PointEdgeEffect[distance_]:= Max[e0*(1-distance/Dmax),0];

(* Maximum value of the point edge effect: *)

e0 = 100;

(* Maximum distance of penetration of the point edge effect: *)

Dmax = 8;

(* The effect field generated when the point edge effect is not linear can be easily calculated equating "PointEdgeEffect[distance_]" to the expression that defines the new point edge effect. *)

(* Total edge effect in any point (x, y) -equation (A6): *)

TotalEffect[x_,y_]:=NIntegrate[PointEdgeEffect[distance[x,y]]*

CBorderDerivative, {s, s0, s1}];

(* Calculation of the edge effect field in the region bounded by -r£ x£ r and -r£ y£ r: *)

x0 = -r;

x1 = r;

y0 = -r;

y1 = r;

CircularPatchField= FunctionInterpolation[TotalEffect[x,y],{x,x0,x1},{y,y0, y1}];

(* Plot of the edge effect field: *)

gCircularPatchField = ContourPlot[CircularPatchField[x,y],{x,x0,x1},{y,y0,y1}, PlotPoints->60, DisplayFunction->Identity, Frame->False];

(* Plot of the edge effect field generated by a circular patch border: *)

Show[gCircularPatchField, gCircularBorder,DisplayFunction->$DisplayFunction];

(* To run the program, press SHIFT + ¬ *)


Program for the calculation of the edge effect field generated by a patch border: square patch border and linear point edge effect

(* When the patch is a square, the total effect field is calculated by applying the model to every side of it. The same procedure can be applied for any patch whose border is polygonal. *)

(* Every side of the border is defined by means of a parameter s, being s0£ s £s1. "Q" indicates "square": *)

xQ [1] = s; (* 0£ s £ side *)

yQ [1] = side;

xQ [2] = side;

yQ [2] = s; (* 0£ s £ side *)

xQ [3] = s; (* 0£ s £ side *)

yQ [3] = 0;

xQ [4] = 0;

yQ [4] = s; (* 0£ s £ side *)

(* In order to compare the results of simulations independently of any effects caused by differences in patch area, all examples shown in figure 2 have been done with patches of equal area. Since the radius of circular patches is 10, every side of the square patches will therefore be equal to: *)

side = 10p;

numberOfSegments = 4;

s0 = 0;

s1 = side;

(* Plot of the patch border: *)

gSquareBorder = Show[Table [ParametricPlot[{xQ[i],yQ[i]},{s,s0,s1 },DisplayFunction-> Identity, PlotStyle-> Thickness[0.009]], {i,1,numberOfSegments}], Axes-> True, AspectRatio -> Automatic, DisplayFunction -> Identity];

(* Calculation of dl -equation (A5)- for any side of the border: *)

QBorderDerivative=Table[Sqrt[(D[xQ[i],s])^2+(D[yQ[i ],s])^2],{i,1,4}];

(* Calculation of the distance between any point of the area under influence (x, y) and any point of the border (xQ, yQ) -equation (A3): *)

distance[i_, x_, y_]:= Sqrt[(xQ[i] - x)^2 + (yQ[i] - y)^2];

(* Assuming a linear decrease with distance, the equation that lends the edge effect on every point (x, y) caused by a point s of the patch border -equation (A1)- will be: *)

PointEdgeEffect[distance_]:= Max[e0*(1-distance/Dmax),0]

(* Maximum value of the point edge effect: *)

e0 = 100;

(* Maximum distance of penetration of the point edge effect: *)

Dmax = 8;

(* The effect field generated when the point edge effect is not linear can be easily calculated equating "PointEdgeEffect[distance_]" to the expression that defines the new point edge effect. *)

(* Total edge effect in any point (x, y) -equation (A6)- is equal to the sum of effects caused by the four sides of the square border. The effect of every side is calculated integrating the point edge effect along its length -equation (A6): *)

TotalEffect[x_,y_]:= Apply[Plus,Table[NIntegrate[PointEdgeEffect[distance[i,x,y]]*

QBorderDerivative[[i]], {s,s0,s1}], {i, 1,numberOfSegments}]];

(* Calculation of the effect field: *)

x0 = s0;

x1 = s1;

y0 = s0;

y1 = s1;

SquarePatchField =

FunctionInterpolation[TotalEffect[x,y],{x,x0,x1},{y ,y0,y1}];

(* Plot of the edge effect field: *)

gSquarePatchField = ContourPlot[SquarePatchField[x,y],{x,x0,x1},{y,y0 ,y1}, PlotPoints->60, DisplayFunction->Identity, AspectRatio->1];

(* Plot of the edge effect field generated by a square patch border: *)

Show[gSquarePatchField, gSquareBorder, DisplayFunction->$DisplayFunction, Frame->False];

(* To run the program, press SHIFT + ¬ *)


Program for the calculation of the edge effect field generated by a patch border: circular heterogeneous border

(* An heterogeneous border can be created by defining border segments that exert a different effect on their respective area of influence. The program below has been developed as an example in which the border of a circular patch is splitted up in three segments of equal length, each one of them having either a different effect function or different parameter values of the same function (see figure 4).

As in the case of the homogeneous circular patch border, every point of the border is defined by means of a value of parameter s, being 0 £ s £ 2p (equation (A2)). If the border is heterogeneous, however, it is also necessary to specify the location of every point in each segment {xH[i],yH[i]} (where "H" indicates "heterogeneous"), since this will determine its influence: *)

Clear[s0,s1,e0,Dmax,PointEdgeEffect]

xH[1] = rH Cos[s]; (* s0[1] £ s < s1[1] *)

yH[1] = rH Sin[s]; (* s0[1] £ s < s1[1] *)

s0[1] = 0;

s1[1] = 2p /3;

xH[2] = rH Cos[s]; (* s0[2] £ s < s1[2] *)

yH[2] = rH Sin[s]; (* s0[2] £ s < s1[2] *)

s0[2] = 2p/3;

s1[2] = 4p/3;

xH[3] = rH Cos[s]; (* s0[3] £ s < s1[3] *)

yH[3] = rH Sin[s]; (* s0[3] £ s < s1[3] *)

s0[3] = 4p/3;

s1[3] = 2p;

(* Radius of the circular heterogeneous patch: *)

rH = 10;

(* Plot of the patch border: *)

gHeterogeneousBorder = Show[Table[ParametricPlot[{xH[i],yH[i]},{s,s0[i],s 1[i]},DisplayFunction->Identity, PlotStyle ->Thickness[0.009]],{i,1,3}], Axes -> True, AspectRatio -> Automatic, DisplayFunction -> Identity];

(* Calculation of dl -equation (A5): *)

HBorderDerivative=Table[Sqrt[(D[xH[i],s])^2+(D[yH[i ],s])^2],{i,1,3}];

(* The distance between a point in the patch border (xH, yH) and a point in the area under its influence (x, y) -equation (A3)- is given by: *)

distance[i_, x_, y_]:= Sqrt[(xH[i] - x)^2 + (yH[i] - y)^2];

(* In an heterogeneous patch border, the equation that lends the edge effect on every point (x, y) caused by a point s of the patch border (equation (A1)) is different in every segment of the border. The program below is an example in which the point edge effect function is linear in all segments, but has different values for the parameter maximum distance of penetration (Dmax) (Fig. 4, middle). It is possible to simulate other situations by simply modifying the definition of the point edge effect for every segment: *)

PointEdgeEffect[1][distance_]:= Max[e0[1] (1-distance/ Dmax[1]), 0];

PointEdgeEffect[2][distance_]:= Max[e0[2] (1-distance/ Dmax[2]), 0];

PointEdgeEffect[3][distance_]:= Max[e0[3] (1-distance/ Dmax[3]), 0];

(* Maximum value of the point edge effect: *)

e0[1] = 100;

e0[2] = 100;

e0[3] = 100;

(* Maximum distance of penetration of the point edge effect: *)

Dmax[1] = 2;

Dmax[2] = 8;

Dmax[3] = 12;

(* Total edge effect in any point (x, y) -equation (A6): *)

TotalEffect[x_,y_]:= Apply[Plus,Table[NIntegrate[PointEdgeEffect[i][distance[i,x,y]]*

HBorderDerivative[[i]],{s,s0[i],s1[i]}],{i,1,3}]];

(* Calculation of the edge effect field in the region bounded by -rH £ x £ rH and -rH £ y £ rH: *)

x0 = -rH;

x1 = rH;

y0 = -rH;

y1 = rH;

HBorderField=FunctionInterpolation[TotalEffect[x,y],{x,x0,x1},{y,y0,y1}];

(* Plot of the edge effect field: *)

gHBorderField = ContourPlot[HBorderField[x,y],{x,x0,x1},{y,y0,y1},PlotPoints->60,

DisplayFunction->Identity,AspectRatio->1];

(* Plot of the edge effect field generated by a circular heterogeneous patch border: *)

Show[gHBorderField,gHeterogeneousBorder, DisplayFunction->$DisplayFunction, Frame->False];

(* To run the program, press SHIFT + ¬ *)




Nuestra línea de investigación        Depto. de Ecología         Volver arriba