[cig-commits] r12445 - in cs/portal/trunk/northridge: . SeismoWebPortal SeismoWebPortal/templates/SeismoWebPortal

leif at geodynamics.org leif at geodynamics.org
Fri Jul 18 12:57:57 PDT 2008


Author: leif
Date: 2008-07-18 12:57:55 -0700 (Fri, 18 Jul 2008)
New Revision: 12445

Modified:
   cs/portal/trunk/northridge/SeismoWebPortal/forms.py
   cs/portal/trunk/northridge/SeismoWebPortal/management.py
   cs/portal/trunk/northridge/SeismoWebPortal/models.py
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_3chunks.html
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_base.html
   cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html
   cs/portal/trunk/northridge/setup.py
Log:
Nex must be a multiple of 16, in addition to being 8 times a multiple
of Nproc.


Modified: cs/portal/trunk/northridge/SeismoWebPortal/forms.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/forms.py	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/SeismoWebPortal/forms.py	2008-07-18 19:57:55 UTC (rev 12445)
@@ -37,7 +37,8 @@
         
         self.fields.extend([
             forms.SelectField(field_name='nproc', choices=nproc_choices, is_required=True),
-            forms.SelectField(field_name='nex_c', choices=NEX_C_CHOICES, is_required=True),
+            forms.SelectField(field_name='nex_c', choices=NEX_C_CHOICES, is_required=True,
+                              validator_list=[models.nexValidator('nproc')]),
             ])
 
     def save(self, new_data):

Modified: cs/portal/trunk/northridge/SeismoWebPortal/management.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/management.py	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/SeismoWebPortal/management.py	2008-07-18 19:57:55 UTC (rev 12445)
@@ -15,7 +15,10 @@
     # about).
     for nproc in xrange(1, 10):
         for nex_c in xrange(1, 10):
+            # NEX_xxx must be multiple of 16 and 8 * multiple of NPROC
             nex = 8 * nex_c * nproc
+            if nex % 16 != 0:
+                continue
             l = m.setdefault(nex, [])
             l.append((nex_c, nproc))
 

Modified: cs/portal/trunk/northridge/SeismoWebPortal/models.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/models.py	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/SeismoWebPortal/models.py	2008-07-18 19:57:55 UTC (rev 12445)
@@ -368,6 +368,21 @@
 NEX_C_CHOICES = oneThruNine
 
 
+def nexValidator(nprocKey):
+    # NYI: redesign mesh forms.
+    def isValidNexC(new_data, all_data):
+        try:
+            nproc = int(all_data[nprocKey])
+            nex_c = int(new_data)
+        except ValueError:
+            nproc = 1
+            nex_c = 1
+        if (8 * nex_c * nproc % 16 != 0):
+            raise validators.ValidationError, "This product must be a multiple of 16."
+        return
+    return isValidNexC
+
+
 class Specfem3DGlobeMesh(Model, EditableObject):
 
     name = models.CharField(maxlength=100)
@@ -375,8 +390,10 @@
     nchunks = models.IntegerField(core=True, choices=NCHUNKS_CHOICES, default=1)
     nproc_xi = models.IntegerField(core=True, choices=NPROC_CHOICES, default=5)
     nproc_eta = models.IntegerField(core=True, choices=NPROC_CHOICES, default=5)
-    nex_xi_c = models.IntegerField(core=True, choices=NEX_C_CHOICES, default=2)
-    nex_eta_c = models.IntegerField(core=True, choices=NEX_C_CHOICES, default=2)
+    nex_xi_c = models.IntegerField(core=True, choices=NEX_C_CHOICES, default=2,
+                                   validator_list=[nexValidator('nproc_xi')])
+    nex_eta_c = models.IntegerField(core=True, choices=NEX_C_CHOICES, default=2,
+                                    validator_list=[nexValidator('nproc_eta')])
     def nex_xi(self): return 8 * self.nex_xi_c * self.nproc_xi
     def nex_eta(self): return 8 * self.nex_eta_c * self.nproc_eta
 

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_3chunks.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_3chunks.html	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_3chunks.html	2008-07-18 19:57:55 UTC (rev 12445)
@@ -39,13 +39,13 @@
     <p>Number of spectral elements per chunk at earth's surface:
     <p>Nex = 8 &times; {{ form.nex_c }} &times; Nproc
     <span class="scripted">= <input name="nex" class="computed" readonly value="?" size="3"></span>
-    {% if form.nex.errors %}<span class=error>{{ form.nex.errors|join:", " }}</span>{% endif %}
+    {% if form.nex_c.errors %}<span class=error>{{ form.nex_c.errors|join:", " }}</span>{% endif %}
 
     <dl class="help collapsible collapsedOnLoad">
     <dt class="collapsibleHeader"><img src="{{root}}/images/help-large.gif"> Help</dt>
     <dd class="collapsibleContent">
     <dl>
-        <dt>Nex</dt><dd><p>The number of spectral elements along each side of the chunks. This number must be 8 &times; a multiple of Nproc defined above. We do not recommend using Nex less than 64 because the curvature of the Earth cannot be honored if one uses too few elements, which results in inaccurate and unstable  simulations.</p></dd>
+        <dt>Nex</dt><dd><p>The number of spectral elements along each side of the chunks. This number must be a multiple of 16 and 8 &times; a multiple of Nproc defined above. We do not recommend using Nex less than 64 because the curvature of the Earth cannot be honored if one uses too few elements, which results in inaccurate and unstable  simulations.</p></dd>
     </dl>
     </dd>
     </dl>

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_base.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_base.html	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/mesh_form_base.html	2008-07-18 19:57:55 UTC (rev 12445)
@@ -100,18 +100,18 @@
 
     <p>Nex <span class=greek>&xi;</span> = 8 &times; {{ form.nex_xi_c }} &times; Nproc <span class=greek>&xi;</span>
     <span class="scripted">= <input name="nex_xi" class="computed" readonly value="?" size="3"></span>
-    {% if form.nex_xi.errors %}<span class=error>{{ form.nex_xi.errors|join:", " }}</span>{% endif %}
+    {% if form.nex_xi_c.errors %}<span class=error>{{ form.nex_xi_c.errors|join:", " }}</span>{% endif %}
     <p>Nex <span class=greek>&eta;</span> = 8 &times; {{ form.nex_eta_c }} &times; Nproc <span class=greek>&eta;</span>
     <span class="scripted">= <input name="nex_eta" class="computed" readonly value="?" size="3"></span>
-    {% if form.nex_eta.errors %}<span class=error>{{ form.nex_eta.errors|join:", " }}</span>{% endif %}
+    {% if form.nex_eta_c.errors %}<span class=error>{{ form.nex_eta_c.errors|join:", " }}</span>{% endif %}
 
     <dl class="help collapsible collapsedOnLoad">
     <dt class="collapsibleHeader"><img src="{{root}}/images/help-large.gif"> Help</dt>
     <dd class="collapsibleContent">
     <dl>
-        <dt>Nex <span class=greek>&xi;</span></dt><dd><p>The number of spectral elements along the <span class=greek>&xi;</span> side of the chunk. This number must be 8 &times; a multiple of Nproc <span class=greek>&xi;</span> defined above. For a 90&deg; chunk, we do not recommend using Nex <span class=greek>&xi;</span> less than 64 because the curvature of the Earth cannot be honored if one uses too few elements, which results in inaccurate and unstable  simulations.</p></dd>
+        <dt>Nex <span class=greek>&xi;</span></dt><dd><p>The number of spectral elements along the <span class=greek>&xi;</span> side of the chunk. This number must be a multiple of 16 and 8 &times; a multiple of Nproc <span class=greek>&xi;</span> defined above. For a 90&deg; chunk, we do not recommend using Nex <span class=greek>&xi;</span> less than 64 because the curvature of the Earth cannot be honored if one uses too few elements, which results in inaccurate and unstable  simulations.</p></dd>
 
-        <dt>Nex <span class=greek>&eta;</span></dt><dd><p>The number of spectral elements along the <span class=greek>&eta;</span> side of the chunk. This number must be 8 &times; a multiple of Nproc <span class=greek>&eta;</span> defined above. Note that in order to get elements that are close to square on the Earth's surface, the following ratios should be similar:</p><blockquote> <div class=formula>angular width <span class=greek>&xi;</span> / Nex <span class=greek>&xi;</span></div> <div class=formula>angular width <span class=greek>&eta;</span> / Nproc <span class=greek>&eta;</span></div> </blockquote><p>Because of the geometry of the cubed sphere, the option of having different values for Nex <span class=greek>&xi;</span> and Nex <span class=greek>&eta;</span> is available only for regional simulations when nchunks = 1 (1/6th of the sphere).</p></dd>
+        <dt>Nex <span class=greek>&eta;</span></dt><dd><p>The number of spectral elements along the <span class=greek>&eta;</span> side of the chunk. This number must be a multiple of 16 and 8 &times; a multiple of Nproc <span class=greek>&eta;</span> defined above. Note that in order to get elements that are close to square on the Earth's surface, the following ratios should be similar:</p><blockquote> <div class=formula>angular width <span class=greek>&xi;</span> / Nex <span class=greek>&xi;</span></div> <div class=formula>angular width <span class=greek>&eta;</span> / Nproc <span class=greek>&eta;</span></div> </blockquote><p>Because of the geometry of the cubed sphere, the option of having different values for Nex <span class=greek>&xi;</span> and Nex <span class=greek>&eta;</span> is available only for regional simulations when nchunks = 1 (1/6th of the sphere).</p></dd>
     </dl>
     </dd>
     </dl>

Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html	2008-07-18 19:57:55 UTC (rev 12445)
@@ -7,7 +7,7 @@
 
     <h1><img src="{{root}}/images/cig.gif"> <img src="{{root}}/images/seismogram.gif"><br>CIG Seismology Web Portal</h1>
 
-    <p>Version 3.1.0</p>
+    <p>Version 3.1.1</p>
 
     <hr>
 

Modified: cs/portal/trunk/northridge/setup.py
===================================================================
--- cs/portal/trunk/northridge/setup.py	2008-07-18 19:49:59 UTC (rev 12444)
+++ cs/portal/trunk/northridge/setup.py	2008-07-18 19:57:55 UTC (rev 12445)
@@ -3,7 +3,7 @@
 
 setup(
     name = 'SeismoWebPortal', 
-    version = '3.1.0',
+    version = '3.1.1',
     url = 'http://www.geodynamics.org/',
     author = 'Leif Strand',
     author_email = 'leif at geodynamics.org',



More information about the cig-commits mailing list