Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /tests/examples/sphere/sphere.diderot
ViewVC logotype

Diff of /tests/examples/sphere/sphere.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4713, Tue Oct 11 17:29:21 2016 UTC revision 4714, Tue Oct 11 17:33:13 2016 UTC
# Line 20  Line 20 
20  input int pcp ("periodicity of population control (if greater than zero)") = 2;  input int pcp ("periodicity of population control (if greater than zero)") = 2;
21  input real hhInit ("initial step size for potential energy gradient descent") = 1;  input real hhInit ("initial step size for potential energy gradient descent") = 1;
22    
23  real newDist = 0.5*rad; // how far away to birth new particles  real newDist = 0.75*rad; // how far away to birth new particles
24  real stepMax = rad;     // limit on distance to travel per iter  real stepMax = rad;     // limit on distance to travel per iter
25  int iter = 0;           // which iteration we're on  int iter = 0;           // which iteration we're on
26    
27  // Univariate energy functions; see ../circle/circle.diderot for alternatives  // Univariate energy functions; see ../circle/circle.diderot for alternatives
28  function real  phi(real r) = (1 - r)^4;  function real  phi(real r) = (1 - r)^4;
29  function real phi'(real r) = -4*(1 - r)^3;  function real phi'(real r) = -4*(1 - r)^3;
30    
31  // Energy and force from particle (with radius rad) at vec3 x  // Energy and force from particle (with radius rad) at vec3 x
32  function real enr(vec3 x) = phi(|x|/rad);  function real enr(vec3 x) = phi(|x|/rad);
33  function vec3 frc(vec3 x) = phi'(|x|/rad) * (1/rad) * x/|x|; // chain rule  function vec3 frc(vec3 x) = phi'(|x|/rad) * (1/rad) * x/|x|; // chain rule
# Line 166  Line 167 
167     real meanncount = mean { real(P.ncount) | P in particle.all};     real meanncount = mean { real(P.ncount) | P in particle.all};
168     real maxundone = max { P.undone | P in particle.all};     real maxundone = max { P.undone | P in particle.all};
169     print("(iter ", iter, ") COV(cl)=", covcl,     print("(iter ", iter, ") COV(cl)=", covcl,
170           "; mean(ncount)=", meanncount, "; max(undone)=", maxundone, "\n");           "; mean(cl)=", meancl,
171             "; mean(ncount)=", meanncount,
172             "; max(undone)=", maxundone, "\n");
173    
174     if (covcl < eps           // seem to be geometrically uniform     if (covcl < eps           // seem to be geometrically uniform
175         && maxundone < 0.5) { // and no particle recently set undone=1         && maxundone < 0.5) { // and no particle recently set undone=1

Legend:
Removed from v.4713  
changed lines
  Added in v.4714

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0