changeset 2577:4ee2a3a3105d

L1d3: Increase some workspace and provide a warning if even more is requested.
author Peter Jacobs <peterj@mech.uq.edu.au>
date Fri, 11 Jan 2019 06:50:49 +1000
parents 4a2134f6283c
children 4b054874569c
files app/L1d3/source/l1d.cxx
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/app/L1d3/source/l1d.cxx	Sun Dec 02 14:33:52 2018 +1000
+++ b/app/L1d3/source/l1d.cxx	Fri Jan 11 06:50:49 2019 +1000
@@ -264,7 +264,8 @@
     int nmodes = gmodel->get_number_of_modes();
 
     if ( prepare_only ) {
-        double x[11000]; 
+        # define NNXDIM 60000
+        double x[NNXDIM]; 
         // Not that we have made a guess for the required size; 
         // we should use a std::vector but x is used in the call 
         // to distribute_points().
@@ -272,14 +273,19 @@
         printf("Prepare initial solution files only.\n");
         printf("Set up gas slugs.\n");
         for (js = 0; js < SD.nslug; ++js) {
+            if (NNXDIM < A[js].nnx) {
+                printf("Dimension too small for workspace NNXDIM=%d, nnx=%d.",
+                       NNXDIM, A[js].nnx);
+                exit(1);
+            }
             /*
              * Distribute the gas cells along the gas slug.
              * Modified to suit sm_3d stretching functions.
              */
             if ( A[js].cluster_to_end_1 == 1 ) {
-                	beta1 = A[js].cluster_strength;
+                beta1 = A[js].cluster_strength;
             } else {
-                	beta1 = 0.0;
+                beta1 = 0.0;
             }
             if ( A[js].cluster_to_end_2 == 1 ) {
                 beta2 = A[js].cluster_strength;
@@ -610,7 +616,7 @@
                     int v_loc = (td->x_loc[i]-td->xb[0])/td->dx + 1;  
                     double a_new = a_max/(vd->open_period*vd->open_period)*dt*dt; 
                     double d_new = sqrt((4*a_new)/pi);
-                    double a_old = td->area[v_loc];
+                    // double a_old = td->area[v_loc]; // unused variable
                     double d_old = td->diam[v_loc];
                     td->area[v_loc] = a_new;
                     //printf("\n diam centre = %e \n", d_new);