// Last edited on 2018-10-27 18:07:43 by stolfilocal // The files "field_{NN}.inc" should define a macro // called "field" with parameters {(xp,yp,zp,tt,zrad)} // where {xp,yp,zp} are the space coordinates, // {tt} is time in the animation (if any). // On entry, {xp,yp,zp} should be scaled so that {xp,yp} range // from {-1} to {+1}, and the layers are spaced by {zrad} in the // Z direction. // The procedure {field} should return the activity (for ECR) or potential (for EEG) // in the neighborhood of the point {(xp,yp,zp)} of the plot cylinder. // Since movies start at {tt=0} and end at {tt=1}, // the fild should be periodic in {tt} with period 1. // It may be independent of {tt} (i.e. the flow may be steady-state). // The files "field_{NN}.inc" should also define the scalar // {field_max} with the estimated maximum magnitude of the field's value, // for arrow length scaling purposes. #macro field_eval_blobs(xp,yp,zp, NB, bctr,brad,bval, zrad) // Evaluates a field defined by {NB} blobs whose // parameters are in {bctr,brad,bval}. Namely {brad[i]} is the // center of the blob, {brad[i]} is the XY radius, and {bval[i]} // is the field value at the center. Every blob will have radius // {zrad} in the Z direction. #local fld = 0.0; #local i = 0; #while (i < NB) #local bc = bctr[i]; #local br = brad[i]; #local bv = bval[i]; #local dx = (xp - bc.x)/br; #local dy = (yp - bc.y)/br; #local dz = (zp - bc.z)/(1.5*zrad); #local d2 = dx*dx + dy*dy + dz*dz; #if (d2 < 1.0) #local bump = (1 - d2)*(1 - d2); #local fld = fld + bv*bump; #end #local i = i + 1; #end fld #end