 |
Ice Sheet System Model
4.18
Code documentation
|
Go to the source code of this file.
|
void | adjointstressbalance_core (FemModel *femmodel) |
|
void | adjointbalancethickness_core (FemModel *femmodel) |
|
void | adjointbalancethickness2_core (FemModel *femmodel) |
|
void | stressbalance_core (FemModel *femmodel) |
|
void | hydrology_core (FemModel *femmodel) |
|
void | thermal_core (FemModel *femmodel) |
|
void | surfaceslope_core (FemModel *femmodel) |
|
void | levelsetfunctionslope_core (FemModel *femmodel) |
|
void | movingfront_core (FemModel *femmodel) |
|
void | bedslope_core (FemModel *femmodel) |
|
void | meshdeformation_core (FemModel *femmodel) |
|
void | control_core (FemModel *femmodel) |
|
void | controltao_core (FemModel *femmodel) |
|
void | controlm1qn3_core (FemModel *femmodel) |
|
void | controladm1qn3_core (FemModel *femmodel) |
|
void | controlvalidation_core (FemModel *femmodel) |
|
void | masstransport_core (FemModel *femmodel) |
|
void | depthaverage_core (FemModel *femmodel) |
|
void | extrudefrombase_core (FemModel *femmodel) |
|
void | extrudefromtop_core (FemModel *femmodel) |
|
void | balancethickness_core (FemModel *femmodel) |
|
void | balancethickness2_core (FemModel *femmodel) |
|
void | balancevelocity_core (FemModel *femmodel) |
|
void | slopecompute_core (FemModel *femmodel) |
|
void | steadystate_core (FemModel *femmodel) |
|
void | transient_core (FemModel *femmodel) |
|
void | dakota_core (FemModel *femmodel) |
|
void | ad_core (FemModel *femmodel) |
|
void | adgradient_core (FemModel *femmodel) |
|
void | dummy_core (FemModel *femmodel) |
|
void | gia_core (FemModel *femmodel) |
|
void | love_core (FemModel *femmodel) |
|
void | esa_core (FemModel *femmodel) |
|
void | smb_core (FemModel *femmodel) |
|
void | bmb_core (FemModel *femmodel) |
|
void | damage_core (FemModel *femmodel) |
|
void | sealevelchange_core (FemModel *femmodel) |
|
void | grd_core (FemModel *femmodel) |
|
void | dynstr_core (FemModel *femmodel) |
|
void | sealevelrise_core_geometry (FemModel *femmodel) |
|
SealevelMasks * | sealevelrise_core_masks (FemModel *femmodel) |
|
Vector< IssmDouble > * | sealevelrise_core_eustatic (FemModel *femmodel, SealevelMasks *mask, IssmDouble *poceanarea) |
|
Vector< IssmDouble > * | sealevelrise_core_noneustatic (FemModel *femmodel, SealevelMasks *masks, Vector< IssmDouble > *RSLg_eustatic, IssmDouble oceanarea) |
|
void | sealevelrise_core_elastic (Vector< IssmDouble > **pU_radial, Vector< IssmDouble > **pU_north, Vector< IssmDouble > **pU_east, FemModel *femmodel, Vector< IssmDouble > *RSLg, SealevelMasks *masks) |
|
void | sealevelrise_core_viscous (Vector< IssmDouble > **pU_gia, Vector< IssmDouble > **pN_gia, FemModel *femmodel, Vector< IssmDouble > *RSLg) |
|
void | sealevelrise_diagnostics (FemModel *femmodel, Vector< IssmDouble > *RSLg) |
|
IssmDouble | objectivefunction (IssmDouble search_scalar, FemModel *femmodel) |
|
void | GetStericRate (Vector< IssmDouble > **psteric_rate_g, FemModel *femmodel) |
|
void | GetDynamicRate (Vector< IssmDouble > **pdynamic_rate_g, FemModel *femmodel) |
|
int | GradJSearch (IssmDouble *search_vector, FemModel *femmodel, int step) |
|
void | ProcessArguments (int *solution, char **pbinname, char **poutbinname, char **ptoolkitsname, char **plockname, char **prestartname, char **prootpath, int argc, char **argv) |
|
void | WriteLockFile (char *filename) |
|
void | ResetBoundaryConditions (FemModel *femmodel, int analysis_type) |
|
void | PrintBanner (void) |
|
void | TransferForcing (FemModel *femmodel, int forcingenum) |
|
void | TransferSealevel (FemModel *femmodel, int forcingenum) |
|
void | EarthMassTransport (FemModel *femmodel) |
|
void | slrconvergence (bool *pconverged, Vector< IssmDouble > *RSLg, Vector< IssmDouble > *RSLg_old, IssmDouble eps_rel, IssmDouble eps_abs) |
|
void | CorePointerFromSolutionEnum (void(**psolutioncore)(FemModel *), Parameters *parameters, int solutiontype) |
|
void | WrapperCorePointerFromSolutionEnum (void(**psolutioncore)(FemModel *), Parameters *parameters, int solutiontype, bool nodakotacore=false) |
|
void | AdjointCorePointerFromSolutionEnum (void(**padjointcore)(FemModel *), int solutiontype) |
|
◆ adjointstressbalance_core()
void adjointstressbalance_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 12 of file adjointstressbalance_core.cpp.
17 bool conserve_loads =
true;
31 bool is_schur_cg_solver =
false;
42 else if(is_schur_cg_solver)
60 if(save_results ||
true){
◆ adjointbalancethickness_core()
void adjointbalancethickness_core |
( |
FemModel * |
femmodel | ) |
|
◆ adjointbalancethickness2_core()
void adjointbalancethickness2_core |
( |
FemModel * |
femmodel | ) |
|
◆ stressbalance_core()
void stressbalance_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 13 of file stressbalance_core.cpp.
19 bool dakota_analysis,control_analysis;
21 bool isSIA,isSSA,isL1L2,isHO,isFS;
25 char **requested_outputs = NULL;
58 if(isSSA || isL1L2 || isHO ){
68 if(isSSA || isL1L2 || isHO){
75 if(isSSA || isL1L2 || isHO || isFS){
82 if (domaintype==
Domain3DEnum && (isSIA || isSSA || isL1L2 || isHO)){
101 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ hydrology_core()
void hydrology_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 12 of file hydrology_core.cpp.
22 bool modify_loads =
true;
23 char **requested_outputs = NULL;
51 bool isefficientlayer;
65 int substep, numaveragedinput, hydro_averaging;
74 subtime=global_time-dt;
84 std::vector<int> substepinput;
85 std::vector<int> transientinput;
86 std::vector<int> averagedinput;
88 if (isefficientlayer){
91 substepinput.assign(substeplist,substeplist+4);
92 transientinput.assign(transientlist,transientlist+4);
93 averagedinput.assign(averagelist,averagelist+4);
97 substepinput.assign(substeplist,substeplist+2);
98 transientinput.assign(transientlist,transientlist+2);
99 averagedinput.assign(averagelist,averagelist+2);
102 while(substep<dtslices){
107 if(
VerboseSolution())
_printf0_(
"sub iteration " << substep <<
"/" << dtslices <<
" time [yr]: " << setprecision(4) << subtime/yts <<
" (time step: " << subdt/yts <<
")\n");
111 if (isefficientlayer){
128 if (isefficientlayer){
138 if (isefficientlayer){
198 for(
int i=0;i<numoutputs;i++){
199 xDelete<char>(requested_outputs[i]);
201 xDelete<char*>(requested_outputs);
◆ thermal_core()
void thermal_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 13 of file thermal_core.cpp.
19 bool save_results,isenthalpy;
21 int solution_type,numoutputs;
22 char** requested_outputs = NULL;
39 delete enthalpy_analysis;
57 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ surfaceslope_core()
void surfaceslope_core |
( |
FemModel * |
femmodel | ) |
|
◆ levelsetfunctionslope_core()
void levelsetfunctionslope_core |
( |
FemModel * |
femmodel | ) |
|
◆ movingfront_core()
void movingfront_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 12 of file movingfront_core.cpp.
18 bool save_results,isstressbalance,ismasstransport,isthermal,isenthalpy,islevelset,ismovingfront,killicebergs;
19 int domaintype, num_extrapol_vars, index,reinit_frequency,step;
20 int* extrapol_vars=NULL;
35 if(!ismovingfront)
return;
53 if(ismasstransport) num_extrapol_vars+=1;
54 if(isthermal && domaintype==
Domain3DEnum) num_extrapol_vars+=1;
55 extrapol_vars=xNew<int>(num_extrapol_vars);
58 extrapol_vars[index]=
VxEnum; index++;
59 extrapol_vars[index]=
VyEnum; index++;
61 extrapol_vars[index]=
VzEnum; index++;
79 for(
int iv=0;iv<num_extrapol_vars;iv++){
83 xDelete<int>(extrapol_vars);
98 if(reinit_frequency && (step%reinit_frequency==0)){
◆ bedslope_core()
void bedslope_core |
( |
FemModel * |
femmodel | ) |
|
◆ meshdeformation_core()
void meshdeformation_core |
( |
FemModel * |
femmodel | ) |
|
◆ control_core()
void control_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 22 of file control_core.cpp.
25 int num_controls,nsize,nsteps;
27 bool isFS,dakota_analysis;
28 int *control_type = NULL;
34 void (*solutioncore)(
FemModel*) = NULL;
35 void (*adjointcore)(
FemModel*) = NULL;
68 optpars.
nsize = nsize;
85 for(
long i=0;i<nsize;i++){
86 if(X0[i]>XU[i]) X0[i]=XU[i];
87 if(X0[i]<XL[i]) X0[i]=XL[i];
89 xDelete<IssmDouble>(XU);
90 xDelete<IssmDouble>(XL);
101 for(
int i=0;i<nsteps;i++) J_passive[i]=reCast<IssmPDouble>(J[i]);
103 xDelete<IssmPDouble>(J_passive);
110 xDelete<int>(control_type);
111 xDelete<int>(maxiter);
112 xDelete<IssmDouble>(cm_jump);
113 xDelete<IssmDouble>(J);
114 xDelete<IssmDouble>(X0);
◆ controltao_core()
void controltao_core |
( |
FemModel * |
femmodel | ) |
|
◆ controlm1qn3_core()
void controlm1qn3_core |
( |
FemModel * |
femmodel | ) |
|
◆ controladm1qn3_core()
void controladm1qn3_core |
( |
FemModel * |
femmodel | ) |
|
◆ controlvalidation_core()
void controlvalidation_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 155 of file controlvalidation_core.cpp.
180 void (*solutioncore)(
FemModel*)=NULL;
183 #if defined(_HAVE_ADOLC_)
187 for(
int i=0;i<n;i++){
191 _error_(
"not implemented yet...");
193 #elif defined(_HAVE_CODIPACK_)
196 auto& tape_codi = IssmDouble::getGlobalTape();
197 codi_global.input_indices.clear();
199 for (
int i=0;i<n;i++) {
201 tape_codi.registerInput(aX[i]);
202 codi_global.input_indices.push_back(aX[i].getGradientData());
215 DataSet* dependent_objects=NULL;
221 dependents=xNew<IssmPDouble>(num_dependents);
222 codi_global.output_indices.clear();
223 for(
int i=0;i<dependent_objects->
Size();i++){
231 _printf0_(
"=== output ="<<output_value<<
" \n");
233 tape_codi.registerOutput(output_value);
234 dependents[i] = output_value.getValue();
235 codi_global.output_indices.push_back(output_value.getGradientData());
240 _printf0_(
"Initial cost function J(x) = "<<setw(12)<<setprecision(7)<<j0<<
"\n");
245 tape_codi.setGradient(codi_global.output_indices[0],1.0);
247 tape_codi.evaluate();
250 auto in_size = codi_global.input_indices.size();
251 for(
size_t i = 0; i < in_size; ++i) {
252 G[i] = tape_codi.getGradient(codi_global.input_indices[i]);
256 void (*adjointcore)(
FemModel*) = NULL;
266 _printf0_(
"Initial cost function J(x) = "<<setw(12)<<setprecision(7)<<j0<<
"\n");
267 xDelete<IssmDouble>(jlist);
271 for(
int i=0;i<n;i++) G[i] = -G[i];
281 _printf0_(
"_________________________\n");
282 for(
int m=0;m<num;m++){
286 for(
int i=0;i<n;i++) X[i] = X0[i] +
alpha*scaling_factors[0];
292 #if defined(_HAVE_CODIPACK_)
294 for(
int i=0;i<dependent_objects->
Size();i++){
309 for(
int i=0;i<n;i++) Den +=
alpha* G[i] * scaling_factors[0];
310 Ialpha = fabs((j - j0)/Den - 1.);
313 _printf0_(
" " << setw(11) << setprecision (5)<<
alpha<<
" " << setw(11) << setprecision (5)<<Ialpha<<
"\n");
314 output[m*2+0] =
alpha;
315 output[m*2+1] = Ialpha;
321 for(
int i=0;i<2*num;i++) J_passive[i]=reCast<IssmPDouble>(output[i]);
323 xDelete<IssmPDouble>(J_passive);
325 for(
int i=0;i<n;i++) aG[i] = G[i];
327 xDelete<IssmDouble>(aG);
335 xDelete<IssmDouble>(output);
336 xDelete<IssmPDouble>(G);
337 xDelete<IssmDouble>(X);
339 xDelete<IssmDouble>(scaling_factors);
◆ masstransport_core()
void masstransport_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 12 of file masstransport_core.cpp.
18 int numoutputs,domaintype;
20 bool isFS,isfreesurface,dakota_analysis;
21 int solution_type,stabilization;
22 char** requested_outputs = NULL;
40 if(isFS && isfreesurface){
94 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ depthaverage_core()
void depthaverage_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 12 of file depthaverage_core.cpp.
15 int domaintype,elementtype;
16 int inputenum,input_average_enum;
◆ extrudefrombase_core()
void extrudefrombase_core |
( |
FemModel * |
femmodel | ) |
|
◆ extrudefromtop_core()
void extrudefromtop_core |
( |
FemModel * |
femmodel | ) |
|
◆ balancethickness_core()
void balancethickness_core |
( |
FemModel * |
femmodel | ) |
|
◆ balancethickness2_core()
void balancethickness2_core |
( |
FemModel * |
femmodel | ) |
|
◆ balancevelocity_core()
void balancevelocity_core |
( |
FemModel * |
femmodel | ) |
|
◆ slopecompute_core()
void slopecompute_core |
( |
FemModel * |
femmodel | ) |
|
◆ steadystate_core()
void steadystate_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 20 of file steadystate_core.cpp.
30 bool save_results,isenthalpy;
34 char** requested_outputs = NULL;
74 delete tg_old;tg_old=tg;
75 delete ug_old;ug_old=ug;
89 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ transient_core()
void transient_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 19 of file transient_core.cpp.
23 bool isstressbalance,ismasstransport,issmb,isFS,isthermal,isgroundingline,isgia,isesa,isslr,iscoupler,ismovingfront,isdamageevolution,ishydrology,isoceancoupling,iscontrol,isautodiff;
24 bool save_results,dakota_analysis;
27 int sb_coupling_frequency;
28 int recording_frequency;
29 int domaintype,groundingline_migration,smb_model,amr_frequency,amr_restart;
32 char **requested_outputs = NULL;
74 #if defined(_HAVE_BAMG_) && !defined(_HAVE_AD_)
81 #if defined(_HAVE_OCEAN_ )
88 DataSet* dependent_objects=NULL;
91 if(iscontrol && isautodiff){
98 dependents=xNew<IssmPDouble>(num_dependents);
103 while(time < finaltime - (yts*DBL_EPSILON)){
106 switch(timestepping){
109 if(time+dt>finaltime) dt=finaltime-time;
123 if(
VerboseSolution())
_printf0_(
"iteration " << step <<
"/" << ceil((finaltime-time)/dt)+step <<
" time [yr]: " << setprecision(4) << time/yts <<
" (time step: " << dt/yts <<
")\n");
124 if(step%output_frequency==0 || (time >= finaltime - (yts*DBL_EPSILON)) || step==1)
130 #if defined(_HAVE_OCEAN_ )
168 if(isstressbalance && (step%sb_coupling_frequency==0 || step==1) ) {
173 if(isdamageevolution) {
222 _error_(
"ISSM was not compiled with gia capabilities. Exiting");
245 if(recording_frequency && (step%recording_frequency==0)){
253 #if !defined(_HAVE_AD_)
255 if(step%amr_frequency==0 && time<finaltime){
261 _error_(
"AMR not suppored with AD");
265 if (iscontrol && isautodiff) {
267 for(
int i=0;i<dependent_objects->
Size();i++){
279 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ dakota_core()
Definition at line 313 of file dakota_core.cpp.
314 _error_(
"dakota_core for versions of Dakota >=6 should not be used anymore! Use instead the issm_dakota executable!");
◆ ad_core()
Definition at line 24 of file ad_core.cpp.
30 int num_independents=0;
31 bool isautodiff,iscontrol;
33 size_t tape_stats[15];
44 if(isautodiff && !iscontrol){
46 #if defined(_HAVE_ADOLC_)
54 tapestats(my_rank,tape_stats);
56 int *sstats=
new int[7];
57 sstats[0]=tape_stats[NUM_OPERATIONS];
58 sstats[1]=tape_stats[OP_FILE_ACCESS];
59 sstats[2]=tape_stats[NUM_LOCATIONS];
60 sstats[3]=tape_stats[LOC_FILE_ACCESS];
61 sstats[4]=tape_stats[NUM_VALUES];
62 sstats[5]=tape_stats[VAL_FILE_ACCESS];
63 sstats[6]=tape_stats[TAY_STACK_SIZE];
65 if (my_rank==0) rstats=
new int[commSize*7];
69 int rOffset=(commSize/10)+1;
71 _printf_(
" "<<setw(offset)<<left<<
"#independents: " <<setw(12)<<right<<tape_stats[NUM_INDEPENDENTS] <<
"\n");
72 _printf_(
" "<<setw(offset)<<left<<
"#dependents: " <<setw(12)<<right<<tape_stats[NUM_DEPENDENTS] <<
"\n");
73 _printf_(
" "<<setw(offset)<<left<<
"max #live active variables: " <<setw(12)<<right<<tape_stats[NUM_MAX_LIVES] <<
"\n");
74 _printf_(
" operations: entry size "<<
sizeof(
unsigned char) <<
" Bytes \n");
75 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffObufsizeEnum) " <<setw(12)<<right<<tape_stats[OP_BUFFER_SIZE] <<
"\n");
76 for (
int r=0;r<commSize;++r)
77 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+0] << (rstats[r*7+1]?
" ->file":
"") <<
"\n");
78 _printf_(
" locations: entry size " <<
sizeof(locint) <<
" Bytes\n");
79 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffLbufsizeEnum) " <<setw(12)<<right<<tape_stats[LOC_BUFFER_SIZE] <<
"\n");
80 for (
int r=0;r<commSize;++r)
81 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+2] << (rstats[r*7+3]?
" ->file":
"") <<
"\n");
82 _printf_(
" constant values: entry size " <<
sizeof(
double) <<
" Bytes\n");
83 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffCbufsizeEnum) " <<setw(12)<<right<<tape_stats[VAL_BUFFER_SIZE] <<
"\n");
84 for (
int r=0;r<commSize;++r)
85 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+4] << (rstats[r*7+5]?
" ->file":
"") <<
"\n");
86 _printf_(
" Taylor stack: entry size " <<
sizeof(revreal) <<
" Bytes\n");
87 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffTbufsizeEnum) " <<setw(12)<<right<<tape_stats[TAY_BUFFER_SIZE] <<
"\n");
88 for (
int r=0;r<commSize;++r)
89 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+6] << (rstats[r*7+6]>tape_stats[TAY_BUFFER_SIZE]?
" ->file":
"") <<
"\n");
100 if(!(num_dependents*num_independents))
return;
104 num_dependents=0; num_independents=0;
111 xp=xNew<double>(num_independents);
112 for(i=0;i<num_independents;i++){
113 xp[i]=reCast<double,IssmDouble>(axp[i]);
122 if (strcmp(driver,
"fos_forward")==0){
125 double *tangentDir = NULL;
126 double *jacTimesTangentDir = NULL;
127 double *theOutput = NULL;
132 if (anIndepIndex<0 || anIndepIndex>=num_independents)
_error_(
"index value for AutodiffFosForwardIndexEnum should be in [0,num_independents-1]");
134 tangentDir=xNewZeroInit<double>(num_independents);
135 tangentDir[anIndepIndex]=1.0;
137 jacTimesTangentDir=xNew<double>(num_dependents);
138 theOutput=xNew<double>(num_dependents);
142 anEDF_for_solverx_p->fos_forward=EDF_fos_forward_for_solverx;
146 fos_forward(my_rank,num_dependents,num_independents, 0, xp, tangentDir, theOutput, jacTimesTangentDir );
156 else if ((strcmp(driver,
"fov_forward")==0) || (strcmp(driver,
"fov_forward_all")==0)){
160 int *indepIndices = NULL;
161 double **jacTimesSeed = NULL;
162 double **seed = NULL;
163 double *theOutput = NULL;
164 std::set<unsigned int> anIndexSet;
167 if (strcmp(driver,
"fov_forward_all")==0){
168 tangentDirNum=num_independents;
169 indepIndices=xNewZeroInit<int>(tangentDirNum);
170 for(i=0;i<num_independents;i++)indepIndices[i]=1;
177 if (tangentDirNum<1 || tangentDirNum>num_independents)
_error_(
"tangentDirNum should be in [1,num_independents]");
180 jacTimesSeed=xNew<double>(num_dependents,tangentDirNum);
184 anEDF_for_solverx_p->fov_forward=EDF_fov_forward_for_solverx;
189 seed=xNewZeroInit<double>(num_independents,tangentDirNum);
192 for (
int i=0; i<tangentDirNum; ++i) {
194 if (indepIndices[i]>num_independents) {
195 _error_(
"indepIndices values must be in [0,num_independents-1]");
197 if (anIndexSet.find(indepIndices[i])!=anIndexSet.end()) {
198 _error_(
"duplicate indepIndices values are not allowed until we implement Jacobian decompression");
200 anIndexSet.insert(indepIndices[i]);
203 seed[indepIndices[i]][i]=1.0;
207 theOutput=xNew<double>(num_dependents);
210 fov_forward(my_rank,num_dependents,num_independents, tangentDirNum, xp, seed, theOutput, jacTimesSeed );
223 else if (strcmp(driver,
"fos_reverse")==0) {
226 double *aWeightVector=NULL;
227 double *weightVectorTimesJac=NULL;
231 aWeightVector=xNewZeroInit<double>(num_dependents);
233 if (aDepIndex<0 || aDepIndex>=num_dependents)
_error_(
"index value for AutodiffFosReverseIndexEnum should be in [0,num_dependents-1]");
234 aWeightVector[aDepIndex]=1.0;
236 weightVectorTimesJac=xNew<double>(num_independents);
240 anEDF_for_solverx_p->fos_reverse=EDF_fos_reverse_for_solverx;
243 anEDF_for_solverx_p->fos_reverse_iArr=fos_reverse_mumpsSolveEDF;
247 fos_reverse(my_rank,num_dependents,num_independents, aWeightVector, weightVectorTimesJac );
256 else if ((strcmp(driver,
"fov_reverse")==0) || (strcmp(driver,
"fov_reverse_all")==0)){
258 int* depIndices=NULL;
261 double **weightsTimesJac=NULL;
262 double **weights=NULL;
263 std::set<unsigned int> anIndexSet;
266 if (strcmp(driver,
"fov_reverse_all")==0){
267 weightNum=num_dependents;
268 depIndices=xNewZeroInit<int>(weightNum);
269 for(i=0;i<num_dependents;i++)depIndices[i]=1;
276 if (weightNum<1 || weightNum>num_dependents)
_error_(
"tangentDirNum should be in [1,num_dependents]");
279 weightsTimesJac=xNew<double>(weightNum,num_independents);
283 anEDF_for_solverx_p->fov_reverse=EDF_fov_reverse_for_solverx;
287 weights=xNewZeroInit<double>(weightNum,num_dependents);
290 for (
int i=0; i<weightNum; ++i) {
292 if (depIndices[i]>num_dependents) {
293 _error_(
"depIndices values must be in [0,num_dependents-1]");
295 if (anIndexSet.find(depIndices[i])!=anIndexSet.end()) {
296 _error_(
"duplicate depIndices values are not allowed until we implement Jacobian decompression");
298 anIndexSet.insert(depIndices[i]);
301 weights[depIndices[i]][i]=1.0;
305 fov_reverse(my_rank,num_dependents,num_independents, weightNum, weights, weightsTimesJac );
315 else _error_(
"driver: " << driver <<
" not yet supported!");
324 #elif defined(_HAVE_CODIPACK_)
328 auto& tape_codi = IssmDouble::getGlobalTape();
329 tape_codi.setPassive();
334 tape_codi.printStatistics(std::cout);
335 codi_global.print(std::cout);
344 if(!(num_dependents*num_independents))
return;
350 if (strcmp(driver,
"fos_reverse")==0) {
353 double *weightVectorTimesJac=NULL;
358 if (aDepIndex<0 || aDepIndex>=num_dependents
359 || codi_global.output_indices.size() <= aDepIndex){
360 _error_(
"index value for AutodiffFosReverseIndexEnum should be in [0,num_dependents-1]");
362 tape_codi.setGradient(codi_global.output_indices[aDepIndex], 1.0);
365 tape_codi.evaluate();
367 weightVectorTimesJac=xNew<double>(num_independents);
369 auto in_size = codi_global.input_indices.size();
370 for(
size_t i = 0; i < in_size; ++i) {
371 weightVectorTimesJac[i] = tape_codi.getGradient(codi_global.input_indices[i]);
380 else _error_(
"driver: " << driver <<
" not yet supported!");
385 _error_(
"Should not be requesting AD drivers when an AD library is not available!");
◆ adgradient_core()
void adgradient_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 22 of file adgradient_core.cpp.
28 int num_dependents_old=0;
29 int num_independents=0;
30 bool isautodiff =
false;
50 #if defined(_HAVE_ADOLC_)
57 size_t tape_stats[15];
58 tapestats(my_rank,tape_stats);
60 int *sstats=
new int[7];
61 sstats[0]=tape_stats[NUM_OPERATIONS];
62 sstats[1]=tape_stats[OP_FILE_ACCESS];
63 sstats[2]=tape_stats[NUM_LOCATIONS];
64 sstats[3]=tape_stats[LOC_FILE_ACCESS];
65 sstats[4]=tape_stats[NUM_VALUES];
66 sstats[5]=tape_stats[VAL_FILE_ACCESS];
67 sstats[6]=tape_stats[TAY_STACK_SIZE];
69 if (my_rank==0) rstats=
new int[commSize*7];
73 int rOffset=(commSize/10)+1;
75 _printf_(
" "<<setw(offset)<<left<<
"#independents: " <<setw(12)<<right<<tape_stats[NUM_INDEPENDENTS] <<
"\n");
76 _printf_(
" "<<setw(offset)<<left<<
"#dependents: " <<setw(12)<<right<<tape_stats[NUM_DEPENDENTS] <<
"\n");
77 _printf_(
" "<<setw(offset)<<left<<
"max #live active variables: " <<setw(12)<<right<<tape_stats[NUM_MAX_LIVES] <<
"\n");
78 _printf_(
" operations: entry size "<<
sizeof(
unsigned char) <<
" Bytes \n");
79 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffObufsizeEnum) " <<setw(12)<<right<<tape_stats[OP_BUFFER_SIZE] <<
"\n");
80 for (
int r=0;r<commSize;++r)
81 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+0] << (rstats[r*7+1]?
" ->file":
"") <<
"\n");
82 _printf_(
" locations: entry size " <<
sizeof(locint) <<
" Bytes\n");
83 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffLbufsizeEnum) " <<setw(12)<<right<<tape_stats[LOC_BUFFER_SIZE] <<
"\n");
84 for (
int r=0;r<commSize;++r)
85 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+2] << (rstats[r*7+3]?
" ->file":
"") <<
"\n");
86 _printf_(
" constant values: entry size " <<
sizeof(
double) <<
" Bytes\n");
87 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffCbufsizeEnum) " <<setw(12)<<right<<tape_stats[VAL_BUFFER_SIZE] <<
"\n");
88 for (
int r=0;r<commSize;++r)
89 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+4] << (rstats[r*7+5]?
" ->file":
"") <<
"\n");
90 _printf_(
" Taylor stack: entry size " <<
sizeof(revreal) <<
" Bytes\n");
91 _printf_(
" "<<setw(offset)<<left<<
" #entries in buffer (AutodiffTbufsizeEnum) " <<setw(12)<<right<<tape_stats[TAY_BUFFER_SIZE] <<
"\n");
92 for (
int r=0;r<commSize;++r)
93 _printf_(
" ["<<setw(rOffset)<<right<<r<<
"]"<<setw(offset-rOffset-4)<<left<<
" #entries total" <<setw(12)<<right<<rstats[r*7+6] << (rstats[r*7+6]>tape_stats[TAY_BUFFER_SIZE]?
" ->file":
"") <<
"\n");
104 if(!(num_dependents*num_independents))
return;
107 num_dependents_old=num_dependents;
109 num_dependents=0; num_independents=0;
116 xp=xNew<double>(num_independents);
117 for(i=0;i<num_independents;i++){
118 xp[i]=reCast<double,IssmDouble>(axp[i]);
125 anEDF_for_solverx_p->dp_x=xNew<double>(anEDF_for_solverx_p->max_n);
126 anEDF_for_solverx_p->dp_y=xNew<double>(anEDF_for_solverx_p->max_m);
132 totalgradient=xNewZeroInit<IssmPDouble>(num_independents);
134 for(aDepIndex=0;aDepIndex<num_dependents_old;aDepIndex++){
137 aWeightVector=xNewZeroInit<IssmPDouble>(num_dependents);
138 if (my_rank==0) aWeightVector[aDepIndex]=1.0;
141 weightVectorTimesJac=xNew<IssmPDouble>(num_independents);
145 anEDF_for_solverx_p->fos_reverse=EDF_fos_reverse_for_solverx;
148 anEDF_for_solverx_p->fos_reverse_iArr=fos_reverse_mumpsSolveEDF;
151 anEDF_for_solverx_p->dp_U=xNew<IssmPDouble>(anEDF_for_solverx_p->max_m);
152 anEDF_for_solverx_p->dp_Z=xNew<IssmPDouble>(anEDF_for_solverx_p->max_n);
155 fos_reverse(my_rank,num_dependents,num_independents, aWeightVector, weightVectorTimesJac );
158 if(my_rank==0)
for(i=0;i<num_independents;i++)totalgradient[i]+=weightVectorTimesJac[i];
171 xDelete(anEDF_for_solverx_p->dp_x);
172 xDelete(anEDF_for_solverx_p->dp_X);
173 xDelete(anEDF_for_solverx_p->dpp_X);
174 xDelete(anEDF_for_solverx_p->dp_y);
175 xDelete(anEDF_for_solverx_p->dp_Y);
176 xDelete(anEDF_for_solverx_p->dpp_Y);
177 xDelete(anEDF_for_solverx_p->dp_U);
178 xDelete(anEDF_for_solverx_p->dpp_U);
179 xDelete(anEDF_for_solverx_p->dp_Z);
180 xDelete(anEDF_for_solverx_p->dpp_Z);
185 #elif defined(_HAVE_CODIPACK_)
186 fprintf(stderr,
"*** Codipack adgradient_core()\n");
188 _error_(
"Should not be requesting AD drivers when an AD library is not available!");
◆ dummy_core()
◆ gia_core()
Definition at line 13 of file gia_core.cpp.
19 int nummodels,giamodel;
65 xDelete<IssmDouble>(x);
66 xDelete<IssmDouble>(y);
85 Input2* tria_input_copy_ngia=tria_input_ngia->
copy();
86 Input2* tria_input_copy_ugia=tria_input_ugia->
copy();
◆ love_core()
Definition at line 11 of file love_core.cpp.
23 bool allow_layer_deletion;
57 IssmDouble* LoveKr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
58 IssmDouble* LoveHr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
59 IssmDouble* LoveLr = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
60 IssmDouble* LoveKi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
61 IssmDouble* LoveHi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
62 IssmDouble* LoveLi = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1));
65 IssmDouble* LoveKernelsReal = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1)*(matlitho->
numlayers+1)*6);
66 IssmDouble* LoveKernelsImag = xNewZeroInit<IssmDouble>(nfreq*(sh_nmax+1)*(matlitho->
numlayers+1)*6);
69 FourierLoveCorex(LoveKr,LoveKi,LoveHr,LoveHi,LoveLr,LoveLi,LoveKernelsReal,LoveKernelsImag,
70 nfreq,frequencies,sh_nmax,sh_nmin,g0,r0,mu0,allow_layer_deletion,forcing_type,verbosemod,
83 if (love_kernels==1) {
89 xDelete<IssmDouble>(frequencies);
90 xDelete<IssmDouble>(LoveKr);
91 xDelete<IssmDouble>(LoveHr);
92 xDelete<IssmDouble>(LoveLr);
93 xDelete<IssmDouble>(LoveKi);
94 xDelete<IssmDouble>(LoveHi);
95 xDelete<IssmDouble>(LoveLi);
96 xDelete<IssmDouble>(LoveKernelsReal);
97 xDelete<IssmDouble>(LoveKernelsImag);
◆ esa_core()
Definition at line 12 of file esa_core.cpp.
22 bool save_results,isesa,iscoupler;
26 char **requested_outputs = NULL;
66 if( !iscoupler & !isesa)
return;
87 femmodel->EsaGeodetic3D(U_radial,U_north,U_east,latitude,longitude,radius,xx,yy,zz);
90 femmodel->EsaGeodetic2D(U_radial,U_north,U_east,U_x,U_y,xx,yy);
114 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ smb_core()
Definition at line 12 of file smb_core.cpp.
23 char** requested_outputs = NULL;
43 std::vector<int> substepinput;
44 std::vector<int> transientinput;
45 std::vector<int> averagedinput;
50 substepinput.assign(substeplist,substeplist+2);
51 transientinput.assign(transientlist,transientlist+2);
52 averagedinput.assign(averagelist,averagelist+2);
57 int substep,smb_averaging;
66 subtime=global_time-dt;
73 while(substep<dtslices){
77 if(
VerboseSolution())
_printf0_(
"sub iteration " << substep <<
"/" << dtslices <<
" time [yr]: " << setprecision(4) << subtime/yts <<
" (time step: " << subdt/yts <<
")\n");
97 for(
int i=0;i<numaveragedinput;i++){
112 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ bmb_core()
Definition at line 12 of file bmb_core.cpp.
15 int basalforcing_model;
◆ damage_core()
Definition at line 12 of file damage_core.cpp.
19 bool dakota_analysis =
false;
20 int solution_type,stabilization;
22 char **requested_outputs = NULL;
48 for(
int i=0;i<numoutputs;i++){
49 xDelete<char>(requested_outputs[i]);
51 xDelete<char*>(requested_outputs);
◆ sealevelchange_core()
void sealevelchange_core |
( |
FemModel * |
femmodel | ) |
|
Definition at line 17 of file sealevelchange_core.cpp.
50 _error_(
"ISSM was not compiled with gia capabilities. Exiting");
69 char **requested_outputs = NULL;
74 if(numoutputs){
for(
int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);}
◆ grd_core()
Definition at line 84 of file sealevelchange_core.cpp.
109 bool istransientmasstransport;
115 int bp_compute_fingerprints=0;
139 modelid=1; earthid=1;
151 if (count<frequency){
166 if(modelid==earthid){
191 if(bp_compute_fingerprints){
197 N_esa_rate=N_esa->
Duplicate(); N_esa->
Copy(N_esa_rate); N_esa_rate->
Scale(1/(dt*frequency));
198 U_esa_rate=U_esa->
Duplicate(); U_esa->
Copy(U_esa_rate); U_esa_rate->
Scale(1/(dt*frequency));
199 N_gia_rate=N_gia->
Duplicate(); N_gia->
Copy(N_gia_rate); N_gia_rate->
Scale(1/(dt*frequency));
200 U_gia_rate=U_gia->
Duplicate(); U_gia->
Copy(U_gia_rate); U_gia_rate->
Scale(1/(dt*frequency));
201 RSLg_rate=RSLg->
Duplicate(); RSLg->
Copy(RSLg_rate); RSLg_rate->
Scale(1/(dt*frequency));
239 delete RSLg_eustatic;
◆ dynstr_core()
Definition at line 259 of file sealevelchange_core.cpp.
306 SL->
AXPY(N_gia_rate,dt);
307 SL->
AXPY(N_esa_rate,dt);
309 SL->
AXPY(steric_rate_g,dt);
310 SL->
AXPY(dynamic_rate_g,dt);
314 bedrock->
AXPY(U_esa_rate,dt);
315 bedrock->
AXPY(U_gia_rate,dt);
325 delete steric_rate_g;
326 delete dynamic_rate_g;
◆ sealevelrise_core_geometry()
void sealevelrise_core_geometry |
( |
FemModel * |
femmodel | ) |
|
Definition at line 351 of file sealevelchange_core.cpp.
364 bool geometrydone =
false;
387 element->SealevelriseGeometry(latitude,longitude,radius,xx,yy,zz);
392 xDelete<IssmDouble>(xx);
393 xDelete<IssmDouble>(yy);
394 xDelete<IssmDouble>(zz);
396 xDelete<IssmDouble>(longitude);
397 xDelete<IssmDouble>(radius);
◆ sealevelrise_core_masks()
◆ sealevelrise_core_eustatic()
Definition at line 404 of file sealevelchange_core.cpp.
428 femmodel->SealevelriseEustatic(RSLgi,&oceanarea,&eustatic, masks);
431 RSLgi_oceanaverage=
femmodel->SealevelriseOceanAverage(RSLgi,masks, oceanarea);
435 RSLgi->
Shift(-eustatic-RSLgi_oceanaverage);
441 *poceanarea=oceanarea;
◆ sealevelrise_core_noneustatic()
Definition at line 444 of file sealevelchange_core.cpp.
463 bool verboseconvolution=
true;
464 int max_nonlinear_iterations;
469 int bp_compute_fingerprints= 0;
487 RSLg_eustatic->
Copy(RSLg);
499 delete RSLg_old; RSLg_old=RSLg;
506 femmodel->SealevelriseNonEustatic(RSLgo, RSLg_old, masks, verboseconvolution);
515 femmodel->SealevelriseRotationalFeedback(RSLgo_rot,RSLg_old,&Ixz,&Iyz,&Izz, masks);
523 RSLgo->
AXPY(RSLgo_rot,1);
527 RSLgo_oceanaverage=
femmodel->SealevelriseOceanAverage(RSLgo,masks, oceanarea);
530 RSLg_eustatic->
Copy(RSLg); RSLg->
AXPY(RSLgo,1);
531 RSLg->
Shift(-RSLgo_oceanaverage);
546 if(count>=max_nonlinear_iterations){
547 _printf0_(
" maximum number of nonlinear iterations (" << max_nonlinear_iterations <<
") exceeded\n");
553 if(count>1)verboseconvolution=
false;
562 if(bp_compute_fingerprints){
◆ sealevelrise_core_elastic()
Definition at line 572 of file sealevelchange_core.cpp.
610 femmodel->SealevelriseElastic(U_esa,U_north_esa,U_east_esa,RSLg, masks);
615 *pU_east_esa=U_east_esa;
616 *pU_north_esa=U_north_esa;
620 xDelete<IssmDouble>(longitude);
621 xDelete<IssmDouble>(latitude);
622 xDelete<IssmDouble>(xx);
623 xDelete<IssmDouble>(yy);
624 xDelete<IssmDouble>(zz);
625 xDelete<IssmDouble>(radius);
◆ sealevelrise_core_viscous()
◆ sealevelrise_diagnostics()
◆ objectivefunction()
◆ GetStericRate()
◆ GetDynamicRate()
◆ GradJSearch()
◆ ProcessArguments()
void ProcessArguments |
( |
int * |
solution, |
|
|
char ** |
pbinname, |
|
|
char ** |
poutbinname, |
|
|
char ** |
ptoolkitsname, |
|
|
char ** |
plockname, |
|
|
char ** |
prestartname, |
|
|
char ** |
prootpath, |
|
|
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 10 of file ProcessArguments.cpp.
13 if(argc<2)
_error_(
"Usage error: no solution requested");
14 if(argc<3)
_error_(
"Usage error: missing execution directory");
15 if(argc<4)
_error_(
"Usage error: missing model name");
19 char* rootpatharg = argv[2];
20 char* modelname = argv[3];
24 int rank_length = (my_rank == 0 ? 1 : (int)(log10(
static_cast<double>(my_rank))+1));
27 char* rootpath = xNew<char>(strlen(rootpatharg)+2); sprintf(rootpath,
"%s/",rootpatharg);
30 char* binfilename = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(
".bin") +1); sprintf(binfilename,
"%s%s%s",rootpath,modelname,
".bin");
31 char* outbinfilename = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(
".outbin") +1); sprintf(outbinfilename,
"%s%s%s",rootpath,modelname,
".outbin");
32 char* toolkitsfilename = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(
".toolkits") +1); sprintf(toolkitsfilename,
"%s%s%s",rootpath,modelname,
".toolkits");
33 char* lockfilename = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(
".lock") +1); sprintf(lockfilename,
"%s%s%s",rootpath,modelname,
".lock");
34 char* restartfilename = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(
".rst.")+rank_length+1);
35 sprintf(restartfilename,
"%s%s%s%i",rootpath,modelname,
".rst.",my_rank);
38 *pbinfilename=binfilename;
39 *poutbinfilename=outbinfilename;
40 *ptoolkitsfilename=toolkitsfilename;
41 *plockfilename=lockfilename;
42 *prestartfilename=restartfilename;
◆ WriteLockFile()
void WriteLockFile |
( |
char * |
filename | ) |
|
Definition at line 10 of file WriteLockFile.cpp.
20 fid=fopen(filename,
"w");
21 if(fid==NULL)
_error_(
"error message: could not open lock file " << filename);
24 if(fclose(fid)!=0)
_error_(
"could not close lock file " << filename);
◆ ResetBoundaryConditions()
void ResetBoundaryConditions |
( |
FemModel * |
femmodel, |
|
|
int |
analysis_type |
|
) |
| |
◆ PrintBanner()
void PrintBanner |
( |
void |
| ) |
|
◆ TransferForcing()
void TransferForcing |
( |
FemModel * |
femmodel, |
|
|
int |
forcingenum |
|
) |
| |
Definition at line 752 of file sealevelchange_core.cpp.
763 int* transitions_m=NULL;
764 int* transitions_n=NULL;
782 if(modelid==earthid){
784 if(!parcoms)
_error_(
"TransferForcing error message: could not find IcecapToEarthComm communicator");
789 if(!parcom)
_error_(
"TransferForcing error message: could not find IcecapToEarthComm communicator");
794 if(modelid!=earthid){
801 if(modelid==earthid){
802 forcings=xNew<IssmDouble*>(nummodels-1);
803 nvs=xNew<int>(nummodels-1);
804 for(
int i=0;i<earthid;i++){
806 forcings[i]=xNew<IssmDouble>(nvs[i]);
819 if(modelid==earthid){
829 if(ntransitions!=earthid)
_error_(
"TransferForcing error message: number of transition vectors is not equal to the number of icecaps!");
833 for(
int i=0;i<earthid;i++){
837 int M=transitions_m[i];
840 int* index=xNew<int>(M);
for(
int i=0;i<M;i++)index[i]=reCast<int>(transition[i])-1;
859 for(
int i=0;i<nummodels-1;i++){
860 IssmDouble* temp=forcings[i]; xDelete<IssmDouble>(temp);
862 xDelete<IssmDouble*>(forcings);
864 if(forcing)xDelete<IssmDouble>(forcing);
865 if(forcingglobal)
delete forcingglobal;
867 for(
int i=0;i<earthid;i++){
869 xDelete<IssmDouble>(temp);
871 xDelete<IssmDouble*>(transitions);
872 xDelete<int>(transitions_m);
873 xDelete<int>(transitions_n);
875 if(nvs)xDelete<int>(nvs);
◆ TransferSealevel()
void TransferSealevel |
( |
FemModel * |
femmodel, |
|
|
int |
forcingenum |
|
) |
| |
Definition at line 879 of file sealevelchange_core.cpp.
888 int* transitions_m=NULL;
889 int* transitions_n=NULL;
908 if(modelid==earthid){
910 if(!parcoms)
_error_(
"TransferSealevel error message: could not find IcecapToEarthComm communicator");
916 if(!parcom)
_error_(
"TransferSealevel error message: could not find IcecapToEarthComm communicator");
922 if(modelid==earthid){
930 if(modelid==earthid){
935 if(ntransitions!=earthid)
_error_(
"TransferSeaLevel error message: number of transition vectors is not equal to the number of icecaps!");
937 for(
int i=0;i<earthid;i++){
939 forcing=xNew<IssmDouble>(nv);
941 for(
int j=0;j<nv;j++){
942 forcing[j]=forcingglobal[reCast<int>(transition[j])-1];
950 forcing=xNew<IssmDouble>(nv);
957 if(modelid!=earthid){
960 if(my_rank!=0)forcing=xNew<IssmDouble>(nv);
969 if(forcingglobal)xDelete<IssmDouble>(forcingglobal);
970 if(forcing)xDelete<IssmDouble>(forcing);
972 for(
int i=0;i<ntransitions;i++){
974 xDelete<IssmDouble>(temp);
976 xDelete<IssmDouble*>(transitions);
977 xDelete<int>(transitions_m);
978 xDelete<int>(transitions_n);
◆ EarthMassTransport()
void EarthMassTransport |
( |
FemModel * |
femmodel | ) |
|
◆ slrconvergence()
Definition at line 1031 of file sealevelchange_core.cpp.
1033 bool converged=
true;
1041 if (xIsNan<IssmDouble>(ndS))
_error_(
"convergence criterion is NaN!");
1043 if(!xIsNan<IssmDouble>(eps_rel)){
1045 if (xIsNan<IssmDouble>(nS))
_error_(
"convergence criterion is NaN!");
1052 if(!xIsNan<IssmDouble>(eps_rel)){
1053 if((ndS/nS)<eps_rel){
1054 if(
VerboseConvergence())
_printf0_(setw(50) << left <<
" convergence criterion: norm(dS)/norm(S)" << ndS/nS*100 <<
" < " << eps_rel*100 <<
" %\n");
1057 if(
VerboseConvergence())
_printf0_(setw(50) << left <<
" convergence criterion: norm(dS)/norm(S)" << ndS/nS*100 <<
" > " << eps_rel*100 <<
" %\n");
1061 if(!xIsNan<IssmDouble>(eps_abs)){
1072 *pconverged=converged;
◆ CorePointerFromSolutionEnum()
void CorePointerFromSolutionEnum |
( |
void(**)(FemModel *) |
psolutioncore, |
|
|
Parameters * |
parameters, |
|
|
int |
solutiontype |
|
) |
| |
◆ WrapperCorePointerFromSolutionEnum()
void WrapperCorePointerFromSolutionEnum |
( |
void(**)(FemModel *) |
psolutioncore, |
|
|
Parameters * |
parameters, |
|
|
int |
solutiontype, |
|
|
bool |
nodakotacore = false |
|
) |
| |
Definition at line 17 of file WrapperCorePointerFromSolutionEnum.cpp.
20 void (*solutioncore)(
FemModel*)=NULL;
23 bool control_analysis;
34 if(nodakotacore)dakota_analysis=
false;
40 _error_(
"ISSM was not compiled with dakota support, cannot carry out dakota analysis!");
43 else if(control_analysis){
44 switch(inversiontype){
50 default:
_error_(
"control type not supported");
57 *psolutioncore=solutioncore;
◆ AdjointCorePointerFromSolutionEnum()
void AdjointCorePointerFromSolutionEnum |
( |
void(**)(FemModel *) |
padjointcore, |
|
|
int |
solutiontype |
|
) |
| |
@ FreeSurfaceTopAnalysisEnum
@ BalancethicknessAnalysisEnum
void controlvalidation_core(FemModel *femmodel)
@ SmbRequestedOutputsEnum
@ DslSeaWaterPressureChangeAtSeaFloor
@ DslSeaSurfaceHeightChangeAboveGeoidEnum
@ DslGlobalAverageThermostericSeaLevelChangeEnum
@ EffectivePressureSubstepEnum
void depthaverage_core(FemModel *femmodel)
@ TimesteppingFinalTimeEnum
void movingfront_core(FemModel *femmodel)
void UpdateGapHeight(FemModel *femmodel)
@ SolidearthSettingsAbstolEnum
@ TransientNumRequestedOutputsEnum
void adjointstressbalance_core(FemModel *femmodel)
virtual void Core(FemModel *femmodel)=0
@ Balancethickness2SolutionEnum
@ TransientIsmasstransportEnum
void OutputResultsx(FemModel *femmodel)
void extrudefrombase_core(FemModel *femmodel)
@ InputToDepthaverageOutEnum
@ AutodiffDependentObjectsEnum
SealevelMasks * sealevelrise_core_masks(FemModel *femmodel)
@ InversionNumControlParametersEnum
@ ThermalRequestedOutputsEnum
void dummy_core(FemModel *femmodel)
@ GroundinglineMigrationEnum
@ ExtrudeFromBaseAnalysisEnum
@ MasstransportAnalysisEnum
@ BalancevelocityAnalysisEnum
#define _printf0_(StreamArgs)
@ TransientRequestedOutputsEnum
@ HydrologySheetThicknessOldEnum
void PetscOptionsDetermineSolverType(int *psolver_type)
void transient_core(FemModel *femmodel)
@ StressbalanceAnalysisEnum
void InputMakeDiscontinuous(int enum_in)
bool VerboseConvergence(void)
IssmDouble FormFunction(IssmDouble *X, void *usr)
void thermal_core(FemModel *femmodel)
int AddObject(Object *object)
@ HydrologyRequestedOutputsEnum
@ LevelsetReinitFrequencyEnum
#define _printf_(StreamArgs)
@ InversionControlParametersEnum
void AdjointCorePointerFromSolutionEnum(void(**padjointcore)(FemModel *), int solutiontype)
void InitTransientInputx(int *transientinput_enum, int numoutputs)
@ Balancethickness2AnalysisEnum
@ ExtrudeFromTopAnalysisEnum
void love_core(FemModel *femmodel)
@ LevelsetfunctionSlopeXEnum
void adjointbalancethickness2_core(FemModel *femmodel)
@ BalancethicknessSoftSolutionEnum
void sealevelrise_diagnostics(FemModel *femmodel, Vector< IssmDouble > *RSLg)
static ISSM_MPI_Comm GetComm(void)
@ TimesteppingTimeStepEnum
void CorePointerFromSolutionEnum(void(**psolutioncore)(FemModel *), Parameters *parameters, int solutiontype)
@ AutodiffFosForwardIndexEnum
@ DepthAverageAnalysisEnum
@ AdaptiveTimesteppingEnum
@ BalancevelocitySolutionEnum
@ LevelsetfunctionSlopeYEnum
@ ThermalNumRequestedOutputsEnum
@ DamageEvolutionAnalysisEnum
void solutionsequence_schurcg(FemModel *femmodel)
bool steadystateconvergence(Vector< IssmDouble > *tg, Vector< IssmDouble > *tg_old, Vector< IssmDouble > *ug, Vector< IssmDouble > *ug_old, IssmDouble reltol)
void CostFunctionx(IssmDouble *pJ, IssmDouble **pJlist, int *pn)
#define GROUNDINGLINECORE
@ SmbMassBalanceTransientEnum
@ HydrologydcIsefficientlayerEnum
void GetVectorFromInputsx(IssmDouble **pvector, int *pvector_size, FemModel *femmodel, int name)
int NumberOfVertices(void)
@ HydrologydcEplThicknessSubstepEnum
void GeothermalFluxx(FemModel *femmodel)
@ BalancethicknessSolutionEnum
void OceanExchangeDatax(FemModel *femmodel, bool init_stage)
void balancevelocity_core(FemModel *femmodel)
Vector< doubletype > * Duplicate(void)
@ FreeSurfaceBaseAnalysisEnum
@ DamageEvolutionSolutionEnum
@ HydrologyShaktiAnalysisEnum
@ IceMaskNodeActivationEnum
@ MasstransportStabilizationEnum
@ SettingsSbCouplingFrequencyEnum
void esa_core(FemModel *femmodel)
@ MasstransportRequestedOutputsEnum
@ HydrologydcEplThicknessTransientEnum
@ HydrologyPismAnalysisEnum
@ SteadystateNumRequestedOutputsEnum
void OutputControlsx(Results **presults)
void TimeAdaptx(IssmDouble *pdt)
@ SealevelriseSolutionEnum
@ AutodiffFovForwardIndicesEnum
@ SolidearthSettingsHorizEnum
@ TransientIsgroundinglineEnum
@ DamageStabilizationEnum
@ SealevelriseRunCountEnum
@ SteadystateRequestedOutputsEnum
@ DamageEvolutionNumRequestedOutputsEnum
void EarthMassTransport(FemModel *femmodel)
void grd_core(FemModel *femmodel)
void solutionsequence_linear(FemModel *femmodel)
@ HydrologydcEplThicknessOldEnum
void steadystate_core(FemModel *femmodel)
@ InversionMaxiterPerStepEnum
void solutionsequence_nonlinear(FemModel *femmodel, bool conserve_loads)
void RequestedDependentsx(void)
void solutionsequence_shakti_nonlinear(FemModel *femmodel)
void ResetBoundaryConditions(FemModel *femmodel, int analysis_type)
void hydrology_core(FemModel *femmodel)
@ HydrologyDCInefficientAnalysisEnum
void BrentSearch(IssmDouble **pJ, OptPars optpars, IssmDouble *X0, IssmDouble(*f)(IssmDouble *, void *), IssmDouble(*g)(IssmDouble **, IssmDouble *, void *), void *usr)
doubletype Norm(NormMode norm_type)
void AddValue(IssmDouble in_value)
void control_core(FemModel *femmodel)
@ SealevelriseTransitionsEnum
void sealevelrise_core_geometry(FemModel *femmodel)
@ HydrologyGlaDSAnalysisEnum
void Scale(doubletype scale_factor)
void solutionsequence_la(FemModel *femmodel)
@ SolidearthSettingsReltolEnum
@ SealevelriseCumDeltathicknessEnum
@ DslComputeFingerprintsEnum
void InputExtrudex(FemModel *femmodel, int input_enum, int start)
void UpdateEffectivePressure(FemModel *femmodel)
void sealevelrise_core_geometry(FemModel *femmodel)
@ LoveAllowLayerDeletionEnum
void SetParam(bool boolean, int enum_type)
@ SedimentHeadTransientEnum
void SurfaceAreax(IssmDouble *pS, FemModel *femmodel)
@ SolidearthSettingsMaxiterEnum
void AXPY(Vector *X, doubletype a)
bool VerboseAutodiff(void)
@ AdjointBalancethicknessAnalysisEnum
void sealevelchange_core(FemModel *femmodel)
void HydrologyIDSupdateDomainx(IssmDouble *pIDScount)
@ L2ProjectionBaseAnalysisEnum
@ BasalforcingsGroundediceMeltingRateEnum
@ ExtrapolationVariableEnum
void solutionsequence_glads_nonlinear(FemModel *femmodel)
void SetValues(int ssize, int *list, doubletype *values, InsMode mode)
void extrudefromtop_core(FemModel *femmodel)
@ SealevelInertiaTensorXZEnum
@ AdjointHorizAnalysisEnum
void KillIcebergsx(FemModel *femmodel)
@ SmbMassBalanceSubstepEnum
@ HydrologySheetThicknessEnum
void ResetFSBasalBoundaryConditionx(Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
const char * EnumToStringx(int enum_in)
@ SealevelRSLEustaticEnum
void smb_core(FemModel *femmodel)
void slrconvergence(bool *pconverged, Vector< IssmDouble > *RSLg, Vector< IssmDouble > *RSLg_old, IssmDouble eps_rel, IssmDouble eps_abs)
void FloatingiceMeltingRatex(FemModel *femmodel)
@ SMBgradientscomponentsEnum
@ SmoothThicknessMultiplierEnum
void controladm1qn3_core(FemModel *femmodel)
@ BasalforcingsFloatingiceMeltingRateEnum
IssmDouble alpha(IssmDouble x, IssmDouble y, IssmDouble z, int testid)
@ StressbalanceSolutionEnum
void solutionsequence_thermal_nonlinear(FemModel *femmodel)
#define MASSTRANSPORTCORE
@ TransientIsoceancouplingEnum
Vector< IssmDouble > * sealevelrise_core_eustatic(FemModel *femmodel, SealevelMasks *masks, IssmDouble *poceanarea)
void gia_core(FemModel *femmodel)
@ MasstransportSolutionEnum
@ AutodiffFosReverseIndexEnum
void AverageTransientInputx(int *transientinput_enum, int *averagedinput_enum, IssmDouble init_time, IssmDouble end_time, int numoutputs, int averaging_method)
int ISSM_MPI_Send(void *buf, int count, ISSM_MPI_Datatype datatype, int dest, int tag, ISSM_MPI_Comm comm)
void Gradjx(Vector< IssmDouble > **pgradient, IssmDouble **pnorm_list, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
void Damagex(FemModel *femmodel)
void sealevelrise_core_viscous(Vector< IssmDouble > **pU_gia, Vector< IssmDouble > **pN_gia, FemModel *femmodel, Vector< IssmDouble > *RSLg)
Constraints * constraints
void GetMaskOfIceVerticesLSMx(FemModel *femmodel)
void TransferForcing(FemModel *femmodel, int forcingenum)
void UpdateConstraintsExtrudeFromBasex()
@ TransientIshydrologyEnum
@ TransientAmrFrequencyEnum
@ SealevelriseAnalysisEnum
int AddResult(ExternalResult *result)
void dynstr_core(FemModel *femmodel)
void Stop(int tagenum, bool dontmpisync=true)
@ SealevelriseGeometryDoneEnum
@ SettingsRecordingFrequencyEnum
@ HydrologyNumRequestedOutputsEnum
void masstransport_core(FemModel *femmodel)
void controlm1qn3_core(FemModel *femmodel)
void StackTransientInputx(int *input_enum, int *transientinput_enum, IssmDouble hydrotime, int numoutputs)
int ISSM_MPI_Bcast(void *buffer, int count, ISSM_MPI_Datatype datatype, int root, ISSM_MPI_Comm comm)
void Responsex(IssmDouble *poutput_value, FemModel *femmodel)
@ HydrologyShreveAnalysisEnum
@ TransientIsstressbalanceEnum
virtual int ObjectEnum()=0
@ TimesteppingStartTimeEnum
void surfaceslope_core(FemModel *femmodel)
void dakota_core(FemModel *femmodel)
int StringToEnumx(const char *string_in, bool notfounderror=true)
void controltao_core(FemModel *femmodel)
void bmb_core(FemModel *femmodel)
@ LevelsetKillIcebergsEnum
@ InversionStepThresholdEnum
@ SedimentHeadSubstepEnum
@ HydrologydcEplThicknessEnum
@ StressbalanceSIAAnalysisEnum
void Core(FemModel *femmodel)
void adjointbalancethickness_core(FemModel *femmodel)
@ StressbalanceRequestedOutputsEnum
@ MasstransportIsfreesurfaceEnum
void sealevelrise_core_elastic(Vector< IssmDouble > **pU_esa, Vector< IssmDouble > **pU_north_esa, Vector< IssmDouble > **pU_east_esa, FemModel *femmodel, Vector< IssmDouble > *RSLg, SealevelMasks *masks)
@ SealevelInertiaTensorZZEnum
@ InversionControlScalingFactorsEnum
@ InputToDepthaverageInEnum
void AYPX(Vector *X, doubletype a)
@ GLheightadvectionAnalysisEnum
@ StressbalanceNumRequestedOutputsEnum
void UpdateWaterColumn(FemModel *femmodel)
@ SealevelriseRequestedOutputsEnum
#define _error_(StreamArgs)
void Start(int tagenum, bool dontmpisync=true)
@ SurfaceSlopeSolutionEnum
@ SolidearthSettingsRotationEnum
bool VerboseSolution(void)
Object * GetObjectByOffset(int offset)
@ SurfaceloadIceThicknessChangeEnum
@ TransientIsmovingfrontEnum
@ InversionNumCostFunctionsEnum
@ SettingsOutputFrequencyEnum
@ SolidearthSettingsRunFrequencyEnum
@ DamageEvolutionRequestedOutputsEnum
void GroundinglineMigrationx(Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
@ AutodiffNumDependentsEnum
void RequestedOutputsx(Results **presults, char **requested_outputs, int numoutputs, bool save_results=true)
void SetCurrentConfiguration(int configuration_type)
@ SmbNumRequestedOutputsEnum
#define STRESSBALANCECORE
void damage_core(FemModel *femmodel)
IssmDouble * burgers_viscosity
@ HydrologyStepsPerStepEnum
void FindParam(bool *pinteger, int enum_type)
void levelsetfunctionslope_core(FemModel *femmodel)
void balancethickness2_core(FemModel *femmodel)
void bedslope_core(FemModel *femmodel)
void solutionsequence_hydro_nonlinear(FemModel *femmodel)
IssmDouble FormFunctionGradient(IssmDouble **pG, IssmDouble *X, void *usr)
@ SteadystateSolutionEnum
void Calvingx(FemModel *femmodel)
@ EsaRequestedOutputsEnum
void VertexCoordinatesx(IssmDouble **px, IssmDouble **py, IssmDouble **pz, Vertices *vertices, bool spherical)
int ISSM_MPI_Recv(void *buf, int count, ISSM_MPI_Datatype datatype, int source, int tag, ISSM_MPI_Comm comm, ISSM_MPI_Status *status)
@ SealevelriseCumDeltathicknessOldEnum
doubletype * ToMPISerial(void)
IssmDouble GetValue(void)
void solutionsequence_fct(FemModel *femmodel)
void solutionsequence_adjoint_linear(FemModel *femmodel)
@ MasstransportNumRequestedOutputsEnum
void UpdateDynamicConstraintsx(Constraints *constraints, Nodes *nodes, Parameters *parameters, Vector< IssmDouble > *yg)
Param * FindParamObject(int enum_type)
Declaration of DataSet class.
void Shift(doubletype shift)
void stressbalance_core(FemModel *femmodel)
void TransferSealevel(FemModel *femmodel, int forcingenum)
@ AutodiffNumIndependentsEnum
void WriteMeshInResults(void)
int NumberOfDofs(int setenum)
@ SealevelInertiaTensorYZEnum
bool VerboseControl(void)
void SetChannelCrossSectionOld(FemModel *femmodel)
void GetStericRate(Vector< IssmDouble > **psteric_rate_g, FemModel *femmodel)
void UpdateConstraintsExtrudeFromTopx()
void FrontalForcingsx(FemModel *femmodel)
void balancethickness_core(FemModel *femmodel)
@ EffectivePressureTransientEnum
@ AggressiveMigrationEnum
@ SolidearthSettingsComputesealevelchangeEnum
@ HydraulicPotentialOldEnum
void GetDynamicRate(Vector< IssmDouble > **pdynamic_rate_g, FemModel *femmodel)
int UpdateVertexPositionsx(void)
int ISSM_MPI_Gather(void *sendbuf, int sendcnt, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm)
@ AdjointBalancethickness2AnalysisEnum
void FourierLoveCorex(IssmDouble *LoveKr, IssmDouble *LoveKi, IssmDouble *LoveHr, IssmDouble *LoveHi, IssmDouble *LoveLr, IssmDouble *LoveLi, IssmDouble *LoveKernelsReal, IssmDouble *LoveKernelsImag, int nfreq, IssmDouble *frequencies, int sh_nmax, int sh_nmin, IssmDouble g0, IssmDouble r0, IssmDouble mu0, bool allow_layer_deletion, int forcing_type, bool verbosemod, int numlayers, IssmDouble *radius, IssmDouble *viscosity, IssmDouble *lame_lambda, IssmDouble *lame_mu, IssmDouble *burgers_viscosity, IssmDouble *burgers_mu, IssmDouble *density, IssmDouble *isburgers, IssmDouble *issolid)
Vector< IssmDouble > * sealevelrise_core_noneustatic(FemModel *femmodel, SealevelMasks *masks, Vector< IssmDouble > *RSLg_eustatic, IssmDouble oceanarea)
@ BasalforcingsPicoIsplumeEnum
@ TransientIsdamageevolutionEnum