Changeset 21510


Ignore:
Timestamp:
02/02/17 15:33:44 (8 years ago)
Author:
schlegel
Message:

NEW: remove solver residual hard code from solutionsequence_linear

Location:
issm/trunk-jpl/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r21261 r21510  
    6060        parameters->AddObject(iomodel->CopyConstantObject("md.settings.results_on_nodes",SettingsResultsOnNodesEnum));
    6161        parameters->AddObject(iomodel->CopyConstantObject("md.settings.io_gather",SettingsIoGatherEnum));
     62        parameters->AddObject(iomodel->CopyConstantObject("md.settings.solver_residue_threshold",SettingsSolverResidueThresholdEnum));
    6263        parameters->AddObject(iomodel->CopyConstantObject("md.autodiff.isautodiff",AutodiffIsautodiffEnum));
    6364        parameters->AddObject(iomodel->CopyConstantObject("md.qmu.isdakota",QmuIsdakotaEnum));
  • issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h

    r21469 r21510  
    309309        SettingsRecordingFrequencyEnum,
    310310        SettingsWaitonlockEnum,
     311        SettingsSolverResidueThresholdEnum,
    311312        DebugProfilingEnum,
    312313        ProfilingCurrentMemEnum,
  • issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp

    r21469 r21510  
    315315                case SettingsRecordingFrequencyEnum : return "SettingsRecordingFrequency";
    316316                case SettingsWaitonlockEnum : return "SettingsWaitonlock";
     317                case SettingsSolverResidueThresholdEnum : return "SettingsSolverResidueThreshold";
    317318                case DebugProfilingEnum : return "DebugProfiling";
    318319                case ProfilingCurrentMemEnum : return "ProfilingCurrentMem";
  • issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

    r21469 r21510  
    321321              else if (strcmp(name,"SettingsRecordingFrequency")==0) return SettingsRecordingFrequencyEnum;
    322322              else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
     323              else if (strcmp(name,"SettingsSolverResidueThreshold")==0) return SettingsSolverResidueThresholdEnum;
    323324              else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
    324325              else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
     
    382383              else if (strcmp(name,"SmbWini")==0) return SmbWiniEnum;
    383384              else if (strcmp(name,"SmbAini")==0) return SmbAiniEnum;
    384               else if (strcmp(name,"SmbTini")==0) return SmbTiniEnum;
    385385         else stage=4;
    386386   }
    387387   if(stage==4){
    388               if (strcmp(name,"SmbSizeini")==0) return SmbSizeiniEnum;
     388              if (strcmp(name,"SmbTini")==0) return SmbTiniEnum;
     389              else if (strcmp(name,"SmbSizeini")==0) return SmbSizeiniEnum;
    389390              else if (strcmp(name,"SMBforcing")==0) return SMBforcingEnum;
    390391              else if (strcmp(name,"SmbMassBalance")==0) return SmbMassBalanceEnum;
     
    505506              else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
    506507              else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
    507               else if (strcmp(name,"TemperaturePDD")==0) return TemperaturePDDEnum;
    508508         else stage=5;
    509509   }
    510510   if(stage==5){
    511               if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
     511              if (strcmp(name,"TemperaturePDD")==0) return TemperaturePDDEnum;
     512              else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
    512513              else if (strcmp(name,"SurfaceAbsMisfit")==0) return SurfaceAbsMisfitEnum;
    513514              else if (strcmp(name,"Vel")==0) return VelEnum;
     
    628629              else if (strcmp(name,"Outputdefinition39")==0) return Outputdefinition39Enum;
    629630              else if (strcmp(name,"Outputdefinition40")==0) return Outputdefinition40Enum;
    630               else if (strcmp(name,"Outputdefinition41")==0) return Outputdefinition41Enum;
    631631         else stage=6;
    632632   }
    633633   if(stage==6){
    634               if (strcmp(name,"Outputdefinition42")==0) return Outputdefinition42Enum;
     634              if (strcmp(name,"Outputdefinition41")==0) return Outputdefinition41Enum;
     635              else if (strcmp(name,"Outputdefinition42")==0) return Outputdefinition42Enum;
    635636              else if (strcmp(name,"Outputdefinition43")==0) return Outputdefinition43Enum;
    636637              else if (strcmp(name,"Outputdefinition44")==0) return Outputdefinition44Enum;
     
    751752              else if (strcmp(name,"Mumps")==0) return MumpsEnum;
    752753              else if (strcmp(name,"Gsl")==0) return GslEnum;
    753               else if (strcmp(name,"Cuffey")==0) return CuffeyEnum;
    754754         else stage=7;
    755755   }
    756756   if(stage==7){
    757               if (strcmp(name,"BuddJacka")==0) return BuddJackaEnum;
     757              if (strcmp(name,"Cuffey")==0) return CuffeyEnum;
     758              else if (strcmp(name,"BuddJacka")==0) return BuddJackaEnum;
    758759              else if (strcmp(name,"CuffeyTemperate")==0) return CuffeyTemperateEnum;
    759760              else if (strcmp(name,"Paterson")==0) return PatersonEnum;
     
    874875              else if (strcmp(name,"BalancethicknessAnalysis")==0) return BalancethicknessAnalysisEnum;
    875876              else if (strcmp(name,"BalancethicknessSolution")==0) return BalancethicknessSolutionEnum;
    876               else if (strcmp(name,"Balancethickness2Analysis")==0) return Balancethickness2AnalysisEnum;
    877877         else stage=8;
    878878   }
    879879   if(stage==8){
    880               if (strcmp(name,"Balancethickness2Solution")==0) return Balancethickness2SolutionEnum;
     880              if (strcmp(name,"Balancethickness2Analysis")==0) return Balancethickness2AnalysisEnum;
     881              else if (strcmp(name,"Balancethickness2Solution")==0) return Balancethickness2SolutionEnum;
    881882              else if (strcmp(name,"BalancethicknessSoftAnalysis")==0) return BalancethicknessSoftAnalysisEnum;
    882883              else if (strcmp(name,"BalancethicknessSoftSolution")==0) return BalancethicknessSoftSolutionEnum;
     
    997998              else if (strcmp(name,"Contours")==0) return ContoursEnum;
    998999              else if (strcmp(name,"Parameters")==0) return ParametersEnum;
    999               else if (strcmp(name,"Vertices")==0) return VerticesEnum;
    10001000         else stage=9;
    10011001   }
    10021002   if(stage==9){
    1003               if (strcmp(name,"Results")==0) return ResultsEnum;
     1003              if (strcmp(name,"Vertices")==0) return VerticesEnum;
     1004              else if (strcmp(name,"Results")==0) return ResultsEnum;
    10041005              else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
    10051006         else stage=10;
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_linear.cpp

    r21294 r21510  
    1919        Vector<IssmDouble>*  ys  = NULL;
    2020        int  configuration_type;
     21        IssmDouble solver_residue_threshold;
    2122       
    2223        /*solver convergence test: */
     
    2728        Vector<IssmDouble>* KUF=NULL;
    2829
    29 
    30 
    3130        /*Recover parameters: */
    3231        femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
     32        femmodel->parameters->FindParam(&solver_residue_threshold,SettingsSolverResidueThresholdEnum);
    3333        femmodel->UpdateConstraintsx();
    3434        SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);
     
    4747        nF=pf->Norm(NORM_TWO);
    4848        solver_residue=nKUF/nF;
    49         if(solver_residue>1.e-6)_error_("   solver residue too high!: norm(KU-F)/norm(F)=" << solver_residue << "\n");
     49        if(isnan(solver_residue_threshold) == false && solver_residue>solver_residue_threshold)_error_("   solver residue too high!: norm(KU-F)/norm(F)=" << solver_residue << "\n");
    5050
    5151        //clean up
  • issm/trunk-jpl/src/m/classes/settings.js

    r20777 r21510  
    2727                //upload options:
    2828                upload_port         = 0;
     29               
     30                //throw an error if solver residue exceeds this value
     31                self.solver_residue_threshold=1e-6;
    2932
    3033        }// }}}
     
    4346                fielddisplay(this,'upload_port','port login (default is 0)');
    4447                fielddisplay(this,'upload_filename','unique id generated when uploading the file to server');
     48                fielddisplay(this,'solver_residue_threshold','throw an error if solver residue exceeds this value');
    4549
    4650
     
    5862                        checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0);
    5963                        checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
     64                        checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
    6065                } // }}}
    6166                this.marshall=function(md,prefix,fid) { //{{{
     
    6570                        WriteData(fid,prefix,'object',this,'fieldname','output_frequency','format','Integer');
    6671                        WriteData(fid,prefix,'object',this,'fieldname','recording_frequency','format','Integer');
     72                        WriteData(fid,prefix,'object',this,'fieldname','solver_residue_threshold','format','Double');
    6773                        if (this.waitonlock>0) WriteData(fid,prefix,'name','md.settings.waitonlock','data',true,'format','Boolean');
    6874                        else WriteData(fid,prefix,'name','md.settings.waitonlock','data',false,'format','Boolean');
     
    8389        this.upload_port         = 0;
    8490        this.upload_filename     = '';
     91        this.solver_residue_threshold = 0;
    8592        this.setdefaultparameters();
    8693        //}}}
  • issm/trunk-jpl/src/m/classes/settings.m

    r20690 r21510  
    1717                upload_port         = 0;
    1818                upload_filename     = '';
     19                solver_residue_threshold = 0;
    1920        end
    2021        methods
     
    4849
    4950                        %upload options:
    50                         upload_port         = 0;
     51                        self.upload_port         = 0;
     52
     53                        %throw an error if solver residue exceeds this value
     54                        self.solver_residue_threshold = 1e-6;
    5155
    5256                end % }}}
     
    5963                        md = checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0);
    6064                        md = checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
     65                        md = checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
    6166
    6267                end % }}}
     
    7580                        fielddisplay(self,'upload_port','port login (default is 0)');
    7681                        fielddisplay(self,'upload_filename','unique id generated when uploading the file to server');
     82                        fielddisplay(self,'solver_residue_threshold','throw an error if solver residue exceeds this value (NaN to deactivate)');
    7783
    7884                end % }}}
     
    8490                        WriteData(fid,prefix,'object',self,'fieldname','recording_frequency','format','Integer');
    8591                        WriteData(fid,prefix,'object',self,'fieldname','waitonlock','data',self.waitonlock>0,'format','Boolean');
     92                        WriteData(fid,prefix,'object',self,'fieldname','solver_residue_threshold','format','Double');
    8693                end % }}}
    8794                function savemodeljs(self,fid,modelname) % {{{
     
    98105                        writejsdouble(fid,[modelname '.settings.upload_port'],self.upload_port);
    99106                        writejsstring(fid,[modelname '.settings.upload_filename'],self.upload_filename);
    100 
     107                        writejsstring(fid,[modelname '.settings.solver_residue_threshold'],self.solver_residue_threshold);
    101108                end % }}}
    102109        end
  • issm/trunk-jpl/src/m/classes/settings.py

    r21254 r21510  
    1818                self.recording_frequency = 0
    1919                self.waitonlock          = 0
     20                self.solver_residue_threshold = 0
    2021
    2122                #set defaults
     
    3233                string="%s\n%s"%(string,fielddisplay(self,"recording_frequency","frequency at which the runs are being recorded, allowing for a restart"))
    3334                string="%s\n%s"%(string,fielddisplay(self,"waitonlock","maximum number of minutes to wait for batch results, or return 0"))
     35                string="%s\n%s"%(string,fielddisplay(self,"solver_residue_threshold","throw an error if solver residue exceeds this value (NaN to deactivate)"))
    3436                return string
    3537                #}}}
     
    5557                self.waitonlock=2**31-1
    5658
     59      #throw an error if solver residue exceeds this value
     60                self.solver_residue_threshold=1e-6;
     61
    5762                return self
    5863        #}}}
     
    6469                md = checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0)
    6570                md = checkfield(md,'fieldname','settings.waitonlock','numel',[1])
     71                md = checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0)
    6672
    6773                return md
     
    7379                WriteData(fid,prefix,'object',self,'fieldname','output_frequency','format','Integer')
    7480                WriteData(fid,prefix,'object',self,'fieldname','recording_frequency','format','Integer')
     81                WriteData(fid,prefix,'object',self,'fieldname','solver_residue_threshold','format','Double')
    7582                if self.waitonlock>0:
    7683                        WriteData(fid,prefix,'name','md.settings.waitonlock','data',True,'format','Boolean');
Note: See TracChangeset for help on using the changeset viewer.