1 | /*! \file Tria.h
|
---|
2 | * \brief: header file for tria object
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifndef _TRIA_H_
|
---|
6 | #define _TRIA_H_
|
---|
7 |
|
---|
8 | /*Headers:*/
|
---|
9 | /*{{{*/
|
---|
10 | #include "./Element.h"
|
---|
11 | #include "./ElementHook.h"
|
---|
12 | #include "./TriaRef.h"
|
---|
13 | class Parameters;
|
---|
14 | class Inputs;
|
---|
15 | class IoModel;
|
---|
16 | class Results;
|
---|
17 | class Node;
|
---|
18 | class Material;
|
---|
19 | class Matpar;
|
---|
20 | class Seg;
|
---|
21 | class ElementMatrix;
|
---|
22 | class ElementVector;
|
---|
23 | class Vertex;
|
---|
24 |
|
---|
25 | #include "../../shared/Exceptions/exceptions.h"
|
---|
26 | #include "../../shared/Enum/Enum.h"
|
---|
27 | /*}}}*/
|
---|
28 |
|
---|
29 | class Tria: public Element,public ElementHook,public TriaRef{
|
---|
30 |
|
---|
31 | public:
|
---|
32 |
|
---|
33 | int id;
|
---|
34 | int sid;
|
---|
35 |
|
---|
36 | Node **nodes; // nodes
|
---|
37 | Vertex **vertices; // 3 vertices
|
---|
38 | Material *material; // 1 material ice
|
---|
39 | Matpar *matpar; // 1 material parameter
|
---|
40 |
|
---|
41 | Parameters *parameters; //pointer to solution parameters
|
---|
42 | Inputs *inputs;
|
---|
43 |
|
---|
44 | /*Tria constructors, destructors {{{*/
|
---|
45 | Tria();
|
---|
46 | Tria(int tria_id,int tria_sid,int i, IoModel* iomodel,int nummodels);
|
---|
47 | ~Tria();
|
---|
48 | /*}}}*/
|
---|
49 | /*Object virtual functions definitions:{{{ */
|
---|
50 | void Echo();
|
---|
51 | void DeepEcho();
|
---|
52 | int Id();
|
---|
53 | int ObjectEnum();
|
---|
54 | Object *copy();
|
---|
55 | /*}}}*/
|
---|
56 | /*Update virtual functions resolution: {{{*/
|
---|
57 | void InputUpdateFromSolution(IssmDouble* solutiong);
|
---|
58 | void InputUpdateFromVector(IssmDouble* vector, int name, int type);
|
---|
59 | #ifdef _HAVE_DAKOTA_
|
---|
60 | void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
|
---|
61 | void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type);
|
---|
62 | #endif
|
---|
63 | void InputUpdateFromConstant(IssmDouble constant, int name);
|
---|
64 | void InputUpdateFromConstant(int constant, int name);
|
---|
65 | void InputUpdateFromConstant(bool constant, int name);
|
---|
66 | void InputUpdateFromIoModel(int index, IoModel* iomodel);
|
---|
67 | /*}}}*/
|
---|
68 | /*Element virtual functions definitions: {{{*/
|
---|
69 | void ComputeBasalStress(Vector<IssmDouble>* sigma_b);
|
---|
70 | void ComputeStrainRate(Vector<IssmDouble>* eps);
|
---|
71 | void ComputeStressTensor();
|
---|
72 | void Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
|
---|
73 | void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
|
---|
74 | void SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
|
---|
75 | void CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
|
---|
76 | void CreateDVector(Vector<IssmDouble>* df);
|
---|
77 | void CreatePVector(Vector<IssmDouble>* pf);
|
---|
78 | void CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
|
---|
79 | void Delta18oParameterization(void);
|
---|
80 | int GetNodeIndex(Node* node);
|
---|
81 | void GetNodesSidList(int* sidlist);
|
---|
82 | void GetNodesLidList(int* lidlist);
|
---|
83 | int GetNumberOfNodes(void);
|
---|
84 | int Sid();
|
---|
85 | bool IsOnBed();
|
---|
86 | bool HasEdgeOnBed();
|
---|
87 | bool HasEdgeOnSurface();
|
---|
88 | void EdgeOnSurfaceIndices(int* pindex1,int* pindex);
|
---|
89 | void EdgeOnBedIndices(int* pindex1,int* pindex);
|
---|
90 | int EdgeOnBedIndex();
|
---|
91 | int EdgeOnSurfaceIndex();
|
---|
92 | bool IsFloating();
|
---|
93 | bool IsNodeOnShelfFromFlags(IssmDouble* flags);
|
---|
94 | bool NoIceInElement();
|
---|
95 | void GetSolutionFromInputs(Vector<IssmDouble>* solution);
|
---|
96 | void GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
|
---|
97 | void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
|
---|
98 | void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum);
|
---|
99 | void InputDuplicate(int original_enum,int new_enum);
|
---|
100 | void InputScale(int enum_type,IssmDouble scale_factor);
|
---|
101 | void MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
|
---|
102 | int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
|
---|
103 | void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
|
---|
104 | void ResultInterpolation(int* pinterpolation,int output_enum);
|
---|
105 | void ResultToVector(Vector<IssmPDouble>* vector,int output_enum);
|
---|
106 | void ResetCoordinateSystem(void);
|
---|
107 | void SmbGradients();
|
---|
108 | IssmDouble SurfaceArea(void);
|
---|
109 | void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
|
---|
110 | IssmDouble TimeAdapt();
|
---|
111 |
|
---|
112 | #ifdef _HAVE_RESPONSES_
|
---|
113 | void AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
|
---|
114 | IssmDouble IceVolume(void);
|
---|
115 | IssmDouble IceVolumeAboveFloatation(void);
|
---|
116 | IssmDouble TotalSmb(void);
|
---|
117 | void MinVel(IssmDouble* pminvel);
|
---|
118 | void MinVx(IssmDouble* pminvx);
|
---|
119 | void MinVy(IssmDouble* pminvy);
|
---|
120 | void MinVz(IssmDouble* pminvz);
|
---|
121 | IssmDouble MassFlux(IssmDouble* segment);
|
---|
122 | IssmDouble MassFlux(IssmDouble x1,IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id);
|
---|
123 | void MaxAbsVx(IssmDouble* pmaxabsvx);
|
---|
124 | void MaxAbsVy(IssmDouble* pmaxabsvy);
|
---|
125 | void MaxAbsVz(IssmDouble* pmaxabsvz);
|
---|
126 | void ElementResponse(IssmDouble* presponse,int response_enum);
|
---|
127 | void MaxVel(IssmDouble* pmaxvel);
|
---|
128 | void MaxVx(IssmDouble* pmaxvx);
|
---|
129 | void MaxVy(IssmDouble* pmaxvy);
|
---|
130 | void MaxVz(IssmDouble* pmaxvz);
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | #ifdef _HAVE_GIA_
|
---|
134 | void GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | #ifdef _HAVE_CONTROL_
|
---|
138 | IssmDouble DragCoefficientAbsGradient(void);
|
---|
139 | void GradientIndexing(int* indexing,int control_index);
|
---|
140 | void Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
|
---|
141 | void GradjBGradient(Vector<IssmDouble>* gradient,int control_index);
|
---|
142 | void GradjDGradient(Vector<IssmDouble>* gradient,int control_index);
|
---|
143 | void GradjBSSA(Vector<IssmDouble>* gradient,int control_index);
|
---|
144 | void GradjDSSA(Vector<IssmDouble>* gradient,int control_index);
|
---|
145 | void GradjDragSSA(Vector<IssmDouble>* gradient,int control_index);
|
---|
146 | void GradjDragFS(Vector<IssmDouble>* gradient,int control_index);
|
---|
147 | void GradjDragGradient(Vector<IssmDouble>* gradient,int control_index);
|
---|
148 | void GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
|
---|
149 | void GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
|
---|
150 | void GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
|
---|
151 | void GradjThicknessBalancethicknessSoft(Vector<IssmDouble>* gradient,int control_index);
|
---|
152 | void GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data);
|
---|
153 | void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index);
|
---|
154 | void ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index);
|
---|
155 | void ControlInputScaleGradient(int enum_type,IssmDouble scale);
|
---|
156 | void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
|
---|
157 | void ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
|
---|
158 | IssmDouble RheologyBbarAbsGradient(void);
|
---|
159 | IssmDouble ThicknessAbsMisfit(void);
|
---|
160 | IssmDouble SurfaceAbsVelMisfit(void);
|
---|
161 | IssmDouble ThicknessAbsGradient(void);
|
---|
162 | IssmDouble ThicknessAlongGradient(void);
|
---|
163 | IssmDouble ThicknessAcrossGradient(void);
|
---|
164 | IssmDouble BalancethicknessMisfit(void);
|
---|
165 | IssmDouble SurfaceRelVelMisfit(void);
|
---|
166 | IssmDouble SurfaceLogVelMisfit(void);
|
---|
167 | IssmDouble SurfaceLogVxVyMisfit(void);
|
---|
168 | IssmDouble SurfaceAverageVelMisfit(void);
|
---|
169 | void InputControlUpdate(IssmDouble scalar,bool save_parameter);
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | #ifdef _HAVE_GROUNDINGLINE_
|
---|
173 | void PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
|
---|
174 | void MigrateGroundingLine(IssmDouble* sheet_ungrounding);
|
---|
175 | int UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
|
---|
176 | #endif
|
---|
177 |
|
---|
178 | /*}}}*/
|
---|
179 | /*Tria specific routines:{{{*/
|
---|
180 | ElementMatrix* CreateKMatrix(void);
|
---|
181 | ElementMatrix* CreateKMatrixBalancethickness(void);
|
---|
182 | ElementMatrix* CreateKMatrixBalancethickness_DG(void);
|
---|
183 | ElementMatrix* CreateKMatrixBalancethickness_CG(void);
|
---|
184 | ElementMatrix* CreateKMatrixBalancevelocity(void);
|
---|
185 | ElementMatrix* CreateKMatrixSmoothedSlope(void);
|
---|
186 | ElementMatrix* CreateKMatrixMelting(void);
|
---|
187 | ElementMatrix* CreateKMatrixMasstransport(void);
|
---|
188 | ElementMatrix* CreateKMatrixMasstransport_CG(void);
|
---|
189 | ElementMatrix* CreateKMatrixMasstransport_DG(void);
|
---|
190 | ElementMatrix* CreateKMatrixExtrusion(void);
|
---|
191 | ElementMatrix* CreateKMatrixExtrusionVolume(void);
|
---|
192 | ElementMatrix* CreateKMatrixExtrusionSurface(void);
|
---|
193 | ElementMatrix* CreateKMatrixExtrusionBed(void);
|
---|
194 | ElementMatrix* CreateKMatrixFreeSurfaceTop(void);
|
---|
195 | ElementMatrix* CreateKMatrixFreeSurfaceTop1D(void);
|
---|
196 | ElementMatrix* CreateKMatrixFreeSurfaceBase(void);
|
---|
197 | ElementMatrix* CreateKMatrixFreeSurfaceBase1D(void);
|
---|
198 | ElementMatrix* CreateMassMatrix(void);
|
---|
199 | ElementMatrix* CreateBasalMassMatrix(void);
|
---|
200 | ElementVector* CreatePVector(void);
|
---|
201 | ElementVector* CreatePVectorBalancethickness(void);
|
---|
202 | ElementVector* CreatePVectorBalancethickness_DG(void);
|
---|
203 | ElementVector* CreatePVectorBalancethickness_CG(void);
|
---|
204 | ElementVector* CreatePVectorBalancevelocity(void);
|
---|
205 | ElementVector* CreatePVectorSmoothedSlopeX(void);
|
---|
206 | ElementVector* CreatePVectorSmoothedSlopeY(void);
|
---|
207 | ElementVector* CreatePVectorMasstransport(void);
|
---|
208 | ElementVector* CreatePVectorMasstransport_CG(void);
|
---|
209 | ElementVector* CreatePVectorMasstransport_DG(void);
|
---|
210 | ElementVector* CreatePVectorFreeSurfaceTop(void);
|
---|
211 | ElementVector* CreatePVectorFreeSurfaceTop1D(void);
|
---|
212 | ElementVector* CreatePVectorFreeSurfaceBase(void);
|
---|
213 | ElementVector* CreatePVectorFreeSurfaceBase1D(void);
|
---|
214 | ElementVector* CreatePVectorL2Projection(void);
|
---|
215 | ElementVector* CreatePVectorL2ProjectionBase(void);
|
---|
216 | IssmDouble GetArea(void);
|
---|
217 | void GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble xyz_zero[3][3],IssmDouble xyz_list[3][3],int numpoints);
|
---|
218 | int GetElementType(void);
|
---|
219 | void GetDofList(int** pdoflist,int approximation_enum,int setenum);
|
---|
220 | void GetDofListVelocity(int** pdoflist,int setenum);
|
---|
221 | void GetDofListPressure(int** pdoflist,int setenum);
|
---|
222 | void GetVertexPidList(int* doflist);
|
---|
223 | void GetVertexSidList(int* sidlist);
|
---|
224 | void GetConnectivityList(int* connectivity);
|
---|
225 | void GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
|
---|
226 | IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
|
---|
227 | void GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]);
|
---|
228 | void GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
|
---|
229 | void GetInputListOnVertices(IssmDouble* pvalue,int enumtype);
|
---|
230 | void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
|
---|
231 | void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED
|
---|
232 | void GetInputListOnNodes(IssmDouble* pvalue,int enumtype);
|
---|
233 | void GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue);
|
---|
234 | void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
|
---|
235 | void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);
|
---|
236 | void GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
|
---|
237 | void InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type);
|
---|
238 | void InputUpdateFromSolutionMasstransport(IssmDouble* solution);
|
---|
239 | bool IsInput(int name);
|
---|
240 | void SetClone(int* minranks);
|
---|
241 | Seg* SpawnSeg(int index1,int index2);
|
---|
242 | void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);
|
---|
243 |
|
---|
244 | #ifdef _HAVE_STRESSBALANCE_
|
---|
245 | ElementMatrix* CreateKMatrixStressbalanceSSA(void);
|
---|
246 | ElementMatrix* CreateKMatrixStressbalanceSSAViscous(void);
|
---|
247 | ElementMatrix* CreateKMatrixStressbalanceSSAFriction(void);
|
---|
248 | ElementMatrix* CreateKMatrixStressbalanceSIA(void);
|
---|
249 | ElementMatrix* CreateKMatrixStressbalanceFS(void);
|
---|
250 | ElementMatrix* CreateKMatrixStressbalanceFSViscous(void);
|
---|
251 | ElementMatrix* CreateKMatrixStressbalanceFSFriction(void);
|
---|
252 | ElementVector* CreatePVectorStressbalanceSSA(void);
|
---|
253 | ElementVector* CreatePVectorStressbalanceSSADrivingStress(void);
|
---|
254 | ElementVector* CreatePVectorStressbalanceSSAFront(void);
|
---|
255 | ElementVector* CreatePVectorStressbalanceSIA(void);
|
---|
256 | ElementVector* CreatePVectorStressbalanceFS(void);
|
---|
257 | ElementVector* CreatePVectorStressbalanceFSFront(void);
|
---|
258 | ElementVector* CreatePVectorStressbalanceFSViscous(void);
|
---|
259 | void PVectorGLSstabilization(ElementVector* pe);
|
---|
260 | ElementVector* CreatePVectorStressbalanceFSShelf(void);
|
---|
261 | ElementMatrix* CreateJacobianStressbalanceSSA(void);
|
---|
262 | void GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution);
|
---|
263 | void GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution);
|
---|
264 | void GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution);
|
---|
265 | IssmDouble GetYcoord(GaussTria* gauss);
|
---|
266 | void InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution);
|
---|
267 | void InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution);
|
---|
268 | void InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solution);
|
---|
269 | #endif
|
---|
270 |
|
---|
271 | #ifdef _HAVE_CONTROL_
|
---|
272 | ElementMatrix* CreateKMatrixAdjointBalancethickness(void);
|
---|
273 | ElementMatrix* CreateKMatrixAdjointSSA(void);
|
---|
274 | ElementVector* CreatePVectorAdjointHoriz(void);
|
---|
275 | ElementVector* CreatePVectorAdjointBalancethickness(void);
|
---|
276 | void InputUpdateFromSolutionAdjointHoriz( IssmDouble* solution);
|
---|
277 | #endif
|
---|
278 |
|
---|
279 | void UpdateConstraintsExtrudeFromBase(void);
|
---|
280 | void UpdateConstraintsExtrudeFromTop(void);
|
---|
281 | #ifdef _HAVE_THERMAL_
|
---|
282 | void UpdateBasalConstraintsEnthalpy(void){_error_("not implemented yet");};
|
---|
283 | void ComputeBasalMeltingrate(void){_error_("not implemented yet");};
|
---|
284 | void DrainWaterfraction(void){_error_("not implemented yet");};
|
---|
285 | #endif
|
---|
286 |
|
---|
287 | #ifdef _HAVE_HYDROLOGY_
|
---|
288 | ElementMatrix* CreateKMatrixHydrologyShreve(void);
|
---|
289 | ElementMatrix* CreateKMatrixHydrologyDCInefficient(void);
|
---|
290 | ElementMatrix* CreateKMatrixHydrologyDCEfficient(void);
|
---|
291 | ElementVector* CreatePVectorHydrologyShreve(void);
|
---|
292 | ElementVector* CreatePVectorHydrologyDCInefficient(void);
|
---|
293 | ElementVector* CreatePVectorHydrologyDCEfficient(void);
|
---|
294 | void GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
|
---|
295 | void CreateHydrologyWaterVelocityInput(void);
|
---|
296 | void InputUpdateFromSolutionHydrology(IssmDouble* solution);
|
---|
297 | void InputUpdateFromSolutionHydrologyShreve(IssmDouble* solution);
|
---|
298 | void InputUpdateFromSolutionHydrologyDC(IssmDouble* solution);
|
---|
299 | void InputUpdateFromSolutionHydrologyDCInefficient(IssmDouble* solution);
|
---|
300 | void InputUpdateFromSolutionHydrologyDCEfficient(IssmDouble* solution);
|
---|
301 | void GetHydrologyDCInefficientHmax(IssmDouble* ph_max, Node* innode);
|
---|
302 | void GetHydrologyTransfer(Vector<IssmDouble>* transfer);
|
---|
303 | void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec);
|
---|
304 | void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask);
|
---|
305 | bool AllActive(void);
|
---|
306 | bool AnyActive(void);
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | #ifdef _HAVE_DAMAGE_
|
---|
310 | ElementMatrix* CreateKMatrixDamageEvolution(void);
|
---|
311 | ElementMatrix* CreateKMatrixDamageEvolution_CG(void);
|
---|
312 | ElementVector* CreatePVectorDamageEvolution(void);
|
---|
313 | ElementVector* CreatePVectorDamageEvolution_CG(void);
|
---|
314 | void DamageEvolutionF(IssmDouble* flist);
|
---|
315 | void InputUpdateFromSolutionDamageEvolution(IssmDouble* solution);
|
---|
316 | #endif
|
---|
317 |
|
---|
318 |
|
---|
319 | /*}}}*/
|
---|
320 |
|
---|
321 | };
|
---|
322 | #endif /* _TRIA_H */
|
---|