Changeset 17806 for issm/trunk/src/c/cores
- Timestamp:
- 04/22/14 10:39:19 (11 years ago)
- Location:
- issm/trunk
- Files:
-
- 18 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 16565-17015,17017-17381,17383-17422,17424-17619,17621-17657,17659-17672,17674-17801,17804
- Property svn:mergeinfo changed
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/c
- Property svn:ignore
-
old new 16 16 .deps 17 17 .dirstamp 18 .libs
-
- Property svn:ignore
-
issm/trunk/src/c/cores
- Property svn:ignore
-
old new 1 *.obj 1 2 .deps 2 3 .dirstamp
-
- Property svn:ignore
-
issm/trunk/src/c/cores/AnalysisConfiguration.cpp
r16533 r17806 26 26 27 27 case StressbalanceSolutionEnum: 28 numanalyses= 4;28 numanalyses=6; 29 29 analyses=xNew<int>(numanalyses); 30 30 analyses[0]=StressbalanceAnalysisEnum; … … 32 32 analyses[2]=StressbalanceSIAAnalysisEnum; 33 33 analyses[3]=L2ProjectionBaseAnalysisEnum; 34 analyses[4]=ExtrudeFromBaseAnalysisEnum; 35 analyses[5]=DepthAverageAnalysisEnum; 34 36 break; 35 37 … … 55 57 56 58 case HydrologySolutionEnum: 57 numanalyses= 4;59 numanalyses=5; 58 60 analyses=xNew<int>(numanalyses); 59 61 analyses[0]=HydrologyShreveAnalysisEnum; … … 61 63 analyses[2]=HydrologyDCEfficientAnalysisEnum; 62 64 analyses[3]=L2ProjectionBaseAnalysisEnum; 65 analyses[4]=L2ProjectionEPLAnalysisEnum; 63 66 break; 64 67 … … 114 117 115 118 case TransientSolutionEnum: 116 numanalyses= 12;119 numanalyses=20; 117 120 analyses=xNew<int>(numanalyses); 118 121 analyses[ 0]=StressbalanceAnalysisEnum; … … 128 131 analyses[10]=ExtrudeFromBaseAnalysisEnum; 129 132 analyses[11]=ExtrudeFromTopAnalysisEnum; 133 analyses[12]=LevelsetAnalysisEnum; 134 analyses[13]=ExtrapolationAnalysisEnum; 135 analyses[14]=LsfReinitializationAnalysisEnum; 136 analyses[15]=DamageEvolutionAnalysisEnum; 137 analyses[16]=HydrologyShreveAnalysisEnum; 138 analyses[17]=HydrologyDCInefficientAnalysisEnum; 139 analyses[18]=HydrologyDCEfficientAnalysisEnum; 140 analyses[19]=L2ProjectionEPLAnalysisEnum; 130 141 break; 131 142 -
issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp
r16518 r17806 24 24 25 25 case StressbalanceSolutionEnum: 26 #ifdef _HAVE_STRESSBALANCE_27 26 solutioncore=&stressbalance_core; 28 #else29 _error_("ISSM was not compiled with stressbalance capabilities. Exiting");30 #endif31 27 break; 32 28 case SteadystateSolutionEnum: 33 #ifdef _HAVE_STEADYSTATE_34 29 solutioncore=&steadystate_core; 35 #else36 _error_("ISSM was not compiled with steady state capabilities. Exiting");37 #endif38 30 break; 39 31 case ThermalSolutionEnum: 40 #ifdef _HAVE_THERMAL_41 32 solutioncore=&thermal_core; 42 #else43 _error_("ISSM was not compiled with thermal capabilities. Exiting");44 #endif45 33 break; 46 34 case BalancethicknessSolutionEnum: 47 #ifdef _HAVE_BALANCED_48 35 solutioncore=&balancethickness_core; 49 #else50 _error_("ISSM was not compiled with balanced capabilities. Exiting");51 #endif52 36 break; 53 37 case BalancethicknessSoftSolutionEnum: 54 #ifdef _HAVE_BALANCED_55 38 solutioncore=&dummy_core; 56 #else57 _error_("ISSM was not compiled with balanced capabilities. Exiting");58 #endif59 39 break; 60 40 case BalancevelocitySolutionEnum: 61 #ifdef _HAVE_BALANCED_62 41 solutioncore=&balancevelocity_core; 63 #else64 _error_("ISSM was not compiled with balanced capabilities. Exiting");65 #endif66 42 break; 67 43 case HydrologySolutionEnum: 68 #ifdef _HAVE_HYDROLOGY_69 44 solutioncore=&hydrology_core; 70 #else71 _error_("ISSM was not compiled with hydrology capabilities. Exiting");72 #endif73 45 break; 74 46 case SurfaceSlopeSolutionEnum: 75 #ifdef _HAVE_SLOPE_76 47 solutioncore=&surfaceslope_core; 77 #else78 _error_("ISSM was not compiled with slope capabilities. Exiting");79 #endif80 48 break; 81 49 case BedSlopeSolutionEnum: 82 #ifdef _HAVE_SLOPE_83 50 solutioncore=&bedslope_core; 84 #else85 _error_("ISSM was not compiled with slope capabilities. Exiting");86 #endif87 51 break; 88 52 case TransientSolutionEnum: 89 #ifdef _HAVE_TRANSIENT_90 53 solutioncore=&transient_core; 91 #else92 _error_("ISSM was not compiled with transient capabilities. Exiting");93 #endif94 54 break; 95 55 case MasstransportSolutionEnum: 96 #ifdef _HAVE_MASSTRANSPORT_97 56 solutioncore=&masstransport_core; 98 #else99 _error_("ISSM was not compiled with masstransport capabilities. Exiting");100 #endif101 57 break; 102 103 58 case GiaSolutionEnum: 104 #if def_HAVE_GIA_59 #if _HAVE_GIA_ 105 60 solutioncore=&gia_core; 106 61 #else 107 _error_("ISSM was not compiled with gia capabilities. Exiting");62 _error_("ISSM not compiled with Gia capability"); 108 63 #endif 109 64 break; 110 65 case DamageEvolutionSolutionEnum: 111 #ifdef _HAVE_DAMAGE_112 66 solutioncore=&damage_core; 113 #else114 _error_("ISSM was not compiled with damage evolution capabilities. Exiting");115 #endif116 67 break; 117 118 68 default: 119 69 _error_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); … … 124 74 _assert_(psolutioncore); 125 75 *psolutioncore=solutioncore; 126 127 76 } -
issm/trunk/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp
r16518 r17806 42 42 } 43 43 else if(control_analysis){ 44 #ifdef _HAVE_CONTROL_45 44 if(tao_analysis) solutioncore=controltao_core; 46 45 else solutioncore=control_core; 47 #else48 _error_("ISSM was not compiled with control support, cannot carry out control analysis!");49 #endif50 46 } 51 47 else CorePointerFromSolutionEnum(&solutioncore,parameters,solutiontype); /*This means we retrieve a core solution that is not a wrapper*/ -
issm/trunk/src/c/cores/bedslope_core.cpp
r16529 r17806 14 14 /*parameters: */ 15 15 bool save_results; 16 int meshtype;16 int domaintype; 17 17 18 18 /*Recover some parameters: */ 19 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 femmodel->parameters->FindParam(& meshtype,MeshTypeEnum);20 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 21 21 22 22 if(VerboseSolution()) _printf0_(" computing slope\n"); … … 28 28 solutionsequence_linear(femmodel); 29 29 30 if( meshtype!=Mesh2DverticalEnum){30 if(domaintype!=Domain2DverticalEnum){ 31 31 femmodel->parameters->SetParam(BedSlopeYEnum,InputToL2ProjectEnum); 32 32 solutionsequence_linear(femmodel); … … 35 35 if(save_results){ 36 36 if(VerboseSolution()) _printf0_(" saving results\n"); 37 if( meshtype!=Mesh2DverticalEnum){37 if(domaintype!=Domain2DverticalEnum){ 38 38 int outputs[2] = {BedSlopeXEnum,BedSlopeYEnum}; 39 39 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2); -
issm/trunk/src/c/cores/cores.h
r16534 r17806 24 24 void thermal_core(FemModel* femmodel); 25 25 void surfaceslope_core(FemModel* femmodel); 26 void levelsetfunctionslope_core(FemModel* femmodel); 26 27 void bedslope_core(FemModel* femmodel); 27 28 void meshdeformation_core(FemModel* femmodel); … … 29 30 void controltao_core(FemModel* femmodel); 30 31 void masstransport_core(FemModel* femmodel); 32 void depthaverage_core(FemModel* femmodel); 31 33 void extrudefrombase_core(FemModel* femmodel); 32 34 void extrudefromtop_core(FemModel* femmodel); -
issm/trunk/src/c/cores/damage_core.cpp
r16518 r17806 14 14 /*intermediary*/ 15 15 bool save_results; 16 bool dakota_analysis = false;16 bool dakota_analysis = false; 17 17 int solution_type; 18 int numoutputs = 0; 19 char **requested_outputs = NULL; 18 20 19 if(VerboseSolution()) _printf0_(" computing damage\n");20 21 21 22 //first recover parameters common to all solutions … … 23 24 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum); 24 25 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 26 femmodel->parameters->FindParam(&numoutputs,DamageEvolutionNumRequestedOutputsEnum); 27 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,DamageEvolutionRequestedOutputsEnum); 25 28 26 29 if(dakota_analysis && solution_type!=TransientSolutionEnum){ … … 29 32 } 30 33 34 if(VerboseSolution()) _printf0_(" computing damage\n"); 31 35 femmodel->SetCurrentConfiguration(DamageEvolutionAnalysisEnum); 32 36 solutionsequence_linear(femmodel); … … 34 38 if(save_results){ 35 39 if(VerboseSolution()) _printf0_(" saving results\n"); 36 int outputs = DamageDEnum; 37 femmodel->RequestedOutputsx(&femmodel->results,&outputs,1); 40 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs); 41 } 42 43 /*Free resources:*/ 44 if(numoutputs){ 45 for(int i=0;i<numoutputs;i++){ 46 xDelete<char>(requested_outputs[i]); 47 } 48 xDelete<char*>(requested_outputs); 38 49 } 39 50 } -
issm/trunk/src/c/cores/gia_core.cpp
r16518 r17806 50 50 if(save_results){ 51 51 if(VerboseSolution()) _printf0_(" saving results\n"); 52 constint outputs[2] = {GiaWEnum,GiadWdtEnum};52 int outputs[2] = {GiaWEnum,GiadWdtEnum}; 53 53 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2); 54 54 } -
issm/trunk/src/c/cores/hydrology_core.cpp
r16518 r17806 12 12 void hydrology_core(FemModel* femmodel){ 13 13 14 int i;15 16 14 /*intermediary*/ 17 int step,nsteps; 18 int output_frequency,hydrology_model; 15 int hydrology_model; 19 16 bool save_results; 20 17 bool modify_loads=true; 21 18 bool isefficientlayer; 22 IssmDouble starttime,final_time;23 IssmDouble time,dt;24 19 25 20 /*first recover parameters common to all solutions*/ 26 femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);27 femmodel->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);28 femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);29 21 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 30 femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum);31 22 femmodel->parameters->FindParam(&hydrology_model,HydrologyModelEnum); 32 23 … … 37 28 } 38 29 39 /*Compute number of time steps: */ 40 if((dt==0)|| (final_time==0)){ 41 dt=0; 42 nsteps=1; 30 /*Using the Shreve based Model*/ 31 if (hydrology_model==HydrologyshreveEnum){ 32 if(VerboseSolution()) _printf0_(" computing water column\n"); 33 femmodel->SetCurrentConfiguration(HydrologyShreveAnalysisEnum); 34 solutionsequence_nonlinear(femmodel,modify_loads); 35 36 /*transfer water column thickness to old water column thickness: */ 37 38 InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum); 39 40 if(save_results){ 41 if(VerboseSolution()) _printf0_(" saving results \n"); 42 int outputs[3] = {WatercolumnEnum,HydrologyWaterVxEnum,HydrologyWaterVyEnum}; 43 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3); 44 45 /*unload results*/ 46 if(VerboseSolution()) _printf0_(" saving temporary results\n"); 47 OutputResultsx(femmodel); 48 } 43 49 } 44 else nsteps=reCast<int,IssmDouble>((final_time-starttime)/dt);45 50 46 /*initialize: */ 47 step=0; 48 time=starttime; 49 50 /*Loop through time: */ 51 for(i=0;i<nsteps;i++){ 52 53 if(nsteps)if(VerboseSolution()) _printf0_("time step:" << i+1 << "/" << nsteps << "\n"); 54 time+=dt; 55 step+=1; 56 femmodel->parameters->SetParam(time,TimeEnum); 57 femmodel->parameters->SetParam(step,StepEnum); 58 59 if (hydrology_model==HydrologyshreveEnum){ 60 if(VerboseSolution()) _printf0_(" computing water column\n"); 61 femmodel->SetCurrentConfiguration(HydrologyShreveAnalysisEnum); 62 solutionsequence_nonlinear(femmodel,modify_loads); 63 64 /*transfer water column thickness to old water column thickness: */ 65 66 InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum); 67 68 if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){ 69 if(VerboseSolution()) _printf0_(" saving results \n"); 70 int outputs[3] = {WatercolumnEnum,HydrologyWaterVxEnum,HydrologyWaterVyEnum}; 51 /*Using the double continuum model*/ 52 else if (hydrology_model==HydrologydcEnum){ 53 InputDuplicatex(femmodel,SedimentHeadEnum,SedimentHeadOldEnum); 54 femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum); 55 if (isefficientlayer){ 56 InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum); 57 InputDuplicatex(femmodel,HydrologydcEplThicknessEnum,HydrologydcEplThicknessOldEnum); 58 } 59 60 /*Proceed now to heads computations*/ 61 if(VerboseSolution()) _printf0_(" computing water head\n"); 62 solutionsequence_hydro_nonlinear(femmodel); 63 if(save_results){ 64 if(VerboseSolution()) _printf0_(" saving results \n"); 65 if(isefficientlayer){ 66 int outputs[9] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveNodeEnum,HydrologydcMaskEplactiveEltEnum,EplHeadSlopeXEnum,EplHeadSlopeYEnum,HydrologydcEplThicknessEnum,EffectivePressureEnum}; 67 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],9); 68 } 69 else{ 70 int outputs[3] = {SedimentHeadEnum,SedimentHeadResidualEnum,EffectivePressureEnum}; 71 71 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3); 72 73 /*unload results*/74 if(VerboseSolution()) _printf0_(" saving temporary results\n");75 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);76 72 } 73 /*unload results*/ 74 if(VerboseSolution()) _printf0_(" saving temporary results\n"); 75 OutputResultsx(femmodel); 77 76 } 78 79 else if (hydrology_model==HydrologydcEnum){80 InputDuplicatex(femmodel,SedimentHeadEnum,SedimentHeadOldEnum);81 femmodel->parameters->FindParam(&isefficientlayer,HydrologydcIsefficientlayerEnum);82 if (isefficientlayer){83 InputDuplicatex(femmodel,EplHeadEnum,EplHeadOldEnum);84 }85 86 if(VerboseSolution()) _printf0_(" computing water head\n");87 solutionsequence_hydro_nonlinear(femmodel);88 if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){89 if(VerboseSolution()) _printf0_(" saving results \n");90 if(isefficientlayer){91 int outputs[4] = {SedimentHeadEnum,SedimentHeadResidualEnum,EplHeadEnum,HydrologydcMaskEplactiveEnum};92 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],4);93 }94 else{95 int outputs[2] = {SedimentHeadEnum,SedimentHeadResidualEnum};96 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);97 }98 /*unload results*/99 if(VerboseSolution()) _printf0_(" saving temporary results\n");100 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);101 }102 }103 104 77 } 105 78 } 79 -
issm/trunk/src/c/cores/masstransport_core.cpp
r16518 r17806 14 14 /*parameters: */ 15 15 int i; 16 int numoutputs, meshtype;16 int numoutputs,domaintype; 17 17 bool save_results; 18 18 bool issmbgradients,ispdd,isdelta18o,isFS,isfreesurface,dakota_analysis; … … 25 25 /*recover parameters: */ 26 26 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 27 femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum);28 femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum);29 femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);30 27 femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum); 31 28 femmodel->parameters->FindParam(&isfreesurface,MasstransportIsfreesurfaceEnum); 32 29 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum); 33 30 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 34 femmodel->parameters->FindParam(& meshtype,MeshTypeEnum);31 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 35 32 femmodel->parameters->FindParam(&numoutputs,MasstransportNumRequestedOutputsEnum); 36 33 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,MasstransportRequestedOutputsEnum); … … 40 37 InputDuplicatex(femmodel,QmuSurfaceEnum,SurfaceEnum); 41 38 InputDuplicatex(femmodel,QmuThicknessEnum,ThicknessEnum); 42 InputDuplicatex(femmodel,QmuB edEnum,BedEnum);39 InputDuplicatex(femmodel,QmuBaseEnum,BaseEnum); 43 40 } 44 41 45 if(issmbgradients){ 46 if(VerboseSolution())_printf_(" call smb gradients module\n\n"); 47 SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 48 } 49 if(ispdd){ 50 if(isdelta18o){ 51 if(VerboseSolution()) _printf0_(" call Delta18oParametrization module\n"); 52 Delta18oParameterizationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 53 } 54 if(VerboseSolution()) _printf0_(" call positive degree day module\n"); 55 PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 56 } 42 /*Calculate new Surface Mass Balance (SMB)*/ 43 SurfaceMassBalancex(femmodel); 57 44 45 /*Transport mass or free surface*/ 58 46 if(isFS && isfreesurface){ 59 47 if(VerboseSolution()) _printf0_(" call free surface computational core\n"); 60 48 femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum); 61 49 solutionsequence_linear(femmodel); 62 if( meshtype==Mesh2DverticalEnum){63 femmodel->parameters->SetParam(B edEnum,InputToExtrudeEnum);50 if(domaintype!=Domain2DhorizontalEnum){ 51 femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum); 64 52 extrudefrombase_core(femmodel); 65 53 } 66 54 femmodel->SetCurrentConfiguration(FreeSurfaceTopAnalysisEnum); 67 55 solutionsequence_linear(femmodel); 68 if( meshtype==Mesh2DverticalEnum){56 if(domaintype!=Domain2DhorizontalEnum){ 69 57 femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum); 70 58 extrudefromtop_core(femmodel); … … 74 62 if(VerboseSolution()) _printf0_(" call computational core\n"); 75 63 solutionsequence_linear(femmodel); 64 if(domaintype==Domain2DverticalEnum){ 65 femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum); 66 extrudefrombase_core(femmodel); 67 femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum); 68 extrudefrombase_core(femmodel); 69 femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum); 70 extrudefrombase_core(femmodel); 71 } 76 72 } 77 73 … … 84 80 85 81 /*Free ressources:*/ 86 if(numoutputs){for(int i=0;i<numoutputs;i++){ char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}82 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 87 83 } -
issm/trunk/src/c/cores/steadystate_core.cpp
r16518 r17806 50 50 51 51 if(VerboseSolution()) _printf0_(" computing temperature and velocity for step: " << step << "\n"); 52 #ifdef _HAVE_THERMAL_53 52 thermal_core(femmodel); 54 53 if(!isenthalpy)femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);/*Could be MeltingAnalysis...*/ 55 54 GetSolutionFromInputsx(&tg,femmodel); 56 #else57 _error_("ISSM was not compiled with thermal capabilities. Exiting");58 #endif59 55 60 56 if(VerboseSolution()) _printf0_(" computing new velocity\n"); … … 87 83 delete tg; 88 84 delete ug; 89 if(numoutputs){ for (i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}85 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 90 86 } 91 87 bool steadystateconvergence(Vector<IssmDouble>* tg,Vector<IssmDouble>* tg_old,Vector<IssmDouble>* ug,Vector<IssmDouble>* ug_old,IssmDouble reltol){ -
issm/trunk/src/c/cores/stressbalance_core.cpp
r16518 r17806 6 6 #include "../toolkits/toolkits.h" 7 7 #include "../classes/classes.h" 8 #include "../analyses/analyses.h" 8 9 #include "../shared/shared.h" 9 10 #include "../modules/modules.h" … … 13 14 14 15 /*parameters: */ 15 bool dakota_analysis; 16 int meshtype; 17 bool isSIA,isSSA,isL1L2,isHO,isFS; 18 bool conserve_loads = true; 19 bool save_results; 20 int newton; 21 int solution_type; 22 int numoutputs = 0; 23 char** requested_outputs = NULL; 24 int i; 25 16 bool dakota_analysis; 17 int domaintype; 18 bool isSIA,isSSA,isL1L2,isHO,isFS; 19 bool save_results; 20 int solution_type; 21 int numoutputs = 0; 22 char **requested_outputs = NULL; 23 Analysis *analysis = NULL; 26 24 27 25 /* recover parameters:*/ 28 femmodel->parameters->FindParam(& meshtype,MeshTypeEnum);26 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 29 27 femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum); 30 28 femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum); … … 32 30 femmodel->parameters->FindParam(&isHO,FlowequationIsHOEnum); 33 31 femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum); 34 femmodel->parameters->FindParam(&newton,StressbalanceIsnewtonEnum);35 32 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum); 36 33 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); … … 43 40 InputDuplicatex(femmodel,QmuVxEnum,VxEnum); 44 41 InputDuplicatex(femmodel,QmuVyEnum,VyEnum); 45 InputDuplicatex(femmodel,QmuVzEnum,VzEnum);42 if(domaintype==Domain3DEnum) InputDuplicatex(femmodel,QmuVzEnum,VzEnum); 46 43 if(isFS) InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum); 47 44 } 48 45 49 /*Compute slopes :*/50 if(isSIA ) surfaceslope_core(femmodel);46 /*Compute slopes if necessary */ 47 if(isSIA || (isFS && domaintype==Domain2DverticalEnum)) surfaceslope_core(femmodel); 51 48 if(isFS){ 52 49 bedslope_core(femmodel); 53 50 femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum); 54 Reset CoordinateSystemx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);51 ResetFSBasalBoundaryConditionx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 55 52 } 56 53 54 /*Compute SIA velocities*/ 57 55 if(isSIA){ 58 if(VerboseSolution()) _printf0_(" computing SIA velocities\n");59 56 60 57 /*Take the last velocity into account so that the velocity on the SSA domain is not zero*/ 61 58 if(isSSA || isL1L2 || isHO ) ResetBoundaryConditions(femmodel,StressbalanceSIAAnalysisEnum); 62 femmodel->SetCurrentConfiguration(StressbalanceSIAAnalysisEnum); 63 solutionsequence_linear(femmodel); 59 60 analysis = new StressbalanceSIAAnalysis(); 61 analysis->Core(femmodel); 62 delete analysis; 63 64 /*Reset velocities for other ice flow models*/ 64 65 if(isSSA || isL1L2 || isHO) ResetBoundaryConditions(femmodel,StressbalanceAnalysisEnum); 65 66 } 66 67 67 if ((isSSA || isHO || isL1L2) ^ isFS){ // ^ = xor 68 if(VerboseSolution()) _printf0_(" computing velocities\n"); 69 70 femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum); 71 if(newton>0) 72 solutionsequence_newton(femmodel); 73 else 74 solutionsequence_nonlinear(femmodel,conserve_loads); 68 /*Compute stressbalance for SSA L1L2 HO and FS*/ 69 if(isSSA || isL1L2 || isHO || isFS){ 70 analysis = new StressbalanceAnalysis(); 71 analysis->Core(femmodel); 72 delete analysis; 75 73 } 76 74 77 if ((isSSA || isL1L2 || isHO) && isFS){ 78 if(VerboseSolution()) _printf0_(" computing coupling betweem lower order models and full-FS\n"); 79 solutionsequence_FScoupling_nonlinear(femmodel,conserve_loads); 75 /*Compute vertical velocities*/ 76 if (domaintype==Domain3DEnum && (isSIA || isSSA || isL1L2 || isHO)){ 77 analysis = new StressbalanceVerticalAnalysis(); 78 analysis->Core(femmodel); 79 delete analysis; 80 80 } 81 81 82 if (meshtype==Mesh3DEnum && (isSIA || isSSA || isL1L2 || isHO)){83 if(VerboseSolution()) _printf0_(" computing vertical velocities\n");84 femmodel->SetCurrentConfiguration(StressbalanceVerticalAnalysisEnum);85 solutionsequence_linear(femmodel);86 }87 82 88 83 if(save_results){ … … 94 89 95 90 /*Free ressources:*/ 96 if(numoutputs){ for (i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}91 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 97 92 } -
issm/trunk/src/c/cores/surfaceslope_core.cpp
r16529 r17806 14 14 /*parameters: */ 15 15 bool save_results; 16 int meshtype;16 int domaintype; 17 17 18 18 /*Recover some parameters: */ 19 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 femmodel->parameters->FindParam(& meshtype,MeshTypeEnum);20 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 21 21 22 22 if(VerboseSolution()) _printf0_("computing slope...\n"); … … 28 28 solutionsequence_linear(femmodel); 29 29 30 if( meshtype!=Mesh2DverticalEnum){30 if(domaintype!=Domain2DverticalEnum){ 31 31 femmodel->parameters->SetParam(SurfaceSlopeYEnum,InputToL2ProjectEnum); 32 32 solutionsequence_linear(femmodel); 33 } 34 if(domaintype==Domain2DverticalEnum){ 35 femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToExtrudeEnum); 36 extrudefrombase_core(femmodel); 33 37 } 34 38 35 39 if(save_results){ 36 40 if(VerboseSolution()) _printf0_("saving results:\n"); 37 if( meshtype!=Mesh2DverticalEnum){41 if(domaintype!=Domain2DverticalEnum){ 38 42 int outputs[2] = {SurfaceSlopeXEnum,SurfaceSlopeYEnum}; 39 43 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2); -
issm/trunk/src/c/cores/thermal_core.cpp
r16518 r17806 6 6 #include "../toolkits/toolkits.h" 7 7 #include "../classes/classes.h" 8 #include "../analyses/analyses.h" 8 9 #include "../shared/shared.h" 9 10 #include "../modules/modules.h" … … 17 18 int solution_type,numoutputs; 18 19 char** requested_outputs = NULL; 20 EnthalpyAnalysis * enthalpy_analysis = NULL; 19 21 20 22 /*first recover parameters common to all solutions*/ … … 46 48 InputDuplicatex(femmodel,EnthalpyEnum,EnthalpyPicardEnum); 47 49 48 /*Post process*/ 49 if(solution_type!=SteadystateSolutionEnum) PostprocessingEnthalpyx(femmodel); 50 if(solution_type!=SteadystateSolutionEnum){ 51 /*Post process*/ 52 enthalpy_analysis = new EnthalpyAnalysis(); 53 enthalpy_analysis->PostProcessing(femmodel); 54 delete enthalpy_analysis; 55 } 50 56 } 51 57 else{ … … 63 69 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs); 64 70 } 71 72 /*Free ressources:*/ 73 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 74 65 75 } -
issm/trunk/src/c/cores/transient_core.cpp
r16518 r17806 22 22 int i; 23 23 IssmDouble starttime,finaltime,dt,yts; 24 bool isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,is delta18o,isgia;24 bool isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution,ishydrology; 25 25 bool save_results,dakota_analysis; 26 26 bool time_adapt=false; 27 27 int output_frequency; 28 int meshtype,groundingline_migration;28 int domaintype,groundingline_migration,smb_model; 29 29 int numoutputs = 0; 30 Analysis *analysis = NULL; 30 31 char** requested_outputs = NULL; 31 32 … … 36 37 37 38 //first recover parameters common to all solutions 38 femmodel->parameters->FindParam(& meshtype,MeshTypeEnum);39 femmodel->parameters->FindParam(&domaintype,DomainTypeEnum); 39 40 femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum); 40 41 femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum); … … 49 50 femmodel->parameters->FindParam(&isgia,TransientIsgiaEnum); 50 51 femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum); 52 femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum); 53 femmodel->parameters->FindParam(&isdamageevolution,TransientIsdamageevolutionEnum); 54 femmodel->parameters->FindParam(&ishydrology,TransientIshydrologyEnum); 51 55 femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum); 52 56 if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum); 53 57 femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum); 54 58 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum); 55 femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);56 59 57 60 /*initialize: */ … … 64 67 InputDuplicatex(femmodel,QmuVxEnum,VxEnum); 65 68 InputDuplicatex(femmodel,QmuVyEnum,VyEnum); 66 if( meshtype==Mesh3DEnum){69 if(domaintype==Domain3DEnum){ 67 70 InputDuplicatex(femmodel,QmuVzEnum,VzEnum); 68 71 if(isFS)InputDuplicatex(femmodel,QmuPressureEnum,PressureEnum); … … 72 75 InputDuplicatex(femmodel,QmuThicknessEnum,ThicknessEnum); 73 76 InputDuplicatex(femmodel,QmuSurfaceEnum,SurfaceEnum); 74 InputDuplicatex(femmodel,QmuB edEnum,BedEnum);77 InputDuplicatex(femmodel,QmuBaseEnum,BaseEnum); 75 78 InputDuplicatex(femmodel,QmuMaskIceLevelsetEnum,MaskIceLevelsetEnum); 76 79 } 77 80 if(isgroundingline) InputDuplicatex(femmodel,QmuMaskGroundediceLevelsetEnum,MaskGroundediceLevelsetEnum); 78 if(isthermal && meshtype==Mesh3DEnum){81 if(isthermal && domaintype==Domain3DEnum){ 79 82 //Update Vertex Position after updating Thickness and Bed 80 83 femmodel->SetCurrentConfiguration(MasstransportAnalysisEnum); … … 93 96 94 97 while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime. 95 96 98 /*Increment*/ 97 99 if(time_adapt){ … … 106 108 107 109 if(VerboseSolution()) _printf0_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << " time [yr]: " << time/yts << " (time step: " << dt/yts << ")\n"); 108 if(step%output_frequency==0 || time==finaltime)110 if(step%output_frequency==0 || (time >= finaltime - (yts*DBL_EPSILON)) || step==1) 109 111 save_results=true; 110 112 else … … 112 114 femmodel->parameters->SetParam(save_results,SaveResultsEnum); 113 115 114 if(isthermal && meshtype==Mesh3DEnum){ 115 if(VerboseSolution()) _printf0_(" computing temperatures\n"); 116 #ifdef _HAVE_THERMAL_ 116 if(isthermal && domaintype==Domain3DEnum){ 117 if(VerboseSolution()) _printf0_(" computing thermal regime\n"); 117 118 thermal_core(femmodel); 118 #else 119 _error_("ISSM was not compiled with thermal capabilities. Exiting"); 120 #endif 119 } 120 121 if(ishydrology){ 122 if(VerboseSolution()) _printf0_(" computing water heads\n"); 123 hydrology_core(femmodel); 121 124 } 122 125 123 126 if(isstressbalance){ 124 127 if(VerboseSolution()) _printf0_(" computing new velocity\n"); 125 #ifdef _HAVE_STRESSBALANCE_126 128 stressbalance_core(femmodel); 127 #else 128 _error_("ISSM was not compiled with stressbalance capabilities. Exiting"); 129 #endif 129 } 130 131 if(isdamageevolution){ 132 if(VerboseSolution()) _printf0_(" computing damage\n"); 133 damage_core(femmodel); 134 } 135 136 if(islevelset){ 137 if(VerboseSolution()) _printf0_(" computing movement of ice boundaries\n"); 138 /* smoothen slope of lsf for computation of normal on ice domain*/ 139 levelsetfunctionslope_core(femmodel); 140 141 /* extrapolate velocities onto domain with no ice */ 142 Analysis* extanalysis = new ExtrapolationAnalysis(); 143 const int nvars=2; 144 int vars[nvars] = {VxEnum, VyEnum}; 145 for(int iv=0;iv<nvars;iv++){ 146 femmodel->parameters->SetParam(vars[iv],ExtrapolationVariableEnum); 147 extanalysis->Core(femmodel); 148 } 149 delete extanalysis; 150 151 /* solve level set equation */ 152 analysis = new LevelsetAnalysis(); 153 analysis->Core(femmodel); 154 delete analysis; 155 156 /* update vertices included for next calculation */ 157 GetMaskOfIceVerticesLSMx(femmodel); 158 159 /* add computation domain mask to outputs */ 160 int outputs[1] = {IceMaskNodeActivationEnum}; 161 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1); 130 162 } 131 163 … … 136 168 femmodel->UpdateVertexPositionsx(); 137 169 } 138 170 139 171 if(isgroundingline){ 140 172 if(VerboseSolution()) _printf0_(" computing new grounding line position\n"); 141 #ifdef _HAVE_GROUNDINGLINE_142 173 GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 143 #else 144 _error_("ISSM was not compiled with grounding line migration capabilities. Exiting"); 145 #endif 174 175 if(groundingline_migration==ContactEnum){ 176 femmodel->parameters->SetParam(MaskGroundediceLevelsetEnum,InputToExtrudeEnum); 177 extrudefrombase_core(femmodel); 178 femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum); 179 extrudefrombase_core(femmodel); 180 } 146 181 if(save_results){ 147 int outputs[3] = {SurfaceEnum,B edEnum,MaskGroundediceLevelsetEnum};182 int outputs[3] = {SurfaceEnum,BaseEnum,MaskGroundediceLevelsetEnum}; 148 183 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3); 149 184 } … … 156 191 _error_("ISSM was not compiled with gia capabilities. Exiting"); 157 192 #endif 158 159 193 } 160 194 161 195 /*unload results*/ 196 if(VerboseSolution()) _printf0_(" computing requested outputs\n"); 197 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results); 198 if(isgroundingline && (groundingline_migration==SubelementMigrationEnum || groundingline_migration==SubelementMigration2Enum)){ 199 int outputs[1] = {MaskGroundediceLevelsetEnum}; 200 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1,save_results); 201 } 202 162 203 if(save_results){ 163 if(VerboseSolution()) _printf0_(" saving transient results\n");164 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs);165 if(isdelta18o){166 int outputs[2] = {SurfaceforcingsMonthlytemperaturesEnum,SurfaceforcingsPrecipitationEnum};167 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);168 }169 if(isgroundingline && (groundingline_migration==SubelementMigrationEnum || groundingline_migration==SubelementMigration2Enum)){170 int outputs[1] = {MaskGroundediceLevelsetEnum};171 femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);172 }173 204 if(VerboseSolution()) _printf0_(" saving temporary results\n"); 174 OutputResultsx(femmodel ->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);205 OutputResultsx(femmodel); 175 206 } 176 207 } … … 179 210 180 211 /*Free ressources:*/ 181 if(numoutputs){ for (i=0;i<numoutputs;i++){char* string=requested_outputs[i];xDelete<char>(string);} xDelete<char*>(requested_outputs);}212 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 182 213 }
Note:
See TracChangeset
for help on using the changeset viewer.