Changeset 23666
- Timestamp:
- 01/28/19 06:41:27 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/hydrology_core.cpp
r23665 r23666 85 85 86 86 if(hydroslices>1){ 87 /*define which variable needs to be averaged on the sub-timestep and initialize as needed*/88 numaveragedinput = 2;89 std::vector<int> inputtostack = {EffectivePressureHydrostepEnum,SedimentHeadHydrostepEnum};90 std::vector<int> stackedinput = {EffectivePressureStackedEnum,SedimentHeadStackedEnum};91 std::vector<int> averagedinput = {EffectivePressureEnum,SedimentHeadEnum};92 93 87 if (isefficientlayer){ 88 /*define which variable needs to be averaged on the sub-timestep and initialize as needed*/ 94 89 numaveragedinput = 4; 95 inputtostack = {EffectivePressureHydrostepEnum,SedimentHeadHydrostepEnum,EplHeadHydrostepEnum,HydrologydcEplThicknessHydrostepEnum}; 96 stackedinput = {EffectivePressureStackedEnum,SedimentHeadStackedEnum,EplHeadStackedEnum,HydrologydcEplThicknessStackedEnum}; 97 averagedinput = {EffectivePressureEnum,SedimentHeadEnum,EplHeadEnum,HydrologydcEplThicknessEnum}; 98 } 99 100 femmodel->InitMeanOutputx(&stackedinput[0],numaveragedinput); 101 102 while(hydrotime<time-(yts*DBL_EPSILON)){ //loop on hydro dts 103 hydrostep+=1; 104 hydrotime+=hydrodt; 105 /*Setting substep time as global time*/ 106 femmodel->parameters->SetParam(hydrotime,TimeEnum); 107 if(VerboseSolution()) _printf0_("sub iteration " << hydrostep << "/" << hydroslices << " time [yr]: " << setprecision(4) << hydrotime/yts << " (time step: " << hydrodt/yts << ")\n"); 108 if(issmb){ 109 if(VerboseSolution()) _printf0_(" computing mass balance\n"); 110 SmbAnalysis* analysis = new SmbAnalysis(); 111 analysis->Core(femmodel); 112 delete analysis; 90 int inputtostack[4] = {EffectivePressureHydrostepEnum,SedimentHeadHydrostepEnum,EplHeadHydrostepEnum,HydrologydcEplThicknessHydrostepEnum}; 91 int stackedinput[4] = {EffectivePressureStackedEnum,SedimentHeadStackedEnum,EplHeadStackedEnum,HydrologydcEplThicknessStackedEnum}; 92 int averagedinput[4] = {EffectivePressureEnum,SedimentHeadEnum,EplHeadEnum,HydrologydcEplThicknessEnum}; 93 femmodel->InitMeanOutputx(&stackedinput[0],numaveragedinput); 94 95 while(hydrotime<time-(yts*DBL_EPSILON)){ //loop on hydro dts 96 hydrostep+=1; 97 hydrotime+=hydrodt; 98 /*Setting substep time as global time*/ 99 femmodel->parameters->SetParam(hydrotime,TimeEnum); 100 if(VerboseSolution()) _printf0_("sub iteration " << hydrostep << "/" << hydroslices << " time [yr]: " << setprecision(4) << hydrotime/yts << " (time step: " << hydrodt/yts << ")\n"); 101 if(issmb){ 102 if(VerboseSolution()) _printf0_(" computing mass balance\n"); 103 SmbAnalysis* analysis = new SmbAnalysis(); 104 analysis->Core(femmodel); 105 delete analysis; 106 } 107 if(VerboseSolution()) _printf0_(" computing water heads\n"); 108 /*save preceding timestep*/ 109 InputDuplicatex(femmodel,SedimentHeadHydrostepEnum,SedimentHeadOldEnum); 110 if(isefficientlayer){ 111 InputDuplicatex(femmodel,EplHeadHydrostepEnum,EplHeadOldEnum); 112 InputDuplicatex(femmodel,HydrologydcEplThicknessHydrostepEnum,HydrologydcEplThicknessOldEnum); 113 } 114 /*Proceed now to heads computations*/ 115 solutionsequence_hydro_nonlinear(femmodel); 116 /*If we have a sub-timestep we stack the variables here*/ 117 femmodel->SumOutputx(&inputtostack[0],&stackedinput[0],numaveragedinput); 113 118 } 114 if(VerboseSolution()) _printf0_(" computing water heads\n"); 115 /*save preceding timestep*/ 116 InputDuplicatex(femmodel,SedimentHeadHydrostepEnum,SedimentHeadOldEnum); 117 if(isefficientlayer){ 118 InputDuplicatex(femmodel,EplHeadHydrostepEnum,EplHeadOldEnum); 119 InputDuplicatex(femmodel,HydrologydcEplThicknessHydrostepEnum,HydrologydcEplThicknessOldEnum); 119 /*Reseting to global time*/ 120 femmodel->parameters->SetParam(time,TimeEnum); 121 femmodel->AverageSumOutputx(&stackedinput[0],&averagedinput[0],numaveragedinput); 122 } 123 else{ 124 /*define which variable needs to be averaged on the sub-timestep and initialize as needed*/ 125 numaveragedinput = 2; 126 int inputtostack[2] = {EffectivePressureHydrostepEnum,SedimentHeadHydrostepEnum}; 127 int stackedinput[2] = {EffectivePressureStackedEnum,SedimentHeadStackedEnum}; 128 int averagedinput[2] = {EffectivePressureEnum,SedimentHeadEnum}; 129 femmodel->InitMeanOutputx(&stackedinput[0],numaveragedinput); 130 while(hydrotime<time-(yts*DBL_EPSILON)){ //loop on hydro dts 131 hydrostep+=1; 132 hydrotime+=hydrodt; 133 /*Setting substep time as global time*/ 134 femmodel->parameters->SetParam(hydrotime,TimeEnum); 135 if(VerboseSolution()) _printf0_("sub iteration " << hydrostep << "/" << hydroslices << " time [yr]: " << setprecision(4) << hydrotime/yts << " (time step: " << hydrodt/yts << ")\n"); 136 if(issmb){ 137 if(VerboseSolution()) _printf0_(" computing mass balance\n"); 138 SmbAnalysis* analysis = new SmbAnalysis(); 139 analysis->Core(femmodel); 140 delete analysis; 141 } 142 if(VerboseSolution()) _printf0_(" computing water heads\n"); 143 /*save preceding timestep*/ 144 InputDuplicatex(femmodel,SedimentHeadHydrostepEnum,SedimentHeadOldEnum); 145 if(isefficientlayer){ 146 InputDuplicatex(femmodel,EplHeadHydrostepEnum,EplHeadOldEnum); 147 InputDuplicatex(femmodel,HydrologydcEplThicknessHydrostepEnum,HydrologydcEplThicknessOldEnum); 148 } 149 /*Proceed now to heads computations*/ 150 solutionsequence_hydro_nonlinear(femmodel); 151 /*If we have a sub-timestep we stack the variables here*/ 152 femmodel->SumOutputx(&inputtostack[0],&stackedinput[0],numaveragedinput); 120 153 } 121 /*Proceed now to heads computations*/ 122 solutionsequence_hydro_nonlinear(femmodel); 123 /*If we have a sub-timestep we stack the variables here*/ 124 femmodel->SumOutputx(&inputtostack[0],&stackedinput[0],numaveragedinput); 125 } 126 /*Reseting to global time*/ 127 femmodel->parameters->SetParam(time,TimeEnum); 128 femmodel->AverageSumOutputx(&stackedinput[0],&averagedinput[0],numaveragedinput); 129 } 154 /*Reseting to global time*/ 155 femmodel->parameters->SetParam(time,TimeEnum); 156 femmodel->AverageSumOutputx(&stackedinput[0],&averagedinput[0],numaveragedinput); 157 } 130 158 else{ 131 159 if(issmb){
Note:
See TracChangeset
for help on using the changeset viewer.