Ice Sheet System Model  4.18
Code documentation
Functions
EstarComponents.cpp File Reference
#include <math.h>
#include "../Numerics/types.h"
#include "../Exceptions/exceptions.h"
#include "./elements.h"

Go to the source code of this file.

Functions

void EstarStrainrateQuantities (IssmDouble *pepsprime_norm, IssmDouble vx, IssmDouble vy, IssmDouble vz, IssmDouble vmag, IssmDouble *dvx, IssmDouble *dvy, IssmDouble *dvz, IssmDouble *dvmag)
 
void EstarOmega (IssmDouble *omega, IssmDouble vx, IssmDouble vy, IssmDouble vz, IssmDouble vmag, IssmDouble *dvx, IssmDouble *dvy, IssmDouble *dvz, IssmDouble *dvmag)
 
IssmDouble EstarLambdaS (IssmDouble epseff, IssmDouble epsprime_norm)
 

Function Documentation

◆ EstarStrainrateQuantities()

void EstarStrainrateQuantities ( IssmDouble pepsprime_norm,
IssmDouble  vx,
IssmDouble  vy,
IssmDouble  vz,
IssmDouble  vmag,
IssmDouble dvx,
IssmDouble dvy,
IssmDouble dvz,
IssmDouble dvmag 
)

Definition at line 5 of file EstarComponents.cpp.

5  {/*{{{*/
6 
7  /*Intermediaries*/
8  IssmDouble omega[3];
9  IssmDouble nrsp[3],nrsp_norm;
10  IssmDouble eps[3][3];
11  IssmDouble epsprime[3],epsprime_norm;
12 
13  /*Get omega, correction for rigid body rotation*/
14  EstarOmega(&omega[0],vx,vy,vz,vmag,dvx,dvy,dvz,dvmag);
15 
16  /*Non-rotating shear plane*/
17  nrsp[0] = vy*omega[2] - vz*omega[1];
18  nrsp[1] = vz*omega[0] - vx*omega[2];
19  nrsp[2] = vx*omega[1] - vy*omega[0];
20 
21  /*Normalize*/
22  nrsp_norm = sqrt(nrsp[0]*nrsp[0] + nrsp[1]*nrsp[1] + nrsp[2]*nrsp[2]);
23  if(nrsp_norm==0){
24  nrsp[0] = 0.;
25  nrsp[1] = 0.;
26  nrsp[2] = 0.;
27  }
28  else{
29  nrsp[0] =nrsp[0]/nrsp_norm;
30  nrsp[1] =nrsp[1]/nrsp_norm;
31  nrsp[2] =nrsp[2]/nrsp_norm;
32  }
33 
34  /*Build strain rate tensor*/
35  eps[0][0] = dvx[0]; eps[0][1] = .5*(dvx[1]+dvy[0]); eps[0][2] = .5*(dvx[2]+dvz[0]);
36  eps[1][0] = .5*(dvx[1]+dvy[0]); eps[1][1] = dvy[1]; eps[1][2] = .5*(dvy[2]+dvz[1]);
37  eps[2][0] = .5*(dvx[2]+dvz[0]); eps[2][1] = .5*(dvy[2]+dvz[1]); eps[2][2] = dvz[2];
38 
39  /*Compute the shear strain rate on the non rotating shear plane*/
40  epsprime[0]=0.;
41  epsprime[1]=0.;
42  epsprime[2]=0.;
43  /*term #1: eps'.n */
44  for(int i=0;i<3;i++){
45  for(int j=0;j<3;j++){
46  epsprime[i] += eps[i][j]*nrsp[j];
47  }
48  }
49  /*term #2: ((eps'.n).n)n */
50  for(int i=0;i<3;i++){
51  for(int j=0;j<3;j++){
52  for(int k=0;k<3;k++){
53  epsprime[j] += -nrsp[i]*eps[i][k]*nrsp[k]*nrsp[j];
54  }
55  }
56  }
57  /*term #3: ((eps'.n).omega)omega */
58  for(int i=0;i<3;i++){
59  for(int j=0;j<3;j++){
60  for(int k=0;k<3;k++){
61  epsprime[j] += -nrsp[i]*eps[i][k]*omega[k]*omega[j];
62  }
63  }
64  }
65 
66  /*Get norm of epsprime*/
67  epsprime_norm = sqrt(epsprime[0]*epsprime[0] + epsprime[1]*epsprime[1] + epsprime[2]*epsprime[2]);
68 
69  /*Assign output pointers*/
70  *pepsprime_norm=epsprime_norm;
71 }/*}}}*/

◆ EstarOmega()

void EstarOmega ( IssmDouble omega,
IssmDouble  vx,
IssmDouble  vy,
IssmDouble  vz,
IssmDouble  vmag,
IssmDouble dvx,
IssmDouble dvy,
IssmDouble dvz,
IssmDouble dvmag 
)

Definition at line 72 of file EstarComponents.cpp.

72  {/*{{{*/
73 
74  /*Intermediaries*/
75  IssmDouble omega_norm;
76  IssmDouble omega_rigid[3];
77 
78  /*Create vorticity vector*/
79  _assert_(dvx && dvy && dvz && dvmag);
80  if(vmag<1e-12)vmag=1e-12;
81 
82  /*Create vorticity vector, corrected for rigid body rotation
83  * \overline{\omega} =\omega - \omega_rigid
84  * =\nabla\times{\bf v} - 2*U*\kappa*\hat{b};
85  * =\nabla\times{\bf v} - (2*{\bf v}\times(({\bf v}\cdot\nabla)*{\bf v}))/U^2
86  * check the magnitude of the second term -- if it is small, then the two
87  * vorticities (omega and first term in omega) are approx. equal
88  *
89  * */
90  omega_rigid[0] = 2*(vy*(vx*dvz[0]+vy*dvz[1]+vz*dvz[2]) - vz*(vx*dvy[0]+vy*dvy[1]+vz*dvy[2]))/(vmag*vmag);
91  omega_rigid[1] = 2*(vz*(vx*dvx[0]+vy*dvx[1]+vz*dvx[2]) - vx*(vx*dvz[0]+vy*dvz[1]+vz*dvz[2]))/(vmag*vmag);
92  omega_rigid[2] = 2*(vx*(vx*dvy[0]+vy*dvy[1]+vz*dvy[2]) - vy*(vx*dvx[0]+vy*dvx[1]+vz*dvx[2]))/(vmag*vmag);
93 
94  omega[0] = (dvz[1] - dvy[2]) - omega_rigid[0];
95  omega[1] = (dvx[2] - dvz[0]) - omega_rigid[1];
96  omega[2] = (dvy[0] - dvx[1]) - omega_rigid[2];
97 
98  /*Take out vorticity component aligned with the velocity*/
99  IssmDouble wdotv = vx/vmag*omega[0] + vy/vmag*omega[1] + vz/vmag*omega[2];
100  omega[0] = omega[0] - wdotv*vx/vmag;
101  omega[1] = omega[1] - wdotv*vy/vmag;
102  omega[2] = omega[2] - wdotv*vz/vmag;
103 
104  /*Normalize*/
105  omega_norm = sqrt(omega[0]*omega[0] + omega[1]*omega[1] + omega[2]*omega[2]);
106  if(omega_norm==0){
107  omega[0] = 0.;
108  omega[1] = 0.;
109  omega[2] = 0.;
110  }
111  else{
112  omega[0] =omega[0]/omega_norm;
113  omega[1] =omega[1]/omega_norm;
114  omega[2] =omega[2]/omega_norm;
115  }
116 
117 }/*}}}*/

◆ EstarLambdaS()

IssmDouble EstarLambdaS ( IssmDouble  epseff,
IssmDouble  epsprime_norm 
)

Definition at line 118 of file EstarComponents.cpp.

118  {/*{{{*/
119  IssmDouble lambdas;
120 
121  _assert_(epsprime_norm>=0.);
122  if(epseff==0.){
123  lambdas=0.;
124  }
125  else{
126  lambdas=sqrt(epsprime_norm*epsprime_norm/(epseff*epseff));
127  }
128  return lambdas;
129 }/*}}}*/
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmDouble
double IssmDouble
Definition: types.h:37
EstarOmega
void EstarOmega(IssmDouble *omega, IssmDouble vx, IssmDouble vy, IssmDouble vz, IssmDouble vmag, IssmDouble *dvx, IssmDouble *dvy, IssmDouble *dvz, IssmDouble *dvmag)
Definition: EstarComponents.cpp:72