Hi Michael,<br><br>I think that&#39;s fine. The header line is easy enough to remove if you need it. The more difficult part was dealing with the format of the points.<br><br>Thanks!<br>Doug<br><br><div class="gmail_quote">

On Thu, Jan 5, 2012 at 11:00 AM, Michael Duda <span dir="ltr">&lt;<a href="mailto:duda@ucar.edu">duda@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi, Folks.<br>
<br>
I&#39;d like to go ahead and make the changes in global_scvt to write out<br>
refinement points automatically in the locs.dat.out file, and to compute<br>
estimates for the required number of generating points.<br>
<br>
On the topic of file format, I think we could easily adopt the format<br>
mentioned below, but I think it would be best for now to keep the header<br>
line: since we might not always be reading the points into a dynamic<br>
data structure, having a header line lets us avoid reading through the<br>
file once to count the number of lines and again to read in the points;<br>
alternatively, programs reading the file won&#39;t need to access, e.g., a<br>
namelist to figure out how many points are in the file. It seems a lot<br>
easier to simply discard the header in programs that don&#39;t need it than<br>
to retrofit other programs to either read a namelist or make two passes<br>
through the file.<br>
<br>
So, I&#39;d like to commit the originally proposed changes, and then to<br>
modify the file format to<br>
<div class="im"><br>
 x1 y1 z1<br>
 x2 y2 z2<br>
 ...<br>
<br>
</div>keeping the header line, in a separate commit. Does this sound<br>
reasonable to everyone?<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888">Michael<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Thu, Dec 22, 2011 at 11:31:47AM -0700, Michael Duda wrote:<br>
&gt; Hi, Doug.<br>
&gt;<br>
&gt; Improving compatibility between our grid generation codes sounds like<br>
&gt; a good idea. Changing the format to just<br>
&gt;<br>
&gt; x1 y1 z1<br>
&gt; x2 y2 z2<br>
&gt; ...<br>
&gt;<br>
&gt; would be straightforward, though removing the header would appear to<br>
&gt; cause problems for the grid_ref program. With refinement points now<br>
&gt; being written to the locs.dat.out file, we may be able to dispense with<br>
&gt; the grid_ref program, though this would depend on whether anyone else<br>
&gt; relies on this program.<br>
&gt;<br>
&gt; Could anyone who is currently making use of grid_ref in a way that<br>
&gt; couldn&#39;t be substituted with the new refined locs.dat.out files comment<br>
&gt; on whether we might be able to eliminate this code? If not, would it<br>
&gt; work to have grid_ref read the namelist.input file to see how many lines<br>
&gt; it should read from the locs.dat.out file?<br>
&gt;<br>
&gt; Thanks!<br>
&gt; Michael<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Dec 21, 2011 at 06:47:38PM -0700, Doug Jacobsen wrote:<br>
&gt; &gt; Hey Michael,<br>
&gt; &gt;<br>
&gt; &gt; While you are making changes anyway.... would there be any way to change<br>
&gt; &gt; the format of the intput/output points? Mainly because it&#39;s difficult to<br>
&gt; &gt; take points from my format and make global_scvt read them in.<br>
&gt; &gt;<br>
&gt; &gt; Also, it seemed like the header information in the file was fairly useless<br>
&gt; &gt; in that global_scvt doesn&#39;t read it. The way I write my points out (as you<br>
&gt; &gt; have seen before) is a left justified set of cartesian coordinates with a<br>
&gt; &gt; space between them. Like this<br>
&gt; &gt;<br>
&gt; &gt; x1 y1 z1<br>
&gt; &gt; x2 y2 z2<br>
&gt; &gt; ...<br>
&gt; &gt; etc<br>
&gt; &gt;<br>
&gt; &gt; I just figured this would make it more general for other scvt generators,<br>
&gt; &gt; and allow points to be more easily migrated between scvt generators.<br>
&gt; &gt;<br>
&gt; &gt; I don&#39;t know if this is something you are interested in changing, but it<br>
&gt; &gt; shouldn&#39;t be too difficult.<br>
&gt; &gt;<br>
&gt; &gt; Doug<br>
&gt; &gt;<br>
&gt; &gt; On Wed, Dec 21, 2011 at 5:43 PM, Michael Duda &lt;<a href="mailto:duda@ucar.edu">duda@ucar.edu</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; &gt; Hi, All.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I&#39;d like to propose two small improvements to the global_scvt code.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The first change is to always write out the final generating points<br>
&gt; &gt; &gt; (i.e., what is currently written) plus a set of refinement points to the<br>
&gt; &gt; &gt; locs.dat.out files. Since the grid_gen program will only read as many<br>
&gt; &gt; &gt; points from the locs.dat file as are specified by the np variable in the<br>
&gt; &gt; &gt; namelist, this change should not disrupt current workflows, but should<br>
&gt; &gt; &gt; enable us to avoid a separate program for refining a grid: when iterations<br>
&gt; &gt; &gt; converge with the current number of generating points, we can copy<br>
&gt; &gt; &gt; locs.dat.out to locs.dat as usual, and simply set np to 4*np-6 in<br>
&gt; &gt; &gt; the namelist.input file.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The second change adds code to estimate the number of generating points<br>
&gt; &gt; &gt; required to reach a target fine-grid resolution based on the density<br>
&gt; &gt; &gt; function encoded in src/module_scvt.F. The only change from the user&#39;s<br>
&gt; &gt; &gt; perspective is the addition of a new variable, min_dx, in the namelist<br>
&gt; &gt; &gt; that specifies the desired minimum resolution; the code will<br>
&gt; &gt; &gt; automatically compute an estimate for the cell count using the following<br>
&gt; &gt; &gt; method:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;   area_per_sample = 4.0 * pi * 6370000**2.0 / n_samples<br>
&gt; &gt; &gt;   nhexs = 0.0<br>
&gt; &gt; &gt;   do i=1,n_samples<br>
&gt; &gt; &gt;      call random_point(p)<br>
&gt; &gt; &gt;      d = density_for_point(p)<br>
&gt; &gt; &gt;      dl = min_dx / (d ** 0.25)<br>
&gt; &gt; &gt;      hex_area = sqrt(3.0) / 2.0 * dl**2.0<br>
&gt; &gt; &gt;      nhexs = nhexs + area_per_sample / hex_area<br>
&gt; &gt; &gt;   end do<br>
&gt; &gt; &gt;   write(0,*) &#39;Estimated # hexs:&#39;, nint(nhexs)<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The routine random_point returns uniformly-distributed points on the<br>
&gt; &gt; &gt; sphere. Although the method assumes planar hexagons (rather than<br>
&gt; &gt; &gt; spherical hexagons), the discrepancy becomes smaller as the number of<br>
&gt; &gt; &gt; hexagons increases.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I&#39;ve placed a checked-out version of the code (on which you can run<br>
&gt; &gt; &gt; &#39;svn status&#39; and &#39;svn diff&#39;) at<br>
&gt; &gt; &gt; <a href="http://www.mmm.ucar.edu/people/duda/files/global_scvt_co.tar.gz" target="_blank">http://www.mmm.ucar.edu/people/duda/files/global_scvt_co.tar.gz</a>.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Any comments or suggestions would be appreciated; if there are no<br>
&gt; &gt; &gt; objections, I&#39;d like to commit the changes to the repository trunk.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Thanks,<br>
&gt; &gt; &gt; Michael<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; mpas-developers mailing list<br>
&gt; &gt; &gt; <a href="mailto:mpas-developers@mailman.ucar.edu">mpas-developers@mailman.ucar.edu</a><br>
&gt; &gt; &gt; <a href="http://mailman.ucar.edu/mailman/listinfo/mpas-developers" target="_blank">http://mailman.ucar.edu/mailman/listinfo/mpas-developers</a><br>
&gt; &gt; &gt;<br>
_______________________________________________<br>
mpas-developers mailing list<br>
<a href="mailto:mpas-developers@mailman.ucar.edu">mpas-developers@mailman.ucar.edu</a><br>
<a href="http://mailman.ucar.edu/mailman/listinfo/mpas-developers" target="_blank">http://mailman.ucar.edu/mailman/listinfo/mpas-developers</a><br>
</div></div></blockquote></div><br>