Ice Sheet System Model  4.18
Code documentation
Public Member Functions
L2ProjectionEPLAnalysis Class Reference

#include <L2ProjectionEPLAnalysis.h>

Inheritance diagram for L2ProjectionEPLAnalysis:
Analysis

Public Member Functions

void CreateConstraints (Constraints *constraints, IoModel *iomodel)
 
void CreateLoads (Loads *loads, IoModel *iomodel)
 
void CreateNodes (Nodes *nodes, IoModel *iomodel, bool isamr=false)
 
int DofsPerNode (int **doflist, int domaintype, int approximation)
 
void UpdateElements (Elements *elements, Inputs2 *inputs2, IoModel *iomodel, int analysis_counter, int analysis_type)
 
void UpdateParameters (Parameters *parameters, IoModel *iomodel, int solution_enum, int analysis_enum)
 
void Core (FemModel *femmodel)
 
ElementVectorCreateDVector (Element *element)
 
ElementMatrixCreateJacobianMatrix (Element *element)
 
ElementMatrixCreateKMatrix (Element *element)
 
ElementVectorCreatePVector (Element *element)
 
void GetSolutionFromInputs (Vector< IssmDouble > *solution, Element *element)
 
void GradientJ (Vector< IssmDouble > *gradient, Element *element, int control_type, int control_index)
 
void InputUpdateFromSolution (IssmDouble *solution, Element *element)
 
void UpdateConstraints (FemModel *femmodel)
 
- Public Member Functions inherited from Analysis
virtual ~Analysis ()
 

Detailed Description

Definition at line 11 of file L2ProjectionEPLAnalysis.h.

Member Function Documentation

◆ CreateConstraints()

void L2ProjectionEPLAnalysis::CreateConstraints ( Constraints constraints,
IoModel iomodel 
)
virtual

Implements Analysis.

Definition at line 8 of file L2ProjectionEPLAnalysis.cpp.

8  {/*{{{*/
9 
10  /*No constraints*/
11 }/*}}}*/

◆ CreateLoads()

void L2ProjectionEPLAnalysis::CreateLoads ( Loads loads,
IoModel iomodel 
)
virtual

Implements Analysis.

Definition at line 12 of file L2ProjectionEPLAnalysis.cpp.

12  {/*{{{*/
13 
14  /*No loads*/
15 }/*}}}*/

◆ CreateNodes()

void L2ProjectionEPLAnalysis::CreateNodes ( Nodes nodes,
IoModel iomodel,
bool  isamr = false 
)
virtual

Implements Analysis.

Definition at line 16 of file L2ProjectionEPLAnalysis.cpp.

16  {/*{{{*/
17  /*Now, do we really want DC?*/
18  int hydrology_model;
19  iomodel->FindConstant(&hydrology_model,"md.hydrology.model");
20  if(hydrology_model!=HydrologydcEnum) return;
21 
22  /*Do we want an efficient layer*/
23  bool isefficientlayer;
24  iomodel->FindConstant(&isefficientlayer,"md.hydrology.isefficientlayer");
25  if(!isefficientlayer) return;
26 
27  if(iomodel->domaintype==Domain3DEnum){
28  iomodel->FetchData(1,"md.mesh.vertexonbase");
29  }
30  else if(iomodel->domaintype==Domain2DverticalEnum){
31  iomodel->FetchData(1,"md.mesh.vertexonbase");
32  }
34  iomodel->DeleteData(1,"md.mesh.vertexonbase");
35 }/*}}}*/

◆ DofsPerNode()

int L2ProjectionEPLAnalysis::DofsPerNode ( int **  doflist,
int  domaintype,
int  approximation 
)
virtual

Implements Analysis.

Definition at line 36 of file L2ProjectionEPLAnalysis.cpp.

36  {/*{{{*/
37  return 1;
38 }/*}}}*/

◆ UpdateElements()

void L2ProjectionEPLAnalysis::UpdateElements ( Elements elements,
Inputs2 inputs2,
IoModel iomodel,
int  analysis_counter,
int  analysis_type 
)
virtual

Implements Analysis.

Definition at line 39 of file L2ProjectionEPLAnalysis.cpp.

39  {/*{{{*/
40 
41  bool isefficientlayer;
42  int hydrology_model;
43 
44  /*Now, do we really want DC?*/
45  iomodel->FindConstant(&hydrology_model,"md.hydrology.model");
46  if(hydrology_model!=HydrologydcEnum) return;
47 
48  /*Do we want an efficient layer*/
49  iomodel->FindConstant(&isefficientlayer,"md.hydrology.isefficientlayer");
50  if(!isefficientlayer) return;
51 
52  /*Update elements: */
53  int counter=0;
54  for(int i=0;i<iomodel->numberofelements;i++){
55  if(iomodel->my_elements[i]){
56  Element* element=(Element*)elements->GetObjectByOffset(counter);
57  element->Update(inputs2,i,iomodel,analysis_counter,analysis_type,P1Enum);
58  counter++;
59  }
60  }
61 
62  iomodel->FetchDataToInput(inputs2,elements,"md.initialization.epl_head",EplHeadSubstepEnum);
63  iomodel->FetchDataToInput(inputs2,elements,"md.mask.ice_levelset",MaskIceLevelsetEnum);
64  if(iomodel->domaintype!=Domain2DhorizontalEnum){
65  iomodel->FetchDataToInput(inputs2,elements,"md.mesh.vertexonbase",MeshVertexonbaseEnum);
66  iomodel->FetchDataToInput(inputs2,elements,"md.mesh.vertexonsurface",MeshVertexonsurfaceEnum);
67  }
68 }/*}}}*/

◆ UpdateParameters()

void L2ProjectionEPLAnalysis::UpdateParameters ( Parameters parameters,
IoModel iomodel,
int  solution_enum,
int  analysis_enum 
)
virtual

Implements Analysis.

Definition at line 69 of file L2ProjectionEPLAnalysis.cpp.

69  {/*{{{*/
70 }/*}}}*/

◆ Core()

void L2ProjectionEPLAnalysis::Core ( FemModel femmodel)
virtual

Implements Analysis.

Definition at line 73 of file L2ProjectionEPLAnalysis.cpp.

73  {/*{{{*/
74  _error_("not implemented");
75 }/*}}}*/

◆ CreateDVector()

ElementVector * L2ProjectionEPLAnalysis::CreateDVector ( Element element)
virtual

Implements Analysis.

Definition at line 76 of file L2ProjectionEPLAnalysis.cpp.

76  {/*{{{*/
77  /*Default, return NULL*/
78  return NULL;
79 }/*}}}*/

◆ CreateJacobianMatrix()

ElementMatrix * L2ProjectionEPLAnalysis::CreateJacobianMatrix ( Element element)
virtual

Implements Analysis.

Definition at line 80 of file L2ProjectionEPLAnalysis.cpp.

80  {/*{{{*/
81 _error_("Not implemented");
82 }/*}}}*/

◆ CreateKMatrix()

ElementMatrix * L2ProjectionEPLAnalysis::CreateKMatrix ( Element element)
virtual

Implements Analysis.

Definition at line 83 of file L2ProjectionEPLAnalysis.cpp.

83  {/*{{{*/
84 
85  /*Intermediaries*/
86  int domaintype;
87  bool active_element;
88  Element* basalelement;
89 
90  /*Get basal element*/
91  element->FindParam(&domaintype,DomainTypeEnum);
92  switch(domaintype){
94  basalelement = element;
95  break;
97  if(!element->IsOnBase()) return NULL;
98  basalelement = element->SpawnBasalElement();
99  break;
100  case Domain3DEnum:
101  if(!element->IsOnBase()) return NULL;
102  basalelement = element->SpawnBasalElement();
103  break;
104  default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
105  }
106 
107  basalelement->GetInput2Value(&active_element,HydrologydcMaskEplactiveEltEnum);
108 
109  /* Check that all nodes are active, else return empty matrix */
110  if(!active_element){
111  if(domaintype!=Domain2DhorizontalEnum){
112  basalelement->DeleteMaterials();
113  delete basalelement;
114  }
115  return NULL;
116  }
117 
118  /*Intermediaries */
119  IssmDouble D,Jdet;
120  IssmDouble *xyz_list = NULL;
121 
122  /*Fetch number of nodes and dof for this finite element*/
123  int numnodes = basalelement->GetNumberOfNodes();
124 
125  /*Initialize Element vector*/
127  IssmDouble* basis = xNew<IssmDouble>(numnodes);
128 
129  /*Retrieve all inputs and parameters*/
130  basalelement->GetVerticesCoordinates(&xyz_list);
131 
132  /* Start looping on the number of gaussian points: */
133  Gauss* gauss=basalelement->NewGauss(2);
134  for(int ig=gauss->begin();ig<gauss->end();ig++){
135  gauss->GaussPoint(ig);
136 
137  basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
138  basalelement->NodalFunctions(basis,gauss);
139  D=gauss->weight*Jdet;
140 
141  TripleMultiply(basis,1,numnodes,1,
142  &D,1,1,0,
143  basis,1,numnodes,0,
144  &Ke->values[0],1);
145  }
146 
147  /*Clean up and return*/
148  xDelete<IssmDouble>(xyz_list);
149  xDelete<IssmDouble>(basis);
150  delete gauss;
151  if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
152  return Ke;
153 }/*}}}*/

◆ CreatePVector()

ElementVector * L2ProjectionEPLAnalysis::CreatePVector ( Element element)
virtual

Implements Analysis.

Definition at line 154 of file L2ProjectionEPLAnalysis.cpp.

154  {/*{{{*/
155 
156  /*Intermediaries*/
157  int domaintype;
158  bool active_element;
159  Element* basalelement;
160 
161  /*Get basal element*/
162  element->FindParam(&domaintype,DomainTypeEnum);
163  switch(domaintype){
165  basalelement = element;
166  break;
167  case Domain3DEnum:
168  if(!element->IsOnBase()) return NULL;
169  basalelement = element->SpawnBasalElement();
170  break;
171  default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
172  }
173 
174  basalelement->GetInput2Value(&active_element,HydrologydcMaskEplactiveEltEnum);
175 
176  /*Check that all nodes are active, else return empty matrix*/
177  if(!active_element) {
178  if(domaintype!=Domain2DhorizontalEnum){
179  basalelement->DeleteMaterials();
180  delete basalelement;
181  }
182  return NULL;
183  }
184 
185  /*Intermediaries */
186  int input_enum,index;
187  IssmDouble Jdet,slopes[2];
188  Input2 *input = NULL;
189  IssmDouble *xyz_list = NULL;
190 
191  /*Fetch number of nodes and dof for this finite element*/
192  int numnodes = basalelement->GetNumberOfNodes();
193 
194  /*Initialize Element vector*/
195  ElementVector* pe = basalelement->NewElementVector();
196  IssmDouble* basis = xNew<IssmDouble>(numnodes);
197 
198  /*Retrieve all inputs and parameters*/
199  basalelement->GetVerticesCoordinates(&xyz_list);
200  basalelement->FindParam(&input_enum,InputToL2ProjectEnum);
201  switch(input_enum){
202  case EplHeadSlopeXEnum: input = basalelement->GetInput2(EplHeadSubstepEnum); index = 0; _assert_(input); break;
203  case EplHeadSlopeYEnum: input = basalelement->GetInput2(EplHeadSubstepEnum); index = 1; _assert_(input); break;
204  default: _error_("not implemented");
205  }
206 
207  /* Start looping on the number of gaussian points: */
208  Gauss* gauss=basalelement->NewGauss(2);
209  for(int ig=gauss->begin();ig<gauss->end();ig++){
210  gauss->GaussPoint(ig);
211 
212  basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
213  basalelement->NodalFunctions(basis,gauss);
214 
215  input->GetInputDerivativeValue(&slopes[0],xyz_list,gauss);
216  for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*slopes[index]*basis[i];
217  }
218 
219  /*Clean up and return*/
220  xDelete<IssmDouble>(xyz_list);
221  xDelete<IssmDouble>(basis);
222  delete gauss;
223  if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
224  return pe;
225 }/*}}}*/

◆ GetSolutionFromInputs()

void L2ProjectionEPLAnalysis::GetSolutionFromInputs ( Vector< IssmDouble > *  solution,
Element element 
)
virtual

Implements Analysis.

Definition at line 226 of file L2ProjectionEPLAnalysis.cpp.

226  {/*{{{*/
227  _error_("not implemented yet");
228 }/*}}}*/

◆ GradientJ()

void L2ProjectionEPLAnalysis::GradientJ ( Vector< IssmDouble > *  gradient,
Element element,
int  control_type,
int  control_index 
)
virtual

Implements Analysis.

Definition at line 229 of file L2ProjectionEPLAnalysis.cpp.

229  {/*{{{*/
230  _error_("Not implemented yet");
231 }/*}}}*/

◆ InputUpdateFromSolution()

void L2ProjectionEPLAnalysis::InputUpdateFromSolution ( IssmDouble solution,
Element element 
)
virtual

Implements Analysis.

Definition at line 232 of file L2ProjectionEPLAnalysis.cpp.

232  {/*{{{*/
233  int inputenum,domaintype;
234 
235  element->FindParam(&inputenum,InputToL2ProjectEnum);
236  element->FindParam(&domaintype,DomainTypeEnum);
237  switch(domaintype){
239  element->InputUpdateFromSolutionOneDof(solution,inputenum);
240  break;
242  element->InputUpdateFromSolutionOneDof(solution,inputenum);
243  break;
244  case Domain3DEnum:
245  element->InputUpdateFromSolutionOneDofCollapsed(solution,inputenum);
246  break;
247  default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
248  }
249 }/*}}}*/

◆ UpdateConstraints()

void L2ProjectionEPLAnalysis::UpdateConstraints ( FemModel femmodel)
virtual

Implements Analysis.

Definition at line 250 of file L2ProjectionEPLAnalysis.cpp.

250  {/*{{{*/
251  /*Default, do nothing*/
252  return;
253 }/*}}}*/

The documentation for this class was generated from the following files:
EplHeadSlopeXEnum
@ EplHeadSlopeXEnum
Definition: EnumDefinitions.h:555
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmDouble
double IssmDouble
Definition: types.h:37
Element::IsOnBase
bool IsOnBase()
Definition: Element.cpp:1984
Element::GetNumberOfNodes
virtual int GetNumberOfNodes(void)=0
Element::FindParam
void FindParam(bool *pvalue, int paramenum)
Definition: Element.cpp:933
HydrologydcEnum
@ HydrologydcEnum
Definition: EnumDefinitions.h:1106
MaskIceLevelsetEnum
@ MaskIceLevelsetEnum
Definition: EnumDefinitions.h:641
Element::SpawnBasalElement
virtual Element * SpawnBasalElement(void)=0
MeshVertexonbaseEnum
@ MeshVertexonbaseEnum
Definition: EnumDefinitions.h:653
TripleMultiply
int TripleMultiply(IssmDouble *a, int nrowa, int ncola, int itrna, IssmDouble *b, int nrowb, int ncolb, int itrnb, IssmDouble *c, int nrowc, int ncolc, int itrnc, IssmDouble *d, int iaddd)
Definition: MatrixUtils.cpp:20
ElementVector::values
IssmDouble * values
Definition: ElementVector.h:24
IoModel::my_elements
bool * my_elements
Definition: IoModel.h:66
Input2::GetInputDerivativeValue
virtual void GetInputDerivativeValue(IssmDouble *derivativevalues, IssmDouble *xyz_list, Gauss *gauss)
Definition: Input2.h:37
Element::GetInput2
virtual Input2 * GetInput2(int inputenum)=0
Element::DeleteMaterials
void DeleteMaterials(void)
Definition: Element.cpp:429
Element
Definition: Element.h:41
Element::NodalFunctions
virtual void NodalFunctions(IssmDouble *basis, Gauss *gauss)=0
P1Enum
@ P1Enum
Definition: EnumDefinitions.h:662
Domain2DhorizontalEnum
@ Domain2DhorizontalEnum
Definition: EnumDefinitions.h:534
Element::NewElementVector
ElementVector * NewElementVector(int approximation_enum=NoneApproximationEnum)
Definition: Element.cpp:2505
IoModel::DeleteData
void DeleteData(int num,...)
Definition: IoModel.cpp:500
IoModel::numberofelements
int numberofelements
Definition: IoModel.h:96
NoneApproximationEnum
@ NoneApproximationEnum
Definition: EnumDefinitions.h:1201
DomainTypeEnum
@ DomainTypeEnum
Definition: EnumDefinitions.h:124
Element::NewGauss
virtual Gauss * NewGauss(void)=0
Element::InputUpdateFromSolutionOneDof
virtual void InputUpdateFromSolutionOneDof(IssmDouble *solution, int inputenum)=0
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
IoModel::FindConstant
void FindConstant(bool *pvalue, const char *constant_name)
Definition: IoModel.cpp:2362
Element::GetInput2Value
void GetInput2Value(bool *pvalue, int enum_type)
Definition: Element.cpp:1185
Element::GetVerticesCoordinates
void GetVerticesCoordinates(IssmDouble **xyz_list)
Definition: Element.cpp:1446
IoModel::FetchData
void FetchData(bool *pboolean, const char *data_name)
Definition: IoModel.cpp:933
Domain3DEnum
@ Domain3DEnum
Definition: EnumDefinitions.h:536
Input2
Definition: Input2.h:18
L2ProjectionEPLAnalysisEnum
@ L2ProjectionEPLAnalysisEnum
Definition: EnumDefinitions.h:1137
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
Gauss::begin
virtual int begin(void)=0
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
MeshVertexonsurfaceEnum
@ MeshVertexonsurfaceEnum
Definition: EnumDefinitions.h:655
Element::JacobianDeterminant
virtual void JacobianDeterminant(IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)=0
Gauss::GaussPoint
virtual void GaussPoint(int ig)=0
Element::Update
virtual void Update(Inputs2 *inputs2, int index, IoModel *iomodel, int analysis_counter, int analysis_type, int finite_element)=0
L2ProjectionEPLAnalysis::CreateNodes
void CreateNodes(Nodes *nodes, IoModel *iomodel, bool isamr=false)
Definition: L2ProjectionEPLAnalysis.cpp:16
IoModel::FetchDataToInput
void FetchDataToInput(Inputs2 *inputs2, Elements *elements, const char *vector_name, int input_enum)
Definition: IoModel.cpp:1651
InputToL2ProjectEnum
@ InputToL2ProjectEnum
Definition: EnumDefinitions.h:206
ElementVector
Definition: ElementVector.h:20
Gauss::weight
IssmDouble weight
Definition: Gauss.h:11
EplHeadSubstepEnum
@ EplHeadSubstepEnum
Definition: EnumDefinitions.h:557
IoModel::domaintype
int domaintype
Definition: IoModel.h:78
EplHeadSlopeYEnum
@ EplHeadSlopeYEnum
Definition: EnumDefinitions.h:556
Domain2DverticalEnum
@ Domain2DverticalEnum
Definition: EnumDefinitions.h:535
ElementMatrix
Definition: ElementMatrix.h:19
Element::InputUpdateFromSolutionOneDofCollapsed
virtual void InputUpdateFromSolutionOneDofCollapsed(IssmDouble *solution, int inputenum)=0
HydrologydcMaskEplactiveEltEnum
@ HydrologydcMaskEplactiveEltEnum
Definition: EnumDefinitions.h:607
Gauss
Definition: Gauss.h:8
ElementMatrix::values
IssmDouble * values
Definition: ElementMatrix.h:26
Element::NewElementMatrix
ElementMatrix * NewElementMatrix(int approximation_enum=NoneApproximationEnum)
Definition: Element.cpp:2497