Changeset 16470
- Timestamp:
- 10/20/13 20:31:07 (11 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 2 added
- 11 deleted
- 65 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/CMakeLists.txt
r16289 r16470 96 96 ./classes/Vertex.cpp 97 97 ./classes/Hook.cpp 98 ./classes/Patch.cpp99 98 ./classes/ElementResults/DoubleElementResult.cpp 100 99 ./classes/ElementResults/TriaP1ElementResult.cpp … … 279 278 ./modules/ResetConstraintsx/ThermalConstraintsReset.cpp 280 279 ./analyses/thermal_core.cpp 281 ./analyses/enthalpy_core.cpp282 280 ./solutionsequences/solutionsequence_thermal_nonlinear.cpp) 283 281 #}}} -
issm/trunk-jpl/src/c/Makefile.am
r16442 r16470 63 63 ./classes/Hook.h\ 64 64 ./classes/Hook.cpp\ 65 ./classes/Patch.h\66 ./classes/Patch.cpp\67 65 ./classes/ElementResults/ElementResultLocal.h\ 68 66 ./classes/ElementResults/DoubleElementResult.h\ … … 426 424 ./modules/PostprocessingEnthalpyx/PostprocessingEnthalpyx.cpp\ 427 425 ./analyses/thermal_core.cpp\ 428 ./analyses/enthalpy_core.cpp\429 426 ./solutionsequences/solutionsequence_thermal_nonlinear.cpp 430 427 #}}} -
issm/trunk-jpl/src/c/analyses/AnalysisConfiguration.cpp
r16442 r16470 49 49 50 50 case ThermalSolutionEnum: 51 numanalyses= 2;51 numanalyses=3; 52 52 analyses=xNew<int>(numanalyses); 53 53 analyses[0]=ThermalAnalysisEnum; 54 54 analyses[1]=MeltingAnalysisEnum; 55 break; 56 57 case EnthalpySolutionEnum: 58 numanalyses=1; 59 analyses=xNew<int>(numanalyses); 60 analyses[0]=EnthalpyAnalysisEnum; 55 analyses[2]=EnthalpyAnalysisEnum; 61 56 break; 62 57 -
issm/trunk-jpl/src/c/analyses/CorePointerFromSolutionEnum.cpp
r16181 r16470 40 40 #ifdef _HAVE_THERMAL_ 41 41 solutioncore=&thermal_core; 42 #else43 _error_("ISSM was not compiled with thermal capabilities. Exiting");44 #endif45 break;46 case EnthalpySolutionEnum:47 #ifdef _HAVE_THERMAL_48 solutioncore=&enthalpy_core;49 42 #else 50 43 _error_("ISSM was not compiled with thermal capabilities. Exiting"); -
issm/trunk-jpl/src/c/analyses/adjointbalancethickness_core.cpp
r15849 r16470 34 34 if(save_results){ 35 35 if(VerboseSolution()) _printf0_(" saving results\n"); 36 InputToResultx(femmodel,AdjointEnum); 36 const char* outputs [] = {"Adjoint"}; 37 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],1); 37 38 } 38 39 } -
issm/trunk-jpl/src/c/analyses/adjointstressbalance_core.cpp
r15849 r16470 35 35 36 36 /*Save results*/ 37 if(save_results ){37 if(save_results || true){ 38 38 if(VerboseSolution()) _printf0_(" saving results\n"); 39 InputToResultx(femmodel,AdjointxEnum);40 InputToResultx(femmodel,AdjointyEnum);41 39 if (isFS){ 42 InputToResultx(femmodel,AdjointzEnum); 43 InputToResultx(femmodel,AdjointpEnum); 40 const char* outputs [] = {"Adjointx","Adjointy","Adjointz","Adjointp"}; 41 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],4); 42 } 43 else{ 44 const char* outputs [] = {"Adjointx","Adjointy"}; 45 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],2); 44 46 } 45 47 } -
issm/trunk-jpl/src/c/analyses/analyses.h
r16442 r16470 23 23 void hydrology_core(FemModel* femmodel); 24 24 void thermal_core(FemModel* femmodel); 25 void enthalpy_core(FemModel* femmodel);26 25 void surfaceslope_core(FemModel* femmodel); 27 26 void bedslope_core(FemModel* femmodel); -
issm/trunk-jpl/src/c/analyses/balancethickness_core.cpp
r15849 r16470 26 26 if(save_results){ 27 27 if(VerboseSolution()) _printf0_(" saving results\n"); 28 InputToResultx(femmodel,ThicknessEnum); 28 const char* outputs [] = {"Thickness"}; 29 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],1); 29 30 } 30 31 -
issm/trunk-jpl/src/c/analyses/balancevelocity_core.cpp
r16144 r16470 31 31 if(save_results){ 32 32 if(VerboseSolution()) _printf0_(" saving results\n"); 33 InputToResultx(femmodel,SurfaceSlopeXEnum); 34 InputToResultx(femmodel,SurfaceSlopeYEnum); 35 InputToResultx(femmodel,VelEnum); 33 const char* outputs [] = {"SurfaceSlopeX","SurfaceSlopeY","Vel"}; 34 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],3); 36 35 } 37 36 -
issm/trunk-jpl/src/c/analyses/bedslope_core.cpp
r16382 r16470 32 32 if(save_results){ 33 33 if(VerboseSolution()) _printf0_(" saving results\n"); 34 InputToResultx(femmodel,BedSlopeXEnum); 35 if(meshtype!=Mesh2DverticalEnum) InputToResultx(femmodel,BedSlopeYEnum); 34 if(meshtype!=Mesh2DverticalEnum){ 35 const char* outputs [] = {"BedSlopeX"}; 36 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],1); 37 } 38 else{ 39 const char* outputs [] = {"BedSlopeX","BedSlopeY"}; 40 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],2); 41 } 36 42 } 37 43 -
issm/trunk-jpl/src/c/analyses/hydrology_core.cpp
r16219 r16470 68 68 if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){ 69 69 if(VerboseSolution()) _printf0_(" saving results \n"); 70 InputToResultx(femmodel,WatercolumnEnum); 71 InputToResultx(femmodel,HydrologyWaterVxEnum); 72 InputToResultx(femmodel,HydrologyWaterVyEnum); 70 const char* outputs [] = {"Watercolumn","HydrologyWaterVx","HydrologyWaterVy"}; 71 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],3); 73 72 74 73 /*unload results*/ … … 92 91 InputToResultx(femmodel,SedimentHeadResidualEnum); 93 92 if(isefficientlayer){ 94 InputToResultx(femmodel,EplHeadEnum); 95 InputToResultx(femmodel,HydrologydcMaskEplactiveEnum); 93 const char* outputs [] = {"SedimentHead","SedimentHeadResidual","EplHead","HydrologydcMaskEplactive"}; 94 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],4); 95 } 96 else{ 97 const char* outputs [] = {"SedimentHead","SedimentHeadResidual"}; 98 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],2); 96 99 } 97 100 /*unload results*/ -
issm/trunk-jpl/src/c/analyses/masstransport_core.cpp
r16464 r16470 32 32 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum); 33 33 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 34 femmodel->parameters->FindParam(&meshtype,MeshTypeEnum); 34 35 femmodel->parameters->FindParam(&numoutputs,MasstransportNumRequestedOutputsEnum); 35 femmodel->parameters->FindParam(&meshtype,MeshTypeEnum);36 36 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,MasstransportRequestedOutputsEnum); 37 37 -
issm/trunk-jpl/src/c/analyses/steadystate_core.cpp
r16363 r16470 33 33 IssmDouble reltol; 34 34 int numoutputs = 0; 35 char** 35 char** requested_outputs = NULL; 36 36 37 37 /* recover parameters:*/ 38 38 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 39 39 femmodel->parameters->FindParam(&maxiter,SteadystateMaxiterEnum); 40 femmodel->parameters->FindParam(&numoutputs,SteadystateNumRequestedOutputsEnum);41 40 femmodel->parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum); 42 41 femmodel->parameters->FindParam(&reltol,SteadystateReltolEnum); 43 42 femmodel->parameters->SetParam(false,SaveResultsEnum); 43 femmodel->parameters->FindParam(&numoutputs,SteadystateNumRequestedOutputsEnum); 44 44 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,SteadystateRequestedOutputsEnum); 45 45 … … 51 51 if(VerboseSolution()) _printf0_(" computing temperature and velocity for step: " << step << "\n"); 52 52 #ifdef _HAVE_THERMAL_ 53 if(isenthalpy==0){ 54 thermal_core(femmodel); 55 femmodel->SetCurrentConfiguration(ThermalAnalysisEnum); 56 GetSolutionFromInputsx(&tg,femmodel); 57 } 58 else{ 59 enthalpy_core(femmodel); 60 GetSolutionFromInputsx(&tg,femmodel); 61 } 53 thermal_core(femmodel); 54 femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);/*Could be MeltingAnalysis...*/ 55 GetSolutionFromInputsx(&tg,femmodel); 62 56 #else 63 57 _error_("ISSM was not compiled with thermal capabilities. Exiting"); … … 85 79 if(save_results){ 86 80 if(VerboseSolution()) _printf0_(" saving results\n"); 87 InputToResultx(femmodel,VxEnum); 88 InputToResultx(femmodel,VyEnum); 89 InputToResultx(femmodel,VzEnum); 90 InputToResultx(femmodel,VelEnum); 91 InputToResultx(femmodel,PressureEnum); 92 InputToResultx(femmodel,TemperatureEnum); 93 if(isenthalpy) InputToResultx(femmodel,WaterfractionEnum); 94 if(isenthalpy) InputToResultx(femmodel,EnthalpyEnum); 95 if(isenthalpy) InputToResultx(femmodel,WatercolumnEnum); 96 //if(!isenthalpy) InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 97 InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 98 femmodel->RequestedOutputsx(requested_outputs,numoutputs); 81 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs); 99 82 } 100 83 -
issm/trunk-jpl/src/c/analyses/surfaceslope_core.cpp
r15849 r16470 14 14 /*parameters: */ 15 15 bool save_results; 16 int meshtype; 16 17 17 18 /*Recover some parameters: */ 18 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 femmodel->parameters->FindParam(&meshtype,MeshTypeEnum); 19 21 20 22 if(VerboseSolution()) _printf0_("computing slope...\n"); … … 28 30 if(save_results){ 29 31 if(VerboseSolution()) _printf0_("saving results:\n"); 30 InputToResultx(femmodel,SurfaceSlopeXEnum); 31 InputToResultx(femmodel,SurfaceSlopeYEnum); 32 if(meshtype!=Mesh2DverticalEnum){ 33 const char* outputs [] = {"SurfaceSlopeX"}; 34 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],1); 35 } 36 else{ 37 const char* outputs [] = {"SurfaceSlopeX","SurfaceSlopeY"}; 38 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],2); 39 } 32 40 } 33 41 -
issm/trunk-jpl/src/c/analyses/thermal_core.cpp
r16272 r16470 13 13 14 14 /*intermediary*/ 15 bool save_results; 16 bool dakota_analysis = false; 17 int solution_type; 15 bool save_results,isenthalpy; 16 bool dakota_analysis; 17 int solution_type,numoutputs; 18 char** requested_outputs = NULL; 18 19 19 / /first recover parameters common to all solutions20 /*first recover parameters common to all solutions*/ 20 21 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 21 22 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum); 22 23 femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum); 24 femmodel->parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum); 25 femmodel->parameters->FindParam(&numoutputs,ThermalNumRequestedOutputsEnum); 26 if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,ThermalRequestedOutputsEnum); 23 27 24 28 if(dakota_analysis && solution_type!=TransientSolutionEnum){ … … 33 37 } 34 38 35 if(VerboseSolution()) _printf0_(" setting basal Dirichlet boundary conditions\n"); 36 femmodel->UpdateBasalConstraintsEnthalpyx(); 39 if(isenthalpy){ 37 40 38 if(VerboseSolution()) _printf0_(" computing temperatures\n");39 femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);40 solutionsequence_thermal_nonlinear(femmodel);41 if(VerboseSolution()) _printf0_(" computing enthalpy\n"); 42 femmodel->SetCurrentConfiguration(EnthalpyAnalysisEnum); 43 solutionsequence_nonlinear(femmodel,true); 41 44 42 if(VerboseSolution()) _printf0_(" computing melting\n"); 43 femmodel->SetCurrentConfiguration(MeltingAnalysisEnum); 44 solutionsequence_linear(femmodel); 45 /*transfer enthalpy to enthalpy picard for the next step: */ 46 InputDuplicatex(femmodel,EnthalpyEnum,EnthalpyPicardEnum); 47 48 /*Post process*/ 49 PostprocessingEnthalpyx(femmodel); 50 } 51 else{ 52 if(VerboseSolution()) _printf0_(" setting basal Dirichlet boundary conditions\n"); 53 femmodel->UpdateBasalConstraintsEnthalpyx(); 54 55 if(VerboseSolution()) _printf0_(" computing temperatures\n"); 56 femmodel->SetCurrentConfiguration(ThermalAnalysisEnum); 57 solutionsequence_thermal_nonlinear(femmodel); 58 59 if(VerboseSolution()) _printf0_(" computing melting\n"); 60 femmodel->SetCurrentConfiguration(MeltingAnalysisEnum); 61 solutionsequence_linear(femmodel); 62 } 45 63 46 64 if(save_results){ 47 65 if(VerboseSolution()) _printf0_(" saving results\n"); 48 InputToResultx(femmodel,TemperatureEnum); 49 InputToResultx(femmodel,BasalforcingsMeltingRateEnum); 66 femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs); 50 67 } 51 68 } -
issm/trunk-jpl/src/c/analyses/transient_core.cpp
r16363 r16470 22 22 int i; 23 23 IssmDouble starttime,finaltime,dt,yts; 24 bool isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,is enthalpy,isdelta18o,isgia;24 bool isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isdelta18o,isgia; 25 25 bool save_results,dakota_analysis; 26 26 bool time_adapt=false; … … 49 49 femmodel->parameters->FindParam(&isgia,TransientIsgiaEnum); 50 50 femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum); 51 femmodel->parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum);52 51 femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum); 53 52 if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum); … … 116 115 if(VerboseSolution()) _printf0_(" computing temperatures\n"); 117 116 #ifdef _HAVE_THERMAL_ 118 if(isenthalpy==0){ 119 thermal_core(femmodel); 120 } 121 else{ 122 enthalpy_core(femmodel); 123 PostprocessingEnthalpyx(femmodel); 124 } 117 thermal_core(femmodel); 125 118 #else 126 119 _error_("ISSM was not compiled with thermal capabilities. Exiting"); … … 152 145 #endif 153 146 if(save_results){ 154 InputToResultx(femmodel,SurfaceEnum); 155 InputToResultx(femmodel,BedEnum); 156 InputToResultx(femmodel,MaskGroundediceLevelsetEnum); 147 const char* outputs [] = {"Surface","Bed","MaskGroundediceLevelset"}; 148 femmodel->RequestedOutputsx(&femmodel->results,(char**)&outputs[0],3); 157 149 } 158 150 } -
issm/trunk-jpl/src/c/classes/ElementResults/BoolElementResult.cpp
r15737 r16470 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION BoolElementResult::PatchFill{{{*/83 void BoolElementResult::PatchFill(int row, Patch* patch){84 85 /*Here, we fill the result information into the patch object. First, let's remember what is in a row86 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values87 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */88 IssmDouble IssmDoublevalue=this->value?1:0;89 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,&IssmDoublevalue,1);90 91 }92 /*}}}*/93 82 /*FUNCTION BoolElementResult::GetVectorFromResults{{{*/ 94 83 void BoolElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){ -
issm/trunk-jpl/src/c/classes/ElementResults/BoolElementResult.h
r15737 r16470 37 37 int GetStep(void){return step;}; 38 38 int NumberOfNodalValues(void); 39 void PatchFill(int row, Patch* patch);40 39 /*}}}*/ 41 40 /*BoolElementResult management: {{{*/ -
issm/trunk-jpl/src/c/classes/ElementResults/DoubleElementResult.cpp
r15737 r16470 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION DoubleElementResult::PatchFill{{{*/83 void DoubleElementResult::PatchFill(int row, Patch* patch){84 85 /*Here, we fill the result information into the patch object. First, let's remember what is in a row86 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values87 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */88 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,&this->value,1);89 90 }91 /*}}}*/92 82 /*FUNCTION DoubleElementResult::GetVectorFromResults{{{1*/ 93 83 void DoubleElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){ -
issm/trunk-jpl/src/c/classes/ElementResults/DoubleElementResult.h
r15737 r16470 37 37 int GetStep(void){return step;}; 38 38 int NumberOfNodalValues(void); 39 void PatchFill(int row, Patch* patch);40 39 41 40 /*DoubleElementResult management*/ -
issm/trunk-jpl/src/c/classes/ElementResults/ElementResult.h
r15737 r16470 8 8 /*Headers:*/ 9 9 #include "../../datastructures/datastructures.h" 10 class Patch;11 10 class Parameters; 12 11 … … 19 18 virtual int GetStep(void) = 0; 20 19 virtual int NumberOfNodalValues(void) = 0; 21 virtual void PatchFill(int row, Patch *patch)=0;22 20 virtual int InstanceEnum() = 0; 23 21 virtual void GetVectorFromResults(Vector <IssmDouble> *vector,int*doflist,int*connectivitylist,int numdof)=0; -
issm/trunk-jpl/src/c/classes/ElementResults/PentaP1ElementResult.cpp
r15737 r16470 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION PentaP1ElementResult::PatchFill{{{*/86 void PentaP1ElementResult::PatchFill(int row, Patch* patch){87 88 /*Here, we fill the result information into the patch object. First, let's remember what is in a row89 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values90 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */91 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P1Enum,this->values,6);92 93 }94 /*}}}*/95 85 /*FUNCTION PentaP1ElementResult::GetVectorFromResults{{{*/ 96 86 void PentaP1ElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){ -
issm/trunk-jpl/src/c/classes/ElementResults/PentaP1ElementResult.h
r15737 r16470 36 36 int GetStep(void){return step;}; 37 37 int NumberOfNodalValues(void); 38 void PatchFill(int row, Patch* patch);39 38 /*}}}*/ 40 39 /*PentaP1ElementResult management: {{{*/ -
issm/trunk-jpl/src/c/classes/ElementResults/TriaP1ElementResult.cpp
r15737 r16470 82 82 } 83 83 /*}}}*/ 84 /*FUNCTION TriaP1ElementResult::PatchFill{{{*/85 void TriaP1ElementResult::PatchFill(int row, Patch* patch){86 87 /*Here, we fill the result information into the patch object. First, let's remember what is in a row88 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values89 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */90 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P1Enum,this->values,3);91 92 }93 /*}}}*/94 84 /*FUNCTION TriaP1ElementResult::GetVectorFromResults{{{*/ 95 85 void TriaP1ElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){ -
issm/trunk-jpl/src/c/classes/ElementResults/TriaP1ElementResult.h
r15737 r16470 35 35 int GetStep(void){return step;}; 36 36 int NumberOfNodalValues(void); 37 void PatchFill(int row, Patch* patch);38 37 /*}}}*/ 39 38 /*TriaP1ElementResult management: {{{*/ -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16461 r16470 15 15 class DataSet; 16 16 class Parameters; 17 class Patch;18 17 class Elements; 19 18 class Loads; … … 60 59 virtual void ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0; 61 60 virtual void ComputeStrainRate(Vector<IssmDouble>* eps)=0; 62 virtual void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes)=0;63 virtual void PatchFill(int* pcount, Patch* patch)=0;64 61 virtual void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results)=0; 65 62 virtual void ResultInterpolation(int* pinterpolation,int output_enum)=0; -
issm/trunk-jpl/src/c/classes/Elements/Elements.cpp
r16469 r16470 16 16 #include "../ExternalResults/Results.h" 17 17 #include "../ExternalResults/GenericExternalResult.h" 18 #include "../Patch.h"19 18 #include "../../toolkits/toolkits.h" 20 19 #include "../../shared/shared.h" … … 61 60 } 62 61 /*}}}*/ 63 /*FUNCTION Elements::ResultsToPatch{{{*/64 Patch* Elements::ResultsToPatch(void){65 66 /*output: */67 Patch* patch=NULL;68 69 /*intermediary: */70 int i;71 int count;72 int numrows;73 int numvertices;74 int numnodes;75 int max_numvertices;76 int max_numnodes;77 int element_numvertices;78 int element_numrows;79 int element_numnodes;80 81 /*We are going to extract from the results within the elements, the desired results , and create a table82 * of patch information, that will hold, for each element that computed the result that83 * we desire, the enum_type of the result, the step and time, the id of the element, the interpolation type, the vertices ids, and the values84 * at the nodes (could be different from the vertices). This will be used for visualization purposes.85 * For example, we could build the following patch table, for velocities:86 *87 1. on a Beam element, Vx, at step 1, time .5, element id 1, interpolation type P0 (constant), vertices ids 1 and 2, one constant value 4.588 VxEnum 1 .5 1 P0 1 2 4.5 NaN NaN89 2. on a Tria element, Vz, at step 2, time .8, element id 2, interpolation type P1 (linear), vertices ids 1 3 and 4, with values at 3 nodes 4.5, 3.2, 2.590 VzEnum 2 .8 2 P1 1 3 4 4.5 3.2 2.591 * ... etc ...92 *93 * So what do we need to build the table: the maximum number of vertices included in the table,94 * and the maximum number of nodal values, as well as the number of rows. Once we have that,95 * we ask the elements to fill their own row in the table, by looping on the elememnts.96 *97 * We will use the Patch object, which will store all of the information needed, and will be able98 * to output itself to disk on its own. See object/Patch.h for format of this object.*/99 100 /*First, determine maximum number of vertices, nodes, and number of results: */101 numrows=0;102 numvertices=0;103 numnodes=0;104 105 for(i=0;i<this->Size();i++){106 107 Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(i));108 element->PatchSize(&element_numrows,&element_numvertices,&element_numnodes);109 110 numrows+=element_numrows;111 if(element_numvertices>numvertices)numvertices=element_numvertices;112 if(element_numnodes>numnodes)numnodes=element_numnodes;113 }114 115 /*Synchronize across cluster, so as to not end up with different sizes for each patch on each cpu: */116 ISSM_MPI_Reduce (&numvertices,&max_numvertices,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm() );117 ISSM_MPI_Bcast(&max_numvertices,1,ISSM_MPI_INT,0,IssmComm::GetComm());118 numvertices=max_numvertices;119 120 ISSM_MPI_Reduce (&numnodes,&max_numnodes,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm() );121 ISSM_MPI_Bcast(&max_numnodes,1,ISSM_MPI_INT,0,IssmComm::GetComm());122 numnodes=max_numnodes;123 124 /*Ok, initialize Patch object: */125 patch=new Patch(numrows,numvertices,numnodes);126 127 /*Now, go through elements, and fill the Patch object: */128 count=0;129 for(i=0;i<this->Size();i++){130 Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(i));131 element->PatchFill(&count,patch);132 }133 134 return patch;135 }136 /*}}}*/137 62 /*FUNCTION Elements::SetCurrentConfiguration{{{*/ 138 63 void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ … … 156 81 int num_procs; 157 82 158 Patch *patch = NULL;159 83 int *resultsenums = NULL; 160 84 int *resultssizes = NULL; … … 164 88 Vector<IssmDouble> *vector = NULL; 165 89 bool io_gather; 166 bool results_as_patches; 167 int numberofvertices ,numberofelements; 168 int numberofresults ,vectorsize; 90 int numberofvertices,numberofelements; 91 int numberofresults ,vectorsize; 169 92 int rank; 170 93 int minrank; … … 176 99 /*Recover parameters: */ 177 100 parameters->FindParam(&io_gather,SettingsIoGatherEnum); 178 parameters->FindParam(&results_as_patches,SettingsResultsAsPatchesEnum);179 101 parameters->FindParam(&numberofvertices,MeshNumberofverticesEnum); 180 102 parameters->FindParam(&numberofelements,MeshNumberofelementsEnum); 181 103 182 if(!results_as_patches){ 183 /*No patch here, we prepare vectors*/ 184 185 /*Get rank of first cpu that has results*/ 186 if(this->Size()) rank=my_rank; 187 else rank=num_procs; 188 ISSM_MPI_Allreduce (&rank,&minrank,1,ISSM_MPI_INT,ISSM_MPI_MIN,IssmComm::GetComm()); 189 190 /*see what the first element of this partition has in stock (this is common to all partitions)*/ 191 if(my_rank==minrank){ 192 if(this->Size()==0) _error_("Cannot write results because there is no element??"); 193 Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(0)); 194 element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults); 104 /*Get rank of first cpu that has results*/ 105 if(this->Size()) rank=my_rank; 106 else rank=num_procs; 107 ISSM_MPI_Allreduce (&rank,&minrank,1,ISSM_MPI_INT,ISSM_MPI_MIN,IssmComm::GetComm()); 108 109 /*see what the first element of this partition has in stock (this is common to all partitions)*/ 110 if(my_rank==minrank){ 111 if(this->Size()==0) _error_("Cannot write results because there is no element??"); 112 Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(0)); 113 element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults); 114 } 115 ISSM_MPI_Bcast(&numberofresults,1,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 116 117 /*Get out if there is no results. Otherwise broadcast info*/ 118 if(!numberofresults) return; 119 if(my_rank!=minrank){ 120 resultsenums=xNew<int>(numberofresults); 121 resultssizes=xNew<int>(numberofresults); 122 resultstimes=xNew<IssmDouble>(numberofresults); 123 resultssteps=xNew<int>(numberofresults); 124 } 125 ISSM_MPI_Bcast(resultsenums,numberofresults,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 126 ISSM_MPI_Bcast(resultssizes,numberofresults,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 127 ISSM_MPI_Bcast(resultstimes,numberofresults,ISSM_MPI_DOUBLE,minrank,IssmComm::GetComm()); 128 ISSM_MPI_Bcast(resultssteps,numberofresults,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 129 130 /*Loop over all results and get nodal vector*/ 131 for(int i=0;i<numberofresults;i++){ 132 133 /*Get vector for result number i*/ 134 if(resultssizes[i]==P1Enum) vectorsize=numberofvertices; 135 else if(resultssizes[i]==P0Enum) vectorsize=numberofelements; 136 else _error_("Unkown result size: " << EnumToStringx(resultssizes[i])); 137 vector=new Vector<IssmDouble>(vectorsize); 138 139 for(int j=0;j<this->Size();j++){ 140 Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(j)); 141 element->GetVectorFromResults(vector,i,resultsenums[i],resultssizes[i]); 195 142 } 196 ISSM_MPI_Bcast(&numberofresults,1,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 197 198 /*Get out if there is no results. Otherwise broadcast info*/ 199 if(!numberofresults) return; 200 if(my_rank!=minrank){ 201 resultsenums=xNew<int>(numberofresults); 202 resultssizes=xNew<int>(numberofresults); 203 resultstimes=xNew<IssmDouble>(numberofresults); 204 resultssteps=xNew<int>(numberofresults); 143 vector->Assemble(); 144 145 /*Serialize and add to results*/ 146 vector_serial=vector->ToMPISerial(); 147 results->DeleteResult(resultsenums[i],resultssteps[i]); 148 if(my_rank==0){ 149 /*No need to add this vector for all cpus*/ 150 #ifdef _HAVE_ADOLC_ 151 IssmPDouble* vector_serial_passive=xNew<IssmPDouble>(vectorsize); 152 for(int k=0;k<vectorsize;k++)vector_serial_passive[k]=reCast<IssmPDouble>(vector_serial[k]); 153 results->AddResult(new GenericExternalResult<IssmPDouble*>(results->Size()+1,resultsenums[i],vector_serial_passive,vectorsize,1,resultssteps[i],resultstimes[i])); 154 xDelete<IssmPDouble>(vector_serial_passive); 155 #else 156 results->AddResult(new GenericExternalResult<IssmPDouble*>(results->Size()+1,resultsenums[i],vector_serial,vectorsize,1,resultssteps[i],resultstimes[i])); 157 #endif 205 158 } 206 ISSM_MPI_Bcast(resultsenums,numberofresults,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 207 ISSM_MPI_Bcast(resultssizes,numberofresults,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 208 ISSM_MPI_Bcast(resultstimes,numberofresults,ISSM_MPI_DOUBLE,minrank,IssmComm::GetComm()); 209 ISSM_MPI_Bcast(resultssteps,numberofresults,ISSM_MPI_INT,minrank,IssmComm::GetComm()); 210 211 /*Loop over all results and get nodal vector*/ 212 for(int i=0;i<numberofresults;i++){ 213 214 /*Get vector for result number i*/ 215 if(resultssizes[i]==P1Enum) vectorsize=numberofvertices; 216 else if(resultssizes[i]==P0Enum) vectorsize=numberofelements; 217 else _error_("Unkown result size: " << EnumToStringx(resultssizes[i])); 218 vector=new Vector<IssmDouble>(vectorsize); 219 220 for(int j=0;j<this->Size();j++){ 221 Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(j)); 222 element->GetVectorFromResults(vector,i,resultsenums[i],resultssizes[i]); 223 } 224 vector->Assemble(); 225 226 /*Serialize and add to results*/ 227 vector_serial=vector->ToMPISerial(); 228 results->DeleteResult(resultsenums[i],resultssteps[i]); 229 if(my_rank==0){ 230 /*No need to add this vector for all cpus*/ 231 #ifdef _HAVE_ADOLC_ 232 IssmPDouble* vector_serial_passive=xNew<IssmPDouble>(vectorsize); 233 for(int k=0;k<vectorsize;k++)vector_serial_passive[k]=reCast<IssmPDouble>(vector_serial[k]); 234 results->AddResult(new GenericExternalResult<IssmPDouble*>(results->Size()+1,resultsenums[i],vector_serial_passive,vectorsize,1,resultssteps[i],resultstimes[i])); 235 xDelete<IssmPDouble>(vector_serial_passive); 236 #else 237 results->AddResult(new GenericExternalResult<IssmPDouble*>(results->Size()+1,resultsenums[i],vector_serial,vectorsize,1,resultssteps[i],resultstimes[i])); 238 #endif 239 } 240 241 /*clean up*/ 242 delete vector; 243 xDelete<IssmDouble>(vector_serial); 244 } 245 } 246 else{ 247 /*create patch object out of all results in this dataset: */ 248 patch=this->ResultsToPatch(); 249 250 /*Gather onto master cpu 0, if needed: */ 251 if(io_gather)patch->Gather(); 252 253 /*create result object and add to results dataset:*/ 254 if (patch->maxvertices && patch->maxnodes){ 255 results->AddObject(new GenericExternalResult<int>(results->Size()+1,PatchVerticesEnum,patch->maxvertices,1,0)); 256 results->AddObject(new GenericExternalResult<int>(results->Size()+1,PatchNodesEnum, patch->maxnodes,1,0)); 257 #ifdef _HAVE_ADOLC_ 258 IssmPDouble* values_passive=xNew<IssmPDouble>(patch->numrows*patch->numcols); 259 for(int k=0;k<(patch->numrows*patch->numcols);k++)values_passive[k]=reCast<IssmPDouble>(patch->values[k]); 260 results->AddObject(new GenericExternalResult<double*>(results->Size()+1,PatchEnum, values_passive,patch->numrows,patch->numcols,1,0)); 261 xDelete<IssmPDouble>(values_passive); 262 #else 263 results->AddObject(new GenericExternalResult<double*>(results->Size()+1,PatchEnum, patch->values,patch->numrows,patch->numcols,1,0)); 264 #endif 265 } 159 160 /*clean up*/ 161 delete vector; 162 xDelete<IssmDouble>(vector_serial); 266 163 } 267 164 … … 271 168 xDelete<int>(resultssteps); 272 169 xDelete<IssmDouble>(resultstimes); 273 delete patch;274 170 } 275 171 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Elements.h
r15128 r16470 9 9 class Loads; 10 10 class Nodes; 11 class Patch;12 11 class Results; 13 12 … … 30 29 void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 31 30 void ToResults(Results* results,Parameters* parameters); 32 Patch* ResultsToPatch(void);33 31 int NumberOfElements(void); 34 32 void InputDuplicate(int input_enum,int output_enum); -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16468 r16470 2882 2882 } 2883 2883 /*}}}*/ 2884 /*FUNCTION Penta::PatchFill{{{*/2885 void Penta::PatchFill(int* pcount, Patch* patch){2886 2887 int i,count;2888 int vertices_ids[6];2889 2890 /*recover pointer: */2891 count=*pcount;2892 2893 /*will be needed later: */2894 for(i=0;i<6;i++) vertices_ids[i]=vertices[i]->Id(); //vertices id start at column 3 of the patch.2895 2896 for(i=0;i<this->results->Size();i++){2897 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);2898 2899 /*For this result,fill the information in the Patch object (element id + vertices ids), and then hand2900 *it to the result object, to fill the rest: */2901 patch->fillelementinfo(count,this->sid+1,vertices_ids,6);2902 elementresult->PatchFill(count,patch);2903 2904 /*increment counter: */2905 count++;2906 }2907 2908 /*Assign output pointers:*/2909 *pcount=count;2910 }/*}}}*/2911 /*FUNCTION Penta::PatchSize{{{*/2912 void Penta::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){2913 2914 int i;2915 int numrows = 0;2916 int numnodes = 0;2917 int temp_numnodes = 0;2918 2919 /*Go through all the results objects, and update the counters: */2920 for (i=0;i<this->results->Size();i++){2921 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);2922 /*first, we have one more result: */2923 numrows++;2924 /*now, how many vertices and how many nodal values for this result? :*/2925 temp_numnodes=elementresult->NumberOfNodalValues(); //ask result object.2926 if(temp_numnodes>numnodes)numnodes=temp_numnodes;2927 }2928 2929 /*Assign output pointers:*/2930 *pnumrows=numrows;2931 *pnumvertices=NUMVERTICES;2932 *pnumnodes=numnodes;2933 }2934 /*}}}*/2935 2884 /*FUNCTION Penta::PositiveDegreeDay{{{*/ 2936 2885 void Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){ … … 3436 3385 bool dakota_analysis; 3437 3386 bool isFS; 3438 IssmDouble beta,heatcapacity,referencetemperature,meltingpoint,latentheat;3439 3387 int numnodes; 3440 3388 int* penta_node_ids = NULL; … … 3444 3392 iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum); 3445 3393 iomodel->Constant(&isFS,FlowequationIsFSEnum); 3446 iomodel->Constant(&beta,MaterialsBetaEnum);3447 iomodel->Constant(&heatcapacity,MaterialsHeatcapacityEnum);3448 iomodel->Constant(&referencetemperature,ConstantsReferencetemperatureEnum);3449 iomodel->Constant(&meltingpoint,MaterialsMeltingpointEnum);3450 iomodel->Constant(&latentheat,MaterialsLatentheatEnum);3451 3394 3452 3395 /*Checks if debuging*/ … … 3636 3579 } 3637 3580 break; 3638 3639 3640 case EnthalpyAnalysisEnum:3641 /*Initialize mesh velocity*/3642 for(i=0;i<6;i++)nodeinputs[i]=0;3643 if (iomodel->Data(TemperatureEnum) && iomodel->Data(WaterfractionEnum) && iomodel->Data(PressureEnum)) {3644 for(i=0;i<6;i++){3645 if(iomodel->Data(TemperatureEnum)[penta_vertex_ids[i]-1] < meltingpoint-beta*iomodel->Data(PressureEnum)[penta_vertex_ids[i]-1]){3646 nodeinputs[i]=heatcapacity*(iomodel->Data(TemperatureEnum)[penta_vertex_ids[i]-1]-referencetemperature);3647 }3648 else nodeinputs[i]=heatcapacity*3649 (meltingpoint-beta*iomodel->Data(PressureEnum)[penta_vertex_ids[i]-1]-referencetemperature)3650 +latentheat*iomodel->Data(WaterfractionEnum)[penta_vertex_ids[i]-1];3651 }3652 this->inputs->AddInput(new PentaInput(EnthalpyEnum,nodeinputs,P1Enum));3653 }3654 else _error_("temperature and waterfraction required for the enthalpy solution");3655 break;3656 3657 3581 default: 3658 3582 /*No update for other solution types*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16461 r16470 103 103 void ResultInterpolation(int* pinterpolation,int output_enum); 104 104 void ResultToVector(Vector<IssmPDouble>* vector,int output_enum); 105 void PatchFill(int* pcount, Patch* patch);106 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);107 105 void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm); 108 106 void ResetCoordinateSystem(void); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16461 r16470 117 117 void RequestedOutput(int output_enum,int step,IssmDouble time){_error_("not implemented yet");}; 118 118 void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results){_error_("not implemented yet");}; 119 void PatchFill(int* pcount, Patch* patch){_error_("not implemented yet");};120 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){_error_("not implemented yet");};121 119 void ResultInterpolation(int* pinterpolation,int output_enum){_error_("not implemented");}; 122 120 void ResultToVector(Vector<IssmPDouble>* vector,int output_enum){_error_("not implemented");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16468 r16470 2449 2449 if(found)*pvalue=value; 2450 2450 return found; 2451 }2452 /*}}}*/2453 /*FUNCTION Tria::PatchFill{{{*/2454 void Tria::PatchFill(int* prow, Patch* patch){2455 2456 int i,row;2457 int vertices_ids[3];2458 2459 /*recover pointer: */2460 row=*prow;2461 2462 for(i=0;i<3;i++) vertices_ids[i]=vertices[i]->Id(); //vertices id start at column 3 of the patch.2463 2464 for(i=0;i<this->results->Size();i++){2465 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);2466 2467 /*For this result,fill the information in the Patch object (element id + vertices ids), and then hand2468 *it to the result object, to fill the rest: */2469 patch->fillelementinfo(row,this->sid+1,vertices_ids,3);2470 elementresult->PatchFill(row,patch);2471 2472 /*increment rower: */2473 row++;2474 }2475 2476 /*Assign output pointers:*/2477 *prow=row;2478 }2479 /*}}}*/2480 /*FUNCTION Tria::PatchSize{{{*/2481 void Tria::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){2482 2483 int i;2484 int numrows = 0;2485 int numnodes = 0;2486 int temp_numnodes = 0;2487 2488 /*Go through all the results objects, and update the counters: */2489 for (i=0;i<this->results->Size();i++){2490 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);2491 /*first, we have one more result: */2492 numrows++;2493 /*now, how many vertices and how many nodal values for this result? :*/2494 temp_numnodes=elementresult->NumberOfNodalValues(); //ask result object.2495 if(temp_numnodes>numnodes)numnodes=temp_numnodes;2496 }2497 2498 /*Assign output pointers:*/2499 *pnumrows=numrows;2500 *pnumvertices=NUMVERTICES;2501 *pnumnodes=numnodes;2502 2451 } 2503 2452 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16461 r16470 110 110 void ResultInterpolation(int* pinterpolation,int output_enum); 111 111 void ResultToVector(Vector<IssmPDouble>* vector,int output_enum); 112 void PatchFill(int* pcount, Patch* patch);113 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);114 112 void ResetCoordinateSystem(void); 115 113 void SmbGradients(); -
issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
r16469 r16470 93 93 } 94 94 /*}}}*/ 95 GenericExternalResult(int in_id, char* in_enum_string,ResultType in_value,int in_step, IssmDouble in_time){ /*{{{*/95 GenericExternalResult(int in_id,const char* in_enum_string,ResultType in_value,int in_step, IssmDouble in_time){ /*{{{*/ 96 96 id = in_id; 97 97 enum_type = -1; -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r16468 r16470 533 533 IssmDouble time; 534 534 IssmDouble double_result; 535 c har*output_string = NULL;535 const char *output_string = NULL; 536 536 537 537 /*recover results*/ -
issm/trunk-jpl/src/c/classes/classes.h
r16388 r16470 117 117 #include "./DofIndexing.h" 118 118 #include "./IoModel.h" 119 #include "./Patch.h"120 119 #include "./Update.h" 121 120 #include "./FemModel.h" -
issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
r16388 r16470 75 75 parameters->AddObject(iomodel->CopyConstantObject(MeshNumberofverticesEnum)); 76 76 parameters->AddObject(iomodel->CopyConstantObject(SettingsIoGatherEnum)); 77 parameters->AddObject(iomodel->CopyConstantObject(SettingsResultsAsPatchesEnum));78 77 parameters->AddObject(iomodel->CopyConstantObject(GroundinglineMigrationEnum)); 79 78 parameters->AddObject(iomodel->CopyConstantObject(TransientIsstressbalanceEnum)); … … 152 151 iomodel->DeleteData(&requestedoutputs,numoutputs,MasstransportRequestedOutputsEnum); 153 152 153 iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum); 154 parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs)); 155 if(numoutputs)parameters->AddObject(new StringArrayParam(ThermalRequestedOutputsEnum,requestedoutputs,numoutputs)); 156 iomodel->DeleteData(&requestedoutputs,numoutputs,ThermalRequestedOutputsEnum); 157 154 158 /*Deal with mass flux segments: {{{*/ 155 159 iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum); -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Enthalpy/UpdateElementsEnthalpy.cpp
r16291 r16470 12 12 void UpdateElementsEnthalpy(Elements* elements, IoModel* iomodel,int analysis_counter,int analysis_type){ 13 13 14 bool dakota_analysis; 15 bool isenthalpy; 16 14 17 /*Now, is the model 3d? otherwise, do nothing: */ 15 18 if(iomodel->meshtype==Mesh2DhorizontalEnum)return; 19 20 /*Is enthalpy requested?*/ 21 iomodel->Constant(&isenthalpy,ThermalIsenthalpyEnum); 22 if(!isenthalpy) return; 16 23 17 24 /*Fetch data needed: */ … … 28 35 } 29 36 30 bool dakota_analysis;31 37 iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum); 32 38 … … 47 53 iomodel->FetchDataToInput(elements,TemperatureEnum); 48 54 iomodel->FetchDataToInput(elements,WaterfractionEnum); 55 iomodel->FetchDataToInput(elements,EnthalpyEnum); 49 56 iomodel->FetchDataToInput(elements,BasalforcingsGeothermalfluxEnum); 50 57 iomodel->FetchDataToInput(elements,WatercolumnEnum); -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp
r16291 r16470 9 9 #include "../ModelProcessorx.h" 10 10 11 void 11 void CreateNodesThermal(Nodes** pnodes, IoModel* iomodel){ 12 12 13 13 if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum); -
issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp
r16388 r16470 8 8 #include "../../classes/classes.h" 9 9 10 IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,c har* output_string){10 IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,const char* output_string){ 11 11 12 int i; 13 Definition* definition=NULL; 14 DataSet* output_definitions=NULL; 15 IssmDouble return_value; 12 Definition *definition = NULL; 13 DataSet *output_definitions = NULL; 14 IssmDouble return_value; 16 15 17 16 /*Ok, go find the output definitions dataset in the parameters, where our responses are hiding: */ … … 19 18 20 19 /*Now, go through the output definitions, and retrieve the object which corresponds to our requested response, output_string: */ 21 for (i=0;i<output_definitions->Size();i++){20 for(int i=0;i<output_definitions->Size();i++){ 22 21 23 22 definition=dynamic_cast<Definition*>(output_definitions->GetObjectByOffset(i)); -
issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.h
r16388 r16470 8 8 9 9 /* local prototypes: */ 10 IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,c har* output_string);10 IssmDouble OutputDefinitionsResponsex(FemModel* femmodel,const char* output_string); 11 11 12 12 #endif /* _OUTPUTDEFINITIONSRESPONSEXX_H */ -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r16442 r16470 50 50 StressbalanceIsnewtonEnum, 51 51 StressbalanceMaxiterEnum, 52 StressbalanceNumRequestedOutputsEnum,53 52 StressbalancePenaltyFactorEnum, 54 53 StressbalanceReferentialEnum, 55 54 StressbalanceReltolEnum, 55 StressbalanceNumRequestedOutputsEnum, 56 56 StressbalanceRequestedOutputsEnum, 57 57 StressbalanceRestolEnum, … … 228 228 SettingsLowmemEnum, 229 229 SettingsOutputFrequencyEnum, 230 SettingsResultsAsPatchesEnum,231 230 SettingsWaitonlockEnum, 232 231 SurfaceforcingsDelta18oEnum, … … 258 257 SurfaceforcingsBNegEnum, 259 258 ThermalIsenthalpyEnum, 260 259 ThermalIsdynamicbasalspcEnum, 261 260 ThermalMaxiterEnum, 262 261 ThermalPenaltyFactorEnum, … … 265 264 ThermalSpctemperatureEnum, 266 265 ThermalStabilizationEnum, 266 ThermalNumRequestedOutputsEnum, 267 ThermalRequestedOutputsEnum, 267 268 GiaMantleViscosityEnum, 268 269 GiaLithosphereThicknessEnum, … … 308 309 StressbalanceVerticalAnalysisEnum, 309 310 EnthalpyAnalysisEnum, 310 EnthalpySolutionEnum,311 311 FlaimAnalysisEnum, 312 312 FlaimSolutionEnum, … … 539 539 IntExternalResultEnum, 540 540 JEnum, 541 PatchEnum,542 PatchNodesEnum,543 PatchVerticesEnum,544 541 PentaP1ElementResultEnum, 545 542 StringExternalResultEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r16442 r16470 58 58 case StressbalanceIsnewtonEnum : return "StressbalanceIsnewton"; 59 59 case StressbalanceMaxiterEnum : return "StressbalanceMaxiter"; 60 case StressbalanceNumRequestedOutputsEnum : return "StressbalanceNumRequestedOutputs";61 60 case StressbalancePenaltyFactorEnum : return "StressbalancePenaltyFactor"; 62 61 case StressbalanceReferentialEnum : return "StressbalanceReferential"; 63 62 case StressbalanceReltolEnum : return "StressbalanceReltol"; 63 case StressbalanceNumRequestedOutputsEnum : return "StressbalanceNumRequestedOutputs"; 64 64 case StressbalanceRequestedOutputsEnum : return "StressbalanceRequestedOutputs"; 65 65 case StressbalanceRestolEnum : return "StressbalanceRestol"; … … 236 236 case SettingsLowmemEnum : return "SettingsLowmem"; 237 237 case SettingsOutputFrequencyEnum : return "SettingsOutputFrequency"; 238 case SettingsResultsAsPatchesEnum : return "SettingsResultsAsPatches";239 238 case SettingsWaitonlockEnum : return "SettingsWaitonlock"; 240 239 case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o"; … … 273 272 case ThermalSpctemperatureEnum : return "ThermalSpctemperature"; 274 273 case ThermalStabilizationEnum : return "ThermalStabilization"; 274 case ThermalNumRequestedOutputsEnum : return "ThermalNumRequestedOutputs"; 275 case ThermalRequestedOutputsEnum : return "ThermalRequestedOutputs"; 275 276 case GiaMantleViscosityEnum : return "GiaMantleViscosity"; 276 277 case GiaLithosphereThicknessEnum : return "GiaLithosphereThickness"; … … 314 315 case StressbalanceVerticalAnalysisEnum : return "StressbalanceVerticalAnalysis"; 315 316 case EnthalpyAnalysisEnum : return "EnthalpyAnalysis"; 316 case EnthalpySolutionEnum : return "EnthalpySolution";317 317 case FlaimAnalysisEnum : return "FlaimAnalysis"; 318 318 case FlaimSolutionEnum : return "FlaimSolution"; … … 529 529 case IntExternalResultEnum : return "IntExternalResult"; 530 530 case JEnum : return "J"; 531 case PatchEnum : return "Patch";532 case PatchNodesEnum : return "PatchNodes";533 case PatchVerticesEnum : return "PatchVertices";534 531 case PentaP1ElementResultEnum : return "PentaP1ElementResult"; 535 532 case StringExternalResultEnum : return "StringExternalResult"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r16442 r16470 58 58 else if (strcmp(name,"StressbalanceIsnewton")==0) return StressbalanceIsnewtonEnum; 59 59 else if (strcmp(name,"StressbalanceMaxiter")==0) return StressbalanceMaxiterEnum; 60 else if (strcmp(name,"StressbalanceNumRequestedOutputs")==0) return StressbalanceNumRequestedOutputsEnum;61 60 else if (strcmp(name,"StressbalancePenaltyFactor")==0) return StressbalancePenaltyFactorEnum; 62 61 else if (strcmp(name,"StressbalanceReferential")==0) return StressbalanceReferentialEnum; 63 62 else if (strcmp(name,"StressbalanceReltol")==0) return StressbalanceReltolEnum; 63 else if (strcmp(name,"StressbalanceNumRequestedOutputs")==0) return StressbalanceNumRequestedOutputsEnum; 64 64 else if (strcmp(name,"StressbalanceRequestedOutputs")==0) return StressbalanceRequestedOutputsEnum; 65 65 else if (strcmp(name,"StressbalanceRestol")==0) return StressbalanceRestolEnum; … … 239 239 else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum; 240 240 else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum; 241 else if (strcmp(name,"SettingsResultsAsPatches")==0) return SettingsResultsAsPatchesEnum;242 241 else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum; 243 242 else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum; … … 260 259 else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum; 261 260 else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum; 261 else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum; 262 262 else stage=3; 263 263 } 264 264 if(stage==3){ 265 if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum; 266 else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum; 265 if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum; 267 266 else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum; 268 267 else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum; … … 279 278 else if (strcmp(name,"ThermalSpctemperature")==0) return ThermalSpctemperatureEnum; 280 279 else if (strcmp(name,"ThermalStabilization")==0) return ThermalStabilizationEnum; 280 else if (strcmp(name,"ThermalNumRequestedOutputs")==0) return ThermalNumRequestedOutputsEnum; 281 else if (strcmp(name,"ThermalRequestedOutputs")==0) return ThermalRequestedOutputsEnum; 281 282 else if (strcmp(name,"GiaMantleViscosity")==0) return GiaMantleViscosityEnum; 282 283 else if (strcmp(name,"GiaLithosphereThickness")==0) return GiaLithosphereThicknessEnum; … … 320 321 else if (strcmp(name,"StressbalanceVerticalAnalysis")==0) return StressbalanceVerticalAnalysisEnum; 321 322 else if (strcmp(name,"EnthalpyAnalysis")==0) return EnthalpyAnalysisEnum; 322 else if (strcmp(name,"EnthalpySolution")==0) return EnthalpySolutionEnum;323 323 else if (strcmp(name,"FlaimAnalysis")==0) return FlaimAnalysisEnum; 324 324 else if (strcmp(name,"FlaimSolution")==0) return FlaimSolutionEnum; … … 541 541 else if (strcmp(name,"IntExternalResult")==0) return IntExternalResultEnum; 542 542 else if (strcmp(name,"J")==0) return JEnum; 543 else if (strcmp(name,"Patch")==0) return PatchEnum;544 else if (strcmp(name,"PatchNodes")==0) return PatchNodesEnum;545 else if (strcmp(name,"PatchVertices")==0) return PatchVerticesEnum;546 543 else if (strcmp(name,"PentaP1ElementResult")==0) return PentaP1ElementResultEnum; 547 544 else if (strcmp(name,"StringExternalResult")==0) return StringExternalResultEnum; -
issm/trunk-jpl/src/m/classes/initialization.m
r16431 r16470 56 56 md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]); 57 57 end 58 if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy) | solution==EnthalpySolutionEnum(),58 if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy) 59 59 md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]); 60 60 md = checkfield(md,'initialization.watercolumn' ,'>=',0,'size',[md.mesh.numberofvertices 1]); … … 106 106 WriteData(fid,'data',obj.epl_head,'format','DoubleMat','mattype',1,'enum',EplHeadEnum); 107 107 WriteData(fid,'data',obj.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum); 108 109 if md.thermal.isenthalpy, 110 tpmp = md.materials.meltingpoint - md.materials.beta*md.initialization.pressure; 111 pos = find(md.initialization.temperature>tpmp); 112 enthalpy = md.materials.heatcapacity*(md.initialization.temperature-md.constants.referencetemperature); 113 enthalpy(pos) = md.materials.heatcapacity*tpmp(pos) - md.constants.referencetemperature + md.materials.latentheat*md.initialization.waterfraction(pos); 114 WriteData(fid,'data',enthalpy,'format','DoubleMat','mattype',1,'enum',EnthalpyEnum()); 115 end 108 116 end % }}} 109 117 end -
issm/trunk-jpl/src/m/classes/initialization.py
r16431 r16470 68 68 md = checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices]) 69 69 md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices]) 70 if (EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy) or solution==EnthalpySolutionEnum():70 if (EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy): 71 71 md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices]) 72 72 md = checkfield(md,'initialization.watercolumn' ,'>=',0,'size',[md.mesh.numberofvertices]) … … 87 87 WriteData(fid,'data',self.watercolumn,'format','DoubleMat','mattype',1,'enum',WatercolumnEnum()) 88 88 WriteData(fid,'data',self.sediment_head,'format','DoubleMat','mattype',1,'enum',SedimentHeadEnum()) 89 90 if md.thermal.isenthalpy: 91 tpmp = md.materials.meltingpoint - md.materials.beta*md.initialization.pressure; 92 pos = numpy.nonzero(md.initialization.temperature > tpmp)[0] 93 enthalpy = md.materials.heatcapacity*(md.initialization.temperature-md.constants.referencetemperature); 94 enthalpy[pos] = md.materials.heatcapacity*tpmp[pos].reshape(-1,1) - md.constants.referencetemperature + md.materials.latentheat*md.initialization.waterfraction[pos].reshape(-1,1) 95 WriteData(fid,'data',enthalpy,'format','DoubleMat','mattype',1,'enum',EnthalpyEnum()); 96 89 97 # }}} -
issm/trunk-jpl/src/m/classes/masstransport.m
r16464 r16470 60 60 end 61 61 end % }}} 62 function list =defaultoutputs(self,md) % {{{62 function list = defaultoutputs(self,md) % {{{ 63 63 64 64 list = {'Thickness','Surface','Bed'}; -
issm/trunk-jpl/src/m/classes/settings.m
r15643 r16470 8 8 io_gather = 0; 9 9 lowmem = 0; 10 results_as_patches = 0;11 10 output_frequency = 0; 12 11 waitonlock = 0; … … 38 37 obj.output_frequency=1; 39 38 40 %do not use patches by default (difficult to plot)41 obj.results_as_patches=0;42 43 39 %this option can be activated to load automatically the results 44 40 %onto the model after a parallel run by waiting for the lock file … … 55 51 md = checkfield(md,'settings.io_gather','numel',[1],'values',[0 1]); 56 52 md = checkfield(md,'settings.lowmem','numel',[1],'values',[0 1]); 57 md = checkfield(md,'settings.results_as_patches','numel',[1],'values',[0 1]);58 53 md = checkfield(md,'settings.output_frequency','numel',[1],'>=',1); 59 54 md = checkfield(md,'settings.waitonlock','numel',[1]); … … 65 60 fielddisplay(obj,'io_gather','I/O gathering strategy for result outputs (default 1)'); 66 61 fielddisplay(obj,'lowmem','is the memory limited ? (0 or 1)'); 67 fielddisplay(obj,'results_as_patches','provide results as patches for each element (0 or 1)');68 62 fielddisplay(obj,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps'); 69 63 fielddisplay(obj,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)'); … … 78 72 WriteData(fid,'object',obj,'fieldname','io_gather','format','Boolean'); 79 73 WriteData(fid,'object',obj,'fieldname','lowmem','format','Boolean'); 80 WriteData(fid,'object',obj,'fieldname','results_as_patches','format','Boolean');81 74 WriteData(fid,'object',obj,'fieldname','output_frequency','format','Integer'); 82 75 if obj.waitonlock>0, -
issm/trunk-jpl/src/m/classes/settings.py
r15131 r16470 15 15 self.io_gather = 0 16 16 self.lowmem = 0 17 self.results_as_patches = 018 17 self.output_frequency = 0 19 18 self.waitonlock = 0 … … 28 27 string="%s\n%s"%(string,fielddisplay(self,"io_gather","I/O gathering strategy for result outputs (default 1)")) 29 28 string="%s\n%s"%(string,fielddisplay(self,"lowmem","is the memory limited ? (0 or 1)")) 30 string="%s\n%s"%(string,fielddisplay(self,"results_as_patches","provide results as patches for each element (0 or 1)"))31 29 string="%s\n%s"%(string,fielddisplay(self,"output_frequency","frequency at which results are saved in all solutions with multiple time_steps")) 32 30 string="%s\n%s"%(string,fielddisplay(self,"waitonlock","maximum number of minutes to wait for batch results, or return 0")) … … 44 42 self.output_frequency=1 45 43 46 #do not use patches by default (difficult to plot)47 self.results_as_patches=048 49 44 #this option can be activated to load automatically the results 50 45 #onto the model after a parallel run by waiting for the lock file … … 58 53 md = checkfield(md,'settings.io_gather','numel',[1],'values',[0,1]) 59 54 md = checkfield(md,'settings.lowmem','numel',[1],'values',[0,1]) 60 md = checkfield(md,'settings.results_as_patches','numel',[1],'values',[0,1])61 55 md = checkfield(md,'settings.output_frequency','numel',[1],'>=',1) 62 56 md = checkfield(md,'settings.waitonlock','numel',[1]) … … 67 61 WriteData(fid,'object',self,'fieldname','io_gather','format','Boolean') 68 62 WriteData(fid,'object',self,'fieldname','lowmem','format','Boolean') 69 WriteData(fid,'object',self,'fieldname','results_as_patches','format','Boolean')70 63 WriteData(fid,'object',self,'fieldname','output_frequency','format','Integer') 71 64 if self.waitonlock>0: -
issm/trunk-jpl/src/m/classes/steadystate.m
r16458 r16470 25 25 %Relative tolerance for the steadystate convertgence 26 26 obj.reltol=0.01; 27 28 %default output 29 obj.requested_outputs={'default'}; 30 end % }}} 31 function list=defaultoutputs(self,md) % {{{ 32 33 list = [md.stressbalance.defaultoutputs(md) md.thermal.defaultoutputs(md)]; 34 27 35 end % }}} 28 36 function md = checkconsistency(obj,md,solution,analyses) % {{{ … … 51 59 WriteData(fid,'object',obj,'fieldname','reltol','format','Double'); 52 60 WriteData(fid,'object',obj,'fieldname','maxiter','format','Integer'); 53 WriteData(fid,'object',obj,'fieldname','requested_outputs','format','StringArray'); 61 62 %process requested outputs 63 outputs = obj.requested_outputs; 64 pos = find(ismember(outputs,'default')); 65 if ~isempty(pos), 66 outputs(pos) = []; %remove 'default' from outputs 67 outputs = [outputs defaultoutputs(obj,md)]; %add defaults 68 end 69 WriteData(fid,'data',outputs,'enum',SteadystateRequestedOutputsEnum,'format','StringArray'); 54 70 end % }}} 55 71 end -
issm/trunk-jpl/src/m/classes/steadystate.py
r16458 r16470 29 29 return string 30 30 #}}} 31 def defaultoutputs(self,md): # {{{ 32 33 return md.stressbalance.defaultoutputs(md)+md.thermal.defaultoutputs(md) 34 35 #}}} 31 36 def setdefaultparameters(self): # {{{ 32 37 … … 37 42 self.reltol=0.01 38 43 44 #default output 45 self.requested_outputs=['default'] 39 46 return self 40 47 #}}} … … 58 65 WriteData(fid,'object',self,'fieldname','reltol','format','Double') 59 66 WriteData(fid,'object',self,'fieldname','maxiter','format','Integer') 60 WriteData(fid,'object',self,'fieldname','requested_outputs','format','StringArray') 67 68 #process requested outputs 69 outputs = self.requested_outputs 70 indices = [i for i, x in enumerate(outputs) if x == 'default'] 71 if len(indices) > 0: 72 outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:] 73 outputs =outputscopy 74 print outputs 75 WriteData(fid,'data',outputs,'enum',SteadystateRequestedOutputsEnum(),'format','StringArray') 61 76 # }}} -
issm/trunk-jpl/src/m/classes/thermal.m
r16322 r16470 14 14 isenthalpy = 0; 15 15 isdynamicbasalspc = 0; 16 requested_outputs = {}; 16 17 end 17 18 methods … … 23 24 error('constructor not supported'); 24 25 end 26 end % }}} 27 function list = defaultoutputs(self,md) % {{{ 28 29 if self.isenthalpy, 30 list = {'Enthalpy','Temperature','Waterfraction','Watercolumn','BasalforcingsMeltingRate'}; 31 else 32 list = {'Temperature','BasalforcingsMeltingRate'}; 33 end 34 25 35 end % }}} 26 36 function obj = setdefaultparameters(obj) % {{{ … … 43 53 %will basal boundary conditions be set dynamically 44 54 obj.isdynamicbasalspc=0; 55 56 %default output 57 obj.requested_outputs={'default'}; 45 58 end % }}} 46 59 function md = checkconsistency(obj,md,solution,analyses) % {{{ … … 51 64 md = checkfield(md,'thermal.stabilization','numel',[1],'values',[0 1 2]); 52 65 md = checkfield(md,'thermal.spctemperature','forcing',1); 53 if (ismember(EnthalpyAnalysisEnum(),analyses) & (md.thermal.isenthalpy | solution==EnthalpySolutionEnum())& md.mesh.dimension==3),66 if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & md.mesh.dimension==3), 54 67 pos=find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN); 55 68 replicate=repmat(md.geometry.surface-md.mesh.z,1,size(md.thermal.spctemperature,2)); … … 61 74 end 62 75 end 76 77 md = checkfield(md,'thermal.requested_outputs','stringrow',1); 63 78 end % }}} 64 79 function disp(obj) % {{{ … … 73 88 fielddisplay(obj,'isenthalpy','use an enthalpy formulation to include temperate ice (default is 0)'); 74 89 fielddisplay(obj,'isdynamicbasalspc',['enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)']); 90 fielddisplay(obj,'requested_outputs','additional outputs requested'); 75 91 76 92 end % }}} … … 84 100 WriteData(fid,'object',obj,'fieldname','isenthalpy','format','Boolean'); 85 101 WriteData(fid,'object',obj,'fieldname','isdynamicbasalspc','format','Boolean'); 102 103 %process requested outputs 104 outputs = obj.requested_outputs; 105 pos = find(ismember(outputs,'default')); 106 if ~isempty(pos), 107 outputs(pos) = []; %remove 'default' from outputs 108 outputs = [outputs defaultoutputs(obj,md)]; %add defaults 109 end 110 WriteData(fid,'data',outputs,'enum',ThermalRequestedOutputsEnum(),'format','StringArray'); 86 111 end % }}} 87 112 end -
issm/trunk-jpl/src/m/classes/thermal.py
r16274 r16470 22 22 self.isenthalpy = 0 23 23 self.isdynamicbasalspc = 0; 24 self.requested_outputs = [] 24 25 25 26 #set defaults … … 36 37 string="%s\n%s"%(string,fielddisplay(self,'isenthalpy','use an enthalpy formulation to include temperate ice (default is 0)')) 37 38 string="%s\n%s"%(string,fielddisplay(self,'isdynamicbasalspc','enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)')) 39 string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','additional outputs requested')) 38 40 return string 39 41 #}}} 42 def defaultoutputs(self,md): # {{{ 43 44 if self.isenthalpy: 45 return ['Enthalpy','Temperature','Waterfraction','Watercolumn','BasalforcingsMeltingRate'] 46 else: 47 return ['Temperature','BasalforcingsMeltingRate'] 48 49 #}}} 40 50 def setdefaultparameters(self): # {{{ 41 51 … … 57 67 #will basal boundary conditions be set dynamically 58 68 self.isdynamicbasalspc=0; 69 70 #default output 71 self.requested_outputs=['default'] 59 72 return self 60 73 … … 68 81 md = checkfield(md,'thermal.stabilization','numel',[1],'values',[0,1,2]) 69 82 md = checkfield(md,'thermal.spctemperature','forcing',1) 70 if EnthalpyAnalysisEnum() in analyses and (md.thermal.isenthalpy or solution==EnthalpySolutionEnum())and md.mesh.dimension==3:83 if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and md.mesh.dimension==3: 71 84 pos=numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices]))) 72 85 replicate=numpy.tile(md.geometry.surface-md.mesh.z,(1,numpy.size(md.thermal.spctemperature,axis=1))) … … 74 87 md = checkfield(md,'thermal.isenthalpy','numel',[1],'values',[0,1]) 75 88 md = checkfield(md,'thermal.isdynamicbasalspc','numel',[1],'values',[0,1]); 89 md = checkfield(md,'thermal.requested_outputs','stringrow',1) 76 90 77 91 return md … … 86 100 WriteData(fid,'object',self,'fieldname','isenthalpy','format','Boolean') 87 101 WriteData(fid,'object',self,'fieldname','isdynamicbasalspc','format','Boolean'); 102 103 #process requested outputs 104 outputs = self.requested_outputs 105 indices = [i for i, x in enumerate(outputs) if x == 'default'] 106 if len(indices) > 0: 107 outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:] 108 outputs =outputscopy 109 WriteData(fid,'data',outputs,'enum',ThermalRequestedOutputsEnum(),'format','StringArray') 88 110 # }}} -
issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.m
r16181 r16470 55 55 case ThermalSolutionEnum(), 56 56 numanalyses=2; 57 analyses=[ThermalAnalysisEnum();MeltingAnalysisEnum()]; 58 59 case EnthalpySolutionEnum(), 60 numanalyses=1; 61 analyses=[EnthalpyAnalysisEnum()]; 57 analyses=[EnthalpyAnalysisEnum;ThermalAnalysisEnum();MeltingAnalysisEnum()]; 62 58 63 59 case MasstransportSolutionEnum(), -
issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py
r16008 r16470 20 20 elif solutiontype == ThermalSolutionEnum(): 21 21 numanalyses=2 22 analyses=[ThermalAnalysisEnum(),MeltingAnalysisEnum()] 23 24 elif solutiontype == EnthalpySolutionEnum(): 25 numanalyses=1 26 analyses=[EnthalpyAnalysisEnum()] 22 analyses=[EnthalpyAnalysisEnum(),ThermalAnalysisEnum(),MeltingAnalysisEnum()] 27 23 28 24 elif solutiontype == MasstransportSolutionEnum(): -
issm/trunk-jpl/src/m/enum/EnumDefinitions.py
r16443 r16470 50 50 def StressbalanceIsnewtonEnum(): return StringToEnum("StressbalanceIsnewton")[0] 51 51 def StressbalanceMaxiterEnum(): return StringToEnum("StressbalanceMaxiter")[0] 52 def StressbalanceNumRequestedOutputsEnum(): return StringToEnum("StressbalanceNumRequestedOutputs")[0]53 52 def StressbalancePenaltyFactorEnum(): return StringToEnum("StressbalancePenaltyFactor")[0] 54 53 def StressbalanceReferentialEnum(): return StringToEnum("StressbalanceReferential")[0] 55 54 def StressbalanceReltolEnum(): return StringToEnum("StressbalanceReltol")[0] 55 def StressbalanceNumRequestedOutputsEnum(): return StringToEnum("StressbalanceNumRequestedOutputs")[0] 56 56 def StressbalanceRequestedOutputsEnum(): return StringToEnum("StressbalanceRequestedOutputs")[0] 57 57 def StressbalanceRestolEnum(): return StringToEnum("StressbalanceRestol")[0] … … 228 228 def SettingsLowmemEnum(): return StringToEnum("SettingsLowmem")[0] 229 229 def SettingsOutputFrequencyEnum(): return StringToEnum("SettingsOutputFrequency")[0] 230 def SettingsResultsAsPatchesEnum(): return StringToEnum("SettingsResultsAsPatches")[0]231 230 def SettingsWaitonlockEnum(): return StringToEnum("SettingsWaitonlock")[0] 232 231 def SurfaceforcingsDelta18oEnum(): return StringToEnum("SurfaceforcingsDelta18o")[0] … … 265 264 def ThermalSpctemperatureEnum(): return StringToEnum("ThermalSpctemperature")[0] 266 265 def ThermalStabilizationEnum(): return StringToEnum("ThermalStabilization")[0] 266 def ThermalNumRequestedOutputsEnum(): return StringToEnum("ThermalNumRequestedOutputs")[0] 267 def ThermalRequestedOutputsEnum(): return StringToEnum("ThermalRequestedOutputs")[0] 267 268 def GiaMantleViscosityEnum(): return StringToEnum("GiaMantleViscosity")[0] 268 269 def GiaLithosphereThicknessEnum(): return StringToEnum("GiaLithosphereThickness")[0] … … 306 307 def StressbalanceVerticalAnalysisEnum(): return StringToEnum("StressbalanceVerticalAnalysis")[0] 307 308 def EnthalpyAnalysisEnum(): return StringToEnum("EnthalpyAnalysis")[0] 308 def EnthalpySolutionEnum(): return StringToEnum("EnthalpySolution")[0]309 309 def FlaimAnalysisEnum(): return StringToEnum("FlaimAnalysis")[0] 310 310 def FlaimSolutionEnum(): return StringToEnum("FlaimSolution")[0] … … 521 521 def IntExternalResultEnum(): return StringToEnum("IntExternalResult")[0] 522 522 def JEnum(): return StringToEnum("J")[0] 523 def PatchEnum(): return StringToEnum("Patch")[0]524 def PatchNodesEnum(): return StringToEnum("PatchNodes")[0]525 def PatchVerticesEnum(): return StringToEnum("PatchVertices")[0]526 523 def PentaP1ElementResultEnum(): return StringToEnum("PentaP1ElementResult")[0] 527 524 def StringExternalResultEnum(): return StringToEnum("StringExternalResult")[0] -
issm/trunk-jpl/src/m/geometry/NowickiProfile.m
r16412 r16470 12 12 delta = 0.1; % ratio of water density and ice density -1 13 13 hg = 1; % ice thickness at grounding line 14 sea = hg/(1+delta); % sea level15 14 lamda = 0.1; % ration of deviatoric stress and water pressure 16 15 beta = 5; % friction coefficient … … 36 35 for i = ceil(numel(x)/2):numel(x) 37 36 h(i) = (x(i)/(4*(delta+1)*q)+hg^(-2))^(-0.5); % ice thickness for ice shelf from (3.1) 38 b(i) = sea-h(i)*(1/(1+delta));37 b(i) = -h(i)*(1/(1+delta)); 39 38 end -
issm/trunk-jpl/src/m/plot/plot_unit.m
r13009 r16470 57 57 end 58 58 59 %Patch plot P160 case 4,61 62 if is2d,63 patch( 'Faces',elements,'Vertices',[x y],'CData',data,'FaceColor','interp','EdgeColor',edgecolor);64 else65 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);66 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data,'FaceColor','interp','EdgeColor',edgecolor);67 patch( 'Faces', [D E F], 'Vertices', [x y z],'CData', data,'FaceColor','interp','EdgeColor',edgecolor);68 patch( 'Faces', [A B E D], 'Vertices', [x y z],'CData', data,'FaceColor','interp','EdgeColor',edgecolor);69 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'CData', data,'FaceColor','interp','EdgeColor',edgecolor);70 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', data,'FaceColor','interp','EdgeColor',edgecolor);71 end72 73 %Patch plot P074 case 5,75 76 if is2d,77 A=elements(:,1); B=elements(:,2); C=elements(:,3);78 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);79 else80 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);81 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor);82 patch( 'Faces', [D E F], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor);83 patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor);84 patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor);85 patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor);86 end87 88 59 otherwise, 89 60 error(['case ' num2str(datatype) ' not supported']); -
issm/trunk-jpl/src/m/plot/processdata.m
r16325 r16470 37 37 end 38 38 39 %Process Patch 40 if isstruct(data) 41 if (isprop(data,'index') & isprop(data,'value')), 42 if data.interpolation(1)==P1Enum(), 43 data=data.value; 44 data=data'; 45 data=data(:); 46 datatype=4; 47 elseif data.interpolation(1)==P0Enum(), 48 data=data.value; 49 datatype=5; 50 else 51 error(['interpolation ' data.interpolation(1) ' not supported yet']); 52 end 53 else 54 error('structure other than Patch not supported yet'); 55 end 56 else 57 %initialize datatype 58 datatype=0; 59 end 39 %initialize datatype 40 datatype=0; 60 41 61 42 %get datasize 62 43 datasize=size(data); 63 44 64 %non patch processing 65 if datatype~=4 & datatype~=5, 45 %transpose data if necessary 46 if (size(data,2) > size(data,1)), 47 data=data'; 48 end 49 datasize=size(data); 66 50 67 %transpose dataif necessary68 if (size(data,2) > size(data,1)), 69 data=data';70 end71 datasize=size(data); 51 %convert to double if necessary 52 if ~isnumeric(data); 53 disp('processdata info message: data is not numeric (logical?). Converted to double'); 54 data=double(data); 55 end 72 56 73 %convert to double if necessary 74 if ~isnumeric(data); 75 disp('processdata info message: data is not numeric (logical?). Converted to double'); 76 data=double(data); 77 end 57 %check length 58 if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements & datasize(1)~=md.mesh.numberofvertices*6 & (md.mesh.dimension==3 & ~(datasize(1)==numberofelements2d | datasize(1)==numberofvertices2d)) 59 error('plotmodel error message: data not supported yet'); 60 end 78 61 79 %check length 80 if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements & datasize(1)~=md.mesh.numberofvertices*6 & (md.mesh.dimension==3 & ~(datasize(1)==numberofelements2d | datasize(1)==numberofvertices2d)) 81 error('plotmodel error message: data not supported yet'); 82 end 62 %quiver? 63 if datasize(2)>1, 64 datatype=3; 83 65 84 %quiver? 85 if datasize(2)>1, 86 datatype=3; 87 88 %check number of columns, add zeros if necessary, 89 if (md.mesh.dimension==3) 90 if datasize(2)==2, 91 data=[data, zeros(datasize(1),1)]; 92 elseif datasize(2)~=3, 93 error('plotmodel error message: data provided should have 2 or 3 columns for quiver plot, and 1 for regular plot'); 94 end 66 %check number of columns, add zeros if necessary, 67 if (md.mesh.dimension==3) 68 if datasize(2)==2, 69 data=[data, zeros(datasize(1),1)]; 70 elseif datasize(2)~=3, 71 error('plotmodel error message: data provided should have 2 or 3 columns for quiver plot, and 1 for regular plot'); 72 end 95 73 %elseif ((md.mesh.dimension==2) & datasize(2)~=2), 96 74 % error('plotmodel error message: data provided should have 2 columns for quiver plot, and 1 for regular plot'); 97 end98 75 end 76 end 99 77 100 101 102 103 104 105 106 107 108 78 %treat the case datasize(1)=6*nodes 79 if datasize(1)==6*md.mesh.numberofvertices 80 %keep the only norm of data 81 data1=data(1:6:md.mesh.numberofvertices*6,:); 82 data2=data(2:6:md.mesh.numberofvertices*6,:); 83 data=sqrt(data1.^2+data2.^2); 84 datasize(1)=md.mesh.numberofvertices; 85 %---> go to node data 86 end 109 87 110 111 112 113 114 115 88 %treat the case datasize(1)=nodes2d 89 if (md.mesh.dimension==3 & datasize(1)==numberofvertices2d), 90 data=project3d(md,'vector',data,'type','node'); 91 datasize(1)=md.mesh.numberofvertices; 92 %---> go to node data 93 end 116 94 117 118 119 120 121 122 95 %treat the case datasize(1)=nodes2d 96 if (md.mesh.dimension==3 & datasize(1)==numberofelements2d), 97 data=project3d(md,'vector',data,'type','element'); 98 datasize(1)=md.mesh.numberofelements; 99 %---> go to node data 100 end 123 101 124 %smoothing? 125 if exist(options,'smooth') 126 data=averaging(md,data,getfieldvalue(options,'smooth')); 127 datasize(1)=md.mesh.numberofvertices; 128 %---> go to node data 129 end 102 %smoothing? 103 if exist(options,'smooth') 104 data=averaging(md,data,getfieldvalue(options,'smooth')); 105 datasize(1)=md.mesh.numberofvertices; 106 %---> go to node data 130 107 end 131 108 -
issm/trunk-jpl/src/m/plot/processmesh.m
r16325 r16470 21 21 end 22 22 23 if (isempty(data) | ~isstruct(data)),23 if isempty(data) 24 24 %first load x,y, etc ... to speed up plot 25 25 … … 70 70 elements=elements2d; 71 71 end 72 else73 %Process Patch74 if (md.mesh.dimension==2),75 elements=transpose(reshape(1:3*md.mesh.numberofelements,3,md.mesh.numberofelements));76 x=transpose(reshape(md.mesh.x(data.index)',1,3*md.mesh.numberofelements));77 y=transpose(reshape(md.mesh.y(data.index)',1,3*md.mesh.numberofelements));78 z=zeros(3*md.mesh.numberofelements,1);79 is2d=1;80 else81 elements=transpose(reshape(1:6*md.mesh.numberofelements,6,md.mesh.numberofelements));82 x=transpose(reshape(md.mesh.x(data.index)',1,6*md.mesh.numberofelements));83 y=transpose(reshape(md.mesh.y(data.index)',1,6*md.mesh.numberofelements));84 z=transpose(reshape(md.mesh.z(data.index)',1,6*md.mesh.numberofelements));85 is2d=0;86 end87 72 end 88 73 -
issm/trunk-jpl/src/m/regional/regionaltransient2d.m
r15771 r16470 102 102 for t=find(numElements==1) 103 103 if ~isempty(md1.results.TransientSolution(t).Vel) & mod(count,stepres)==0, 104 vx= PatchToVec(md1.results.TransientSolution(t).Vx);105 vy= PatchToVec(md1.results.TransientSolution(t).Vy);106 thickness= PatchToVec(md1.results.TransientSolution(t).Thickness);104 vx=md1.results.TransientSolution(t).Vx; 105 vy=md1.results.TransientSolution(t).Vy; 106 thickness=md1.results.TransientSolution(t).Thickness; 107 107 spcx=[spcx InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vx,md2.mesh.x,md2.mesh.y)]; 108 108 spcy=[spcy InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vy,md2.mesh.x,md2.mesh.y)]; -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m
r15135 r16470 11 11 end 12 12 13 %process patch if necessary14 results=MatlabProcessPatch(results);15 13 16 14 function results=parseresultsfromdiskioserial(filename) % {{{ … … 76 74 77 75 %Add result 78 if strcmpi(result.fieldname,'Patch'), 79 results(result.step).(result.fieldname)=[0 result.N]; 80 else 81 results(result.step).(result.fieldname)=NaN; 82 end 76 results(result.step).(result.fieldname)=NaN; 83 77 84 78 %read next result … … 90 84 result=ReadDataDimensions(fid); 91 85 while ~isempty(result), 92 93 %Add result94 if strcmpi(result.fieldname,'Patch'),95 patchdimensions=results(result.step).(result.fieldname);96 results(result.step).(result.fieldname)=[patchdimensions(1)+result.M result.N];97 end98 99 86 %read next result 100 87 result=ReadDataDimensions(fid); 101 end102 103 %allocate patches104 for i=1:length(results),105 results(i).Patch=zeros(results(i).Patch(1),results(i).Patch(2));106 results(i).counter=1; %use to index into the patch107 88 end 108 89 … … 117 98 118 99 %Add result 119 if strcmpi(result.fieldname,'Patch'), 120 counter=results(result.step).counter; 121 counter2=counter+size(result.field,1)-1; 122 results(result.step).(result.fieldname)(counter:counter2,:)=result.field; 123 124 %increment counter: 125 results(result.step).counter=counter2+1; 126 else 127 results(result.step).(result.fieldname)=result.field; 128 end 100 results(result.step).(result.fieldname)=result.field; 129 101 130 102 %read next result -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py
r15135 r16470 4 4 import results as resultsclass 5 5 from MatlabFuncs import * 6 from MatlabProcessPatch import *7 6 8 7 def parseresultsfromdisk(filename,iosplit): … … 18 17 else: 19 18 results=parseresultsfromdiskioserial(filename) 20 21 #process patch if necessary22 results=MatlabProcessPatch(results)23 19 24 20 return results … … 96 92 97 93 #Add result 98 if strcmpi(result['fieldname'],'Patch'): 99 setattr(results[result['step']-1],result['fieldname'],[0,result['N']]) 100 else: 101 setattr(results[result['step']-1],result['fieldname'],float('NaN')) 94 setattr(results[result['step']-1],result['fieldname'],float('NaN')) 102 95 103 96 #read next result … … 109 102 while result: 110 103 111 #Add result112 if strcmpi(result['fieldname'],'Patch'):113 patchdimensions=getattr(results[result['step']-1],result['fieldname'])114 setattr(results[result['step']-1],result['fieldname'],[patchdimensions[0]+result['M'],result['N']])115 116 104 #read next result 117 105 result=ReadDataDimensions(fid) 118 119 #allocate patches120 for result in results.itervalues():121 if 'Patch' in result:122 setattr(result,'Patch',numpy.zeros((result['Patch'][0],result['Patch'][1])))123 setattr(result,'counter',0) #use to index into the patch124 106 125 107 #third pass, this time to read the real information … … 137 119 138 120 #Add result 139 if strcmpi(result['fieldname'],'Patch'): 140 counter=results[result['step']-1].counter 141 counter2=counter+result['field'].shape[0]-1 142 getattr(results[result['step']-1],result['fieldname'])[counter:counter2,:]=result['field'] 143 #increment counter: 144 results[result['step']-1].counter=counter2+1 145 else: 146 setattr(results[result['step']-1],result['fieldname'],result['field']) 121 setattr(results[result['step']-1],result['fieldname'],result['field']) 147 122 148 123 #read next result -
issm/trunk-jpl/src/m/solve/process_solve_options.m
r16181 r16470 10 10 solution_type=getfieldvalue(options,'solution_type'); 11 11 if ~ismember(solution_type,[StressbalanceSolutionEnum(),MasstransportSolutionEnum(),ThermalSolutionEnum(),... 12 SteadystateSolutionEnum(),TransientSolutionEnum(), EnthalpySolutionEnum(),...12 SteadystateSolutionEnum(),TransientSolutionEnum(),... 13 13 BalancethicknessSolutionEnum(),BalancethicknessSoftSolutionEnum(),... 14 14 BalancevelocitySolutionEnum(),BedSlopeSolutionEnum(),... -
issm/trunk-jpl/src/m/solve/process_solve_options.py
r16008 r16470 19 19 solution_type=options.getfieldvalue('solution_type') 20 20 if solution_type not in (StressbalanceSolutionEnum(),MasstransportSolutionEnum(),ThermalSolutionEnum(),\ 21 SteadystateSolutionEnum(),TransientSolutionEnum(), EnthalpySolutionEnum(),\21 SteadystateSolutionEnum(),TransientSolutionEnum(),\ 22 22 BalancethicknessSolutionEnum(),BalancevelocitySolutionEnum(),\ 23 23 BedSlopeSolutionEnum(),SurfaceSlopeSolutionEnum(),\
Note:
See TracChangeset
for help on using the changeset viewer.