10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
13 #include "../classes.h"
14 #include "../Inputs2/PentaInput2.h"
15 #include "../Inputs2/ControlInput2.h"
16 #include "../Inputs2/TransientInput2.h"
17 #include "../Inputs2/DatasetInput2.h"
18 #include "../../shared/shared.h"
23 #define NUMVERTICES2D 3
33 int penta_elements_ids[2];
41 this->
sid = penta_sid;
42 this->
lid = penta_lid;
49 if (xIsNan<IssmDouble>(iomodel->
Data(
"md.mesh.upperelements")[penta_sid]) || iomodel->
Data(
"md.mesh.upperelements")[penta_sid]==-1.) penta_elements_ids[1]=this->
id;
50 else penta_elements_ids[1]=reCast<int,IssmDouble>((iomodel->
Data(
"md.mesh.upperelements")[penta_sid]));
51 if (xIsNan<IssmDouble>(iomodel->
Data(
"md.mesh.lowerelements")[penta_sid]) || iomodel->
Data(
"md.mesh.lowerelements")[penta_sid]==-1.) penta_elements_ids[0]=this->
id;
52 else penta_elements_ids[0]=reCast<int,IssmDouble>((iomodel->
Data(
"md.mesh.lowerelements")[penta_sid]));
93 for(i=0;i<nanalyses;i++) {
107 else penta->
hnodes[i] = NULL;
110 else penta->
hnodes = NULL;
118 penta->
id = this->
id;
129 unsigned int num_nodes = 6;
130 penta->
nodes = xNew<Node*>(num_nodes);
131 for(i=0;i<num_nodes;i++)
if(this->
nodes[i]) penta->
nodes[i]=this->
nodes[i];
else penta->
nodes[i] = NULL;
133 else penta->
nodes = NULL;
143 void Penta::Marshall(
char** pmarshalled_data,
int* pmarshalled_data_size,
int marshall_direction){
170 extrudedvalues[i]=values[i];
175 penta->
AddInput2(input_enum,&extrudedvalues[0],interpolation_enum);
180 else _error_(
"not implemented yet");
192 switch(interpolation_enum){
218 switch(interpolation_enum){
236 if(num_inputs<1)
_error_(
"Cannot create a DatasetInput of size <1");
238 if(N!=num_inputs)
_error_(
"Sizes are not consistent");
248 for(
int i=0;i<num_inputs;i++){
249 for(
int j=0;j<
NUMVERTICES;j++) nodeinputs[j]=array[vertexsids[j]*N+i];
274 IssmDouble B,sigma_max,sigma_max_floating,sigma_max_grounded,n;
299 for(
int iv=0;iv<3;iv++){
311 vel=sqrt(vx*vx+vy*vy)+1.e-14;
315 this->
StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
318 Matrix2x2Eigen(&lambda1,&lambda2,&ex,&ey,epsilon[0],epsilon[2],epsilon[1]);
319 _assert_(!xIsNan<IssmDouble>(lambda1));
320 _assert_(!xIsNan<IssmDouble>(lambda2));
323 lambda1 =
max(lambda1,0.);
324 lambda2 =
max(lambda2,0.);
327 epse_2 = 1./2. *(lambda1*lambda1 + lambda2*lambda2);
328 sigma_vm[iv] = sqrt(3.) * B * pow(epse_2,1./(2.*n));
332 sigma_max = sigma_max_floating;
334 sigma_max = sigma_max_grounded;
342 calvingratex[iv]=vx*sigma_vm[iv]/sigma_max;
343 calvingratey[iv]=vy*sigma_vm[iv]/sigma_max;
345 calvingrate[iv] =sqrt(calvingratex[iv]*calvingratex[iv] + calvingratey[iv]*calvingratey[iv]);
395 strainperpendicular_input->
GetInputValue(&strainperpendicular,gauss);
399 calvingrate[iv]=propcoeff*strainparallel*strainperpendicular;
400 if(calvingrate[iv]<0){
403 calvingratex[iv]=calvingrate[iv]*vx/(sqrt(vel)+1.e-14);
404 calvingratey[iv]=calvingrate[iv]*vy/(sqrt(vel)+1.e-14);
425 int domaintype,index1,index2;
438 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
439 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
440 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
447 s1=gl[2]/(gl[2]-gl[1]);
448 s2=gl[2]/(gl[2]-gl[0]);
452 xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
453 xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
454 xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
455 xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
456 xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
457 xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
459 else if(gl[1]*gl[2]>0){
462 s1=gl[0]/(gl[0]-gl[1]);
463 s2=gl[0]/(gl[0]-gl[2]);
468 xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
469 xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
470 xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
471 xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
472 xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
473 xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
475 else if(gl[0]*gl[2]>0){
478 s1=gl[1]/(gl[1]-gl[0]);
479 s2=gl[1]/(gl[1]-gl[2]);
484 xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
485 xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
486 xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
487 xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
488 xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
489 xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
502 normal[0] = -normal[0];
503 normal[1] = -normal[1];
508 IssmDouble calvingratex,calvingratey,thickness,Jdet,flux_per_area;
511 Input2* calvingratex_input=NULL;
512 Input2* calvingratey_input=NULL;
518 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
526 flux += rho_ice*Jdet*gauss->
weight*thickness*(calvingratex*normal[0] + calvingratey*normal[1]);
527 area += Jdet*gauss->
weight*thickness;
529 flux_per_area=flux/area;
547 int domaintype,index1,index2;
560 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
561 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
562 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
569 s1=gl[2]/(gl[2]-gl[1]);
570 s2=gl[2]/(gl[2]-gl[0]);
574 xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
575 xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
576 xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
577 xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
578 xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
579 xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
581 else if(gl[1]*gl[2]>0){
584 s1=gl[0]/(gl[0]-gl[1]);
585 s2=gl[0]/(gl[0]-gl[2]);
590 xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
591 xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
592 xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
593 xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
594 xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
595 xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
597 else if(gl[0]*gl[2]>0){
600 s1=gl[1]/(gl[1]-gl[0]);
601 s2=gl[1]/(gl[1]-gl[2]);
606 xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
607 xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
608 xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
609 xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
610 xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
611 xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
624 normal[0] = -normal[0];
625 normal[1] = -normal[1];
630 IssmDouble calvingratex,calvingratey,vx,vy,vel,meltingrate,meltingratex,meltingratey,thickness,Jdet,flux_per_area;
633 Input2* calvingratex_input=NULL;
634 Input2* calvingratey_input=NULL;
637 Input2* meltingrate_input=NULL;
646 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
656 meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
657 meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
660 flux += rho_ice*Jdet*gauss->
weight*thickness*((calvingratex+meltingratex)*normal[0] + (calvingratey+meltingratey)*normal[1]);
661 area += Jdet*gauss->
weight*thickness;
663 flux_per_area=flux/area;
675 _error_(
"not implemented (needs to be redone)");
679 int analysis_type,approximation;
716 for(i=0;i<3;i++)
for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];
726 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
731 this->
StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
732 this->
material->
ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
736 sigma_xx=2*viscosity*epsilon[0]-pressure*FSreconditioning;
737 sigma_yy=2*viscosity*epsilon[1]-pressure*FSreconditioning;
738 sigma_zz=2*viscosity*epsilon[2]-pressure*FSreconditioning;
739 sigma_xy=2*viscosity*epsilon[3];
740 sigma_xz=2*viscosity*epsilon[4];
741 sigma_yz=2*viscosity*epsilon[5];
744 NormalBase(&bed_normal[0],&xyz_list_tria[0][0]);
747 basalforce[0] += sigma_xx*bed_normal[0] + sigma_xy*bed_normal[1] + sigma_xz*bed_normal[2];
748 basalforce[1] += sigma_xy*bed_normal[0] + sigma_yy*bed_normal[1] + sigma_yz*bed_normal[2];
749 basalforce[2] += sigma_xz*bed_normal[0] + sigma_yz*bed_normal[1] + sigma_zz*bed_normal[2];
752 value+=sigma_zz*Jdet2d*gauss->
weight;
753 surface+=Jdet2d*gauss->
weight;
789 this->
StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
790 this->
material->
ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
793 tau_xx[iv]=2*viscosity*epsilon[0];
794 tau_yy[iv]=2*viscosity*epsilon[1];
795 tau_zz[iv]=2*viscosity*epsilon[2];
796 tau_xy[iv]=2*viscosity*epsilon[3];
797 tau_xz[iv]=2*viscosity*epsilon[4];
798 tau_yz[iv]=2*viscosity*epsilon[5];
800 tau_eff[iv] = tau_xx[iv]*tau_xx[iv] + tau_yy[iv]*tau_yy[iv] + tau_zz[iv]*tau_zz[iv] +
801 2*tau_xy[iv]*tau_xy[iv] + 2*tau_xz[iv]*tau_xz[iv] + 2*tau_yz[iv]*tau_yz[iv];
803 tau_eff[iv] = sqrt(tau_eff[iv]/2.);
847 this->
StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
848 this->
material->
ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
852 sigma_xx[iv]=2*viscosity*epsilon[0]-pressure;
853 sigma_yy[iv]=2*viscosity*epsilon[1]-pressure;
854 sigma_zz[iv]=2*viscosity*epsilon[2]-pressure;
855 sigma_xy[iv]=2*viscosity*epsilon[3];
856 sigma_xz[iv]=2*viscosity*epsilon[4];
857 sigma_yz[iv]=2*viscosity*epsilon[5];
874 int analysis_counter;
891 else this->
nodes=NULL;
943 for(
int i=0;i<
NUMVERTICES;i++) grad_list[i]=gradient[idlist[i]];
976 values[iv] = reCast<IssmPDouble>(value)/reCast<IssmPDouble>(connectivity[iv]);
977 gradients[iv] = reCast<IssmPDouble>(gradient)/reCast<IssmPDouble>(connectivity[iv]);
993 if(xIsNan<IssmDouble>(distance))
_error_(
"NaN found in vector");
994 if(xIsInf<IssmDouble>(distance))
_error_(
"Inf found in vector");
1016 Input2* averaged_copy = averaged_input->
copy();
1018 averaged_copy->
ChangeEnum(averagedinput_enum);
1024 switch(response_enum){
1057 xmin=xyz_list[0][0]; xmax=xyz_list[0][0];
1058 ymin=xyz_list[0][1]; ymax=xyz_list[0][1];
1059 zmin=xyz_list[0][2]; zmax=xyz_list[0][2];
1062 if(xyz_list[i][0]<xmin) xmin=xyz_list[i][0];
1063 if(xyz_list[i][0]>xmax) xmax=xyz_list[i][0];
1064 if(xyz_list[i][1]<ymin) ymin=xyz_list[i][1];
1065 if(xyz_list[i][1]>ymax) ymax=xyz_list[i][1];
1066 if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];
1067 if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
1083 IssmDouble phi,base_area,scalefactor,floatingarea;
1094 base_area= 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
1096 floatingarea=(1-phi)*base_area;
1101 floatingarea=floatingarea*scalefactor;
1105 return floatingarea;
1115 _error_(
"Cannot compute contact condition for non FS elements");
1148 this->
StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
1155 sigmaxx[iv]=2*viscosity*epsilon[0]-pressure[iv];
1156 sigmayy[iv]=2*viscosity*epsilon[1]-pressure[iv];
1157 sigmazz[iv]=2*viscosity*epsilon[2]-pressure[iv];
1158 sigmaxy[iv]=2*viscosity*epsilon[3];
1159 sigmaxz[iv]=2*viscosity*epsilon[4];
1160 sigmayz[iv]=2*viscosity*epsilon[5];
1169 sigma_nn[i]=-1*(sigmaxx[i]*bed_normal[0]*bed_normal[0] + sigmayy[i]*bed_normal[1]*bed_normal[1] + sigmazz[i]*bed_normal[2]*bed_normal[2]+2*sigmaxy[i]*bed_normal[0]*bed_normal[1]+2*sigmaxz[i]*bed_normal[0]*bed_normal[2]+2*sigmayz[i]*bed_normal[1]*bed_normal[2]);
1170 water_pressure[i]=-gravity*rho_water*base[i];
1187 xDelete<IssmDouble>(xyz_list);
1197 area_init=fabs(xyz_list[1*3+0]*xyz_list[2*3+1] - xyz_list[1*3+1]*xyz_list[2*3+0] + xyz_list[0*3+0]*xyz_list[1*3+1] - xyz_list[0*3+1]*xyz_list[1*3+0] + xyz_list[2*3+0]*xyz_list[0*3+1] - xyz_list[2*3+1]*xyz_list[0*3+0])/2.;
1202 xyz_bis[j][k]=xyz_list[j*3+k];
1205 for(i=0;i<numpoints;i++){
1209 xyz_bis[j][k]=xyz_zero[i*3+k];
1213 area_portion=fabs(xyz_bis[1][0]*xyz_bis[2][1] - xyz_bis[1][1]*xyz_bis[2][0] + xyz_bis[0][0]*xyz_bis[1][1] - xyz_bis[0][1]*xyz_bis[1][0] + xyz_bis[2][0]*xyz_bis[0][1] - xyz_bis[2][1]*xyz_bis[0][0])/2.;
1214 *(area_coordinates+3*i+j)=area_portion/area_init;
1219 xyz_bis[j][k]=xyz_list[j*3+k];
1271 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
1272 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
1273 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
1276 if(gl[0]>0 && gl[1]>0 && gl[2]>0){
1281 else if(gl[0]<0 && gl[1]<0 && gl[2]<0){
1287 if(gl[0]*gl[1]*gl[2]<0) floating=
false;
1291 f1=gl[2]/(gl[2]-gl[0]);
1292 f2=gl[2]/(gl[2]-gl[1]);
1294 else if(gl[1]*gl[2]>0){
1296 f1=gl[0]/(gl[0]-gl[1]);
1297 f2=gl[0]/(gl[0]-gl[2]);
1299 else if(gl[0]*gl[2]>0){
1301 f1=gl[1]/(gl[1]-gl[2]);
1302 f2=gl[1]/(gl[1]-gl[0]);
1304 else _error_(
"case not possible");
1309 *mainlyfloating=floating;
1315 bool mainlyfloating =
true;
1317 IssmDouble phi,s1,s2,area_init,area_grounded;
1325 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
1326 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
1327 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
1330 if(gl[0]>0 && gl[1]>0 && gl[2]>0){
1333 else if(gl[0]<0 && gl[1]<0 && gl[2]<0){
1338 if(gl[0]*gl[1]*gl[2]>0) mainlyfloating=
false;
1342 xyz_bis[2][0]=xyz_list[3*2+0];
1343 xyz_bis[2][1]=xyz_list[3*2+1];
1344 xyz_bis[2][2]=xyz_list[3*2+2];
1347 s1=gl[2]/(gl[2]-gl[1]);
1348 s2=gl[2]/(gl[2]-gl[0]);
1351 xyz_bis[1][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
1352 xyz_bis[1][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
1353 xyz_bis[1][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
1356 xyz_bis[0][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
1357 xyz_bis[0][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
1358 xyz_bis[0][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
1360 else if(gl[1]*gl[2]>0){
1362 xyz_bis[0][0]=*(xyz_list+3*0+0);
1363 xyz_bis[0][1]=*(xyz_list+3*0+1);
1364 xyz_bis[0][2]=*(xyz_list+3*0+2);
1367 s1=gl[0]/(gl[0]-gl[1]);
1368 s2=gl[0]/(gl[0]-gl[2]);
1371 xyz_bis[1][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*0+0));
1372 xyz_bis[1][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*0+1));
1373 xyz_bis[1][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*0+2));
1376 xyz_bis[2][0]=*(xyz_list+3*0+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*0+0));
1377 xyz_bis[2][1]=*(xyz_list+3*0+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*0+1));
1378 xyz_bis[2][2]=*(xyz_list+3*0+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*0+2));
1380 else if(gl[0]*gl[2]>0){
1382 xyz_bis[1][0]=*(xyz_list+3*1+0);
1383 xyz_bis[1][1]=*(xyz_list+3*1+1);
1384 xyz_bis[1][2]=*(xyz_list+3*1+2);
1387 s1=gl[1]/(gl[1]-gl[0]);
1388 s2=gl[1]/(gl[1]-gl[2]);
1391 xyz_bis[0][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*1+0));
1392 xyz_bis[0][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*1+1));
1393 xyz_bis[0][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*1+2));
1396 xyz_bis[2][0]=*(xyz_list+3*1+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*1+0));
1397 xyz_bis[2][1]=*(xyz_list+3*1+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*1+1));
1398 xyz_bis[2][2]=*(xyz_list+3*1+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*1+2));
1400 else _error_(
"case not possible");
1405 if(mainlyfloating==
true) area_grounded=area_init-area_grounded;
1406 phi=area_grounded/area_init;
1409 if(phi>1. || phi<0.)
_error_(
"Error. Problem with portion of grounded element: value should be between 0 and 1");
1422 int nrfrontbed,numiceverts;
1436 if(bed[i]<0.) nrfrontbed++;
1451 for(
int i=0;i<numiceverts;i++){
1453 x[counter] = xyz_list[indices[i]][0]+s[counter]*(xyz_list[indices[n]][0]-xyz_list[indices[i]][0]);
1454 y[counter] = xyz_list[indices[i]][1]+s[counter]*(xyz_list[indices[n]][1]-xyz_list[indices[i]][1]);
1462 if(lsf[indices[i]]==0.){
1463 x[counter]=xyz_list[indices[i]][0];
1464 y[counter]=xyz_list[indices[i]][1];
1467 if(counter==2)
break;
1477 _error_(
"not sure what's going on here...");
1479 x1=x[0]; y1=y[0]; x2=x[1]; y2=y[1];
1480 distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
1482 int numthk=numiceverts+2;
1483 H=xNew<IssmDouble>(numthk);
1484 for(
int iv=0;iv<
NUMVERTICES2D;iv++) Haux[iv]=-bed[indices[iv]];
1486 switch(numiceverts){
1489 H[1]=Haux[0]+s[0]*(Haux[1]-Haux[0]);
1490 H[2]=Haux[0]+s[1]*(Haux[2]-Haux[0]);
1491 Haverage=(H[1]+H[2])/2;
1496 H[2]=Haux[0]+s[0]*(Haux[2]-Haux[0]);
1497 H[3]=Haux[1]+s[1]*(Haux[2]-Haux[1]);
1498 Haverage=(H[2]+H[3])/2;
1501 _error_(
"Number of ice covered vertices wrong in Tria::GetIceFrontArea(void)");
1504 frontarea=distance*Haverage;
1508 xDelete<int>(indices);
1509 xDelete<IssmDouble>(H);
1519 int i, dir,nrfrontnodes;
1529 if(levelset[i]>=0.){
1530 indicesfront[nrfrontnodes]=i;
1538 int index=indicesfront[0];
1539 indicesfront[0]=indicesfront[1];
1540 indicesfront[1]=index;
1543 IssmDouble* xyz_front = xNew<IssmDouble>(2*dim*nrfrontnodes);
1545 for(i=0;i<nrfrontnodes;i++){
1546 for(dir=0;dir<dim;dir++){
1547 int ind1=i*dim+dir, ind2=(2*nrfrontnodes-1-i)*dim+dir;
1548 xyz_front[ind1]=xyz_list[dim*indicesfront[i]+dir];
1549 xyz_front[ind2]=xyz_list[dim*(indicesfront[i]+
NUMVERTICES2D)+dir];
1553 *pxyz_front=xyz_front;
1555 xDelete<int>(indicesfront);
1561 if(!input)
return input;
1569 if(interpolation==
P1Enum){
1571 for(
int i=0;i<6;i++) indices[i] =
vertices[i]->
lid;
1572 input->
Serve(numindices,&indices[0]);
1588 if(!input)
return input;
1596 if(interpolation==
P1Enum){
1598 for(
int i=0;i<6;i++) indices[i] =
vertices[i]->
lid;
1599 input->
Serve(numindices,&indices[0]);
1625 for(
int iv=0;iv<
NUMVERTICES;iv++) pvalue[iv] = default_value;
1641 for(
int iv=0;iv<numnodes;iv++){
1647 for(
int iv=0;iv<numnodes;iv++) pvalue[iv] = default_value;
1654 if(!datasetinput)
return NULL;
1656 for(
int i=0;i<datasetinput->
GetNumIds();i++){
1666 if(interpolation==
P1Enum){
1668 for(
int i=0;i<6;i++) indices[i] =
vertices[i]->
lid;
1669 input->
Serve(numindices,&indices[0]);
1677 return datasetinput;
1709 Penta* lower_penta=NULL;
1723 int i, numiceverts, numnoiceverts;
1724 int ind0, ind1, lastindex;
1738 if((lsf[ind0]-level)*(lsf[ind1]-level)<=0.){
1739 if(lsf[ind1]==level)
1752 indices_ice[numiceverts]=i;
1756 indices_noice[numnoiceverts]=i;
1761 for(i=0;i<numiceverts;i++){indices[i]=indices_ice[i];}
1762 for(i=0;i<numnoiceverts;i++){indices[numiceverts+i]=indices_noice[i];}
1764 switch (numiceverts){
1771 fraction[i]=(level-lsf[indices[0]])/(lsf[indices[numiceverts+i]]-lsf[indices[0]]);
1776 fraction[i]=(level-lsf[indices[i]])/(lsf[indices[numiceverts]]-lsf[indices[i]]);
1784 _error_(
"Wrong number of ice vertices in Penta::GetLevelsetIntersectionBase!");
1789 *pnumiceverts=numiceverts;
1798 _error_(
"Vertex provided not found among element vertices");
1815 Penta* upper_penta=NULL;
1841 switch(interpolation){
1845 input->
Serve(numindices,&indices[0]);
1874 PentaInput2* pentainput = xDynamicCast<PentaInput2*>(input);
1890 _error_(
"not implemented (see Tria)");
1896 xDelete<int>(idlist);
1897 xDelete<IssmDouble>(values);
1906 *pxyz_list = xyz_list;
1915 *pxyz_list = xyz_list;
1922 IssmDouble phi,base_area,scalefactor,groundedarea;
1933 base_area= 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
1935 groundedarea=phi*base_area;
1940 groundedarea=groundedarea*scalefactor;
1943 return groundedarea;
1956 int domaintype,index1,index2;
1969 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
1970 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
1971 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
1978 s1=gl[2]/(gl[2]-gl[1]);
1979 s2=gl[2]/(gl[2]-gl[0]);
1983 xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
1984 xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
1985 xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
1986 xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
1987 xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
1988 xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
1990 else if(gl[1]*gl[2]>0){
1993 s1=gl[0]/(gl[0]-gl[1]);
1994 s2=gl[0]/(gl[0]-gl[2]);
1999 xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
2000 xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
2001 xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
2002 xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
2003 xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
2004 xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
2006 else if(gl[0]*gl[2]>0){
2009 s1=gl[1]/(gl[1]-gl[0]);
2010 s2=gl[1]/(gl[1]-gl[2]);
2015 xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
2016 xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
2017 xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
2018 xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
2019 xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
2020 xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
2034 normal[0] = -normal[0];
2035 normal[1] = -normal[1];
2050 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
2058 flux += rho_ice*Jdet*gauss->
weight*thickness*(vx*normal[0] + vy*normal[1]);
2063 xDelete<IssmDouble>(xyz_list);
2076 int domaintype,index1,index2;
2089 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
2090 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
2091 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
2098 s1=gl[2]/(gl[2]-gl[1]);
2099 s2=gl[2]/(gl[2]-gl[0]);
2103 xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
2104 xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
2105 xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
2106 xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
2107 xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
2108 xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
2110 else if(gl[1]*gl[2]>0){
2113 s1=gl[0]/(gl[0]-gl[1]);
2114 s2=gl[0]/(gl[0]-gl[2]);
2119 xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
2120 xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
2121 xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
2122 xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
2123 xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
2124 xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
2126 else if(gl[0]*gl[2]>0){
2129 s1=gl[1]/(gl[1]-gl[0]);
2130 s2=gl[1]/(gl[1]-gl[2]);
2135 xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
2136 xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
2137 xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
2138 xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
2139 xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
2140 xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
2154 normal[0] = -normal[0];
2155 normal[1] = -normal[1];
2172 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
2180 flux += rho_ice*Jdet*gauss->
weight*thickness*(vx*normal[0] + vy*normal[1]);
2184 xDelete<IssmDouble>(xyz_list);
2203 base = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
2208 base=base*scalefactor;
2212 height = 1./3.*((xyz_list[3][2]-xyz_list[0][2])+(xyz_list[4][2]-xyz_list[1][2])+(xyz_list[5][2]-xyz_list[2][2]));
2222 IssmDouble base,bed,surface,bathymetry,scalefactor;
2234 base = 1./2.*fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
2238 base=base*scalefactor;
2245 if(!bed_input)
_error_(
"Could not find bed");
2251 return base*(surface - bed +
min( rho_water/rho_ice * bathymetry, 0.) );
2262 Input2 *original_input = NULL;
2263 Input2 *depth_averaged_input = NULL;
2269 Penta* penta =
this;
2272 for(
int iv=0;iv<3;iv++) gauss[iv] = penta->
NewGaussLine(iv,iv+3,3);
2277 original_input=penta->
GetInput2(original_enum);
2278 if(!original_input)
_error_(
"could not find input with enum " <<
EnumToStringx(original_enum));
2282 for(
int iv=0;iv<3;iv++){
2284 for(
int i=0;i<3;i++){
2285 xyz_list_line[0][i]=xyz_list[iv][i];
2286 xyz_list_line[1][i]=xyz_list[iv+3][i];
2289 for(
int ig=gauss[iv]->begin();ig<gauss[iv]->
end();ig++){
2293 total[iv] += value*Jdet*gauss[iv]->
weight;
2294 intz[iv] += Jdet*gauss[iv]->
weight;
2305 for(
int iv=0;iv<3;iv++)
delete gauss[iv];
2308 for(
int iv=0;iv<3;iv++){
2309 total[iv ] = total[iv]/intz[iv];
2310 total[iv+3] = total[iv];
2330 if(start==-1 && !
IsOnBase())
return;
2339 for(
int id=0;
id<dinput->
GetNumIds();
id++){
2368 if(start==+1 && penta->
IsOnBase())
break;
2377 _error_(
"not implemented yet");
2388 if(start==-1 && !
IsOnBase())
return;
2394 PentaInput2* pentainput = xDynamicCast<PentaInput2*>(input);
2397 PentaInput2* pentainput2= xDynamicCast<PentaInput2*>(input2);
2401 PentaInput2* pentainput3= xDynamicCast<PentaInput2*>(input3);
2424 for(
int i=0;i<
NUMVERTICES2D;i++) extrudedvalues3[i]=extrudedvalues3[i]/2.;
2444 if(start==-1 && !penta->
IsOnBase()){
2450 if(start==+1 && penta->
IsOnBase())
break;
2459 _error_(
"not implemented yet");
2469 if(start==-1 && !
IsOnBase())
return;
2476 PentaInput2* pentainput = xDynamicCast<PentaInput2*>(input);
2499 if(start==+1 && penta->
IsOnBase())
break;
2522 bool control_analysis;
2523 char** controls = NULL;
2524 int num_control_type,num_responses;
2528 iomodel->
FindConstant(&control_analysis,
"md.inversion.iscontrol");
2529 if(control_analysis) iomodel->
FindConstant(&num_control_type,
"md.inversion.num_control_parameters");
2530 if(control_analysis) iomodel->
FindConstant(&num_responses,
"md.inversion.num_cost_functions");
2542 int* doflist = NULL;
2549 IssmDouble* values = xNew<IssmDouble>(numnodes);
2552 for(
int i=0;i<numnodes;i++){
2553 values[i]=solution[doflist[i]];
2554 if(xIsNan<IssmDouble>(values[i]))
_error_(
"NaN found in solution vector");
2555 if(xIsInf<IssmDouble>(values[i]))
_error_(
"Inf found in solution vector");
2562 xDelete<IssmDouble>(values);
2563 xDelete<int>(doflist);
2572 int* doflist = NULL;
2573 Penta *penta = NULL;
2582 for(
int i=0;i<numdof2d;i++){
2583 values[i] =solution[doflist[i]];
2584 values[i+numdof2d]=values[i];
2585 if(xIsNan<IssmDouble>(values[i]))
_error_(
"NaN found in solution vector");
2586 if(xIsInf<IssmDouble>(values[i]))
_error_(
"Inf found in solution vector");
2603 xDelete<int>(doflist);
2609 int *doflist = NULL;
2648 for(
int i=0;i<numdof;i++){
2649 values[i]=vector[doflist[i]];
2650 if(xIsNan<IssmDouble>(values[i]))
_error_(
"NaN found in solution vector");
2651 if(xIsInf<IssmDouble>(values[i]))
_error_(
"Inf found in solution vector");
2657 xDelete<int>(doflist);
2663 if(xIsNan<IssmDouble>(values[i]))
_error_(
"NaN found in solution vector");
2664 if(xIsInf<IssmDouble>(values[i]))
_error_(
"Inf found in solution vector");
2670 xDelete<int>(doflist);
2692 if(ls[i]<0.) nrice++;
2693 if(nrice==1) isicefront=
true;
2722 if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
2777 delete tria->
material;
delete tria;
2795 mass_flux=tria->
MassFlux(x1,y1,x2,y2,segment_id);
2796 delete tria->
material;
delete tria;
2806 int edges[9][2]={{0,1},{0,2},{1,2},{3,4},{3,5},{4,5},{0,3},{1,4},{2,5}};
2816 length=sqrt(pow(xyz_list[node0*3+0]-xyz_list[node1*3+0],2)+pow(xyz_list[node0*3+1]-xyz_list[node1*3+1],2)+pow(xyz_list[node0*3+2]-xyz_list[node1*3+2],2));
2817 if(length<minlength || minlength<0) minlength=length;
2837 return new GaussPenta(area_coordinates,order_horiz,order_vert);
2841 return new GaussPenta(point1,fraction1,fraction2,mainlyfloating,order);
2854 return new GaussPenta(area_coordinates,order_horiz);
2858 return new GaussPenta(vertex1,vertex2,order);
2961 if(found)*pvalue=value;
2971 for(
int i=0;i<3;i++){
2972 v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
2973 v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
2976 normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
2977 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
2978 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
2979 normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
2982 bed_normal[0]=-normal[0]/normal_norm;
2983 bed_normal[1]=-normal[1]/normal_norm;
2984 bed_normal[2]=-normal[2]/normal_norm;
2994 AB[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
2995 AB[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
2996 AB[2]=xyz_list[1*3+2] - xyz_list[0*3+2];
2997 AC[0]=xyz_list[2*3+0] - xyz_list[0*3+0];
2998 AC[1]=xyz_list[2*3+1] - xyz_list[0*3+1];
2999 AC[2]=xyz_list[2*3+2] - xyz_list[0*3+2];
3001 cross(normal,AB,AC);
3002 norm=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
3004 for(
int i=0;i<3;i++) normal[i]=normal[i]/norm;
3013 vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
3014 vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
3016 norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
3018 normal[0]= + vector[1]/norm;
3019 normal[1]= - vector[0]/norm;
3030 v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
3031 v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
3034 normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
3035 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
3036 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
3037 normal_norm=sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);
3039 top_normal[0]=normal[0]/normal_norm;
3040 top_normal[1]=normal[1]/normal_norm;
3041 top_normal[2]=normal[2]/normal_norm;
3067 density=rho_ice/rho_water;
3076 bed_hydro=-density*h[i];
3103 int indices[3]={18,19,20};
3111 int* indices=xNew<int>(size);
3112 for(
int i=0;i<size;i++) indices[i] = offset+i;
3114 xDelete<int>(indices);
3128 int indices[3]={18,19,20};
3135 int* indices=xNew<int>(size);
3136 for(
int i=0;i<size;i++) indices[i] = offset+i;
3138 xDelete<int>(indices);
3149 int *indices = NULL;
3168 for(
int i=0;i<numindices;i++){
3173 groundedicelevelset_input->
GetInputValue(&groundedice,gauss);
3176 xz_plane[0]=1.; xz_plane[3]=-slopex;
3177 xz_plane[1]=0.; xz_plane[4]=-slopey;
3178 xz_plane[2]=slopex; xz_plane[5]=1.;
3187 else _error_(
"Flow equation approximation"<<
EnumToStringx(this->
nodes[indices[i]]->GetApproximation())<<
" not supported yet");
3196 else _error_(
"Flow equation approximation"<<
EnumToStringx(this->
nodes[indices[i]]->GetApproximation())<<
" not supported yet");
3203 xDelete<int>(indices);
3262 if(basinid[iv]==0 || basin_icefront_area[reCast<int>(basinid[iv])-1]==0.) meltrates[iv]=0.;
3265 qsg_basin=qsg/basin_icefront_area[reCast<int>(basinid[iv])-1];
3268 meltrates[iv]=((A*
max(-bed,0.)*pow(
max(qsg_basin,0.),
alpha)+B)*pow(
max(TF,0.),beta))/86400;
3271 if(xIsNan<IssmDouble>(meltrates[iv]))
_error_(
"NaN found in vector");
3272 if(xIsInf<IssmDouble>(meltrates[iv]))
_error_(
"Inf found in vector");
3281 xDelete<IssmDouble>(basin_icefront_area);
3311 control_init=control_enum;
3329 values[i]=vector[vertexpidlist[i]];
3355 control_init=control_enum;
3390 values[i]=vector[idlist[i]];
3407 int analysis_counter;
3415 else this->
nodes=NULL;
3462 int analysis_counter;
3475 this->
SpawnTriaHook(xDynamicCast<ElementHook*>(tria),index1,index2,index3);
3477 if(index1==0 && index2==1 && index3==2){
3480 else if(index1==3 && index2==4 && index3==5){
3503 normu=pow(pow(u,2)+pow(v,2)+pow(w,2),0.5);
3504 if(normu*diameter/(3*2*kappa)<1){
3505 tau_parameter=pow(diameter,2)/(3*2*2*kappa);
3507 else tau_parameter=diameter/(2*normu);
3509 return tau_parameter;
3520 normu=pow(pow(u,p)+pow(v,p)+pow(w,p),1./p);
3521 hk=sqrt(pow(hx,2)+pow(hy,2));
3523 if(normu*hk/(C*2*kappa)<1){
3524 tau_parameter_anisotropic[0]=pow(hk,2)/(C*2*2*kappa);
3526 else tau_parameter_anisotropic[0]=hk/(2*normu);
3530 if(normu*hk/(C*2*kappa)<1){
3531 tau_parameter_anisotropic[1]=pow(hk,2)/(C*2*2*kappa);
3534 tau_parameter_anisotropic[1]=hk/(2*normu);
3568 this->
StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
3569 strainxx=epsilon[0];
3570 strainyy=epsilon[1];
3571 strainxy=epsilon[3];
3574 strainparallel[iv]=(vx*vx*(strainxx)+vy*vy*(strainyy)+2*vy*vx*strainxy)/(vel+1.e-14);
3582 xDelete<IssmDouble>(xyz_list);
3615 this->
StrainRateFS(&epsilon[0],xyz_list,gauss,vx_input,vy_input,vz_input);
3616 strainxx=epsilon[0];
3617 strainyy=epsilon[1];
3618 strainxy=epsilon[3];
3621 strainperpendicular[iv]=(vx*vx*(strainyy)+vy*vy*(strainxx)-2*vy*vx*strainxy)/(vel+1.e-14);
3629 xDelete<IssmDouble>(xyz_list);
3642 IssmDouble pressure,vx,vy,vel,deviaxx,deviaxy,deviayy,water_depth,prof,stress_xx,thickness;
3652 Jdet[0]=(xyz_list[3][2]-xyz_list[0][2])*0.5;
3653 Jdet[1]=(xyz_list[4][2]-xyz_list[1][2])*0.5;
3654 Jdet[2]=(xyz_list[5][2]-xyz_list[2][2])*0.5;
3668 for(
int ig=0;ig<3;ig++){
3670 for (
int iv=gauss->
begin();iv<gauss->end();iv++){
3683 prof=water_depth-penta->
GetZcoord(&xyz_list[0][0],gauss);
3686 stress_xx=(vx*vx*(deviaxx)+vy*vy*(deviayy)+2*vy*vx*deviaxy)/(vel*vel+1.e-6);
3688 if(prof<water_depth&prof<thickness){
3733 delete tria->
material;
delete tria;
3740 delete tria->
material;
delete tria;
3773 if(xyz_list[i][0]<minx) minx=xyz_list[i][0];
3774 if(xyz_list[i][0]>maxx) maxx=xyz_list[i][0];
3775 if(xyz_list[i][1]<miny) miny=xyz_list[i][1];
3776 if(xyz_list[i][1]>maxy) maxy=xyz_list[i][1];
3777 if(xyz_list[i][2]<minz) minz=xyz_list[i][2];
3778 if(xyz_list[i][2]>maxz) maxz=xyz_list[i][2];
3785 IssmDouble dt = C/(maxabsvx/dx+maxabsvy/dy+maxabsvz/dz);
3797 int domaintype,index1,index2;
3810 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
3811 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
3812 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
3819 s1=gl[2]/(gl[2]-gl[1]);
3820 s2=gl[2]/(gl[2]-gl[0]);
3824 xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
3825 xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
3826 xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
3827 xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
3828 xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
3829 xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
3831 else if(gl[1]*gl[2]>0){
3834 s1=gl[0]/(gl[0]-gl[1]);
3835 s2=gl[0]/(gl[0]-gl[2]);
3840 xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
3841 xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
3842 xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
3843 xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
3844 xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
3845 xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
3847 else if(gl[0]*gl[2]>0){
3850 s1=gl[1]/(gl[1]-gl[0]);
3851 s2=gl[1]/(gl[1]-gl[2]);
3856 xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
3857 xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
3858 xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
3859 xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
3860 xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
3861 xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
3875 normal[0] = -normal[0];
3876 normal[1] = -normal[1];
3880 IssmDouble calvingratex,calvingratey,thickness,Jdet;
3883 Input2* calvingratex_input=NULL;
3884 Input2* calvingratey_input=NULL;
3890 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
3898 flux += rho_ice*Jdet*gauss->
weight*thickness*(calvingratex*normal[0] + calvingratey*normal[1]);
3915 int domaintype,index1,index2;
3928 if(gl[0]==0.) gl[0]=gl[0]+epsilon;
3929 if(gl[1]==0.) gl[1]=gl[1]+epsilon;
3930 if(gl[2]==0.) gl[2]=gl[2]+epsilon;
3937 s1=gl[2]/(gl[2]-gl[1]);
3938 s2=gl[2]/(gl[2]-gl[0]);
3942 xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
3943 xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
3944 xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
3945 xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
3946 xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
3947 xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
3949 else if(gl[1]*gl[2]>0){
3952 s1=gl[0]/(gl[0]-gl[1]);
3953 s2=gl[0]/(gl[0]-gl[2]);
3958 xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
3959 xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
3960 xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
3961 xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
3962 xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
3963 xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
3965 else if(gl[0]*gl[2]>0){
3968 s1=gl[1]/(gl[1]-gl[0]);
3969 s2=gl[1]/(gl[1]-gl[2]);
3974 xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
3975 xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
3976 xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
3977 xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
3978 xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
3979 xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
3993 normal[0] = -normal[0];
3994 normal[1] = -normal[1];
4001 IssmDouble calvingratex,calvingratey,vx,vy,vel,meltingrate,meltingratex,meltingratey,thickness,Jdet;
4004 Input2* calvingratex_input=NULL;
4005 Input2* calvingratey_input=NULL;
4008 Input2* meltingrate_input=NULL;
4017 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
4027 meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
4028 meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
4031 flux += rho_ice*Jdet*gauss->
weight*thickness*((calvingratex+meltingratex)*normal[0] + (calvingratey+meltingratey)*normal[1]);
4044 bool mainlyfloating;
4046 IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet,scalefactor;
4049 Gauss* gauss = NULL;
4057 Input2* scalefactor_input = NULL;
4065 gauss = this->
NewGauss(point1,fraction1,fraction2,1-mainlyfloating,3);
4066 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
4075 fbmb+=floatingmelt*Jdet*gauss->
weight*scalefactor;
4078 Total_Fbmb=rho_ice*fbmb;
4089 bool mainlyfloating;
4091 IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet,scalefactor;
4094 Gauss* gauss = NULL;
4102 Input2* scalefactor_input = NULL;
4110 gauss = this->
NewGauss(point1,fraction1,fraction2,mainlyfloating,3);
4111 for(
int ig=gauss->
begin();ig<gauss->end();ig++){
4120 gbmb+=groundedmelt*Jdet*gauss->
weight*scalefactor;
4123 Total_Gbmb=rho_ice*gbmb;
4147 base = 1./2. * fabs((xyz_list[0][0]-xyz_list[2][0])*(xyz_list[1][1]-xyz_list[0][1]) - (xyz_list[0][0]-xyz_list[1][0])*(xyz_list[2][1]-xyz_list[0][1]));
4160 Total_Smb=rho_ice*base*smb*scalefactor;
4170 int penta_vertex_ids[6];
4173 bool dakota_analysis;
4175 int* penta_node_ids = NULL;
4179 iomodel->
FindConstant(&dakota_analysis,
"md.qmu.isdakota");
4189 for(i=0;i<6;i++) penta_vertex_ids[i]=iomodel->
elements[6*index+i];
4192 switch(finiteelement_type){
4195 penta_node_ids = xNew<int>(numnodes);
4196 penta_node_ids[0]=iomodel->
elements[6*index+0];
4197 penta_node_ids[1]=iomodel->
elements[6*index+1];
4198 penta_node_ids[2]=iomodel->
elements[6*index+2];
4199 penta_node_ids[3]=iomodel->
elements[6*index+3];
4200 penta_node_ids[4]=iomodel->
elements[6*index+4];
4201 penta_node_ids[5]=iomodel->
elements[6*index+5];
4205 penta_node_ids = xNew<int>(numnodes);
4206 penta_node_ids[0]=iomodel->
elements[6*index+0];
4207 penta_node_ids[1]=iomodel->
elements[6*index+1];
4208 penta_node_ids[2]=iomodel->
elements[6*index+2];
4209 penta_node_ids[3]=iomodel->
elements[6*index+3];
4210 penta_node_ids[4]=iomodel->
elements[6*index+4];
4211 penta_node_ids[5]=iomodel->
elements[6*index+5];
4216 penta_node_ids = xNew<int>(numnodes);
4217 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4218 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4219 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4220 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4221 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4222 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4229 penta_node_ids = xNew<int>(numnodes);
4230 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4231 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4232 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4233 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4234 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4235 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4245 penta_node_ids = xNew<int>(numnodes);
4246 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4247 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4248 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4249 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4250 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4251 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4261 penta_node_ids = xNew<int>(numnodes);
4262 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4263 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4264 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4265 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4266 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4267 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4280 penta_node_ids = xNew<int>(numnodes);
4281 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4282 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4283 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4284 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4285 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4286 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4314 penta_node_ids = xNew<int>(numnodes);
4315 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4316 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4317 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4318 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4319 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4320 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4336 penta_node_ids = xNew<int>(numnodes);
4337 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4338 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4339 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4340 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4341 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4342 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4359 penta_node_ids = xNew<int>(numnodes);
4360 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4361 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4362 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4363 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4364 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4365 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4376 penta_node_ids = xNew<int>(numnodes);
4377 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4378 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4379 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4380 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4381 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4382 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4394 penta_node_ids = xNew<int>(numnodes);
4395 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4396 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4397 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4398 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4399 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4400 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4423 penta_node_ids = xNew<int>(numnodes);
4424 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4425 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4426 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4427 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4428 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4429 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4445 penta_node_ids = xNew<int>(numnodes);
4446 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4447 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4448 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4449 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4450 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4451 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4486 penta_node_ids = xNew<int>(numnodes);
4487 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4488 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4489 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4490 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4491 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4492 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4516 penta_node_ids = xNew<int>(numnodes);
4517 penta_node_ids[ 0]=iomodel->
elements[6*index+0];
4518 penta_node_ids[ 1]=iomodel->
elements[6*index+1];
4519 penta_node_ids[ 2]=iomodel->
elements[6*index+2];
4520 penta_node_ids[ 3]=iomodel->
elements[6*index+3];
4521 penta_node_ids[ 4]=iomodel->
elements[6*index+4];
4522 penta_node_ids[ 5]=iomodel->
elements[6*index+5];
4543 xDelete<int>(penta_node_ids);
4546 switch(analysis_type){
4549 _assert_(iomodel->
Data(
"md.flowequation.element_equation"));
4555 if(iomodel->
Data(
"md.initialization.vz") && iomodel->
Data(
"md.flowequation.borderFS")){
4556 for(i=0;i<6;i++) nodeinputs[i]=iomodel->
Data(
"md.initialization.vz")[penta_vertex_ids[i]-1]*iomodel->
Data(
"md.flowequation.borderFS")[penta_vertex_ids[i]-1];
4558 for(i=0;i<6;i++) nodeinputs[i]=iomodel->
Data(
"md.initialization.vz")[penta_vertex_ids[i]-1]*(1-iomodel->
Data(
"md.flowequation.borderFS")[penta_vertex_ids[i]-1]);
4562 for(i=0;i<6;i++)nodeinputs[i]=0;
4571 if(iomodel->
Data(
"md.initialization.vz") && iomodel->
Data(
"md.flowequation.borderFS")){
4572 for(i=0;i<6;i++) nodeinputs[i]=iomodel->
Data(
"md.initialization.vz")[penta_vertex_ids[i]-1]*iomodel->
Data(
"md.flowequation.borderFS")[penta_vertex_ids[i]-1];
4574 for(i=0;i<6;i++) nodeinputs[i]=iomodel->
Data(
"md.initialization.vz")[penta_vertex_ids[i]-1]*(1-iomodel->
Data(
"md.flowequation.borderFS")[penta_vertex_ids[i]-1]);
4578 for(i=0;i<6;i++)nodeinputs[i]=0;
4619 int indices[3]={3,4,5};
4626 for(
int i=0;i<3;i++){
4642 if (reCast<bool,IssmDouble>(vertices_potentially_ungrounding[
vertices[i]->Pid()])){
4646 if(nodes_on_iceshelf[
vertices[i]->Pid()]>=0.){
4674 int *indices = xNew<int>(3*2);
4675 indices[0*2 + 0] = 0; indices[0*2 + 1] = 3;
4676 indices[1*2 + 0] = 1; indices[1*2 + 1] = 4;
4677 indices[2*2 + 0] = 2; indices[2*2 + 1] = 5;
4680 *pindices = indices;
4701 GetPhi(&phi,&epsilon[0],viscosity);
4710 _error_(
"GIA deflection not implemented yet!");
4715 #ifdef _HAVE_DAKOTA_
4716 void Penta::InputUpdateFromMatrixDakota(
IssmDouble* matrix,
int nrows,
int ncols,
int name,
int type){
4732 for(
int t=0;t<ncols;t++){
4735 for(
int i=0;i<6;i++){
4737 values[i]=matrix[ncols*row+t];
4749 for(
int t=0;t<ncols;t++){
4762 void Penta::InputUpdateFromVectorDakota(
IssmDouble* vector,
int name,
int type){
4807 di=rho_ice/rho_water;
4810 for (j=0; j<6; j++) {
4812 if (hydrostatic_ratio[j] >= 0.)
4813 thickness[j]=values[j]-(values[j]/thickness_init[j]-1.)*hydrostatic_ratio[j]*surface[j]/(1.-di);
4816 thickness[j]=thickness_init[j];
4819 if (thickness[j] < 0.)
4820 thickness[j]=1./(1.-di);
4821 bed[j]=surface[j]-thickness[j];
4831 for (j=0; j<6; j++) {
4833 if(hydrostatic_ratio[j] >= 0.)
4834 thickness[j]=values[j];
4837 thickness[j]=thickness_init[j];
4842 for(j=0;j<6;j++)bed[j]=surface[j]-thickness[j];
4859 value=vector[this->
Sid()];