Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Data Fields
Tria Class Reference

#include <Tria.h>

Inheritance diagram for Tria:
Element ElementHook TriaRef Object

Public Member Functions

 Tria ()
 
 Tria (int tria_id, int tria_sid, int tria_lid, IoModel *iomodel, int nummodels)
 
 ~Tria ()
 
Objectcopy ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
void InputUpdateFromIoModel (int index, IoModel *iomodel)
 
void InputUpdateFromVector (IssmDouble *vector, int name, int type)
 
void AverageOntoPartition (Vector< IssmDouble > *partition_contributions, Vector< IssmDouble > *partition_areas, IssmDouble *vertex_response, IssmDouble *qmu_part)
 
void CalvingRateVonmises ()
 
void CalvingCrevasseDepth ()
 
void CalvingRateLevermann ()
 
void CalvingFluxLevelset ()
 
void CalvingMeltingFluxLevelset ()
 
IssmDouble CharacteristicLength (void)
 
void ComputeBasalStress (void)
 
void ComputeDeviatoricStressTensor ()
 
void ComputeEsaStrainAndVorticity ()
 
void ComputeSigmaNN ()
 
void ComputeStressTensor ()
 
void ComputeSurfaceNormalVelocity ()
 
void Configure (Elements *elements, Loads *loads, Nodes *nodesin, Vertices *verticesin, Materials *materials, Parameters *parameters, Inputs2 *inputs2in)
 
void ControlInputSetGradient (IssmDouble *gradient, int enum_type, int control_index, int offset, int N, int M)
 
void ControlInputSetGradient (IssmDouble *gradient, int enum_type, int control_index)
 
void ControlToVectors (Vector< IssmPDouble > *vector_control, Vector< IssmPDouble > *vector_gradient, int control_enum)
 
void CreateDistanceInputFromSegmentlist (IssmDouble *distances, int distanceenum)
 
int EdgeOnBaseIndex ()
 
void EdgeOnBaseIndices (int *pindex1, int *pindex)
 
int EdgeOnSurfaceIndex ()
 
void EdgeOnSurfaceIndices (int *pindex1, int *pindex)
 
void ElementResponse (IssmDouble *presponse, int response_enum)
 
void ElementSizes (IssmDouble *hx, IssmDouble *hy, IssmDouble *hz)
 
int FiniteElement (void)
 
IssmDouble FloatingArea (bool scaled)
 
void FSContactMigration (Vector< IssmDouble > *vertex_sigmann, Vector< IssmDouble > *vertex_waterpressure)
 
ElementGetBasalElement (void)
 
void GetLevelsetPositivePart (int *point1, IssmDouble *fraction1, IssmDouble *fraction2, bool *mainlynegative, IssmDouble *levelsetvalues)
 
void GetGroundedPart (int *point1, IssmDouble *fraction1, IssmDouble *fraction2, bool *mainlyfloating)
 
IssmDouble GetGroundedPortion (IssmDouble *xyz_list)
 
IssmDouble GetIcefrontArea ()
 
void GetIcefrontCoordinates (IssmDouble **pxyz_front, IssmDouble *xyz_list, int levelsetenum)
 
void GetInputListOnVertices (IssmDouble *pvalue, Input2 *input, IssmDouble default_value)
 
void GetInputListOnNodes (IssmDouble *pvalue, Input2 *input, IssmDouble default_value)
 
void GetLevelCoordinates (IssmDouble **pxyz_front, IssmDouble *xyz_list, int levelsetenum, IssmDouble level)
 
int GetVertexIndex (Vertex *vertex)
 
int GetNumberOfNodes (void)
 
int GetNumberOfNodes (int enum_type)
 
int GetNumberOfVertices (void)
 
void GetVectorFromControlInputs (Vector< IssmDouble > *gradient, int control_enum, int control_index, const char *data, int offset)
 
void GetVectorFromControlInputs (Vector< IssmDouble > *gradient, int control_enum, int control_index, const char *data)
 
void GetVerticesCoordinatesBase (IssmDouble **pxyz_list)
 
void GetVerticesCoordinatesTop (IssmDouble **pxyz_list)
 
IssmDouble GroundedArea (bool scaled)
 
bool HasEdgeOnBase ()
 
bool HasEdgeOnSurface ()
 
IssmDouble IceVolume (bool scaled)
 
IssmDouble IceVolumeAboveFloatation (bool scaled)
 
IssmDouble IcefrontMassFlux (bool scaled)
 
IssmDouble IcefrontMassFluxLevelset (bool scaled)
 
IssmDouble GroundinglineMassFlux (bool scaled)
 
void InputDepthAverageAtBase (int enum_type, int average_enum_type)
 
void InputExtrude (int enum_type, int start)
 
void ControlInputExtrude (int enum_type, int start)
 
bool IsFaceOnBoundary (void)
 
bool IsIcefront (void)
 
bool IsNodeOnShelfFromFlags (IssmDouble *flags)
 
bool IsZeroLevelset (int levelset_enum)
 
IssmDouble Masscon (IssmDouble *levelset)
 
IssmDouble MassFlux (IssmDouble *segment)
 
IssmDouble MassFlux (IssmDouble x1, IssmDouble y1, IssmDouble x2, IssmDouble y2, int segment_id)
 
void MaterialUpdateFromTemperature (void)
 
IssmDouble Misfit (int modelenum, int observationenum, int weightsenum)
 
IssmDouble MisfitArea (int weightsenum)
 
int NodalValue (IssmDouble *pvalue, int index, int natureofdataenum)
 
int NumberofNodesPressure (void)
 
int NumberofNodesVelocity (void)
 
void PotentialUngrounding (Vector< IssmDouble > *potential_sheet_ungrounding)
 
int PressureInterpolation ()
 
void ReduceMatrices (ElementMatrix *Ke, ElementVector *pe)
 
void ResetFSBasalBoundaryCondition (void)
 
void ResetHooks ()
 
void ResetLevelsetFromSegmentlist (IssmDouble *segments, int numsegments)
 
void RignotMeltParameterization ()
 
void SetElementInput (int enum_in, IssmDouble values)
 
void SetElementInput (Inputs2 *inputs2, int enum_in, IssmDouble values)
 
void SetElementInput (Inputs2 *inputs2, int numindices, int *indices, IssmDouble *values, int enum_in)
 
void SetControlInputsFromVector (IssmDouble *vector, int control_enum, int control_index, int offset, int N, int M)
 
void SetControlInputsFromVector (IssmDouble *vector, int control_enum, int control_index)
 
void SetCurrentConfiguration (Elements *elements, Loads *loads, Nodes *nodes, Materials *materials, Parameters *parameters)
 
ElementSpawnBasalElement (void)
 
ElementSpawnTopElement (void)
 
void StrainRateparallel ()
 
void StrainRateperpendicular ()
 
void StressIntensityFactor (void)
 
IssmDouble SurfaceArea (void)
 
int TensorInterpolation ()
 
IssmDouble TimeAdapt ()
 
IssmDouble TotalCalvingFluxLevelset (bool scaled)
 
IssmDouble TotalCalvingMeltingFluxLevelset (bool scaled)
 
IssmDouble TotalFloatingBmb (bool scaled)
 
IssmDouble TotalGroundedBmb (bool scaled)
 
IssmDouble TotalSmb (bool scaled)
 
void Update (Inputs2 *inputs2, int index, IoModel *iomodel, int analysis_counter, int analysis_type, int finitelement)
 
int UpdatePotentialUngrounding (IssmDouble *vertices_potentially_ungrounding, Vector< IssmDouble > *vec_nodes_on_iceshelf, IssmDouble *nodes_on_iceshelf)
 
void ValueP1DerivativesOnGauss (IssmDouble *dvalue, IssmDouble *values, IssmDouble *xyz_list, Gauss *gauss)
 
void ValueP1OnGauss (IssmDouble *pvalue, IssmDouble *values, Gauss *gauss)
 
int VelocityInterpolation ()
 
int VertexConnectivity (int vertexindex)
 
void VerticalSegmentIndices (int **pindices, int *pnumseg)
 
void VerticalSegmentIndicesBase (int **pindices, int *pnumseg)
 
void WriteFieldIsovalueSegment (DataSet *segments, int fieldenum, IssmDouble fieldvalue)
 
void AddBasalInput2 (int input_enum, IssmDouble *values, int interpolation_enum)
 
void AddInput2 (int input_enum, IssmDouble *values, int interpolation_enum)
 
void AddControlInput (int input_enum, Inputs2 *inputs2, IoModel *iomodel, IssmDouble *values, IssmDouble *values_min, IssmDouble *values_max, int interpolation_enum, int id)
 
void DatasetInputCreate (IssmDouble *array, int M, int N, int *individual_enums, int num_inputs, Inputs2 *inputs2, IoModel *iomodel, int input_enum)
 
void CreateInputTimeAverage (int transientinput_enum, int averagedinput_enum, IssmDouble init_time, IssmDouble end_time, int averaging_method)
 
void GetInputAveragesUpToCurrentTime (int input_enum, IssmDouble **pvalues, IssmDouble **ptimes, int *pnumtimes, IssmDouble currenttime)
 
IssmDouble GetArea (void)
 
IssmDouble GetHorizontalSurfaceArea (void)
 
IssmDouble GetArea3D (void)
 
IssmDouble GetAreaIce (void)
 
IssmDouble GetAreaSpherical (void)
 
void GetAreaCoordinates (IssmDouble *area_coordinates, IssmDouble *xyz_zero, IssmDouble *xyz_list, int numpoints)
 
int GetElementType (void)
 
Input2GetInput2 (int enumtype)
 
Input2GetInput2 (int enumtype, IssmDouble time)
 
Input2GetInput2 (int inputenum, IssmDouble start_time, IssmDouble end_time, int averaging_method)
 
DatasetInput2GetDatasetInput2 (int inputenum)
 
void GetInputValue (IssmDouble *pvalue, Node *node, int enumtype)
 
void GetInputValue (IssmDouble *pvalue, Vertex *vertex, int enumtype)
 
void GetLevelsetIntersection (int **pindices, int *pnumiceverts, IssmDouble *fraction, int levelset_enum, IssmDouble level)
 
void GetMaterialInputValue (IssmDouble *pvalue, Node *node, int enumtype)
 
void InputUpdateFromSolutionOneDof (IssmDouble *solution, int enum_type)
 
void InputUpdateFromSolutionOneDofCollapsed (IssmDouble *solution, int enum_type)
 
void JacobianDeterminant (IssmDouble *pJdet, IssmDouble *xyz_list, Gauss *gauss)
 
void JacobianDeterminantBase (IssmDouble *pJdet, IssmDouble *xyz_list_base, Gauss *gauss)
 
void JacobianDeterminantLine (IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
 
void JacobianDeterminantSurface (IssmDouble *pJdet, IssmDouble *xyz_list, Gauss *gauss)
 
void JacobianDeterminantTop (IssmDouble *pJdet, IssmDouble *xyz_list_base, Gauss *gauss)
 
IssmDouble MinEdgeLength (IssmDouble *xyz_list)
 
GaussNewGauss (void)
 
GaussNewGauss (int order)
 
GaussNewGauss (IssmDouble *xyz_list, IssmDouble *xyz_list_front, int order)
 
GaussNewGauss (int point1, IssmDouble fraction1, IssmDouble fraction2, bool mainlyfloating, int order)
 
GaussNewGauss (int point1, IssmDouble fraction1, IssmDouble fraction2, int order)
 
GaussNewGauss (IssmDouble *xyz_list, IssmDouble *xyz_list_front, int order_horiz, int order_vert)
 
GaussNewGaussBase (int order)
 
GaussNewGaussLine (int vertex1, int vertex2, int order)
 
GaussNewGaussTop (int order)
 
void NodalFunctions (IssmDouble *basis, Gauss *gauss)
 
void NodalFunctionsDerivatives (IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss)
 
void NodalFunctionsDerivativesVelocity (IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss)
 
void NodalFunctionsMINIDerivatives (IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss)
 
void NodalFunctionsPressure (IssmDouble *basis, Gauss *gauss)
 
void NodalFunctionsP1 (IssmDouble *basis, Gauss *gauss)
 
void NodalFunctionsP1Derivatives (IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss)
 
void NodalFunctionsP2 (IssmDouble *basis, Gauss *gauss)
 
void NodalFunctionsTensor (IssmDouble *basis, Gauss *gauss)
 
void NodalFunctionsVelocity (IssmDouble *basis, Gauss *gauss)
 
void NormalBase (IssmDouble *normal, IssmDouble *xyz_list)
 
void NormalSection (IssmDouble *normal, IssmDouble *xyz_list)
 
void NormalTop (IssmDouble *normal, IssmDouble *xyz_list)
 
void SetTemporaryElementType (int element_type_in)
 
void InputServe (Input2 *input_in)
 
SegSpawnSeg (int index1, int index2)
 
IssmDouble StabilizationParameter (IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa)
 
void StabilizationParameterAnisotropic (IssmDouble *tau_parameter_ansiotropic, IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble hx, IssmDouble hy, IssmDouble hz, IssmDouble kappa)
 
void UpdateConstraintsExtrudeFromBase (void)
 
void UpdateConstraintsExtrudeFromTop (void)
 
- Public Member Functions inherited from Element
 Element ()
 
 ~Element ()
 
bool AnyFSet (void)
 
void ComputeLambdaS (void)
 
void ComputeNewDamage ()
 
void ComputeStrainRate ()
 
void CoordinateSystemTransform (IssmDouble **ptransform, Node **nodes, int numnodes, int *cs_array)
 
void DeepEcho ()
 
void DeleteMaterials (void)
 
void Delta18oParameterization (void)
 
void Delta18opdParameterization (void)
 
void SmbGradCompParameterization (void)
 
IssmDouble Divergence (void)
 
void dViscositydBFS (IssmDouble *pdmudB, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)
 
void dViscositydBHO (IssmDouble *pdmudB, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void dViscositydBSSA (IssmDouble *pdmudB, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void dViscositydDSSA (IssmDouble *pdmudB, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void Echo ()
 
void FindParam (bool *pvalue, int paramenum)
 
void FindParam (int *pvalue, int paramenum)
 
void FindParam (IssmDouble *pvalue, int paramenum)
 
IssmDouble FindParam (int paramenum)
 
void FindParam (int **pvalues, int *psize, int paramenum)
 
IssmDouble FloatingArea (IssmDouble *mask, bool scaled)
 
void GetDofList (int **pdoflist, int approximation_enum, int setenum)
 
void GetDofListPressure (int **pdoflist, int setenum)
 
void GetDofListVelocity (int **pdoflist, int setenum)
 
void GetDofListLocal (int **pdoflist, int approximation_enum, int setenum)
 
void GetDofListLocalPressure (int **pdoflist, int setenum)
 
void GetDofListLocalVelocity (int **pdoflist, int setenum)
 
void GetInputListOnNodes (IssmDouble *pvalue, int enumtype)
 
void GetInputListOnNodes (IssmDouble *pvalue, int enumtype, IssmDouble defaultvalue)
 
void GetInputListOnNodesVelocity (IssmDouble *pvalue, int enumtype)
 
void GetInputListOnVertices (IssmDouble *pvalue, int enumtype)
 
void GetInputListOnVerticesAtTime (IssmDouble *pvalue, int enumtype, IssmDouble time)
 
void GetInputListOnVertices (IssmDouble *pvalue, int enumtype, IssmDouble defaultvalue)
 
void GetInputLocalMinMaxOnNodes (IssmDouble *min, IssmDouble *max, IssmDouble *ug)
 
void GetInputValue (bool *pvalue, int enum_type)
 
void GetInputValue (int *pvalue, int enum_type)
 
void GetInput2Value (bool *pvalue, int enum_type)
 
void GetInput2Value (int *pvalue, int enum_type)
 
void GetInput2Value (IssmDouble *pvalue, int enum_type)
 
void GetInputValue (IssmDouble *pvalue, Gauss *gauss, int enum_type)
 
NodeGetNode (int nodeindex)
 
int GetNodeIndex (Node *node)
 
void GetNodesLidList (int *lidlist)
 
void GetNodesSidList (int *sidlist)
 
void GetPhi (IssmDouble *phi, IssmDouble *epsilon, IssmDouble viscosity)
 
void GetSolutionFromInputsOneDof (Vector< IssmDouble > *solution, int solutionenum)
 
void GetVectorFromInputs (Vector< IssmDouble > *vector, int name_enum, int type)
 
void GetVectorFromInputs (Vector< IssmDouble > *vector, int name_enum, int type, IssmDouble time)
 
void GetVerticesLidList (int *lidlist)
 
void GetVerticesPidList (int *pidlist)
 
void GetVerticesConnectivityList (int *connectivitylist)
 
void GetVerticesCoordinates (IssmDouble **xyz_list)
 
void GetVerticesSidList (int *sidlist)
 
IssmDouble GetXcoord (IssmDouble *xyz_list, Gauss *gauss)
 
IssmDouble GetYcoord (IssmDouble *xyz_list, Gauss *gauss)
 
IssmDouble GetZcoord (IssmDouble *xyz_list, Gauss *gauss)
 
void GradientIndexing (int *indexing, int control_index)
 
IssmDouble GroundedArea (IssmDouble *mask, bool scaled)
 
bool HasNodeOnBase ()
 
bool HasNodeOnSurface ()
 
IssmDouble IceMass (bool scaled)
 
IssmDouble IceMass (IssmDouble *mask, bool scaled)
 
IssmDouble IceVolume (IssmDouble *mask, bool scaled)
 
IssmDouble IceVolumeAboveFloatation (IssmDouble *mask, bool scaled)
 
int Id ()
 
void InputCreate (IssmDouble *vector, Inputs2 *inputs2, IoModel *iomodel, int M, int N, int vector_type, int vector_enum, int code)
 
void ControlInputCreate (IssmDouble *doublearray, IssmDouble *independents_min, IssmDouble *independents_max, Inputs2 *inputs2, IoModel *iomodel, int M, int N, IssmDouble scale, int input_enum, int id)
 
void DatasetInputAdd (int enum_type, IssmDouble *vector, Inputs2 *inputs2, IoModel *iomodel, int M, int N, int vector_type, int vector_enum, int code, int input_enum)
 
void InputUpdateFromConstant (IssmDouble constant, int name)
 
void InputUpdateFromConstant (int constant, int name)
 
void InputUpdateFromConstant (bool constant, int name)
 
bool IsFloating ()
 
bool IsGrounded ()
 
bool IsOnBase ()
 
bool IsOnSurface ()
 
bool IsIceInElement ()
 
bool IsIceOnlyInElement ()
 
bool IsOceanInElement ()
 
bool IsLandInElement ()
 
void Ismip6FloatingiceMeltingRate ()
 
void LinearFloatingiceMeltingRate ()
 
void SpatialLinearFloatingiceMeltingRate ()
 
void MantlePlumeGeothermalFlux ()
 
void MarshallElement (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction, int numanalyses)
 
void MigrateGroundingLine (IssmDouble *sheet_ungrounding)
 
void MismipFloatingiceMeltingRate ()
 
void BeckmannGoosseFloatingiceMeltingRate ()
 
void MungsmtpParameterization (void)
 
ElementMatrixNewElementMatrix (int approximation_enum=NoneApproximationEnum)
 
ElementMatrixNewElementMatrixCoupling (int number_nodes, int approximation_enum=NoneApproximationEnum)
 
ElementVectorNewElementVector (int approximation_enum=NoneApproximationEnum)
 
void PicoUpdateBoxid (int *pmax_boxid_basin)
 
void PicoUpdateBox (int loopboxid)
 
void PicoComputeBasalMelt ()
 
void PositiveDegreeDay (IssmDouble *pdds, IssmDouble *pds, IssmDouble signorm, bool ismungsm, bool issetpddfac)
 
void PositiveDegreeDaySicopolis (bool isfirnwarming)
 
void ResultInterpolation (int *pinterpolation, int *nodesperelement, int *parray_size, int output_enum)
 
void ResultToPatch (IssmDouble *values, int nodesperelement, int output_enum)
 
void ResultToMatrix (IssmDouble *values, int ncols, int output_enum)
 
void ResultToVector (Vector< IssmDouble > *vector, int output_enum)
 
void SetwiseNodeConnectivity (int *d_nz, int *o_nz, Node *node, bool *flags, int *flagsindices, int set1_enum, int set2_enum)
 
void SetBoolInput (Inputs2 *inputs2, int enum_in, bool value)
 
void SetIntInput (Inputs2 *inputs2, int enum_in, int value)
 
void SmbSemic ()
 
int Sid ()
 
void SmbGemb (IssmDouble timeinputs, int count)
 
void StrainRateESA (IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void StrainRateFS (IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)
 
void StrainRateHO (IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void StrainRateHO2dvertical (IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void StrainRateSSA (IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
 
void StrainRateSSA1d (IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input)
 
void StressMaxPrincipalCreateInput (void)
 
IssmDouble TotalFloatingBmb (IssmDouble *mask, bool scaled)
 
IssmDouble TotalGroundedBmb (IssmDouble *mask, bool scaled)
 
IssmDouble TotalSmb (IssmDouble *mask, bool scaled)
 
void TransformInvStiffnessMatrixCoord (ElementMatrix *Ke, int cs_enum)
 
void TransformInvStiffnessMatrixCoord (ElementMatrix *Ke, Node **nodes, int numnodes, int cs_enum)
 
void TransformInvStiffnessMatrixCoord (ElementMatrix *Ke, Node **nodes, int numnodes, int *cs_array)
 
void TransformLoadVectorCoord (ElementVector *pe, int cs_enum)
 
void TransformLoadVectorCoord (ElementVector *pe, int *cs_array)
 
void TransformLoadVectorCoord (ElementVector *pe, Node **nodes, int numnodes, int cs_enum)
 
void TransformLoadVectorCoord (ElementVector *pe, Node **nodes, int numnodes, int *cs_array)
 
void TransformLoadVectorCoord (ElementVector *pe, int numnodes, int transformenum)
 
void TransformLoadVectorCoord (ElementVector *pe, int numnodes, int *transformenum_list)
 
void TransformSolutionCoord (IssmDouble *solution, int cs_enum)
 
void TransformSolutionCoord (IssmDouble *solution, int *cs_array)
 
void TransformSolutionCoord (IssmDouble *solution, int numnodes, int cs_enum)
 
void TransformSolutionCoord (IssmDouble *solution, int numnodes, int *cs_array)
 
void TransformSolutionCoord (IssmDouble *solution, Node **nodes, int numnodes, int cs_enum)
 
void TransformSolutionCoord (IssmDouble *solution, Node **nodes, int numnodes, int *cs_array)
 
void TransformStiffnessMatrixCoord (ElementMatrix *Ke, int cs_enum)
 
void TransformStiffnessMatrixCoord (ElementMatrix *Ke, int *cs_array)
 
void TransformStiffnessMatrixCoord (ElementMatrix *Ke, Node **nodes, int numnodes, int cs_enum)
 
void TransformStiffnessMatrixCoord (ElementMatrix *Ke, Node **nodes, int numnodes, int *cs_array)
 
void TransformStiffnessMatrixCoord (ElementMatrix *Ke, int numnodes, int *transformenum_list)
 
void ViscousHeatingCreateInput (void)
 
void ThermalToEnthalpy (IssmDouble *penthalpy, IssmDouble temperature, IssmDouble waterfraction, IssmDouble pressure)
 
IssmDouble TMeltingPoint (IssmDouble pressure)
 
void EnthalpyToThermal (IssmDouble *ptemperature, IssmDouble *pwaterfraction, IssmDouble enthalpy, IssmDouble pressure)
 
IssmDouble EnthalpyDiffusionParameter (IssmDouble enthalpy, IssmDouble pressure)
 
IssmDouble EnthalpyDiffusionParameterVolume (int numvertices, IssmDouble *enthalpy, IssmDouble *pressure)
 
IssmDouble PureIceEnthalpy (IssmDouble pressure)
 
virtual void BasalNodeIndices (int *pnumindices, int **pindices, int finiteelement)
 
virtual void DatasetInputExtrude (int input_enum, int start)
 
virtual void ViscousHeating (IssmDouble *pphi, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
- Public Member Functions inherited from ElementHook
 ElementHook ()
 
 ElementHook (int in_numanalyses, int material_id, int numvertices, IoModel *iomodel)
 
 ~ElementHook ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
void DeepEcho ()
 
void Echo ()
 
void InitHookNeighbors (int *element_ids)
 
void SetHookNodes (int *node_ids, int numnodes, int analysis_counter)
 
void SpawnSegHook (ElementHook *triahook, int ndex1, int index2)
 
void SpawnTriaHook (ElementHook *triahook, int index1, int index2, int index3)
 
- Public Member Functions inherited from TriaRef
 TriaRef ()
 
 ~TriaRef ()
 
void GetInputDerivativeValue (IssmDouble *pp, IssmDouble *plist, IssmDouble *xyz_list, Gauss *gauss, int finiteelement)
 
void GetInputValue (IssmDouble *pp, IssmDouble *plist, Gauss *gauss, int finiteelement)
 
void GetJacobian (IssmDouble *J, IssmDouble *xyz_list, Gauss *gauss)
 
void GetJacobianDeterminant (IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
 
void GetJacobianDeterminant3D (IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
 
void GetJacobianInvert (IssmDouble *Jinv, IssmDouble *xyz_list, Gauss *gauss)
 
void GetNodalFunctions (IssmDouble *basis, Gauss *gauss, int finiteelement)
 
void GetNodalFunctionsDerivatives (IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss, int finiteelement)
 
void GetNodalFunctionsDerivativesReference (IssmDouble *dbasis, Gauss *gauss, int finiteelement)
 
void GetSegmentJacobianDeterminant (IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
 
void GetSegmentNodalFunctions (IssmDouble *basis, Gauss *gauss, int index1, int index2, int finiteelement)
 
void GetSegmentNodalFunctionsDerivatives (IssmDouble *dbasis, IssmDouble *xyz_list_tria, Gauss *gauss, int index1, int index2, int finiteelement)
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
void NodeOnEdgeIndices (int *pnumindices, int **pindices, int index, int finiteelement)
 
int NumberofNodes (int finiteelement)
 
int PressureInterpolation (int fe_stokes)
 
int TensorInterpolation (int fe_stokes)
 
int VelocityInterpolation (int fe_stokes)
 

Data Fields

int iscollapsed
 
- Data Fields inherited from Element
int id
 
int sid
 
int lid
 
Inputs2inputs2
 
Node ** nodes
 
Vertex ** vertices
 
Materialmaterial
 
Parametersparameters
 
bool isonsurface
 
bool isonbase
 
int * element_type_list
 
int element_type
 
- Data Fields inherited from ElementHook
int numanalyses
 
Hook ** hnodes
 
Hookhvertices
 
Hookhmaterial
 
Hookhneighbors
 

Detailed Description

Definition at line 29 of file Tria.h.

Constructor & Destructor Documentation

◆ Tria() [1/2]

Tria::Tria ( )
inline

Definition at line 35 of file Tria.h.

35 {};

◆ Tria() [2/2]

Tria::Tria ( int  tria_id,
int  tria_sid,
int  tria_lid,
IoModel iomodel,
int  nummodels 
)

Definition at line 33 of file Tria.cpp.

34  :ElementHook(nummodels,tria_id,NUMVERTICES,iomodel){
35 
36  this->iscollapsed = 0;
37 
38  /*id: */
39  this->id = tria_id;
40  this->sid = tria_sid;
41  this->lid = tria_lid;
42 
43  /*this->parameters: we still can't point to it, it may not even exist. Configure will handle this.*/
44  this->parameters = NULL;
45 
46  /*initialize pointers:*/
47  this->nodes = NULL;
48  this->vertices = NULL;
49  this->material = NULL;
50  if(nummodels>0){
51  this->element_type_list=xNew<int>(nummodels);
52  for(int i=0;i<nummodels;i++) this->element_type_list[i] = 0;
53  }
54  else this->element_type_list = NULL;
55 
56  /*surface and base*/
57  IssmDouble sum;
58  this->isonsurface = false;
59  this->isonbase = false;
60  switch(iomodel->domaintype){
62  _assert_(iomodel->Data("md.mesh.vertexonsurface"));
63  _assert_(iomodel->Data("md.mesh.vertexonbase"));
64  sum = 0.;
65  for(int i=0;i<NUMVERTICES;i++) sum += iomodel->Data("md.mesh.vertexonsurface")[reCast<int>(iomodel->elements[(tria_id-1)*NUMVERTICES+i])-1];
66  _assert_(sum>=0 && sum<3);
67  if(sum>1.) this->isonsurface = true;
68  sum = 0.;
69  for(int i=0;i<NUMVERTICES;i++) sum += iomodel->Data("md.mesh.vertexonbase")[reCast<int>(iomodel->elements[(tria_id-1)*NUMVERTICES+i])-1];
70  _assert_(sum>=0 && sum<3);
71  if(sum>1.) this->isonbase = true;
72  break;
75  this->isonsurface = true;
76  this->isonbase = true;
77  break;
78  default: _error_("mesh "<<EnumToStringx(iomodel->domaintype)<<" not supported yet");
79  }
80 
81 }/*}}}*/

◆ ~Tria()

Tria::~Tria ( )

Definition at line 82 of file Tria.cpp.

82  {/*{{{*/
83  this->parameters=NULL;
84 }

Member Function Documentation

◆ copy()

Object * Tria::copy ( void  )
virtual

Implements Object.

Definition at line 86 of file Tria.cpp.

86  {/*{{{*/
87 
88  int i;
89  Tria* tria=NULL;
90 
91  tria=new Tria();
92 
93  tria->iscollapsed=this->iscollapsed;
94 
95  //deal with TriaRef mother class
96  int nanalyses = this->numanalyses;
97  if(nanalyses > 0){
98  tria->element_type_list=xNew<int>(nanalyses);
99  for(i=0;i<nanalyses;i++){
100  if (this->element_type_list[i]) tria->element_type_list[i]=this->element_type_list[i];
101  else tria->element_type_list[i] = 0;
102  }
103  }
104  else tria->element_type_list = NULL;
105  tria->element_type=this->element_type;
106  tria->numanalyses=nanalyses;
107 
108  //deal with ElementHook mother class
109  if (this->hnodes){
110  tria->hnodes=xNew<Hook*>(tria->numanalyses);
111  for(i=0;i<tria->numanalyses;i++){
112  if (this->hnodes[i]) tria->hnodes[i] = (Hook*)(this->hnodes[i]->copy());
113  else tria->hnodes[i] = NULL;
114  }
115  }
116  else tria->hnodes = NULL;
117 
118  tria->hvertices = (Hook*)this->hvertices->copy();
119  if(this->hmaterial)tria->hmaterial = (Hook*)this->hmaterial->copy();
120  tria->hneighbors = NULL;
121 
122  /*deal with Tria fields: */
123  tria->id = this->id;
124  tria->sid = this->sid;
125  tria->lid = this->lid;
126  tria->isonbase = this->isonbase;
127  tria->isonsurface = this->isonsurface;
128 
129  /*point parameters: */
130  tria->parameters=this->parameters;
131 
132  /*recover objects: */
133  if (this->nodes){
134  unsigned int num_nodes = 3;
135  tria->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
136  for(i=0;i<num_nodes;i++) if(this->nodes[i]) tria->nodes[i]=this->nodes[i]; else tria->nodes[i] = NULL;
137  }
138  else tria->nodes = NULL;
139 
140  tria->vertices = (Vertex**)this->hvertices->deliverp();
141  if(this->hmaterial)tria->material = (Material*)this->hmaterial->delivers();
142 
143  return tria;
144 }

◆ Marshall()

void Tria::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
virtual

Implements Element.

Definition at line 146 of file Tria.cpp.

146  { /*{{{*/
147 
149  MARSHALLING(this->iscollapsed);
150  MARSHALLING(this->isonsurface);
151  MARSHALLING(this->isonbase);
152 
153  /*Call parent classes: */
154  ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
155  Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
156  TriaRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
157 
158  vertices = (Vertex**)this->hvertices->deliverp();
159  material = (Material*)this->hmaterial->delivers();
160 
161 }

◆ ObjectEnum()

int Tria::ObjectEnum ( void  )
virtual

Implements Object.

Definition at line 3704 of file Tria.cpp.

3704  {/*{{{*/
3705 
3706  return TriaEnum;
3707 
3708 }

◆ InputUpdateFromIoModel()

void Tria::InputUpdateFromIoModel ( int  index,
IoModel iomodel 
)
virtual

Implements Element.

Definition at line 3064 of file Tria.cpp.

3064  { //i is the element index/*{{{*/
3065 
3066  /*Intermediaries*/
3067  int i,j;
3068  int tria_vertex_ids[3];
3069  IssmDouble nodeinputs[3];
3070  IssmDouble cmmininputs[3];
3071  IssmDouble cmmaxinputs[3];
3072  bool control_analysis,ad_analysis = false;
3073  int num_control_type,num_responses;
3074  char** controls = NULL;
3075  IssmDouble yts;
3076 
3077  /*Get parameters: */
3078  iomodel->FindConstant(&yts,"md.constants.yts");
3079  iomodel->FindConstant(&control_analysis,"md.inversion.iscontrol");
3080  iomodel->FindConstant(&ad_analysis, "md.autodiff.isautodiff");
3081  if(control_analysis && !ad_analysis) iomodel->FindConstant(&num_control_type,"md.inversion.num_control_parameters");
3082  if(control_analysis && !ad_analysis) iomodel->FindConstant(&num_responses,"md.inversion.num_cost_functions");
3083  if(control_analysis && ad_analysis) iomodel->FindConstant(&num_control_type,"md.autodiff.num_independent_objects");
3084  if(control_analysis && ad_analysis) iomodel->FindConstant(&num_responses,"md.autodiff.num_dependent_objects");
3085 
3086  /*Recover vertices ids needed to initialize inputs*/
3087  for(i=0;i<3;i++){
3088  tria_vertex_ids[i]=reCast<int>(iomodel->elements[3*index+i]); //ids for vertices are in the elements array from Matlab
3089  }
3090 }

◆ InputUpdateFromVector()

void Tria::InputUpdateFromVector ( IssmDouble vector,
int  name,
int  type 
)
virtual

Implements Element.

Definition at line 3119 of file Tria.cpp.

3119  {/*{{{*/
3120 
3121  /*Check that name is an element input*/
3122  if(!IsInputEnum(name)) _error_("Enum "<<EnumToStringx(name)<<" is not in IsInput");
3123 
3124  int numnodes;
3125  IssmDouble value;
3126  int lidlist[NUMVERTICES];
3127  int *doflist = NULL;
3128  IssmDouble *values = NULL;
3129 
3130  GetVerticesLidList(&lidlist[0]);
3131 
3132  switch(type){
3133  case VertexLIdEnum:
3134  values = xNew<IssmDouble>(NUMVERTICES);
3135  for(int i=0;i<NUMVERTICES;i++){
3136  values[i]=vector[this->vertices[i]->Lid()];
3137  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector");
3138  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in vector");
3139  }
3140  /*update input*/
3141  inputs2->SetTriaInput(name,P1Enum,NUMVERTICES,lidlist,values);
3142  break;
3143 
3144  case VertexPIdEnum:
3145  values = xNew<IssmDouble>(NUMVERTICES);
3146  for(int i=0;i<NUMVERTICES;i++){
3147  values[i]=vector[this->vertices[i]->Pid()];
3148  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector");
3149  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in vector");
3150  }
3151  /*update input*/
3152  inputs2->SetTriaInput(name,P1Enum,NUMVERTICES,lidlist,values);
3153  break;
3154 
3155  case VertexSIdEnum:
3156  values = xNew<IssmDouble>(NUMVERTICES);
3157  for(int i=0;i<NUMVERTICES;i++){
3158  values[i]=vector[this->vertices[i]->Sid()];
3159  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector");
3160  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in vector");
3161  }
3162  /*update input*/
3163  inputs2->SetTriaInput(name,P1Enum,NUMVERTICES,lidlist,values);
3164  break;
3165 
3166  case NodesEnum:
3167  /*Get number of nodes and dof list: */
3168  numnodes = this->NumberofNodes(this->element_type);
3169  values = xNew<IssmDouble>(numnodes);
3171 
3172  for(int i=0;i<numnodes;i++){
3173  values[i]=vector[doflist[i]];
3174  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector");
3175  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in vector");
3176  }
3177  //this->inputs->AddInput(new TriaInput(name,values,this->element_type));
3178  _error_("not implemented");
3179  break;
3180 
3181  case NodeSIdEnum:
3182  /*Get number of nodes and dof list: */
3183  numnodes = this->NumberofNodes(this->element_type);
3184  values = xNew<IssmDouble>(numnodes);
3185 
3186  for(int i=0;i<numnodes;i++){
3187  values[i]=vector[nodes[i]->Sid()];
3188  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in vector");
3189  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in vector");
3190  }
3191  if(this->element_type==P1Enum){
3192  inputs2->SetTriaInput(name,P1Enum,NUMVERTICES,lidlist,values);
3193  }
3194  else{
3195  inputs2->SetTriaInput(name,this->element_type,this->lid,numnodes,values);
3196  }
3197  break;
3198 
3199  case ElementEnum:
3200  value=vector[this->Sid()];
3201  if(xIsNan<IssmDouble>(value)) _error_("NaN found in vector");
3202  if(xIsInf<IssmDouble>(value)) _error_("Inf found in vector");
3203  /*update input*/
3204  //this->inputs->AddInput(new DoubleInput(name,value));
3205  //inputs2->SetTriaInput(name,P1Enum,NUMVERTICES,lidlist,values);
3206  _error_("not implemented");
3207  break;
3208 
3209  default:
3210  _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");
3211  }
3212 
3213  /*Clean-up*/
3214  xDelete<int>(doflist);
3215  xDelete<IssmDouble>(values);
3216 
3217 }

◆ AverageOntoPartition()

void Tria::AverageOntoPartition ( Vector< IssmDouble > *  partition_contributions,
Vector< IssmDouble > *  partition_areas,
IssmDouble vertex_response,
IssmDouble qmu_part 
)
virtual

Implements Element.

Definition at line 259 of file Tria.cpp.

259  {/*{{{*/
260 
261  bool already = false;
262  int i,j;
263  int partition[NUMVERTICES];
264  int offsetsid[NUMVERTICES];
265  int offsetdof[NUMVERTICES];
266  IssmDouble area;
267  IssmDouble mean;
268 
269  /*First, get the area: */
270  area=this->GetArea();
271 
272  /*Figure out the average for this element: */
273  this->GetVerticesSidList(&offsetsid[0]);
274  this->GetVerticesPidList(&offsetdof[0]);
275  mean=0;
276  for(i=0;i<NUMVERTICES;i++){
277  partition[i]=reCast<int>(qmu_part[offsetsid[i]]);
278  mean=mean+1.0/NUMVERTICES*vertex_response[offsetdof[i]];
279  }
280 
281  /*Add contribution: */
282  for(i=0;i<NUMVERTICES;i++){
283  already=false;
284  for(j=0;j<i;j++){
285  if (partition[i]==partition[j]){
286  already=true;
287  break;
288  }
289  }
290  if(!already){
291  partition_contributions->SetValue(partition[i],mean*area,ADD_VAL);
292  partition_areas->SetValue(partition[i],area,ADD_VAL);
293  };
294  }
295 }

◆ CalvingRateVonmises()

void Tria::CalvingRateVonmises ( void  )
virtual

Reimplemented from Element.

Definition at line 297 of file Tria.cpp.

297  {/*{{{*/
298 
299  IssmDouble xyz_list[NUMVERTICES][3];
300  IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
301  IssmDouble calvingratex[NUMVERTICES];
302  IssmDouble calvingratey[NUMVERTICES];
303  IssmDouble calvingrate[NUMVERTICES];
304  IssmDouble lambda1,lambda2,ex,ey,vx,vy,vel;
305  IssmDouble sigma_vm[NUMVERTICES];
306  IssmDouble B,sigma_max,sigma_max_floating,sigma_max_grounded,n;
307  IssmDouble epse_2,groundedice,bed,sealevel; // added sealevel
308 
309 
310  /* Get node coordinates and dof list: */
312 
313  /*Retrieve all inputs and parameters we will need*/
314  Input2* vx_input = this->GetInput2(VxEnum); _assert_(vx_input);
315  Input2* vy_input = this->GetInput2(VyEnum); _assert_(vy_input);
316  Input2* B_input = this->GetInput2(MaterialsRheologyBbarEnum); _assert_(B_input);
317  Input2* gr_input = this->GetInput2(MaskOceanLevelsetEnum); _assert_(gr_input);
318  Input2* bs_input = this->GetInput2(BaseEnum); _assert_(bs_input);
319  Input2* smax_fl_input = this->GetInput2(CalvingStressThresholdFloatingiceEnum); _assert_(smax_fl_input);
320  Input2* smax_gr_input = this->GetInput2(CalvingStressThresholdGroundediceEnum); _assert_(smax_gr_input);
321  Input2* n_input = this->GetInput2(MaterialsRheologyNEnum); _assert_(n_input);
322  Input2* sl_input = this->GetInput2(SealevelEnum); _assert_(sl_input);
323 
324 
325 
326  /* Start looping on the number of vertices: */
327  GaussTria* gauss=new GaussTria();
328  for(int iv=0;iv<NUMVERTICES;iv++){
329  gauss->GaussVertex(iv);
330 
331  /*Get velocity components and thickness*/
332  B_input->GetInputValue(&B,gauss);
333  n_input->GetInputValue(&n,gauss);
334  vx_input->GetInputValue(&vx,gauss);
335  vy_input->GetInputValue(&vy,gauss);
336  gr_input->GetInputValue(&groundedice,gauss);
337  bs_input->GetInputValue(&bed,gauss);
338  smax_fl_input->GetInputValue(&sigma_max_floating,gauss);
339  smax_gr_input->GetInputValue(&sigma_max_grounded,gauss);
340  vel=sqrt(vx*vx+vy*vy)+1.e-14;
341  sl_input->GetInputValue(&sealevel,gauss);
342 
343  /*Compute strain rate and viscosity: */
344  this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
345 
346  /*Get Eigen values*/
347  Matrix2x2Eigen(&lambda1,&lambda2,&ex,&ey,epsilon[0],epsilon[2],epsilon[1]);
348  _assert_(!xIsNan<IssmDouble>(lambda1));
349  _assert_(!xIsNan<IssmDouble>(lambda2));
350 
351  /*Process Eigen values (only account for extension)*/
352  lambda1 = max(lambda1,0.);
353  lambda2 = max(lambda2,0.);
354 
355  /*Calculate sigma_vm*/
356  epse_2 = 1./2. *(lambda1*lambda1 + lambda2*lambda2);
357  sigma_vm[iv] = sqrt(3.) * B * pow(epse_2,1./(2.*n));
358 
359  /*OLD (keep for a little bit)*/
360  //sigma_max = 800.e+3; //IUGG previous test
361  //sigma_max = 1000.e+3; //GRL
362  //if(groundedice<0) sigma_max=150.e+3;
363 
364  /*Tensile stress threshold*/
365  if(groundedice<0)
366  sigma_max = sigma_max_floating;
367  else
368  sigma_max = sigma_max_grounded;
369  /*Assign values*/
370  if(bed>sealevel){ // Changed 0. to sealevel
371  calvingratex[iv]=0.;
372  calvingratey[iv]=0.;
373  }
374  else{
375  calvingratex[iv]=vx*sigma_vm[iv]/sigma_max;
376  calvingratey[iv]=vy*sigma_vm[iv]/sigma_max;
377  }
378  calvingrate[iv] =sqrt(calvingratex[iv]*calvingratex[iv] + calvingratey[iv]*calvingratey[iv]);
379 
380  }
381 
382  /*Add input*/
383  this->AddInput2(CalvingratexEnum,&calvingratex[0],P1DGEnum);
384  this->AddInput2(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
385  this->AddInput2(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
386  this->AddInput2(SigmaVMEnum,&sigma_vm[0],P1DGEnum);
387 
388  /*Clean up and return*/
389  delete gauss;
390 }

◆ CalvingCrevasseDepth()

void Tria::CalvingCrevasseDepth ( void  )
virtual

Reimplemented from Element.

Definition at line 392 of file Tria.cpp.

392  {/*{{{*/
393 
394  IssmDouble xyz_list[NUMVERTICES][3];
395  IssmDouble calvingrate[NUMVERTICES];
396  IssmDouble vx,vy,vel;
397  IssmDouble water_height, bed,Ho,thickness,surface;
398  IssmDouble surface_crevasse[NUMVERTICES], basal_crevasse[NUMVERTICES], crevasse_depth[NUMVERTICES], H_surf, H_surfbasal;
399  IssmDouble B, strainparallel, straineffective,n;
400  IssmDouble s_xx,s_xy,s_yy,s1,s2,stmp;
401  int crevasse_opening_stress;
402 
403  /* Get node coordinates and dof list: */
405 
406  /*retrieve the type of crevasse_opening_stress*/
407  this->parameters->FindParam(&crevasse_opening_stress,CalvingCrevasseDepthEnum);
408 
409  IssmDouble rho_ice = this->FindParam(MaterialsRhoIceEnum);
410  IssmDouble rho_seawater = this->FindParam(MaterialsRhoSeawaterEnum);
411  IssmDouble rho_freshwater = this->FindParam(MaterialsRhoFreshwaterEnum);
412  IssmDouble constant_g = this->FindParam(ConstantsGEnum);
413 
414  Input2* H_input = this->GetInput2(ThicknessEnum); _assert_(H_input);
415  Input2* bed_input = this->GetInput2(BedEnum); _assert_(bed_input);
416  Input2* surface_input = this->GetInput2(SurfaceEnum); _assert_(surface_input);
417  Input2* strainrateparallel_input = this->GetInput2(StrainRateparallelEnum); _assert_(strainrateparallel_input);
418  Input2* strainrateeffective_input = this->GetInput2(StrainRateeffectiveEnum); _assert_(strainrateeffective_input);
419  Input2* vx_input = this->GetInput2(VxEnum); _assert_(vx_input);
420  Input2* vy_input = this->GetInput2(VxEnum); _assert_(vy_input);
421  Input2* waterheight_input = this->GetInput2(WaterheightEnum); _assert_(waterheight_input);
422  Input2* s_xx_input = this->GetInput2(DeviatoricStressxxEnum); _assert_(s_xx_input);
423  Input2* s_xy_input = this->GetInput2(DeviatoricStressxyEnum); _assert_(s_xy_input);
424  Input2* s_yy_input = this->GetInput2(DeviatoricStressyyEnum); _assert_(s_yy_input);
425  Input2* B_input = this->GetInput2(MaterialsRheologyBbarEnum); _assert_(B_input);
426  Input2* n_input = this->GetInput2(MaterialsRheologyNEnum); _assert_(n_input);
427 
428  /*Loop over all elements of this partition*/
429  GaussTria* gauss=new GaussTria();
430  for (int iv=0;iv<NUMVERTICES;iv++){
431  gauss->GaussVertex(iv);
432 
433  H_input->GetInputValue(&thickness,gauss);
434  bed_input->GetInputValue(&bed,gauss);
435  surface_input->GetInputValue(&surface,gauss);
436  strainrateparallel_input->GetInputValue(&strainparallel,gauss);
437  strainrateeffective_input->GetInputValue(&straineffective,gauss);
438  vx_input->GetInputValue(&vx,gauss);
439  vy_input->GetInputValue(&vy,gauss);
440  waterheight_input->GetInputValue(&water_height,gauss);
441  s_xx_input->GetInputValue(&s_xx,gauss);
442  s_xy_input->GetInputValue(&s_xy,gauss);
443  s_yy_input->GetInputValue(&s_yy,gauss);
444  B_input->GetInputValue(&B,gauss);
445  n_input->GetInputValue(&n,gauss);
446 
447  vel=sqrt(vx*vx+vy*vy)+1.e-14;
448 
449  s1=(s_xx+s_yy)/2.+sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
450  s2=(s_xx+s_yy)/2.-sqrt(pow((s_xx-s_yy)/2.,2)+pow(s_xy,2));
451  if(fabs(s2)>fabs(s1)){stmp=s2; s2=s1; s1=stmp;}
452 
453  Ho = thickness - (rho_seawater/rho_ice) * (-bed);
454  if(Ho<0.) Ho=0.;
455 
456  if(crevasse_opening_stress==0){ /*Otero2010: balance between the tensile deviatoric stress and ice overburden pressure*/
457  surface_crevasse[iv] = B * strainparallel * pow(straineffective, ((1 / n)-1)) / (rho_ice * constant_g);
458  basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice)) * (B * strainparallel * pow(straineffective,((1/n)-1)) / (rho_ice*constant_g) - Ho);
459  }
460  else if(crevasse_opening_stress==1){ /*Benn2017,Todd2018: maximum principal stress */
461  surface_crevasse[iv] = s1 / (rho_ice*constant_g);
462  basal_crevasse[iv] = (rho_ice/(rho_seawater-rho_ice))* (s1/ (rho_ice*constant_g)-Ho);
463  }
464 
465  /* some constraints */
466  if (surface_crevasse[iv]<0.) {
467  surface_crevasse[iv]=0.;
468  water_height = 0.;
469  }
470  if (basal_crevasse[iv]<0.) basal_crevasse[iv]=0.;
471  if (bed>0.) basal_crevasse[iv] = 0.;
472 
473  //if (surface_crevasse[iv]<water_height){
474  // water_height = surface_crevasse[iv];
475  //}
476 
477  /* add water in surface crevasse */
478  surface_crevasse[iv] = surface_crevasse[iv] + (rho_freshwater/rho_ice)*water_height; /* surface crevasse + water */
479  crevasse_depth[iv] = surface_crevasse[iv] + (rho_freshwater/rho_ice)*water_height + basal_crevasse[iv]; /* surface crevasse + basal crevasse + water */
480 
481  }
482 
483  this->AddInput2(SurfaceCrevasseEnum,&surface_crevasse[0],P1DGEnum);
484  this->AddInput2(BasalCrevasseEnum,&basal_crevasse[0],P1DGEnum);
485  this->AddInput2(CrevasseDepthEnum,&crevasse_depth[0],P1DGEnum);
486 
487  delete gauss;
488 }

◆ CalvingRateLevermann()

void Tria::CalvingRateLevermann ( void  )
virtual

Implements Element.

Definition at line 490 of file Tria.cpp.

490  {/*{{{*/
491 
492  IssmDouble xyz_list[NUMVERTICES][3];
493  IssmDouble vx,vy,vel;
494  IssmDouble strainparallel;
495  IssmDouble propcoeff,bed;
496  IssmDouble strainperpendicular;
497  IssmDouble calvingratex[NUMVERTICES];
498  IssmDouble calvingratey[NUMVERTICES];
499  IssmDouble calvingrate[NUMVERTICES];
500 
501  /* Get node coordinates and dof list: */
503 
504  /*Retrieve all inputs and parameters we will need*/
505  Input2* vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
506  Input2* vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
507  Input2* bs_input = this->GetInput2(BaseEnum); _assert_(bs_input);
508  Input2* strainparallel_input=this->GetInput2(StrainRateparallelEnum); _assert_(strainparallel_input);
509  Input2* strainperpendicular_input=this->GetInput2(StrainRateperpendicularEnum);_assert_(strainperpendicular_input);
510  Input2* levermanncoeff_input=this->GetInput2(CalvinglevermannCoeffEnum); _assert_(levermanncoeff_input);
511 
512  /* Start looping on the number of vertices: */
513  GaussTria* gauss=new GaussTria();
514  for (int iv=0;iv<NUMVERTICES;iv++){
515  gauss->GaussVertex(iv);
516 
517  /* Get the value we need*/
518  vx_input->GetInputValue(&vx,gauss);
519  vy_input->GetInputValue(&vy,gauss);
520  vel=vx*vx+vy*vy;
521  strainparallel_input->GetInputValue(&strainparallel,gauss);
522  strainperpendicular_input->GetInputValue(&strainperpendicular,gauss);
523  levermanncoeff_input->GetInputValue(&propcoeff,gauss);
524  bs_input->GetInputValue(&bed,gauss);
525 
526  /*Calving rate proportionnal to the positive product of the strain rate along the ice flow direction and the strain rate perpendicular to the ice flow */
527  if(strainparallel>0. && strainperpendicular>0. && bed<=0.){
528  calvingrate[iv]=propcoeff*strainparallel*strainperpendicular;
529  }
530  else
531  calvingrate[iv]=0.;
532 
533  calvingratex[iv]=calvingrate[iv]*vx/(sqrt(vel)+1.e-14);
534  calvingratey[iv]=calvingrate[iv]*vy/(sqrt(vel)+1.e-14);
535  }
536 
537  /*Add input*/
538  this->AddInput2(CalvingratexEnum,&calvingratex[0],P1DGEnum);
539  this->AddInput2(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
540  this->AddInput2(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
541 
542  /*Clean up and return*/
543  delete gauss;
544 
545 }

◆ CalvingFluxLevelset()

void Tria::CalvingFluxLevelset ( void  )
virtual

Reimplemented from Element.

Definition at line 547 of file Tria.cpp.

547  {/*{{{*/
548 
549  /*Make sure there is an ice front here*/
551  IssmDouble flux_per_area=0;
552  this->AddInput2(CalvingFluxLevelsetEnum,&flux_per_area,P0Enum);
553  }
554  else{
555  int domaintype,index1,index2;
556  const IssmPDouble epsilon = 1.e-15;
557  IssmDouble s1,s2;
559  IssmDouble xyz_front[2][3];
560 
561  IssmDouble *xyz_list = NULL;
562  this->GetVerticesCoordinates(&xyz_list);
563 
564  /*Recover parameters and values*/
565  parameters->FindParam(&domaintype,DomainTypeEnum);
567 
568  /*Be sure that values are not zero*/
569  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
570  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
571  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
572 
573  if(domaintype==Domain2DverticalEnum){
574  _error_("not implemented");
575  }
576  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
577  int pt1 = 0;
578  int pt2 = 1;
579  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
580 
581  /*Portion of the segments*/
582  s1=gl[2]/(gl[2]-gl[1]);
583  s2=gl[2]/(gl[2]-gl[0]);
584  if(gl[2]<0.){
585  pt1 = 1; pt2 = 0;
586  }
587  xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
588  xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
589  xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
590  xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
591  xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
592  xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
593  }
594  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
595 
596  /*Portion of the segments*/
597  s1=gl[0]/(gl[0]-gl[1]);
598  s2=gl[0]/(gl[0]-gl[2]);
599  if(gl[0]<0.){
600  pt1 = 1; pt2 = 0;
601  }
602 
603  xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
604  xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
605  xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
606  xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
607  xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
608  xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
609  }
610  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
611 
612  /*Portion of the segments*/
613  s1=gl[1]/(gl[1]-gl[0]);
614  s2=gl[1]/(gl[1]-gl[2]);
615  if(gl[1]<0.){
616  pt1 = 1; pt2 = 0;
617  }
618 
619  xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
620  xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
621  xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
622  xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
623  xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
624  xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
625  }
626  else{
627  _error_("case not possible");
628  }
629 
630  }
631  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
632 
633  /*Some checks in debugging mode*/
634  _assert_(s1>=0 && s1<=1.);
635  _assert_(s2>=0 && s2<=1.);
636 
637  /*Get normal vector*/
638  IssmDouble normal[3];
639  this->NormalSection(&normal[0],&xyz_front[0][0]);
640  normal[0] = -normal[0];
641  normal[1] = -normal[1];
642 
643  /*Get inputs*/
644  IssmDouble flux = 0.;
645  IssmDouble area = 0.;
646  IssmDouble calvingratex,calvingratey,thickness,Jdet,flux_per_area;
648  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
649  Input2* calvingratex_input=NULL;
650  Input2* calvingratey_input=NULL;
651  if(domaintype==Domain2DhorizontalEnum){
652  calvingratex_input=this->GetInput2(CalvingratexEnum); _assert_(calvingratex_input);
653  calvingratey_input=this->GetInput2(CalvingrateyEnum); _assert_(calvingratey_input);
654  }
655  else{
656  calvingratex_input=this->GetInput2(CalvingratexAverageEnum); _assert_(calvingratex_input);
657  calvingratey_input=this->GetInput2(CalvingrateyAverageEnum); _assert_(calvingratey_input);
658  }
659 
660  /*Start looping on Gaussian points*/
661  Gauss* gauss=this->NewGauss(xyz_list,&xyz_front[0][0],3);
662  for(int ig=gauss->begin();ig<gauss->end();ig++){
663 
664  gauss->GaussPoint(ig);
665  thickness_input->GetInputValue(&thickness,gauss);
666  calvingratex_input->GetInputValue(&calvingratex,gauss);
667  calvingratey_input->GetInputValue(&calvingratey,gauss);
668  this->JacobianDeterminantSurface(&Jdet,&xyz_front[0][0],gauss);
669 
670  flux += rho_ice*Jdet*gauss->weight*thickness*(calvingratex*normal[0] + calvingratey*normal[1]);
671  area += Jdet*gauss->weight*thickness;
672 
673  flux_per_area=flux/area;
674  }
675 
676  this->AddInput2(CalvingFluxLevelsetEnum,&flux_per_area,P0Enum);
677 
678  /*Clean up and return*/
679  delete gauss;
680  }
681 }

◆ CalvingMeltingFluxLevelset()

void Tria::CalvingMeltingFluxLevelset ( void  )
virtual

Reimplemented from Element.

Definition at line 683 of file Tria.cpp.

683  {/*{{{*/
684 
685  /*Make sure there is an ice front here*/
687  IssmDouble flux_per_area=0;
688  this->AddInput2(CalvingMeltingFluxLevelsetEnum,&flux_per_area,P0Enum);
689  }
690  else{
691  int domaintype,index1,index2;
692  const IssmPDouble epsilon = 1.e-15;
693  IssmDouble s1,s2;
695  IssmDouble xyz_front[2][3];
696 
697 
698  IssmDouble *xyz_list = NULL;
699  this->GetVerticesCoordinates(&xyz_list);
700 
701  /*Recover parameters and values*/
702  parameters->FindParam(&domaintype,DomainTypeEnum);
704 
705  /*Be sure that values are not zero*/
706  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
707  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
708  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
709 
710  if(domaintype==Domain2DverticalEnum){
711  _error_("not implemented");
712  }
713  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
714  int pt1 = 0;
715  int pt2 = 1;
716  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
717 
718  /*Portion of the segments*/
719  s1=gl[2]/(gl[2]-gl[1]);
720  s2=gl[2]/(gl[2]-gl[0]);
721  if(gl[2]<0.){
722  pt1 = 1; pt2 = 0;
723  }
724  xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
725  xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
726  xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
727  xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
728  xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
729  xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
730  }
731  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
732 
733  /*Portion of the segments*/
734  s1=gl[0]/(gl[0]-gl[1]);
735  s2=gl[0]/(gl[0]-gl[2]);
736  if(gl[0]<0.){
737  pt1 = 1; pt2 = 0;
738  }
739 
740  xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
741  xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
742  xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
743  xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
744  xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
745  xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
746  }
747  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
748 
749  /*Portion of the segments*/
750  s1=gl[1]/(gl[1]-gl[0]);
751  s2=gl[1]/(gl[1]-gl[2]);
752  if(gl[1]<0.){
753  pt1 = 1; pt2 = 0;
754  }
755 
756  xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
757  xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
758  xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
759  xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
760  xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
761  xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
762  }
763  else{
764  _error_("case not possible");
765  }
766 
767  }
768  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
769 
770  /*Some checks in debugging mode*/
771  _assert_(s1>=0 && s1<=1.);
772  _assert_(s2>=0 && s2<=1.);
773 
774  /*Get normal vector*/
775  IssmDouble normal[3];
776  this->NormalSection(&normal[0],&xyz_front[0][0]);
777  normal[0] = -normal[0];
778  normal[1] = -normal[1];
779 
780  /*Get inputs*/
781  IssmDouble flux = 0.;
782  IssmDouble area = 0.;
783  IssmDouble calvingratex,calvingratey,vx,vy,vel,meltingrate,meltingratex,meltingratey,thickness,Jdet,flux_per_area;
785  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
786  Input2* calvingratex_input=NULL;
787  Input2* calvingratey_input=NULL;
788  Input2* vx_input=NULL;
789  Input2* vy_input=NULL;
790  Input2* meltingrate_input=NULL;
791  if(domaintype==Domain2DhorizontalEnum){
792  calvingratex_input=this->GetInput2(CalvingratexEnum); _assert_(calvingratex_input);
793  calvingratey_input=this->GetInput2(CalvingrateyEnum); _assert_(calvingratey_input);
794  vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
795  vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
796  meltingrate_input=this->GetInput2(CalvingMeltingrateEnum); _assert_(meltingrate_input);
797  }
798  else{
799  calvingratex_input=this->GetInput2(CalvingratexAverageEnum); _assert_(calvingratex_input);
800  calvingratey_input=this->GetInput2(CalvingrateyAverageEnum); _assert_(calvingratey_input);
801  }
802 
803  /*Start looping on Gaussian points*/
804  Gauss* gauss=this->NewGauss(xyz_list,&xyz_front[0][0],3);
805  for(int ig=gauss->begin();ig<gauss->end();ig++){
806 
807  gauss->GaussPoint(ig);
808  thickness_input->GetInputValue(&thickness,gauss);
809  calvingratex_input->GetInputValue(&calvingratex,gauss);
810  calvingratey_input->GetInputValue(&calvingratey,gauss);
811  vx_input->GetInputValue(&vx,gauss);
812  vy_input->GetInputValue(&vy,gauss);
813  vel=vx*vx+vy*vy;
814  meltingrate_input->GetInputValue(&meltingrate,gauss);
815  meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
816  meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
817  this->JacobianDeterminantSurface(&Jdet,&xyz_front[0][0],gauss);
818 
819  flux += rho_ice*Jdet*gauss->weight*thickness*((calvingratex+meltingratex)*normal[0] + (calvingratey+meltingratey)*normal[1]);
820  area += Jdet*gauss->weight*thickness;
821 
822  flux_per_area=flux/area;
823  }
824 
825  this->AddInput2(CalvingMeltingFluxLevelsetEnum,&flux_per_area,P0Enum);
826 
827  /*Clean up and return*/
828  delete gauss;
829  }
830 }

◆ CharacteristicLength()

IssmDouble Tria::CharacteristicLength ( void  )
virtual

Implements Element.

Definition at line 832 of file Tria.cpp.

832  {/*{{{*/
833 
834  return sqrt(2*this->GetArea());
835 }

◆ ComputeBasalStress()

void Tria::ComputeBasalStress ( void  )
virtual

Reimplemented from Element.

Definition at line 837 of file Tria.cpp.

837  {/*{{{*/
838  _error_("Not Implemented yet");
839 }

◆ ComputeDeviatoricStressTensor()

void Tria::ComputeDeviatoricStressTensor ( void  )
virtual

Implements Element.

Definition at line 841 of file Tria.cpp.

841  {/*{{{*/
842 
843  IssmDouble xyz_list[NUMVERTICES][3];
844  IssmDouble viscosity,lambda1,lambda2;
845  IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
846  IssmDouble tau_xx[NUMVERTICES];
847  IssmDouble tau_yy[NUMVERTICES];
848  IssmDouble tau_zz[NUMVERTICES]={0,0,0};
849  IssmDouble tau_xy[NUMVERTICES];
850  IssmDouble tau_xz[NUMVERTICES]={0,0,0};
851  IssmDouble tau_yz[NUMVERTICES]={0,0,0};
852  IssmDouble tau_e[NUMVERTICES];
853  IssmDouble tau_1[NUMVERTICES];
854  IssmDouble tau_2[NUMVERTICES];
855  GaussTria* gauss=NULL;
856  int domaintype,dim=2;
857 
858  /*Get approximation*/
859  int approximation;
860  this->GetInput2Value(&approximation,ApproximationEnum);
861 
862  /* Get node coordinates and dof list: */
864 
865  /*Retrieve all inputs we will be needing: */
866  this->FindParam(&domaintype,DomainTypeEnum);
867  Input2* vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
868  Input2* vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
869 
870  /* Start looping on the number of vertices: */
871  gauss=new GaussTria();
872  for (int iv=0;iv<NUMVERTICES;iv++){
873  gauss->GaussVertex(iv);
874 
875  /*Compute strain rate and viscosity: */
876  this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
877  switch(approximation){
879  this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
880  break;
881  case HOApproximationEnum:
882  this->material->ViscosityHO(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
883  break;
884  case FSApproximationEnum:
885  this->material->ViscosityFS(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input,NULL);
886  break;
887  default:
888  _error_("not supported yet");
889  }
890 
891  /*Compute Stress*/
892  tau_xx[iv]=2*viscosity*epsilon[0]; // tau = nu eps
893  tau_yy[iv]=2*viscosity*epsilon[1];
894  tau_xy[iv]=2*viscosity*epsilon[2];
895  tau_e[iv]=1/sqrt(2)*sqrt(pow(tau_xx[iv],2)+pow(tau_yy[iv],2)+2*pow(tau_xy[iv],2));
896 
897  /*Get Eigen values*/
898  Matrix2x2Eigen(&tau_2[iv],&tau_1[iv],NULL,NULL,tau_xx[iv],tau_xy[iv],tau_yy[iv]);
899  }
900 
901  /*Add Stress tensor components into inputs*/
902  this->AddInput2(DeviatoricStressxxEnum,&tau_xx[0],P1DGEnum);
903  this->AddInput2(DeviatoricStressxyEnum,&tau_xy[0],P1DGEnum);
904  this->AddInput2(DeviatoricStressxzEnum,&tau_xz[0],P1DGEnum);
905  this->AddInput2(DeviatoricStressyyEnum,&tau_yy[0],P1DGEnum);
906  this->AddInput2(DeviatoricStressyzEnum,&tau_yz[0],P1DGEnum);
907  this->AddInput2(DeviatoricStresszzEnum,&tau_zz[0],P1DGEnum);
909  this->AddInput2(DeviatoricStress1Enum,&tau_1[0],P1DGEnum);
910  this->AddInput2(DeviatoricStress2Enum,&tau_2[0],P1DGEnum);
911 
912  /*Clean up and return*/
913  delete gauss;
914 }

◆ ComputeEsaStrainAndVorticity()

void Tria::ComputeEsaStrainAndVorticity ( void  )
virtual

Implements Element.

Definition at line 916 of file Tria.cpp.

916  { /*{{{*/
917 
918  IssmDouble xyz_list[NUMVERTICES][3];
919  IssmDouble epsilon[4]; /* epsilon=[exx,eyy,exy+ (shear),exy- (rotation)];*/
920  IssmDouble strain_xx[NUMVERTICES];
921  IssmDouble strain_yy[NUMVERTICES];
922  IssmDouble strain_xy[NUMVERTICES];
923  IssmDouble vorticity_xy[NUMVERTICES];
924  GaussTria* gauss=NULL;
925 
926  /* Get node coordinates and dof list: */
928 
929  /*Retrieve all inputs we will be needing: */
930  Input2* vx_input=this->GetInput2(EsaXmotionEnum); _assert_(vx_input);
931  Input2* vy_input=this->GetInput2(EsaYmotionEnum); _assert_(vy_input);
932 
933  /* Start looping on the number of vertices: */
934  gauss=new GaussTria();
935  for (int iv=0;iv<NUMVERTICES;iv++){
936  gauss->GaussVertex(iv);
937 
938  /*Compute strain rate and vorticity rate: */
939  this->StrainRateESA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
940 
941  /*Compute Stress*/
942  strain_xx[iv]=epsilon[0];
943  strain_yy[iv]=epsilon[1];
944  strain_xy[iv]=epsilon[2];
945  vorticity_xy[iv]=epsilon[3];
946  }
947 
948  /*Add Stress tensor components into inputs*/
949  this->AddInput2(EsaStrainratexxEnum,&strain_xx[0],P1DGEnum);
950  this->AddInput2(EsaStrainrateyyEnum,&strain_yy[0],P1DGEnum);
951  this->AddInput2(EsaStrainratexyEnum,&strain_xy[0],P1DGEnum);
952  this->AddInput2(EsaRotationrateEnum,&vorticity_xy[0],P1DGEnum);
953 
954  /*Clean up and return*/
955  delete gauss;
956 }

◆ ComputeSigmaNN()

void Tria::ComputeSigmaNN ( void  )
virtual

Implements Element.

Definition at line 958 of file Tria.cpp.

958  {/*{{{*/
959 
960  if(!IsOnBase()){
961  IssmDouble sigma_nn[3]={0.};
962  this->AddInput2(SigmaNNEnum,&sigma_nn[0],P1Enum);
963  return;
964  }
965  else{
966  IssmDouble* xyz_list=NULL;
967  IssmDouble *xyz_list_base=NULL;
968  IssmDouble pressure,viscosity;
969  IssmDouble sigma_nn[3];
970  IssmDouble sigma_xx,sigma_xy,sigma_yy;
971  IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
972  IssmDouble base_normal[2];
973  int domaintype,dim=2;
974 
975  /* Get node coordinates and dof list: */
976  GetVerticesCoordinates(&xyz_list);
977  GetVerticesCoordinatesBase(&xyz_list_base);
978 
979  /*Retrieve all inputs we will be needing: */
980  this->FindParam(&domaintype,DomainTypeEnum);
981  if(domaintype==Domain2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(domaintype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
982  Input2* pressure_input=this->GetInput2(PressureEnum); _assert_(pressure_input);
983  Input2* vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
984  Input2* vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
985 
986  /* Start looping on the number of vertices: */
987  Gauss* gauss = this->NewGauss();
988  for(int i=0;i<NUMVERTICES;i++){
989  gauss->GaussNode(P1Enum,i);
990 
991  /*Compute strain rate viscosity and pressure: */
992  this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
993  this->material->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,NULL);
994  pressure_input->GetInputValue(&pressure,gauss);
995 
996  /*Compute Stress*/
997  sigma_xx=2*viscosity*epsilon[0]-pressure; // sigma = nu eps - pressure
998  sigma_yy=2*viscosity*epsilon[1]-pressure;
999  sigma_xy=2*viscosity*epsilon[2];
1000 
1001  /*Get normal vector to the bed */
1002  NormalBase(&base_normal[0],xyz_list_base);
1003 
1004  /*Compute sigma_nn*/
1005  sigma_nn[i]=sigma_xx*base_normal[0]*base_normal[0] + 2*sigma_xy*base_normal[0]*base_normal[1] + sigma_yy*base_normal[1]*base_normal[1];
1006  }
1007 
1008  /*Add Stress tensor components into inputs*/
1009  this->AddInput2(SigmaNNEnum,&sigma_nn[0],P1Enum);
1010 
1011  /*Clean up and return*/
1012  xDelete<IssmDouble>(xyz_list);
1013  xDelete<IssmDouble>(xyz_list_base);
1014  delete gauss;
1015  }
1016 }

◆ ComputeStressTensor()

void Tria::ComputeStressTensor ( void  )
virtual

Implements Element.

Definition at line 1018 of file Tria.cpp.

1018  {/*{{{*/
1019 
1020  IssmDouble xyz_list[NUMVERTICES][3];
1021  IssmDouble pressure,viscosity;
1022  IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
1023  IssmDouble sigma_xx[NUMVERTICES];
1024  IssmDouble sigma_yy[NUMVERTICES];
1025  IssmDouble sigma_zz[NUMVERTICES]={0,0,0};
1026  IssmDouble sigma_xy[NUMVERTICES];
1027  IssmDouble sigma_xz[NUMVERTICES]={0,0,0};
1028  IssmDouble sigma_yz[NUMVERTICES]={0,0,0};
1029  GaussTria* gauss=NULL;
1030  int domaintype,dim=2;
1031 
1032  /* Get node coordinates and dof list: */
1034 
1035  /*Retrieve all inputs we will be needing: */
1036  this->FindParam(&domaintype,DomainTypeEnum);
1037  if(domaintype==Domain2DhorizontalEnum) _error_("stress tensor calculation not supported for mesh of type " <<EnumToStringx(domaintype)<<", extrude mesh or call ComputeDeviatoricStressTensor");
1038  Input2* pressure_input=this->GetInput2(PressureEnum); _assert_(pressure_input);
1039  Input2* vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
1040  Input2* vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
1041 
1042  /* Start looping on the number of vertices: */
1043  gauss=new GaussTria();
1044  for (int iv=0;iv<NUMVERTICES;iv++){
1045  gauss->GaussVertex(iv);
1046 
1047  /*Compute strain rate viscosity and pressure: */
1048  this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
1049  this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
1050  pressure_input->GetInputValue(&pressure,gauss);
1051 
1052  /*Compute Stress*/
1053  sigma_xx[iv]=2*viscosity*epsilon[0]-pressure; // sigma = nu eps - pressure
1054  sigma_yy[iv]=2*viscosity*epsilon[1]-pressure;
1055  sigma_xy[iv]=2*viscosity*epsilon[2];
1056  }
1057 
1058  /*Add Stress tensor components into inputs*/
1059  this->AddInput2(StressTensorxxEnum,&sigma_xx[0],P1DGEnum);
1060  this->AddInput2(StressTensorxyEnum,&sigma_xy[0],P1DGEnum);
1061  this->AddInput2(StressTensorxzEnum,&sigma_xz[0],P1DGEnum);
1062  this->AddInput2(StressTensoryyEnum,&sigma_yy[0],P1DGEnum);
1063  this->AddInput2(StressTensoryzEnum,&sigma_yz[0],P1DGEnum);
1064  this->AddInput2(StressTensorzzEnum,&sigma_zz[0],P1DGEnum);
1065 
1066  /*Clean up and return*/
1067  delete gauss;
1068 }

◆ ComputeSurfaceNormalVelocity()

void Tria::ComputeSurfaceNormalVelocity ( )

◆ Configure()

void Tria::Configure ( Elements elements,
Loads loads,
Nodes nodesin,
Vertices verticesin,
Materials materials,
Parameters parameters,
Inputs2 inputs2in 
)
virtual

Implements Element.

Definition at line 1070 of file Tria.cpp.

1070  {/*{{{*/
1071 
1072  /*go into parameters and get the analysis_counter: */
1073  int analysis_counter;
1074  parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
1075 
1076  /*Get Element type*/
1077  if (this->element_type_list) this->element_type=this->element_type_list[analysis_counter];
1078 
1079  /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
1080  * datasets, using internal ids and offsets hidden in hooks: */
1081  if(this->hnodes){
1082  if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
1083  else this->hnodes[analysis_counter] = NULL;
1084  }
1085  else this->hnodes = NULL;
1086  this->hvertices->configure(verticesin);
1087  if(this->hmaterial) this->hmaterial->configure(materialsin);
1088 
1089  /*Now, go pick up the objects inside the hooks: */
1090  if(this->hnodes && this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
1091  else this->nodes=NULL;
1092  this->vertices = (Vertex**)this->hvertices->deliverp();
1093  if(this->hmaterial)this->material = (Material*)this->hmaterial->delivers();
1094 
1095  /*point parameters to real dataset: */
1096  this->parameters=parametersin;
1097  this->inputs2=inputs2in;
1098 }/*}}}*/

◆ ControlInputSetGradient() [1/2]

void Tria::ControlInputSetGradient ( IssmDouble gradient,
int  enum_type,
int  control_index,
int  offset,
int  N,
int  M 
)
virtual

Implements Element.

Definition at line 1099 of file Tria.cpp.

1099  {/*{{{*/
1100 
1101  int idlist[NUMVERTICES];
1102  int vertexlids[NUMVERTICES];
1103  int gradidlist[NUMVERTICES];
1104  IssmDouble grad_list[NUMVERTICES];
1105 
1106  GradientIndexing(&gradidlist[0],control_index);
1107  for(int i=0;i<NUMVERTICES;i++) vertexlids[i]=this->vertices[i]->lid;
1108 
1109  if(N==1){
1110  this->inputs2->SetTriaControlInputGradient(enum_type,P1Enum,NUMVERTICES,&vertexlids[0],&grad_list[0]);
1111  }
1112  else{
1113  for(int n=0;n<N;n++){
1114  for(int i=0;i<NUMVERTICES;i++){
1115  idlist[i] = offset + this->vertices[i]->Sid()+n*M;
1116  grad_list[i]=gradient[idlist[i]];
1117  }
1118  this->inputs2->SetTriaControlInputGradient(enum_type,P1Enum,NUMVERTICES,&vertexlids[0],&grad_list[0],n);
1119  }
1120  }
1121 
1122 }/*}}}*/

◆ ControlInputSetGradient() [2/2]

void Tria::ControlInputSetGradient ( IssmDouble gradient,
int  enum_type,
int  control_index 
)
virtual

Implements Element.

Definition at line 1123 of file Tria.cpp.

1123  {/*{{{*/
1124 
1125  int idlist[NUMVERTICES];
1126  int vertexlids[NUMVERTICES];
1127  IssmDouble grad_list[NUMVERTICES];
1128 
1129  GradientIndexing(&idlist[0],control_index);
1130  for(int i=0;i<NUMVERTICES;i++) grad_list[i]=gradient[idlist[i]];
1131  for(int i=0;i<NUMVERTICES;i++) vertexlids[i]=this->vertices[i]->lid;
1132 
1133  this->inputs2->SetTriaControlInputGradient(enum_type,P1Enum,NUMVERTICES,&vertexlids[0],&grad_list[0]);
1134 
1135 }/*}}}*/

◆ ControlToVectors()

void Tria::ControlToVectors ( Vector< IssmPDouble > *  vector_control,
Vector< IssmPDouble > *  vector_gradient,
int  control_enum 
)
virtual

Implements Element.

Definition at line 1136 of file Tria.cpp.

1136  {/*{{{*/
1137 
1138  int sidlist[NUMVERTICES];
1139  int lidlist[NUMVERTICES];
1140  int connectivity[NUMVERTICES];
1141  IssmPDouble values[NUMVERTICES];
1142  IssmPDouble gradients[NUMVERTICES];
1143  IssmDouble value,gradient;
1144 
1145  this->GetVerticesConnectivityList(&connectivity[0]);
1146  this->GetVerticesSidList(&sidlist[0]);
1147  this->GetVerticesLidList(&lidlist[0]);
1148 
1149  ElementInput2* control_value = this->inputs2->GetControlInput2Data(control_enum,"value"); _assert_(control_value);
1150  ElementInput2* control_gradient = this->inputs2->GetControlInput2Data(control_enum,"gradient"); _assert_(control_gradient);
1151  control_value->Serve(NUMVERTICES,&lidlist[0]);
1152  control_gradient->Serve(NUMVERTICES,&lidlist[0]);
1153 
1154  GaussTria* gauss=new GaussTria();
1155  for (int iv=0;iv<NUMVERTICES;iv++){
1156  gauss->GaussVertex(iv);
1157 
1158  control_value->GetInputValue(&value,gauss);
1159  control_gradient->GetInputValue(&gradient,gauss);
1160 
1161  values[iv] = reCast<IssmPDouble>(value)/reCast<IssmPDouble>(connectivity[iv]);
1162  gradients[iv] = reCast<IssmPDouble>(gradient)/reCast<IssmPDouble>(connectivity[iv]);
1163  }
1164  delete gauss;
1165 
1166  vector_control->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
1167  vector_gradient->SetValues(NUMVERTICES,&sidlist[0],&gradients[0],ADD_VAL);
1168 
1169 }/*}}}*/

◆ CreateDistanceInputFromSegmentlist()

void Tria::CreateDistanceInputFromSegmentlist ( IssmDouble distances,
int  distanceenum 
)
virtual

Reimplemented from Element.

Definition at line 1170 of file Tria.cpp.

1170  {/*{{{*/
1171 
1172  /*Get current field and vertex coordinates*/
1173  IssmDouble ls[NUMVERTICES],distance;
1174  Element::GetInputListOnVertices(&ls[0],distanceenum);
1175 
1176  /*Get distance from list of segments and reset ls*/
1177  for(int j=0;j<NUMVERTICES;j++){
1178  distance=distances[this->vertices[j]->Lid()];
1179  if(xIsNan<IssmDouble>(distance)) _error_("NaN found in vector");
1180  if(xIsInf<IssmDouble>(distance)) _error_("Inf found in vector");
1181 
1182  /*FIXME: do we really need this?*/
1183  if(distanceenum==MaskIceLevelsetEnum) if(distance>10000) distance=10000;
1184  if(ls[j]>0){
1185  ls[j] = distance;
1186  }
1187  else{
1188  ls[j] = - distance;
1189  }
1190  }
1191 
1192  /*Update Levelset*/
1193  this->AddInput2(distanceenum,&ls[0],P1Enum);
1194 }

◆ EdgeOnBaseIndex()

int Tria::EdgeOnBaseIndex ( void  )

Definition at line 1196 of file Tria.cpp.

1196  {/*{{{*/
1197 
1198  IssmDouble values[NUMVERTICES];
1199  int indices[3][2] = {{1,2},{2,0},{0,1}};
1200 
1201  /*Retrieve all inputs and parameters*/
1203 
1204  for(int i=0;i<3;i++){
1205  if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){
1206  return i;
1207  }
1208  }
1209 
1210  _printf_("list of vertices on bed: "<<values[0]<<" "<<values[1]<<" "<<values[2]);
1211  _error_("Could not find 2 vertices on bed");
1212 }

◆ EdgeOnBaseIndices()

void Tria::EdgeOnBaseIndices ( int *  pindex1,
int *  pindex 
)

Definition at line 1214 of file Tria.cpp.

1214  {/*{{{*/
1215 
1216  IssmDouble values[NUMVERTICES];
1217  int indices[3][2] = {{1,2},{2,0},{0,1}};
1218 
1219  /*Retrieve all inputs and parameters*/
1221 
1222  for(int i=0;i<3;i++){
1223  if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){
1224  *pindex1 = indices[i][0];
1225  *pindex2 = indices[i][1];
1226  return;
1227  }
1228  }
1229 
1230  _printf_("list of vertices on bed: "<<values[0]<<" "<<values[1]<<" "<<values[2]);
1231  _error_("Could not find 2 vertices on bed");
1232 }

◆ EdgeOnSurfaceIndex()

int Tria::EdgeOnSurfaceIndex ( void  )

Definition at line 1234 of file Tria.cpp.

1234  {/*{{{*/
1235 
1236  IssmDouble values[NUMVERTICES];
1237  int indices[3][2] = {{1,2},{2,0},{0,1}};
1238 
1239  /*Retrieve all inputs and parameters*/
1241 
1242  for(int i=0;i<3;i++){
1243  if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){
1244  return i;
1245  }
1246  }
1247 
1248  _printf_("list of vertices on surface: "<<values[0]<<" "<<values[1]<<" "<<values[2]);
1249  _error_("Could not find 2 vertices on surface");
1250 }

◆ EdgeOnSurfaceIndices()

void Tria::EdgeOnSurfaceIndices ( int *  pindex1,
int *  pindex 
)

Definition at line 1252 of file Tria.cpp.

1252  {/*{{{*/
1253 
1254  IssmDouble values[NUMVERTICES];
1255  int indices[3][2] = {{1,2},{2,0},{0,1}};
1256 
1257  /*Retrieve all inputs and parameters*/
1259 
1260  for(int i=0;i<3;i++){
1261  if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1.){
1262  *pindex1 = indices[i][0];
1263  *pindex2 = indices[i][1];
1264  return;
1265  }
1266  }
1267 
1268  _printf_("list of vertices on surface: "<<values[0]<<" "<<values[1]<<" "<<values[2]);
1269  _error_("Could not find 2 vertices on surface");
1270 }

◆ ElementResponse()

void Tria::ElementResponse ( IssmDouble presponse,
int  response_enum 
)
virtual

Implements Element.

Definition at line 1272 of file Tria.cpp.

1272  {/*{{{*/
1273 
1274  switch(response_enum){
1276  *presponse=this->material->GetBbar(NULL);
1277  break;
1278 
1279  case VelEnum:{
1280 
1281  /*Get input:*/
1282  IssmDouble vel;
1283  Input2* vel_input=this->GetInput2(VelEnum); _assert_(vel_input);
1284  vel_input->GetInputAverage(&vel);
1285 
1286  /*Assign output pointers:*/
1287  *presponse=vel;}
1288  break;
1289  default:
1290  _error_("Response type " << EnumToStringx(response_enum) << " not supported yet!");
1291  }
1292 
1293 }

◆ ElementSizes()

void Tria::ElementSizes ( IssmDouble hx,
IssmDouble hy,
IssmDouble hz 
)
virtual

Implements Element.

Definition at line 1295 of file Tria.cpp.

1295  {/*{{{*/
1296 
1297  IssmDouble xyz_list[NUMVERTICES][3];
1298  IssmDouble xmin,ymin;
1299  IssmDouble xmax,ymax;
1300 
1301  /*Get xyz list: */
1303  xmin=xyz_list[0][0]; xmax=xyz_list[0][0];
1304  ymin=xyz_list[0][1]; ymax=xyz_list[0][1];
1305 
1306  for(int i=1;i<NUMVERTICES;i++){
1307  if(xyz_list[i][0]<xmin) xmin=xyz_list[i][0];
1308  if(xyz_list[i][0]>xmax) xmax=xyz_list[i][0];
1309  if(xyz_list[i][1]<ymin) ymin=xyz_list[i][1];
1310  if(xyz_list[i][1]>ymax) ymax=xyz_list[i][1];
1311  }
1312 
1313  *hx=xmax-xmin;
1314  *hy=ymax-ymin;
1315  *hz=0.;
1316 }

◆ FiniteElement()

int Tria::FiniteElement ( void  )
virtual

Implements Element.

Definition at line 1318 of file Tria.cpp.

1318  {/*{{{*/
1319  return this->element_type;
1320 }

◆ FloatingArea()

IssmDouble Tria::FloatingArea ( bool  scaled)
virtual

Implements Element.

Definition at line 1322 of file Tria.cpp.

1322  {/*{{{*/
1323 
1324  /*Intermediaries*/
1325  int domaintype;
1326  IssmDouble phi,scalefactor,floatingarea;
1327  IssmDouble *xyz_list = NULL;
1328 
1329  if(!IsIceInElement())return 0.;
1330 
1331  /*Get problem dimension*/
1332  this->FindParam(&domaintype,DomainTypeEnum);
1333  if(domaintype!=Domain2DhorizontalEnum && domaintype!=Domain3DEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
1334 
1335  this->GetVerticesCoordinates(&xyz_list);
1336  phi=this->GetGroundedPortion(xyz_list);
1337  floatingarea=(1-phi)*this->GetArea();
1338  if(scaled==true){
1339  Input2* scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
1340  scalefactor_input->GetInputAverage(&scalefactor);
1341  floatingarea=floatingarea*scalefactor;
1342  }
1343 
1344  /*Clean up and return*/
1345  xDelete<IssmDouble>(xyz_list);
1346  return floatingarea;
1347 }

◆ FSContactMigration()

void Tria::FSContactMigration ( Vector< IssmDouble > *  vertex_sigmann,
Vector< IssmDouble > *  vertex_waterpressure 
)
virtual

Implements Element.

Definition at line 1349 of file Tria.cpp.

1349  {/*{{{*/
1350 
1351  if(!IsOnBase()) return;
1352 
1353  int approximation;
1354  this->GetInput2Value(&approximation,ApproximationEnum);
1355 
1356  if(approximation==HOApproximationEnum || approximation==SSAApproximationEnum || approximation==SSAHOApproximationEnum){
1357  _error_(" contact contiditon only works for FS elements");
1358  }
1359  /*Intermediaries*/
1360  IssmDouble* xyz_list = NULL;
1361  IssmDouble bed_normal[2],base[NUMVERTICES],bed[NUMVERTICES],surface[NUMVERTICES],phi[NUMVERTICES];
1362  IssmDouble water_pressure[NUMVERTICES],pressureice[NUMVERTICES],pressure[NUMVERTICES];
1363  IssmDouble sigmaxx[NUMVERTICES],sigmayy[NUMVERTICES],sigmaxy[NUMVERTICES],sigma_nn[NUMVERTICES];
1364  IssmDouble viscosity,epsilon[NUMVERTICES];
1372  IssmDouble gravity = FindParam(ConstantsGEnum);
1373 
1374  /* Get node coordinates and dof list: */
1375  GetVerticesCoordinates(&xyz_list);
1376  /*Retrieve all inputs we will be needing: */
1377  Input2* vx_input = this->GetInput2(VxEnum); _assert_(vx_input);
1378  Input2* vy_input = this->GetInput2(VyEnum); _assert_(vy_input);
1379 
1380  /*1. Recover stresses at the base*/
1381  GaussTria* gauss=new GaussTria();
1382  for (int iv=0;iv<NUMVERTICES;iv++){
1383  gauss->GaussVertex(iv);
1384 
1385  /*Compute strain rate viscosity and pressure: */
1386  this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
1387  this->material->ViscosityFS(&viscosity,2,xyz_list,gauss,vx_input,vy_input,NULL);
1388  /*FIXME: this is for Hongju only*/
1389  // pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
1390  // if (pressure[iv]/pressureice[iv]>1) pressure[iv]=pressureice[iv];
1391 
1392  /*Compute Stress*/
1393  sigmaxx[iv]=2*viscosity*epsilon[0]-pressure[iv];
1394  sigmayy[iv]=2*viscosity*epsilon[1]-pressure[iv];
1395  sigmaxy[iv]=2*viscosity*epsilon[2];
1396  }
1397 
1398  /*2. compute contact condition*/
1399  for(int i=0;i<NUMVERTICES;i++){
1400  /*If was grounded*/
1401  if (phi[i]>=0.){
1402  NormalBase(&bed_normal[0],xyz_list);
1403  sigma_nn[i]=-1*(sigmaxx[i]*bed_normal[0]*bed_normal[0] + sigmayy[i]*bed_normal[1]*bed_normal[1]+2*sigmaxy[i]*bed_normal[0]*bed_normal[1]);
1404  water_pressure[i]=-gravity*rho_water*base[i];
1405  vertex_sigmann->SetValue(vertices[i]->Pid(),sigma_nn[i],ADD_VAL);
1406  vertex_waterpressure->SetValue(vertices[i]->Pid(),water_pressure[i],ADD_VAL);
1407  }
1408  /*If was floating*/
1409  else{
1410  /*Tricky part:
1411  * 1. if base is now touching, we put 1 for sigma_nn and leave water pressure at 0 so that the rest of the module will reground this vertex
1412  * 2. if base is still above bed, water pressure is set as 1, sigma_nn is left as 0, so the GL module will keep it afloat*/
1413  if(base[i]<bed[i]) vertex_sigmann->SetValue(vertices[i]->Pid(),+1.,ADD_VAL);
1414  vertex_waterpressure->SetValue(vertices[i]->Pid(),+1.,ADD_VAL);
1415  }
1416  }
1417 
1418  /*clean up*/
1419  delete gauss;
1420  xDelete<IssmDouble>(xyz_list);
1421 }

◆ GetBasalElement()

Element* Tria::GetBasalElement ( void  )
inlinevirtual

Implements Element.

Definition at line 80 of file Tria.h.

80 {_error_("not implemented yet");};

◆ GetLevelsetPositivePart()

void Tria::GetLevelsetPositivePart ( int *  point1,
IssmDouble fraction1,
IssmDouble fraction2,
bool *  mainlynegative,
IssmDouble levelsetvalues 
)
virtual

Implements Element.

Definition at line 2315 of file Tria.cpp.

2315  {/*{{{*/
2316 
2317  /*Computeportion of the element that has a positive levelset*/
2318 
2319  bool negative=true;
2320  int point=0;
2321  const IssmPDouble epsilon= 1.e-15;
2322  IssmDouble f1,f2;
2323 
2324  /*Be sure that values are not zero*/
2325  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
2326  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
2327  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
2328 
2329  /*Check that not all nodes are positive or negative*/
2330  if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All positive
2331  point=0;
2332  f1=1.;
2333  f2=1.;
2334  }
2335  else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All negative
2336  point=0;
2337  f1=0.;
2338  f2=0.;
2339  }
2340  else{
2341  if(gl[0]*gl[1]*gl[2]<0) negative=false;
2342 
2343  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
2344  point=2;
2345  f1=gl[2]/(gl[2]-gl[0]);
2346  f2=gl[2]/(gl[2]-gl[1]);
2347  }
2348  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
2349  point=0;
2350  f1=gl[0]/(gl[0]-gl[1]);
2351  f2=gl[0]/(gl[0]-gl[2]);
2352  }
2353  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
2354  point=1;
2355  f1=gl[1]/(gl[1]-gl[2]);
2356  f2=gl[1]/(gl[1]-gl[0]);
2357  }
2358  else{
2359  _error_("This case should NOT be happening");
2360  }
2361  }
2362  *point1=point;
2363  *fraction1=f1;
2364  *fraction2=f2;
2365  *mainlynegative=negative;
2366 }

◆ GetGroundedPart()

void Tria::GetGroundedPart ( int *  point1,
IssmDouble fraction1,
IssmDouble fraction2,
bool *  mainlyfloating 
)
virtual

Implements Element.

Definition at line 1565 of file Tria.cpp.

1565  {/*{{{*/
1566  /*Computeportion of the element that is grounded*/
1567 
1568  bool floating=true;
1569  int point;
1570  const IssmPDouble epsilon= 1.e-15;
1571  IssmDouble gl[NUMVERTICES];
1572  IssmDouble f1,f2;
1573 
1574  /*Recover parameters and values*/
1576 
1577  /*Be sure that values are not zero*/
1578  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
1579  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
1580  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
1581 
1582  /*Check that not all nodes are grounded or floating*/
1583  if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
1584  point=0;
1585  f1=1.;
1586  f2=1.;
1587  }
1588  else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All floating
1589  point=0;
1590  f1=0.;
1591  f2=0.;
1592  }
1593  else{
1594  if(gl[0]*gl[1]*gl[2]<0) floating=false;
1595 
1596  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
1597  point=2;
1598  f1=gl[2]/(gl[2]-gl[0]);
1599  f2=gl[2]/(gl[2]-gl[1]);
1600  }
1601  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
1602  point=0;
1603  f1=gl[0]/(gl[0]-gl[1]);
1604  f2=gl[0]/(gl[0]-gl[2]);
1605  }
1606  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
1607  point=1;
1608  f1=gl[1]/(gl[1]-gl[2]);
1609  f2=gl[1]/(gl[1]-gl[0]);
1610  }
1611  else _error_("case not possible");
1612  }
1613  *point1=point;
1614  *fraction1=f1;
1615  *fraction2=f2;
1616  *mainlyfloating=floating;
1617 }

◆ GetGroundedPortion()

IssmDouble Tria::GetGroundedPortion ( IssmDouble xyz_list)
virtual

Implements Element.

Definition at line 1619 of file Tria.cpp.

1619  {/*{{{*/
1620  /*Computeportion of the element that is grounded*/
1621 
1622  bool mainlyfloating = true;
1623  int domaintype,index1,index2;
1624  const IssmPDouble epsilon = 1.e-15;
1625  IssmDouble phi,s1,s2,area_init,area_grounded;
1626  IssmDouble gl[NUMVERTICES];
1627  IssmDouble xyz_bis[3][3];
1628 
1629  /*Recover parameters and values*/
1630  parameters->FindParam(&domaintype,DomainTypeEnum);
1632 
1633  /*Be sure that values are not zero*/
1634  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
1635  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
1636  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
1637 
1638  if(domaintype==Domain2DverticalEnum){
1639  this->EdgeOnBaseIndices(&index1,&index2);
1640  if(gl[index1]>0 && gl[index2]>0) phi=1; // All grounded
1641  else if(gl[index1]<0 && gl[index2]<0) phi=0; // All floating
1642  else if(gl[index1]<0 && gl[index2]>0){ //index2 grounded
1643  phi=1./(1.-gl[index1]/gl[index2]);
1644  }
1645  else if(gl[index2]<0 && gl[index1]>0){ //index1 grounded
1646  phi=1./(1.-gl[index2]/gl[index1]);
1647  }
1648 
1649  }
1650  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
1651  /*Check that not all nodes are grounded or floating*/
1652  if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
1653  phi=1;
1654  }
1655  else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All floating
1656  phi=0;
1657  }
1658  else{
1659  /*Figure out if two nodes are floating or grounded*/
1660  if(gl[0]*gl[1]*gl[2]>0) mainlyfloating=false;
1661 
1662  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
1663  /*Coordinates of point 2: same as initial point 2*/
1664  xyz_bis[2][0]=xyz_list[3*2+0];
1665  xyz_bis[2][1]=xyz_list[3*2+1];
1666  xyz_bis[2][2]=xyz_list[3*2+2];
1667 
1668  /*Portion of the segments*/
1669  s1=gl[2]/(gl[2]-gl[1]);
1670  s2=gl[2]/(gl[2]-gl[0]);
1671 
1672  /*New point 1*/
1673  xyz_bis[1][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
1674  xyz_bis[1][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
1675  xyz_bis[1][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
1676 
1677  /*New point 0*/
1678  xyz_bis[0][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
1679  xyz_bis[0][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
1680  xyz_bis[0][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
1681  }
1682  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
1683  /*Coordinates of point 0: same as initial point 2*/
1684  xyz_bis[0][0]=xyz_list[3*0+0];
1685  xyz_bis[0][1]=xyz_list[3*0+1];
1686  xyz_bis[0][2]=xyz_list[3*0+2];
1687 
1688  /*Portion of the segments*/
1689  s1=gl[0]/(gl[0]-gl[1]);
1690  s2=gl[0]/(gl[0]-gl[2]);
1691 
1692  /*New point 1*/
1693  xyz_bis[1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
1694  xyz_bis[1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
1695  xyz_bis[1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
1696 
1697  /*New point 2*/
1698  xyz_bis[2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
1699  xyz_bis[2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
1700  xyz_bis[2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
1701  }
1702  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
1703  /*Coordinates of point 1: same as initial point 2*/
1704  xyz_bis[1][0]=xyz_list[3*1+0];
1705  xyz_bis[1][1]=xyz_list[3*1+1];
1706  xyz_bis[1][2]=xyz_list[3*1+2];
1707 
1708  /*Portion of the segments*/
1709  s1=gl[1]/(gl[1]-gl[0]);
1710  s2=gl[1]/(gl[1]-gl[2]);
1711 
1712  /*New point 0*/
1713  xyz_bis[0][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
1714  xyz_bis[0][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
1715  xyz_bis[0][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
1716 
1717  /*New point 2*/
1718  xyz_bis[2][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
1719  xyz_bis[2][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
1720  xyz_bis[2][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
1721  }
1722  else _error_("case not possible");
1723 
1724  /*Compute fraction of grounded element*/
1725  if(domaintype==Domain3DsurfaceEnum){ //hack, need to be implemented in a Tria 3D
1726  GetJacobianDeterminant3D(&area_init, xyz_list,NULL);
1727  GetJacobianDeterminant3D(&area_grounded, &xyz_bis[0][0],NULL);
1728  }
1729  else{
1730  GetJacobianDeterminant(&area_init, xyz_list,NULL);
1731  GetJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
1732  }
1733  if(mainlyfloating==true) area_grounded=area_init-area_grounded;
1734  phi=area_grounded/area_init;
1735  }
1736  }
1737  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
1738 
1739  if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
1740 
1741  return phi;
1742 }

◆ GetIcefrontArea()

IssmDouble Tria::GetIcefrontArea ( )
virtual

Reimplemented from Element.

Definition at line 1744 of file Tria.cpp.

1744  {/*{{{*/
1745 
1746  IssmDouble bed[NUMVERTICES]; //basinId[NUMVERTICES];
1747  IssmDouble Haverage,frontarea;
1748  IssmDouble x1,y1,x2,y2,distance;
1749  IssmDouble lsf[NUMVERTICES], Haux[NUMVERTICES], surfaces[NUMVERTICES], bases[NUMVERTICES];
1750  int* indices=NULL;
1751  IssmDouble* H=NULL;;
1752  int nrfrontbed,numiceverts;
1753 
1754  if(!IsZeroLevelset(MaskIceLevelsetEnum)) return 0;
1755 
1756  /*Retrieve all inputs and parameters*/
1761 
1762  nrfrontbed=0;
1763  for(int i=0;i<NUMVERTICES;i++){
1764  /*Find if bed<0*/
1765  if(bed[i]<0.) nrfrontbed++;
1766  }
1767 
1768  if(nrfrontbed==3){
1769  /*2. Find coordinates of where levelset crosses 0*/
1770  int numiceverts;
1771  IssmDouble s[2],x[2],y[2];
1772  this->GetLevelsetIntersection(&indices, &numiceverts,&s[0],MaskIceLevelsetEnum,0.);
1773  _assert_(numiceverts);
1774 
1775  /*3 Write coordinates*/
1776  IssmDouble xyz_list[NUMVERTICES][3];
1777  ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
1778  int counter = 0;
1779  if((numiceverts>0) && (numiceverts<NUMVERTICES)){
1780  for(int i=0;i<numiceverts;i++){
1781  for(int n=numiceverts;n<NUMVERTICES;n++){ // iterate over no-ice vertices
1782  x[counter] = xyz_list[indices[i]][0]+s[counter]*(xyz_list[indices[n]][0]-xyz_list[indices[i]][0]);
1783  y[counter] = xyz_list[indices[i]][1]+s[counter]*(xyz_list[indices[n]][1]-xyz_list[indices[i]][1]);
1784  counter++;
1785  }
1786  }
1787  }
1788  else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge
1789 
1790  for(int i=0;i<NUMVERTICES;i++){
1791  if(lsf[indices[i]]==0.){
1792  x[counter]=xyz_list[indices[i]][0];
1793  y[counter]=xyz_list[indices[i]][1];
1794  counter++;
1795  }
1796  if(counter==2) break;
1797  }
1798  if(counter==1){
1799  /*We actually have only 1 vertex on levelset, write a single point as a segment*/
1800  x[counter]=x[0];
1801  y[counter]=y[0];
1802  counter++;
1803  }
1804  }
1805  else{
1806  _error_("not sure what's going on here...");
1807  }
1808  x1=x[0]; y1=y[0]; x2=x[1]; y2=y[1];
1809  distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
1810 
1811  int numthk=numiceverts+2;
1812  H=xNew<IssmDouble>(numthk);
1813  for(int iv=0;iv<NUMVERTICES;iv++) Haux[iv]=-bed[indices[iv]]; //sort bed in ice/noice
1814 
1815  switch(numiceverts){
1816  case 1: // average over triangle
1817  H[0]=Haux[0];
1818  H[1]=Haux[0]+s[0]*(Haux[1]-Haux[0]);
1819  H[2]=Haux[0]+s[1]*(Haux[2]-Haux[0]);
1820  Haverage=(H[1]+H[2])/2;
1821  break;
1822  case 2: // average over quadrangle
1823  H[0]=Haux[0];
1824  H[1]=Haux[1];
1825  H[2]=Haux[0]+s[0]*(Haux[2]-Haux[0]);
1826  H[3]=Haux[1]+s[1]*(Haux[2]-Haux[1]);
1827  Haverage=(H[2]+H[3])/2;
1828  break;
1829  default:
1830  _error_("Number of ice covered vertices wrong in Tria::GetIceFrontArea(void)");
1831  break;
1832  }
1833  frontarea=distance*Haverage;
1834  }
1835  else return 0;
1836 
1837  xDelete<int>(indices);
1838  xDelete<IssmDouble>(H);
1839 
1840  _assert_(frontarea>0);
1841  return frontarea;
1842 }

◆ GetIcefrontCoordinates()

void Tria::GetIcefrontCoordinates ( IssmDouble **  pxyz_front,
IssmDouble xyz_list,
int  levelsetenum 
)
virtual

Implements Element.

Definition at line 1844 of file Tria.cpp.

1844  {/*{{{*/
1845 
1846  /* Intermediaries */
1847  IssmDouble levelset[NUMVERTICES];
1848  int indicesfront[NUMVERTICES];
1849 
1850  /*Recover parameters and values*/
1851  Element::GetInputListOnVertices(&levelset[0],levelsetenum);
1852 
1853  /* Get nodes where there is no ice */
1854  int num_frontnodes=0;
1855  for(int i=0;i<NUMVERTICES;i++){
1856  if(levelset[i]>=0.){
1857  indicesfront[num_frontnodes]=i;
1858  num_frontnodes++;
1859  }
1860  }
1861  _assert_(num_frontnodes==2);
1862 
1863  /* arrange order of frontnodes such that they are oriented counterclockwise */
1864  if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=NUMVERTICES-1){
1865  int index=indicesfront[0];
1866  indicesfront[0]=indicesfront[1];
1867  indicesfront[1]=index;
1868  }
1869 
1870  IssmDouble* xyz_front = xNew<IssmDouble>(3*2);
1871  /* Return nodes */
1872  for(int i=0;i<2;i++){
1873  for(int j=0;j<3;j++){
1874  xyz_front[3*i+j]=xyz_list[3*indicesfront[i]+j];
1875  }
1876  }
1877 
1878  *pxyz_front=xyz_front;
1879 }/*}}}*/

◆ GetInputListOnVertices()

void Tria::GetInputListOnVertices ( IssmDouble pvalue,
Input2 input,
IssmDouble  default_value 
)
virtual

Implements Element.

Definition at line 1934 of file Tria.cpp.

1934  {/*{{{*/
1935 
1936  /*Checks in debugging mode*/
1937  _assert_(pvalue);
1938 
1939  /* Start looping on the number of vertices: */
1940  if(input){
1941  GaussTria gauss;
1942  for(int iv=0;iv<NUMVERTICES;iv++){
1943  gauss.GaussVertex(iv);
1944  input->GetInputValue(&pvalue[iv],&gauss);
1945  }
1946  }
1947  else{
1948  for(int iv=0;iv<NUMVERTICES;iv++) pvalue[iv] = default_value;
1949  }
1950 }

◆ GetInputListOnNodes()

void Tria::GetInputListOnNodes ( IssmDouble pvalue,
Input2 input,
IssmDouble  default_value 
)
virtual

Implements Element.

Definition at line 1952 of file Tria.cpp.

1952  {/*{{{*/
1953 
1954  /*Checks in debugging mode*/
1955  _assert_(pvalue);
1956 
1957  /*What type of finite element are we dealing with?*/
1958  int fe = this->FiniteElement();
1959  int numnodes = this->GetNumberOfNodes();
1960 
1961  /* Start looping on the number of vertices: */
1962  if(input){
1963  GaussTria gauss;
1964  for(int iv=0;iv<numnodes;iv++){
1965  gauss.GaussNode(fe,iv);
1966  input->GetInputValue(&pvalue[iv],&gauss);
1967  }
1968  }
1969  else{
1970  for(int iv=0;iv<numnodes;iv++) pvalue[iv] = default_value;
1971  }
1972 }

◆ GetLevelCoordinates()

void Tria::GetLevelCoordinates ( IssmDouble **  pxyz_front,
IssmDouble xyz_list,
int  levelsetenum,
IssmDouble  level 
)
virtual

Implements Element.

Definition at line 2200 of file Tria.cpp.

2200  {/*{{{*/
2201 
2202  /* Intermediaries */
2203  int i, dir,nrfrontnodes;
2204  IssmDouble levelset[NUMVERTICES];
2205  int indicesfront[NUMVERTICES];
2206 
2207  /*Recover parameters and values*/
2208  Element::GetInputListOnVertices(&levelset[0],levelsetenum);
2209 
2210  /* Get nodes where there is no ice */
2211  nrfrontnodes=0;
2212  for(i=0;i<NUMVERTICES;i++){
2213  if(levelset[i]==level){
2214  indicesfront[nrfrontnodes]=i;
2215  nrfrontnodes++;
2216  }
2217  }
2218 
2219  _assert_(nrfrontnodes==2);
2220 
2221  /* arrange order of frontnodes such that they are oriented counterclockwise */
2222  if((NUMVERTICES+indicesfront[0]-indicesfront[1])%NUMVERTICES!=NUMVERTICES-1){
2223  int index=indicesfront[0];
2224  indicesfront[0]=indicesfront[1];
2225  indicesfront[1]=index;
2226  }
2227 
2228  IssmDouble* xyz_front = xNew<IssmDouble>(3*nrfrontnodes);
2229  /* Return nodes */
2230  for(i=0;i<nrfrontnodes;i++){
2231  for(dir=0;dir<3;dir++){
2232  xyz_front[3*i+dir]=xyz_list[3*indicesfront[i]+dir];
2233  }
2234  }
2235 
2236  *pxyz_front=xyz_front;
2237 
2238 }/*}}}*/

◆ GetVertexIndex()

int Tria::GetVertexIndex ( Vertex vertex)
virtual

Reimplemented from Element.

Definition at line 2368 of file Tria.cpp.

2368  {/*{{{*/
2369  _assert_(vertices);
2370  for(int i=0;i<NUMVERTICES;i++){
2371  if(vertex==vertices[i])
2372  return i;
2373  }
2374  _error_("Vertex provided not found among element vertices");
2375 }

◆ GetNumberOfNodes() [1/2]

int Tria::GetNumberOfNodes ( void  )
virtual

Implements Element.

Definition at line 2377 of file Tria.cpp.

2377  {/*{{{*/
2378  if (this->nodes) return this->NumberofNodes(this->element_type);
2379  else return 0;
2380 }

◆ GetNumberOfNodes() [2/2]

int Tria::GetNumberOfNodes ( int  enum_type)
virtual

Implements Element.

Definition at line 2382 of file Tria.cpp.

2382  {/*{{{*/
2383  return this->NumberofNodes(enum_type);
2384 }

◆ GetNumberOfVertices()

int Tria::GetNumberOfVertices ( void  )
virtual

Implements Element.

Definition at line 2386 of file Tria.cpp.

2386  {/*{{{*/
2387  return NUMVERTICES;
2388 }

◆ GetVectorFromControlInputs() [1/2]

void Tria::GetVectorFromControlInputs ( Vector< IssmDouble > *  gradient,
int  control_enum,
int  control_index,
const char *  data,
int  offset 
)
virtual

Create list of indices and values for global vector‍/

Implements Element.

Definition at line 2434 of file Tria.cpp.

2434  {/*{{{*/
2435 
2436  /*Get input*/
2437  ElementInput2* input=this->inputs2->GetControlInput2Data(control_enum,data); _assert_(input);
2438 
2439  /*Lid list once for all*/
2440  int lidlist[NUMVERTICES];
2441  for(int i=0;i<NUMVERTICES;i++) lidlist[i] = vertices[i]->lid;
2442 
2443  /*Check what input we are dealing with*/
2444  switch(input->ObjectEnum()){
2445  case TriaInput2Enum:
2446  {
2447  IssmDouble values[NUMVERTICES];
2448  int idlist[NUMVERTICES];
2449 
2450  TriaInput2* triainput = xDynamicCast<TriaInput2*>(input);
2451  if(triainput->GetInputInterpolationType()!=P1Enum) _error_("not supported yet");
2452  input->Serve(NUMVERTICES,&lidlist[0]);
2453 
2454  /*Create list of indices and values for global vector*/
2455  GradientIndexing(&idlist[0],control_index);
2456  for(int i=0;i<NUMVERTICES;i++) values[i] = triainput->element_values[i];
2457  vector->SetValues(NUMVERTICES,idlist,values,INS_VAL);
2458  break;
2459  }
2460 
2461  case TransientInputEnum:
2462  {
2463  TransientInput2* transientinput = xDynamicCast<TransientInput2*>(input);
2464  int N = transientinput->numtimesteps;
2465  int* M=NULL;
2467  int* idlist = xNew<int>(NUMVERTICES*N);
2468  IssmDouble* values = xNew<IssmDouble>(NUMVERTICES*N);
2469  for(int t=0;t<transientinput->numtimesteps;t++) {
2470  IssmDouble time = transientinput->GetTimeByOffset(t);
2471  _error_("not implemented");
2472  //TriaInput* timeinput = xDynamicCast<TriaInput*>(transientinput->GetTimeInput(time));
2473  //if(timeinput->interpolation_type!=P1Enum) _error_("not supported yet");
2474  //input->Serve(NUMVERTICES,&lidlist[0]);
2476  //for(int i=0;i<NUMVERTICES;i++){
2477  // idlist[N*i+t] = offset + this->vertices[i]->Sid()+t*M[control_index];
2478  // values[N*i+t] = timeinput->values[i];
2479  //}
2480  }
2481  vector->SetValues(NUMVERTICES*transientinput->numtimesteps,idlist,values,INS_VAL);
2482  xDelete<int>(M);
2483  xDelete<int>(idlist);
2484  xDelete<IssmDouble>(values);
2485  break;
2486  }
2487  default: _error_("input "<<EnumToStringx(input->ObjectEnum())<<" not supported yet");
2488  }
2489 }

◆ GetVectorFromControlInputs() [2/2]

void Tria::GetVectorFromControlInputs ( Vector< IssmDouble > *  gradient,
int  control_enum,
int  control_index,
const char *  data 
)
virtual

Implements Element.

Definition at line 2390 of file Tria.cpp.

2390  {/*{{{*/
2391 
2392  /*Get out if this is not an element input*/
2393  if(!IsInputEnum(control_enum)) _error_("Enum "<<EnumToStringx(control_enum)<<" is not in IsInput");
2394 
2395  /*Prepare index list*/
2396  int idlist[NUMVERTICES];
2397  GradientIndexing(&idlist[0],control_index);
2398 
2399  /*Get input (either in element or material)*/
2400  ElementInput2* input=this->inputs2->GetControlInput2Data(control_enum,data); _assert_(input);
2401 
2402  /*Intermediaries*/
2403  int numindices;
2404  int indices[NUMVERTICES];
2405 
2406  /*Check interpolation*/
2407  int interpolation = input->GetInterpolation();
2408  switch(interpolation){
2409  case P1Enum:
2410  numindices = NUMVERTICES;
2411  for(int i=0;i<NUMVERTICES;i++) indices[i] = vertices[i]->lid;
2412  input->Serve(numindices,&indices[0]);
2413  break;
2414  default: _error_("interpolation "<<EnumToStringx(interpolation)<<" not supported");
2415  }
2416 
2417  /*Flag as collapsed for later use*/
2418  if(this->iscollapsed){
2419  xDynamicCast<PentaInput2*>(input)->SetServeCollapsed(true);
2420  }
2421 
2422  /* Start looping on the number of vertices: */
2423  IssmDouble values[NUMVERTICES];
2424  Gauss*gauss=this->NewGauss();
2425  for(int iv=0;iv<NUMVERTICES;iv++){
2426  gauss->GaussVertex(iv);
2427  input->GetInputValue(&values[iv],gauss);
2428  }
2429  delete gauss;
2430 
2431  vector->SetValues(NUMVERTICES,idlist,&values[0],INS_VAL);
2432 }

◆ GetVerticesCoordinatesBase()

void Tria::GetVerticesCoordinatesBase ( IssmDouble **  pxyz_list)
virtual

Implements Element.

Definition at line 2491 of file Tria.cpp.

2491  {/*{{{*/
2492 
2493  int indices[2];
2494  IssmDouble xyz_list[NUMVERTICES][3];
2495 
2496  /*Element XYZ list*/
2497  ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
2498 
2499  /*Allocate Output*/
2500  IssmDouble* xyz_list_edge = xNew<IssmDouble>(2*3);
2501  this->EdgeOnBaseIndices(&indices[0],&indices[1]);
2502  for(int i=0;i<2;i++) for(int j=0;j<2;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
2503 
2504  /*Assign output pointer*/
2505  *pxyz_list = xyz_list_edge;
2506 
2507 }/*}}}*/

◆ GetVerticesCoordinatesTop()

void Tria::GetVerticesCoordinatesTop ( IssmDouble **  pxyz_list)
virtual

Implements Element.

Definition at line 2508 of file Tria.cpp.

2508  {/*{{{*/
2509 
2510  int indices[2];
2511  IssmDouble xyz_list[NUMVERTICES][3];
2512 
2513  /*Element XYZ list*/
2514  ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
2515 
2516  /*Allocate Output*/
2517  IssmDouble* xyz_list_edge = xNew<IssmDouble>(2*3);
2518  this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
2519  for(int i=0;i<2;i++) for(int j=0;j<2;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
2520 
2521  /*Assign output pointer*/
2522  *pxyz_list = xyz_list_edge;
2523 
2524 }/*}}}*/

◆ GroundedArea()

IssmDouble Tria::GroundedArea ( bool  scaled)
virtual

Implements Element.

Definition at line 2525 of file Tria.cpp.

2525  {/*{{{*/
2526 
2527  /*Intermediaries*/
2528  int domaintype;
2529  IssmDouble phi,scalefactor,groundedarea;
2530  IssmDouble *xyz_list = NULL;
2531 
2532  if(!IsIceInElement())return 0.;
2533 
2534  /*Get problem dimension*/
2535  this->FindParam(&domaintype,DomainTypeEnum);
2536  if(domaintype!=Domain2DhorizontalEnum && domaintype!=Domain3DEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
2537 
2538  this->GetVerticesCoordinates(&xyz_list);
2539  phi=this->GetGroundedPortion(xyz_list);
2540  groundedarea=phi*this->GetArea();
2541  if(scaled==true){
2542  Input2* scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
2543  scalefactor_input->GetInputAverage(&scalefactor);
2544  groundedarea=groundedarea*scalefactor;
2545  }
2546 
2547  /*Clean up and return*/
2548  xDelete<IssmDouble>(xyz_list);
2549  return groundedarea;
2550 }

◆ HasEdgeOnBase()

bool Tria::HasEdgeOnBase ( )

Definition at line 2552 of file Tria.cpp.

2552  {/*{{{*/
2553 
2554  IssmDouble values[NUMVERTICES];
2555  IssmDouble sum;
2556 
2557  /*Retrieve all inputs and parameters*/
2559  sum = values[0]+values[1]+values[2];
2560 
2561  _assert_(sum==0. || sum==1. || sum==2.);
2562 
2563  if(sum==3.) _error_("Two edges on bed not supported yet...");
2564 
2565  if(sum>1.){
2566  return true;
2567  }
2568  else{
2569  return false;
2570  }
2571 }

◆ HasEdgeOnSurface()

bool Tria::HasEdgeOnSurface ( )

Definition at line 2573 of file Tria.cpp.

2573  {/*{{{*/
2574 
2575  IssmDouble values[NUMVERTICES];
2576  IssmDouble sum;
2577 
2578  /*Retrieve all inputs and parameters*/
2580  sum = values[0]+values[1]+values[2];
2581 
2582  _assert_(sum==0. || sum==1. || sum==2.);
2583 
2584  if(sum==3.) _error_("Two edges on surface not supported yet...");
2585 
2586  if(sum>1.){
2587  return true;
2588  }
2589  else{
2590  return false;
2591  }
2592 }

◆ IceVolume()

IssmDouble Tria::IceVolume ( bool  scaled)
virtual

Implements Element.

Definition at line 2906 of file Tria.cpp.

2906  {/*{{{*/
2907 
2908  /*The volume of a truncated prism is area_base * 1/numedges sum(length of edges)*/
2909 
2910  /*Intermediaries*/
2911  int i, numiceverts;
2912  IssmDouble area_base,surface,base,Haverage,scalefactor;
2913  IssmDouble Haux[NUMVERTICES], surfaces[NUMVERTICES], bases[NUMVERTICES];
2914  IssmDouble SFaux[NUMVERTICES], scalefactors[NUMVERTICES];
2915  IssmDouble s[2]; // s:fraction of intersected triangle edges, that lies inside ice
2916  int* indices=NULL;
2917  IssmDouble* H=NULL;
2918  IssmDouble* SF=NULL;
2919 
2920  if(!IsIceInElement())return 0.;
2921 
2922  int domaintype;
2923  parameters->FindParam(&domaintype,DomainTypeEnum);
2924 
2925  if(false && IsIcefront()){
2926  //Assumption: linear ice thickness profile on element.
2927  //Hence ice thickness at intersection of levelset function with triangle edge is linear interpolation of ice thickness at vertices.
2928  this->GetLevelsetIntersection(&indices, &numiceverts, s, MaskIceLevelsetEnum, 0.);
2929  int numthk=numiceverts+2;
2930  H=xNew<IssmDouble>(numthk);
2931  //Correct area distortion caused by projection if requestion
2932  area_base=this->GetAreaIce();
2933  if(scaled==true){
2935  for(i=0;i<NUMVERTICES;i++) SFaux[i]= scalefactors[indices[i]]; //sort thicknesses in ice/noice
2936  switch(numiceverts){
2937  case 1: // average over triangle
2938  SF[0]=SFaux[0];
2939  SF[1]=SFaux[0]+s[0]*(SFaux[1]-SFaux[0]);
2940  SF[2]=SFaux[0]+s[1]*(SFaux[2]-SFaux[0]);
2941  break;
2942  case 2: // average over quadrangle
2943  SF[0]=SFaux[0];
2944  SF[1]=SFaux[1];
2945  SF[2]=SFaux[0]+s[0]*(SFaux[2]-SFaux[0]);
2946  SF[3]=SFaux[1]+s[1]*(SFaux[2]-SFaux[1]);
2947  break;
2948  default:
2949  _error_("Number of ice covered vertices wrong in Tria::IceVolume()");
2950  break;
2951  }
2952  scalefactor=0.;
2953  for(i=0;i<numthk;i++) scalefactor+=SF[i];
2954  scalefactor/=IssmDouble(numthk);
2955  area_base=area_base*scalefactor;
2956  }
2959  for(i=0;i<NUMVERTICES;i++) Haux[i]= surfaces[indices[i]]-bases[indices[i]]; //sort thicknesses in ice/noice
2960  switch(numiceverts){
2961  case 1: // average over triangle
2962  H[0]=Haux[0];
2963  H[1]=Haux[0]+s[0]*(Haux[1]-Haux[0]);
2964  H[2]=Haux[0]+s[1]*(Haux[2]-Haux[0]);
2965  break;
2966  case 2: // average over quadrangle
2967  H[0]=Haux[0];
2968  H[1]=Haux[1];
2969  H[2]=Haux[0]+s[0]*(Haux[2]-Haux[0]);
2970  H[3]=Haux[1]+s[1]*(Haux[2]-Haux[1]);
2971  break;
2972  default:
2973  _error_("Number of ice covered vertices wrong in Tria::IceVolume()");
2974  break;
2975  }
2976  Haverage=0.;
2977  for(i=0;i<numthk;i++) Haverage+=H[i];
2978  Haverage/=IssmDouble(numthk);
2979  }
2980  else{
2981  /*First get back the area of the base*/
2982  area_base=this->GetArea();
2983  if(scaled==true){
2984  Input2* scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
2985  scalefactor_input->GetInputAverage(&scalefactor);
2986  area_base=area_base*scalefactor;
2987  }
2988 
2989  /*Now get the average height*/
2990  Input2* surface_input = this->GetInput2(SurfaceEnum); _assert_(surface_input);
2991  Input2* base_input = this->GetInput2(BaseEnum); _assert_(base_input);
2992  surface_input->GetInputAverage(&surface);
2993  base_input->GetInputAverage(&base);
2994  Haverage=surface-base;
2995  }
2996 
2997  /*Cleanup & return: */
2998  xDelete<int>(indices);
2999  xDelete<IssmDouble>(H);
3000  xDelete<IssmDouble>(SF);
3001 
3002  if(domaintype==Domain2DverticalEnum){
3003  return area_base;
3004  }
3005  else{
3006  return area_base*Haverage;
3007  }
3008 }

◆ IceVolumeAboveFloatation()

IssmDouble Tria::IceVolumeAboveFloatation ( bool  scaled)
virtual

Implements Element.

Definition at line 3010 of file Tria.cpp.

3010  {/*{{{*/
3011 
3012  /*The volume above floatation: H + rho_water/rho_ice * bathymetry */
3013  IssmDouble rho_ice,rho_water;
3014  IssmDouble base,surface,bed,bathymetry,scalefactor;
3015  IssmDouble xyz_list[NUMVERTICES][3];
3016 
3017  if(!IsIceInElement() || IsFloating())return 0;
3018 
3019  rho_ice=FindParam(MaterialsRhoIceEnum);
3022 
3023  /*First calculate the area of the base (cross section triangle)
3024  * http://en.wikipedia.org/wiki/Triangle
3025  * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/
3026  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]));
3027  if(scaled==true){
3028  Input2* scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
3029  scalefactor_input->GetInputAverage(&scalefactor);
3030  base=base*scalefactor;
3031  }
3032 
3033  /*Now get the average height and bathymetry*/
3034  Input2* surface_input = this->GetInput2(SurfaceEnum); _assert_(surface_input);
3035  Input2* base_input = this->GetInput2(BaseEnum); _assert_(base_input);
3036  Input2* bed_input = this->GetInput2(BedEnum); _assert_(bed_input);
3037  if(!bed_input) _error_("Could not find bed");
3038  surface_input->GetInputAverage(&surface);
3039  base_input->GetInputAverage(&bed);
3040  bed_input->GetInputAverage(&bathymetry);
3041 
3042  /*Return: */
3043  return base*(surface-bed+min(rho_water/rho_ice*bathymetry,0.));
3044 }

◆ IcefrontMassFlux()

IssmDouble Tria::IcefrontMassFlux ( bool  scaled)
virtual

Reimplemented from Element.

Definition at line 2594 of file Tria.cpp.

2594  {/*{{{*/
2595 
2596  /*Make sure there is an ice front here*/
2597  if(!IsIceInElement() || !IsIcefront()) return 0;
2598 
2599  /*Scaled not implemented yet...*/
2600  _assert_(!scaled);
2601 
2602  /*Get domain type*/
2603  int domaintype;
2604  parameters->FindParam(&domaintype,DomainTypeEnum);
2605 
2606  /*Get ice front coordinates*/
2607  IssmDouble *xyz_list = NULL;
2608  IssmDouble* xyz_front = NULL;
2609  this->GetVerticesCoordinates(&xyz_list);
2610  this->GetIcefrontCoordinates(&xyz_front,xyz_list,MaskIceLevelsetEnum);
2611 
2612  /*Get normal vector*/
2613  IssmDouble normal[3];
2614  this->NormalSection(&normal[0],xyz_front);
2615  //normal[0] = -normal[0];
2616  //normal[1] = -normal[1];
2617 
2618  /*Get inputs*/
2619  IssmDouble flux = 0.;
2620  IssmDouble vx,vy,thickness,Jdet;
2622  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
2623  Input2* vx_input=NULL;
2624  Input2* vy_input=NULL;
2625  if(domaintype==Domain2DhorizontalEnum){
2626  vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
2627  vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
2628  }
2629  else{
2630  vx_input=this->GetInput2(VxAverageEnum); _assert_(vx_input);
2631  vy_input=this->GetInput2(VyAverageEnum); _assert_(vy_input);
2632  }
2633 
2634  /*Start looping on Gaussian points*/
2635  Gauss* gauss=this->NewGauss(xyz_list,xyz_front,3);
2636  for(int ig=gauss->begin();ig<gauss->end();ig++){
2637 
2638  gauss->GaussPoint(ig);
2639  thickness_input->GetInputValue(&thickness,gauss);
2640  vx_input->GetInputValue(&vx,gauss);
2641  vy_input->GetInputValue(&vy,gauss);
2642  this->JacobianDeterminantSurface(&Jdet,xyz_front,gauss);
2643 
2644  flux += rho_ice*Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1]);
2645  }
2646  delete gauss;
2647  return flux;
2648 }

◆ IcefrontMassFluxLevelset()

IssmDouble Tria::IcefrontMassFluxLevelset ( bool  scaled)
virtual

Reimplemented from Element.

Definition at line 2650 of file Tria.cpp.

2650  {/*{{{*/
2651 
2652  /*Make sure there is an ice front here*/
2653  if(!IsIceInElement() || !IsZeroLevelset(MaskIceLevelsetEnum)) return 0;
2654 
2655  /*Scaled not implemented yet...*/
2656  _assert_(!scaled);
2657 
2658  int domaintype,index1,index2;
2659  const IssmPDouble epsilon = 1.e-15;
2660  IssmDouble s1,s2;
2661  IssmDouble gl[NUMVERTICES];
2662  IssmDouble xyz_front[2][3];
2663 
2664 
2665  IssmDouble *xyz_list = NULL;
2666  this->GetVerticesCoordinates(&xyz_list);
2667 
2668  /*Recover parameters and values*/
2669  parameters->FindParam(&domaintype,DomainTypeEnum);
2671 
2672  /*Be sure that values are not zero*/
2673  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
2674  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
2675  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
2676 
2677  if(domaintype==Domain2DverticalEnum){
2678  _error_("not implemented");
2679  }
2680  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
2681  int pt1 = 0;
2682  int pt2 = 1;
2683  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
2684 
2685  /*Portion of the segments*/
2686  s1=gl[2]/(gl[2]-gl[1]);
2687  s2=gl[2]/(gl[2]-gl[0]);
2688  if(gl[2]<0.){
2689  pt1 = 1; pt2 = 0;
2690  }
2691  xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
2692  xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
2693  xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
2694  xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
2695  xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
2696  xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
2697  }
2698  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
2699 
2700  /*Portion of the segments*/
2701  s1=gl[0]/(gl[0]-gl[1]);
2702  s2=gl[0]/(gl[0]-gl[2]);
2703  if(gl[0]<0.){
2704  pt1 = 1; pt2 = 0;
2705  }
2706 
2707  xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
2708  xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
2709  xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
2710  xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
2711  xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
2712  xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
2713  }
2714  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
2715 
2716  /*Portion of the segments*/
2717  s1=gl[1]/(gl[1]-gl[0]);
2718  s2=gl[1]/(gl[1]-gl[2]);
2719  if(gl[1]<0.){
2720  pt1 = 1; pt2 = 0;
2721  }
2722 
2723  xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
2724  xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
2725  xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
2726  xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
2727  xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
2728  xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
2729  }
2730  else{
2731  _error_("case not possible");
2732  }
2733 
2734  }
2735  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
2736 
2737  /*Some checks in debugging mode*/
2738  _assert_(s1>=0 && s1<=1.);
2739  _assert_(s2>=0 && s2<=1.);
2740 
2741  /*Get normal vector*/
2742  IssmDouble normal[3];
2743  this->NormalSection(&normal[0],&xyz_front[0][0]);
2744  normal[0] = -normal[0];
2745  normal[1] = -normal[1];
2746 
2747  /*Get inputs*/
2748  IssmDouble flux = 0.;
2749  IssmDouble vx,vy,thickness,Jdet;
2751  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
2752  Input2* vx_input=NULL;
2753  Input2* vy_input=NULL;
2754  if(domaintype==Domain2DhorizontalEnum){
2755  vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
2756  vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
2757  }
2758  else{
2759  vx_input=this->GetInput2(VxAverageEnum); _assert_(vx_input);
2760  vy_input=this->GetInput2(VyAverageEnum); _assert_(vy_input);
2761  }
2762 
2763  /*Start looping on Gaussian points*/
2764  Gauss* gauss=this->NewGauss(xyz_list,&xyz_front[0][0],3);
2765  for(int ig=gauss->begin();ig<gauss->end();ig++){
2766 
2767  gauss->GaussPoint(ig);
2768  thickness_input->GetInputValue(&thickness,gauss);
2769  vx_input->GetInputValue(&vx,gauss);
2770  vy_input->GetInputValue(&vy,gauss);
2771  this->JacobianDeterminantSurface(&Jdet,&xyz_front[0][0],gauss);
2772 
2773  flux += rho_ice*Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1]);
2774  }
2775  delete gauss;
2776  return flux;
2777 }

◆ GroundinglineMassFlux()

IssmDouble Tria::GroundinglineMassFlux ( bool  scaled)
virtual

Reimplemented from Element.

Definition at line 2779 of file Tria.cpp.

2779  {/*{{{*/
2780 
2781  /*Make sure there is a grounding line here*/
2782  if(!IsIceInElement()) return 0;
2783  if(!IsZeroLevelset(MaskOceanLevelsetEnum)) return 0;
2784 
2785  /*Scaled not implemented yet...*/
2786  _assert_(!scaled);
2787 
2788  int domaintype,index1,index2;
2789  const IssmPDouble epsilon = 1.e-15;
2790  IssmDouble s1,s2;
2791  IssmDouble gl[NUMVERTICES];
2792  IssmDouble xyz_front[2][3];
2793 
2794  IssmDouble *xyz_list = NULL;
2795  this->GetVerticesCoordinates(&xyz_list);
2796 
2797  /*Recover parameters and values*/
2798  parameters->FindParam(&domaintype,DomainTypeEnum);
2800 
2801  /*Be sure that values are not zero*/
2802  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
2803  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
2804  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
2805 
2806  if(domaintype==Domain2DverticalEnum){
2807  _error_("not implemented");
2808  }
2809  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
2810  int pt1 = 0;
2811  int pt2 = 1;
2812  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
2813 
2814  /*Portion of the segments*/
2815  s1=gl[2]/(gl[2]-gl[1]);
2816  s2=gl[2]/(gl[2]-gl[0]);
2817  if(gl[2]<0.){
2818  pt1 = 1; pt2 = 0;
2819  }
2820  xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
2821  xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
2822  xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
2823  xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
2824  xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
2825  xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
2826  }
2827  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
2828 
2829  /*Portion of the segments*/
2830  s1=gl[0]/(gl[0]-gl[1]);
2831  s2=gl[0]/(gl[0]-gl[2]);
2832  if(gl[0]<0.){
2833  pt1 = 1; pt2 = 0;
2834  }
2835 
2836  xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
2837  xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
2838  xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
2839  xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
2840  xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
2841  xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
2842  }
2843  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
2844 
2845  /*Portion of the segments*/
2846  s1=gl[1]/(gl[1]-gl[0]);
2847  s2=gl[1]/(gl[1]-gl[2]);
2848  if(gl[1]<0.){
2849  pt1 = 1; pt2 = 0;
2850  }
2851 
2852  xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
2853  xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
2854  xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
2855  xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
2856  xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
2857  xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
2858  }
2859  else{
2860  _error_("case not possible");
2861  }
2862 
2863  }
2864  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
2865 
2866  /*Some checks in debugging mode*/
2867  _assert_(s1>=0 && s1<=1.);
2868  _assert_(s2>=0 && s2<=1.);
2869 
2870  /*Get normal vector*/
2871  IssmDouble normal[3];
2872  this->NormalSection(&normal[0],&xyz_front[0][0]);
2873 
2874  /*Get inputs*/
2875  IssmDouble flux = 0.;
2876  IssmDouble vx,vy,thickness,Jdet;
2878  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
2879  Input2* vx_input=NULL;
2880  Input2* vy_input=NULL;
2881  if(domaintype==Domain2DhorizontalEnum){
2882  vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
2883  vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
2884  }
2885  else{
2886  vx_input=this->GetInput2(VxAverageEnum); _assert_(vx_input);
2887  vy_input=this->GetInput2(VyAverageEnum); _assert_(vy_input);
2888  }
2889 
2890  /*Start looping on Gaussian points*/
2891  Gauss* gauss=this->NewGauss(xyz_list,&xyz_front[0][0],3);
2892  for(int ig=gauss->begin();ig<gauss->end();ig++){
2893 
2894  gauss->GaussPoint(ig);
2895  thickness_input->GetInputValue(&thickness,gauss);
2896  vx_input->GetInputValue(&vx,gauss);
2897  vy_input->GetInputValue(&vy,gauss);
2898  this->JacobianDeterminantSurface(&Jdet,&xyz_front[0][0],gauss);
2899 
2900  flux += rho_ice*Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1]);
2901  }
2902 
2903  return flux;
2904 }

◆ InputDepthAverageAtBase()

void Tria::InputDepthAverageAtBase ( int  enum_type,
int  average_enum_type 
)
virtual

Implements Element.

Definition at line 3046 of file Tria.cpp.

3046  {/*{{{*/
3047 
3048  /*New input*/
3049  Input2* oldinput=NULL;
3050  Input2* newinput=NULL;
3051 
3052  /*copy input of enum_type*/
3053  oldinput=this->GetInput2(enum_type);
3054  if(!oldinput)_error_("could not find old input with enum: " << EnumToStringx(enum_type));
3055  newinput=oldinput->copy();
3056 
3057  /*Assign new name (average)*/
3058  newinput->ChangeEnum(average_enum_type);
3059 
3060  /*Add new input to current element*/
3061  _error_("not implemented");
3062 }

◆ InputExtrude()

void Tria::InputExtrude ( int  enum_type,
int  start 
)
inlinevirtual

Implements Element.

Definition at line 106 of file Tria.h.

106 {_error_("not implemented"); /*For penta only*/};

◆ ControlInputExtrude()

void Tria::ControlInputExtrude ( int  enum_type,
int  start 
)
inline

Definition at line 107 of file Tria.h.

107 {/*For penta only*/};

◆ IsFaceOnBoundary()

bool Tria::IsFaceOnBoundary ( void  )
virtual

Implements Element.

Definition at line 3219 of file Tria.cpp.

3219  {/*{{{*/
3220 
3221  IssmDouble values[NUMVERTICES];
3222  IssmDouble sum;
3223 
3224  /*Retrieve all inputs and parameters*/
3226  sum = values[0]+values[1]+values[2];
3227 
3228  _assert_(sum==0. || sum==1. || sum==2.);
3229 
3230  if(sum==3.) _error_("Two edges on boundary not supported yet...");
3231 
3232  if(sum>1.){
3233  return true;
3234  }
3235  else{
3236  return false;
3237  }
3238 }/*}}}*/

◆ IsIcefront()

bool Tria::IsIcefront ( void  )
virtual

Implements Element.

Definition at line 3239 of file Tria.cpp.

3239  {/*{{{*/
3240 
3241  bool isicefront;
3242  int i,nrice;
3243  IssmDouble ls[NUMVERTICES];
3244 
3245  /*Retrieve all inputs and parameters*/
3247 
3248  /* If only one vertex has ice, there is an ice front here */
3249  isicefront=false;
3250  if(IsIceInElement()){
3251  nrice=0;
3252  for(i=0;i<NUMVERTICES;i++)
3253  if(ls[i]<0.) nrice++;
3254  if(nrice==1) isicefront= true;
3255  }
3256  return isicefront;
3257 }/*}}}*/

◆ IsNodeOnShelfFromFlags()

bool Tria::IsNodeOnShelfFromFlags ( IssmDouble flags)
virtual

Implements Element.

Definition at line 3258 of file Tria.cpp.

3258  {/*{{{*/
3259 
3260  int i;
3261  bool shelf=false;
3262 
3263  for(i=0;i<NUMVERTICES;i++){
3264  if (flags[vertices[i]->Pid()]<0.){
3265  shelf=true;
3266  break;
3267  }
3268  }
3269  return shelf;
3270 }

◆ IsZeroLevelset()

bool Tria::IsZeroLevelset ( int  levelset_enum)
virtual

Implements Element.

Definition at line 3272 of file Tria.cpp.

3272  {/*{{{*/
3273 
3274  bool iszerols;
3275  IssmDouble ls[NUMVERTICES];
3276 
3277  /*Retrieve all inputs and parameters*/
3278  Element::GetInputListOnVertices(&ls[0],levelset_enum);
3279 
3280  /*If the level set is awlays <0, there is no ice front here*/
3281  iszerols= false;
3282  if(IsIceInElement()){
3283  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.)){
3284  iszerols = true;
3285  }
3286  }
3287 
3288  return iszerols;
3289 }

◆ Masscon()

IssmDouble Tria::Masscon ( IssmDouble levelset)
virtual

Implements Element.

Definition at line 3319 of file Tria.cpp.

3319  { /*{{{*/
3320 
3321  /*intermediary: */
3322  IssmDouble* values=NULL;
3323  Input2* thickness_input=NULL;
3324  IssmDouble thickness;
3325  IssmDouble weight;
3326  IssmDouble Jdet;
3327  IssmDouble volume;
3328  IssmDouble rho_ice;
3329  IssmDouble* xyz_list=NULL;
3330  int point1;
3331  IssmDouble fraction1,fraction2;
3332  bool mainlynegative=true;
3333 
3334  /*Output:*/
3335  volume=0;
3336 
3337  /* Get node coordinates and dof list: */
3338  GetVerticesCoordinates(&xyz_list);
3339 
3340  /*Retrieve inputs required:*/
3341  thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
3342 
3343  /*Retrieve material parameters: */
3344  rho_ice=FindParam(MaterialsRhoIceEnum);
3345 
3346  /*Retrieve values of the levelset defining the masscon: */
3347  values = xNew<IssmDouble>(NUMVERTICES);
3348  for(int i=0;i<NUMVERTICES;i++){
3349  values[i]=levelset[this->vertices[i]->Sid()];
3350  }
3351 
3352  /*Ok, use the level set values to figure out where we put our gaussian points:*/
3353  this->GetLevelsetPositivePart(&point1,&fraction1,&fraction2,&mainlynegative,values);
3354  Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlynegative,4);
3355 
3356  volume=0;
3357 
3358  for(int ig=gauss->begin();ig<gauss->end();ig++){
3359  gauss->GaussPoint(ig);
3360 
3361  this->JacobianDeterminant(&Jdet,xyz_list,gauss);
3362  thickness_input->GetInputValue(&thickness, gauss);
3363 
3364  volume+=thickness*gauss->weight*Jdet;
3365  }
3366 
3367  /* clean up and Return: */
3368  xDelete<IssmDouble>(xyz_list);
3369  xDelete<IssmDouble>(values);
3370  delete gauss;
3371  return rho_ice*volume;
3372 }

◆ MassFlux() [1/2]

IssmDouble Tria::MassFlux ( IssmDouble segment)
virtual

Implements Element.

Definition at line 3433 of file Tria.cpp.

3433  {/*{{{*/
3434  return this->MassFlux(segment[0],segment[1],segment[2],segment[3],reCast<int>(segment[4]));
3435 }

◆ MassFlux() [2/2]

IssmDouble Tria::MassFlux ( IssmDouble  x1,
IssmDouble  y1,
IssmDouble  x2,
IssmDouble  y2,
int  segment_id 
)
virtual

Implements Element.

Definition at line 3374 of file Tria.cpp.

3374  {/*{{{*/
3375 
3376  int domaintype;
3377  IssmDouble mass_flux=0.;
3378  IssmDouble xyz_list[NUMVERTICES][3];
3379  IssmDouble vx1,vx2,vy1,vy2,h1,h2;
3380 
3381  /*Get material parameters :*/
3383 
3384  /*First off, check that this segment belongs to this element: */
3385  if (segment_id!=this->id)_error_("error message: segment with id " << segment_id << " does not belong to element with id:" << this->id);
3386 
3387  /*Get xyz list: */
3389 
3390  /*get area coordinates of 0 and 1 locations: */
3391  GaussTria* gauss_1=new GaussTria();
3392  gauss_1->GaussFromCoords(x1,y1,&xyz_list[0][0]);
3393  GaussTria* gauss_2=new GaussTria();
3394  gauss_2->GaussFromCoords(x2,y2,&xyz_list[0][0]);
3395 
3396  /*Get segment length and normal (needs to be properly oriented)*/
3397  IssmDouble nx=cos(atan2(x1-x2,y2-y1));
3398  IssmDouble ny=sin(atan2(x1-x2,y2-y1));
3399  IssmDouble length=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
3400 
3401  /*Get velocity and thickness*/
3402  this->parameters->FindParam(&domaintype,DomainTypeEnum);
3403  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
3404  Input2* vx_input=NULL;
3405  Input2* vy_input=NULL;
3406  if(domaintype==Domain2DhorizontalEnum){
3407  vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
3408  vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
3409  }
3410  else{
3411  vx_input=this->GetInput2(VxAverageEnum); _assert_(vx_input);
3412  vy_input=this->GetInput2(VyAverageEnum); _assert_(vy_input);
3413  }
3414 
3415  thickness_input->GetInputValue(&h1, gauss_1);
3416  thickness_input->GetInputValue(&h2, gauss_2);
3417  vx_input->GetInputValue(&vx1,gauss_1);
3418  vx_input->GetInputValue(&vx2,gauss_2);
3419  vy_input->GetInputValue(&vy1,gauss_1);
3420  vy_input->GetInputValue(&vy2,gauss_2);
3421 
3422  mass_flux= rho_ice*length*(
3423  (1./3.*(h1-h2)*(vx1-vx2)+0.5*h2*(vx1-vx2)+0.5*(h1-h2)*vx2+h2*vx2)*nx+
3424  (1./3.*(h1-h2)*(vy1-vy2)+0.5*h2*(vy1-vy2)+0.5*(h1-h2)*vy2+h2*vy2)*ny
3425  );
3426 
3427  /*clean up and return:*/
3428  delete gauss_1;
3429  delete gauss_2;
3430  return mass_flux;
3431 }

◆ MaterialUpdateFromTemperature()

void Tria::MaterialUpdateFromTemperature ( void  )
inline

Definition at line 115 of file Tria.h.

115 {_error_("not implemented yet");};

◆ Misfit()

IssmDouble Tria::Misfit ( int  modelenum,
int  observationenum,
int  weightsenum 
)
virtual

Implements Element.

Definition at line 3437 of file Tria.cpp.

3437  {/*{{{*/
3438 
3439  /*Intermediaries*/
3440  IssmDouble model,observation,weight;
3441  IssmDouble Jdet;
3442  IssmDouble Jelem = 0;
3443  IssmDouble xyz_list[NUMVERTICES][3];
3444  GaussTria *gauss = NULL;
3445 
3446  /*If on water, return 0: */
3447  if(!IsIceInElement())return 0;
3448 
3449  /*Retrieve all inputs we will be needing: */
3451  Input2* model_input=this->GetInput2(modelenum); _assert_(model_input);
3452  Input2* observation_input=this->GetInput2(observationenum);_assert_(observation_input);
3453  Input2* weights_input =this->GetInput2(weightsenum); _assert_(weights_input);
3454 
3455  /* Start looping on the number of gaussian points: */
3456  gauss=new GaussTria(2);
3457  for(int ig=gauss->begin();ig<gauss->end();ig++){
3458 
3459  gauss->GaussPoint(ig);
3460 
3461  /* Get Jacobian determinant: */
3462  GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
3463 
3464  /*Get parameters at gauss point*/
3465  model_input->GetInputValue(&model,gauss);
3466  observation_input->GetInputValue(&observation,gauss);
3467  weights_input->GetInputValue(&weight,gauss);
3468 
3469  /*compute misfit between model and observation */
3470  Jelem+=0.5*(model-observation)*(model-observation)*Jdet*weight*gauss->weight;
3471  }
3472 
3473  /* clean up and Return: */
3474  delete gauss;
3475  return Jelem;
3476 }

◆ MisfitArea()

IssmDouble Tria::MisfitArea ( int  weightsenum)
virtual

Implements Element.

Definition at line 3478 of file Tria.cpp.

3478  {/*{{{*/
3479 
3480  /*Intermediaries*/
3481  IssmDouble weight;
3482  IssmDouble Jdet;
3483  IssmDouble Jelem = 0;
3484  IssmDouble xyz_list[NUMVERTICES][3];
3485  GaussTria *gauss = NULL;
3486 
3487  /*If on water, return 0: */
3488  if(!IsIceInElement())return 0;
3489 
3490  /*Retrieve all inputs we will be needing: */
3492  Input2* weights_input =this->GetInput2(weightsenum); _assert_(weights_input);
3493 
3494  /* Start looping on the number of gaussian points: */
3495  gauss=new GaussTria(2);
3496  for(int ig=gauss->begin();ig<gauss->end();ig++){
3497 
3498  gauss->GaussPoint(ig);
3499 
3500  /* Get Jacobian determinant: */
3501  GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
3502 
3503  /*Get parameters at gauss point*/
3504  weights_input->GetInputValue(&weight,gauss);
3505 
3506  /*compute misfit between model and observation */
3507  Jelem+=Jdet*weight*gauss->weight;
3508  }
3509 
3510  /* clean up and Return: */
3511  delete gauss;
3512  return Jelem;
3513 }

◆ NodalValue()

int Tria::NodalValue ( IssmDouble pvalue,
int  index,
int  natureofdataenum 
)
virtual

Implements Element.

Definition at line 3624 of file Tria.cpp.

3624  {/*{{{*/
3625 
3626  int found = 0;
3627  IssmDouble value;
3628  GaussTria *gauss = NULL;
3629 
3630  /*First, serarch the input: */
3631  Input2* data=this->GetInput2(natureofdataenum);
3632 
3633  /*figure out if we have the vertex id: */
3634  found=0;
3635  for(int i=0;i<NUMVERTICES;i++){
3636  if(index==vertices[i]->Sid()){
3637  /*Do we have natureofdataenum in our inputs? :*/
3638  if(data){
3639  /*ok, we are good. retrieve value of input at vertex :*/
3640  gauss=new GaussTria(); gauss->GaussVertex(i);
3641  data->GetInputValue(&value,gauss);
3642  found=1;
3643  break;
3644  }
3645  }
3646  }
3647 
3648  /*clean-up*/
3649  delete gauss;
3650 
3651  if(found)*pvalue=value;
3652  return found;
3653 }

◆ NumberofNodesPressure()

int Tria::NumberofNodesPressure ( void  )
virtual

Implements Element.

Definition at line 3710 of file Tria.cpp.

3710  {/*{{{*/
3712 }

◆ NumberofNodesVelocity()

int Tria::NumberofNodesVelocity ( void  )
virtual

Implements Element.

Definition at line 3714 of file Tria.cpp.

3714  {/*{{{*/
3716 }

◆ PotentialUngrounding()

void Tria::PotentialUngrounding ( Vector< IssmDouble > *  potential_sheet_ungrounding)
virtual

Implements Element.

Definition at line 3718 of file Tria.cpp.

3718  {/*{{{*/
3719 
3721  IssmDouble bed_hydro;
3722  IssmDouble rho_water,rho_ice,density;
3723 
3724  /*material parameters: */
3726  rho_ice=FindParam(MaterialsRhoIceEnum);
3727  density=rho_ice/rho_water;
3731 
3732  /*go through vertices, and figure out which ones are grounded and want to unground: */
3733  for(int i=0;i<NUMVERTICES;i++){
3734  /*Find if grounded vertices want to start floating*/
3735  if (gl[i]>0.){
3736  bed_hydro=-density*h[i];
3737  if(bed_hydro>r[i]){
3738  /*Vertex that could potentially unground, flag it*/
3739  potential_ungrounding->SetValue(vertices[i]->Pid(),1,INS_VAL);
3740  }
3741  }
3742  }
3743 }

◆ PressureInterpolation()

int Tria::PressureInterpolation ( void  )
virtual

Implements Element.

Definition at line 3745 of file Tria.cpp.

3745  {/*{{{*/
3747 }

◆ ReduceMatrices()

void Tria::ReduceMatrices ( ElementMatrix Ke,
ElementVector pe 
)
virtual

Implements Element.

Definition at line 3749 of file Tria.cpp.

3749  {/*{{{*/
3750 
3751  /*Static condensation if requested*/
3752  if(pe){
3753  if(this->element_type==MINIcondensedEnum){
3754  int indices[2]={6,7};
3755  pe->StaticCondensation(Ke,2,&indices[0]);
3756  }
3757  else if(this->element_type==P1bubblecondensedEnum){
3759  int offset = 0;
3760  for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
3761  int* indices=xNew<int>(size);
3762  for(int i=0;i<size;i++) indices[i] = offset+i;
3763  pe->StaticCondensation(Ke,size,indices);
3764  xDelete<int>(indices);
3765  }
3766  }
3767 
3768  if(Ke){
3769  if(this->element_type==MINIcondensedEnum){
3770  int indices[2]={6,7};
3771  Ke->StaticCondensation(2,&indices[0]);
3772  }
3773  else if(this->element_type==P1bubblecondensedEnum){
3775  int offset = 0;
3776  for(int i=0;i<3;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
3777  int* indices=xNew<int>(size);
3778  for(int i=0;i<size;i++) indices[i] = offset+i;
3779  Ke->StaticCondensation(size,indices);
3780  xDelete<int>(indices);
3781  }
3782  }
3783 
3784 }

◆ ResetFSBasalBoundaryCondition()

void Tria::ResetFSBasalBoundaryCondition ( void  )
virtual

Implements Element.

Definition at line 3786 of file Tria.cpp.

3786  {/*{{{*/
3787 
3788  int numnodes = this->NumberofNodesVelocity();
3789 
3790  int approximation;
3791  IssmDouble* vertexonbase= NULL;
3792  IssmDouble slope,groundedice;
3793  IssmDouble xz_plane[6];
3794 
3795  /*For FS only: we want the CS to be tangential to the bedrock*/
3796  this->GetInput2Value(&approximation,ApproximationEnum);
3797  if(!HasNodeOnBase() || approximation!=FSApproximationEnum) return;
3798 
3799  /*Get inputs*/
3800  Input2* slope_input=this->GetInput2(BedSlopeXEnum); _assert_(slope_input);
3801  Input2* groundedicelevelset_input=this->GetInput2(MaskOceanLevelsetEnum); _assert_(groundedicelevelset_input);
3802  vertexonbase = xNew<IssmDouble>(numnodes);
3803  this->GetInputListOnNodesVelocity(&vertexonbase[0],MeshVertexonbaseEnum);
3804 
3805  /*Loop over basal nodes and update their CS*/
3806  GaussTria* gauss = new GaussTria();
3807  for(int i=0;i<this->NumberofNodesVelocity();i++){
3808 
3809  if(vertexonbase[i]==1){
3810  gauss->GaussNode(this->VelocityInterpolation(),i);
3811  slope_input->GetInputValue(&slope,gauss);
3812  groundedicelevelset_input->GetInputValue(&groundedice,gauss);
3813  IssmDouble theta = atan(slope);
3814 
3815  /*New X axis New Z axis*/
3816  xz_plane[0]=cos(theta); xz_plane[3]=0.;
3817  xz_plane[1]=sin(theta); xz_plane[4]=0.;
3818  xz_plane[2]=0.; xz_plane[5]=1.;
3819 
3820  if(groundedice>=0){
3821  this->nodes[i]->DofInSSet(1); //vy
3822  }
3823  else{
3824  this->nodes[i]->DofInFSet(1); //vy
3825  }
3826 
3827  XZvectorsToCoordinateSystem(&this->nodes[i]->coord_system[0][0],&xz_plane[0]);
3828  }
3829  }
3830 
3831  /*cleanup*/
3832  xDelete<IssmDouble>(vertexonbase);
3833  delete gauss;
3834 }

◆ ResetHooks()

void Tria::ResetHooks ( )
virtual

Implements Element.

Definition at line 3836 of file Tria.cpp.

3836  {/*{{{*/
3837 
3838  if(this->nodes) xDelete<Node*>(this->nodes);
3839  this->nodes=NULL;
3840  this->vertices=NULL;
3841  this->material=NULL;
3842  this->parameters=NULL;
3843 
3844  //deal with ElementHook mother class
3845  for(int i=0;i<this->numanalyses;i++) if(this->hnodes[i]) this->hnodes[i]->reset();
3846  this->hvertices->reset();
3847  if(this->hmaterial)this->hmaterial->reset();
3848  if(this->hneighbors) this->hneighbors->reset();
3849 
3850 }

◆ ResetLevelsetFromSegmentlist()

void Tria::ResetLevelsetFromSegmentlist ( IssmDouble segments,
int  numsegments 
)

◆ RignotMeltParameterization()

void Tria::RignotMeltParameterization ( void  )
virtual

Reimplemented from Element.

Definition at line 3852 of file Tria.cpp.

3852  {/*{{{*/
3853 
3854  IssmDouble A, B, alpha, beta;
3855  IssmDouble bed,qsg,qsg_basin,TF,yts;
3856  int numbasins;
3857  IssmDouble basinid[NUMVERTICES];
3858  IssmDouble* basin_icefront_area=NULL;
3859 
3860  /* Coefficients */
3861  A = 3e-4;
3862  B = 0.15;
3863  alpha = 0.39;
3864  beta = 1.18;
3865 
3866  /*Get inputs*/
3867  Input2* bed_input = this->GetInput2(BedEnum); _assert_(bed_input);
3868  Input2* qsg_input = this->GetInput2(FrontalForcingsSubglacialDischargeEnum); _assert_(qsg_input);
3869  Input2* TF_input = this->GetInput2(FrontalForcingsThermalForcingEnum); _assert_(TF_input);
3871 
3872  this->FindParam(&yts, ConstantsYtsEnum);
3874  this->parameters->FindParam(&basin_icefront_area,&numbasins,FrontalForcingsBasinIcefrontAreaEnum);
3875 
3876  IssmDouble meltrates[NUMVERTICES]; //frontal melt-rate
3877 
3878  /* Start looping on the number of vertices: */
3879  GaussTria* gauss=new GaussTria();
3880  for(int iv=0;iv<NUMVERTICES;iv++){
3881  gauss->GaussVertex(iv);
3882 
3883  /* Get variables */
3884  bed_input->GetInputValue(&bed,gauss);
3885  qsg_input->GetInputValue(&qsg,gauss);
3886  TF_input->GetInputValue(&TF,gauss);
3887 
3888  if(basin_icefront_area[reCast<int>(basinid[iv])-1]==0.) meltrates[iv]=0.;
3889  else{
3890  /* change the unit of qsg (m^3/d -> m/d) with ice front area */
3891  qsg_basin=qsg/basin_icefront_area[reCast<int>(basinid[iv])-1];
3892 
3893  /* calculate melt rates */
3894  meltrates[iv]=((A*max(-bed,0.)*pow(max(qsg_basin,0.),alpha)+B)*pow(max(TF,0.),beta))/86400; //[m/s]
3895  }
3896 
3897  if(xIsNan<IssmDouble>(meltrates[iv])) _error_("NaN found in vector");
3898  if(xIsInf<IssmDouble>(meltrates[iv])) _error_("Inf found in vector");
3899  }
3900 
3901  /*Add input*/
3902  this->AddInput2(CalvingMeltingrateEnum,&meltrates[0],P1Enum);
3903 
3904  /*Cleanup and return*/
3905  xDelete<IssmDouble>(basin_icefront_area);
3906  delete gauss;
3907 }

◆ SetElementInput() [1/3]

void Tria::SetElementInput ( int  enum_in,
IssmDouble  values 
)
virtual

Reimplemented from Element.

Definition at line 4012 of file Tria.cpp.

4012  {/*{{{*/
4013 
4014  this->SetElementInput(this->inputs2,enum_in,value);
4015 
4016 }

◆ SetElementInput() [2/3]

void Tria::SetElementInput ( Inputs2 inputs2,
int  enum_in,
IssmDouble  values 
)
virtual

Reimplemented from Element.

Definition at line 4018 of file Tria.cpp.

4018  {/*{{{*/
4019 
4020  _assert_(inputs2);
4021  inputs2->SetTriaInput(enum_in,P0Enum,this->lid,value);
4022 
4023 }

◆ SetElementInput() [3/3]

void Tria::SetElementInput ( Inputs2 inputs2,
int  numindices,
int *  indices,
IssmDouble values,
int  enum_in 
)
virtual

Reimplemented from Element.

Definition at line 4025 of file Tria.cpp.

4025  {/*{{{*/
4026 
4027  _assert_(inputs2);
4028  inputs2->SetTriaInput(enum_in,P1Enum,numindices,indices,values);
4029 
4030 }

◆ SetControlInputsFromVector() [1/2]

void Tria::SetControlInputsFromVector ( IssmDouble vector,
int  control_enum,
int  control_index,
int  offset,
int  N,
int  M 
)
virtual

Implements Element.

Definition at line 3909 of file Tria.cpp.

3909  {/*{{{*/
3910 
3911  IssmDouble values[NUMVERTICES];
3912  int lidlist[NUMVERTICES];
3913  int idlist[NUMVERTICES],control_init;
3914 
3915  /*Get Domain type*/
3916  int domaintype;
3917  parameters->FindParam(&domaintype,DomainTypeEnum);
3918 
3919  /*Specific case for depth averaged quantities*/
3920  control_init=control_enum;
3921  if(domaintype==Domain2DverticalEnum){
3922  if(control_enum==MaterialsRheologyBbarEnum){
3923  control_enum=MaterialsRheologyBEnum;
3924  if(!IsOnBase()) return;
3925  }
3926  if(control_enum==DamageDbarEnum){
3927  control_enum=DamageDEnum;
3928  if(!IsOnBase()) return;
3929  }
3930  }
3931 
3932  /*Get out if this is not an element input*/
3933  if(!IsInputEnum(control_enum)) return;
3934 
3935  this->GetVerticesLidList(&lidlist[0]);
3936  ElementInput2* input=this->inputs2->GetControlInput2Data(control_enum,"value"); _assert_(input);
3937 
3938  /*Get values on vertices*/
3939  for(int n=0;n<N;n++){
3940  for(int i=0;i<NUMVERTICES;i++){
3941  idlist[i]=offset + this->vertices[i]->Sid()+n*M;
3942  values[i]=vector[idlist[i]];
3943  }
3944  if(input->ObjectEnum()==TriaInput2Enum){
3945  input->SetInput(P1Enum,NUMVERTICES,&lidlist[0],&values[0]);
3946  }
3947  else if(input->ObjectEnum()==TransientInput2Enum){
3948  _error_("not implemented");
3949  //Input* new_input = new TriaInput(control_enum,values,P1Enum);
3950  //controlinput->SetInput(new_input,n);
3951  //controlinput->Configure(parameters);
3952  }
3953  else _error_("Type not supported");
3954  }
3955 }

◆ SetControlInputsFromVector() [2/2]

void Tria::SetControlInputsFromVector ( IssmDouble vector,
int  control_enum,
int  control_index 
)
virtual

Implements Element.

Definition at line 3957 of file Tria.cpp.

3957  {/*{{{*/
3958 
3959  IssmDouble values[NUMVERTICES];
3960  int idlist[NUMVERTICES];
3961  int lidlist[NUMVERTICES];
3962 
3963  /*Get Domain type*/
3964  int domaintype;
3965  parameters->FindParam(&domaintype,DomainTypeEnum);
3966 
3967  /*Specific case for depth averaged quantities*/
3968  if(domaintype==Domain2DverticalEnum){
3969  if(control_enum==MaterialsRheologyBbarEnum){
3970  control_enum=MaterialsRheologyBEnum;
3971  if(!IsOnBase()) return;
3972  }
3973  if(control_enum==DamageDbarEnum){
3974  control_enum=DamageDEnum;
3975  if(!IsOnBase()) return;
3976  }
3977  }
3978 
3979  /*Get out if this is not an element input*/
3980  if(!IsInputEnum(control_enum)) return;
3981 
3982  /*prepare index list*/
3983  this->GetVerticesLidList(&lidlist[0]);
3984  GradientIndexing(&idlist[0],control_index);
3985 
3986  /*Get values on vertices*/
3987  for(int i=0;i<NUMVERTICES;i++){
3988  values[i]=vector[idlist[i]];
3989  }
3990 
3991  /*Set Input*/
3992  ElementInput2* input=this->inputs2->GetControlInput2Data(control_enum,"value"); _assert_(input);
3993  input->SetInput(P1Enum,NUMVERTICES,&lidlist[0],&values[0]);
3994 }

◆ SetCurrentConfiguration()

void Tria::SetCurrentConfiguration ( Elements elements,
Loads loads,
Nodes nodes,
Materials materials,
Parameters parameters 
)
virtual

Implements Element.

Definition at line 3996 of file Tria.cpp.

3996  {/*{{{*/
3997 
3998  /*go into parameters and get the analysis_counter: */
3999  int analysis_counter;
4000  parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
4001 
4002  /*Get Element type*/
4003  if(this->element_type_list) this->element_type=this->element_type_list[analysis_counter];
4004 
4005  /*Pick up nodes*/
4006  if(this->hnodes && this->hnodes[analysis_counter]){
4007  this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
4008  }
4009 
4010 }

◆ SpawnBasalElement()

Element * Tria::SpawnBasalElement ( void  )
virtual

Implements Element.

Definition at line 4032 of file Tria.cpp.

4032  {/*{{{*/
4033 
4034  int index1,index2;
4035  int domaintype;
4036 
4037  this->parameters->FindParam(&domaintype,DomainTypeEnum);
4038  switch(domaintype){
4040  return this;
4041  case Domain2DverticalEnum:
4043  this->EdgeOnBaseIndices(&index1,&index2);
4044  return SpawnSeg(index1,index2);
4045  default:
4046  _error_("not implemented yet");
4047  }
4048 }

◆ SpawnTopElement()

Element * Tria::SpawnTopElement ( void  )
virtual

Implements Element.

Definition at line 4082 of file Tria.cpp.

4082  {/*{{{*/
4083 
4084  int index1,index2;
4085  int domaintype;
4086 
4087  this->parameters->FindParam(&domaintype,DomainTypeEnum);
4088  switch(domaintype){
4090  return this;
4091  case Domain2DverticalEnum:
4093  this->EdgeOnSurfaceIndices(&index1,&index2);
4094  return SpawnSeg(index2,index1); //reverse order
4095  default:
4096  _error_("not implemented yet");
4097  }
4098 }

◆ StrainRateparallel()

void Tria::StrainRateparallel ( void  )
virtual

Implements Element.

Definition at line 4100 of file Tria.cpp.

4100  {/*{{{*/
4101 
4102  IssmDouble *xyz_list = NULL;
4103  IssmDouble epsilon[3];
4104  GaussTria* gauss=NULL;
4105  IssmDouble vx,vy,vel;
4106  IssmDouble strainxx;
4107  IssmDouble strainxy;
4108  IssmDouble strainyy;
4109  IssmDouble strainparallel[NUMVERTICES];
4110 
4111  /* Get node coordinates and dof list: */
4112  this->GetVerticesCoordinates(&xyz_list);
4113 
4114  /*Retrieve all inputs we will need*/
4115  Input2* vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
4116  Input2* vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
4117 
4118  /* Start looping on the number of vertices: */
4119  gauss=new GaussTria();
4120  for (int iv=0;iv<NUMVERTICES;iv++){
4121  gauss->GaussVertex(iv);
4122 
4123  /* Get the value we need*/
4124  vx_input->GetInputValue(&vx,gauss);
4125  vy_input->GetInputValue(&vy,gauss);
4126  vel=vx*vx+vy*vy;
4127 
4128  /*Compute strain rate viscosity and pressure: */
4129  this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
4130  strainxx=epsilon[0];
4131  strainyy=epsilon[1];
4132  strainxy=epsilon[2];
4133 
4134  /*strainparallel= Strain rate along the ice flow direction */
4135  strainparallel[iv]=(vx*vx*(strainxx)+vy*vy*(strainyy)+2*vy*vx*strainxy)/(vel+1.e-14);
4136  }
4137 
4138  /*Add input*/
4139  this->AddInput2(StrainRateparallelEnum,&strainparallel[0],P1DGEnum);
4140 
4141  /*Clean up and return*/
4142  delete gauss;
4143  xDelete<IssmDouble>(xyz_list);
4144 }

◆ StrainRateperpendicular()

void Tria::StrainRateperpendicular ( void  )
virtual

Implements Element.

Definition at line 4146 of file Tria.cpp.

4146  {/*{{{*/
4147 
4148  IssmDouble *xyz_list = NULL;
4149  GaussTria* gauss=NULL;
4150  IssmDouble epsilon[3];
4151  IssmDouble vx,vy,vel;
4152  IssmDouble strainxx;
4153  IssmDouble strainxy;
4154  IssmDouble strainyy;
4155  IssmDouble strainperpendicular[NUMVERTICES];
4156 
4157  /* Get node coordinates and dof list: */
4158  this->GetVerticesCoordinates(&xyz_list);
4159 
4160  /*Retrieve all inputs we will need*/
4161  Input2* vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
4162  Input2* vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
4163 
4164  /* Start looping on the number of vertices: */
4165  gauss=new GaussTria();
4166  for (int iv=0;iv<NUMVERTICES;iv++){
4167  gauss->GaussVertex(iv);
4168 
4169  /* Get the value we need*/
4170  vx_input->GetInputValue(&vx,gauss);
4171  vy_input->GetInputValue(&vy,gauss);
4172  vel=vx*vx+vy*vy;
4173 
4174  /*Compute strain rate viscosity and pressure: */
4175  this->StrainRateSSA(&epsilon[0],xyz_list,gauss,vx_input,vy_input);
4176  strainxx=epsilon[0];
4177  strainyy=epsilon[1];
4178  strainxy=epsilon[2];
4179 
4180  /*strainperpendicular= Strain rate perpendicular to the ice flow direction */
4181  strainperpendicular[iv]=(vx*vx*(strainyy)+vy*vy*(strainxx)-2*vy*vx*strainxy)/(vel+1.e-14);
4182  }
4183 
4184  /*Add input*/
4185  this->AddInput2(StrainRateperpendicularEnum,&strainperpendicular[0],P1DGEnum);
4186 
4187  /*Clean up and return*/
4188  delete gauss;
4189  xDelete<IssmDouble>(xyz_list);
4190 }

◆ StressIntensityFactor()

void Tria::StressIntensityFactor ( void  )
inlinevirtual

Implements Element.

Definition at line 138 of file Tria.h.

138 {_error_("not implemented yet");};

◆ SurfaceArea()

IssmDouble Tria::SurfaceArea ( void  )
virtual

Implements Element.

Definition at line 4192 of file Tria.cpp.

4192  {/*{{{*/
4193 
4194  IssmDouble S;
4195  IssmDouble normal[3];
4196  IssmDouble v13[3],v23[3];
4197  IssmDouble xyz_list[NUMVERTICES][3];
4198 
4199  /*If on water, return 0: */
4200  if(!IsIceInElement()) return 0.;
4201 
4203 
4204  for(int i=0;i<3;i++){
4205  v13[i]=xyz_list[0][i]-xyz_list[2][i];
4206  v23[i]=xyz_list[1][i]-xyz_list[2][i];
4207  }
4208 
4209  normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
4210  normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
4211  normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
4212 
4213  S = 0.5 * sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);
4214 
4215  /*Return: */
4216  return S;
4217 }

◆ TensorInterpolation()

int Tria::TensorInterpolation ( void  )
virtual

Implements Element.

Definition at line 4219 of file Tria.cpp.

4219  {/*{{{*/
4221 }

◆ TimeAdapt()

IssmDouble Tria::TimeAdapt ( void  )
virtual

Implements Element.

Definition at line 4223 of file Tria.cpp.

4223  {/*{{{*/
4224 
4225  /*intermediary: */
4226  IssmDouble C;
4227  IssmDouble xyz_list[NUMVERTICES][3];
4228 
4229  /*get CFL coefficient:*/
4231 
4232  /*Get for Vx and Vy, the max of abs value: */
4233  Input2* vx_input = this->GetInput2(VxEnum); _assert_(vx_input);
4234  Input2* vy_input = this->GetInput2(VyEnum); _assert_(vy_input);
4235  IssmDouble maxabsvx = vx_input->GetInputMaxAbs();
4236  IssmDouble maxabsvy = vy_input->GetInputMaxAbs();
4237 
4238  /* Get node coordinates and dof list: */
4240 
4241  IssmDouble minx=xyz_list[0][0];
4242  IssmDouble maxx=xyz_list[0][0];
4243  IssmDouble miny=xyz_list[0][1];
4244  IssmDouble maxy=xyz_list[0][1];
4245 
4246  for(int i=1;i<NUMVERTICES;i++){
4247  if(xyz_list[i][0]<minx) minx=xyz_list[i][0];
4248  if(xyz_list[i][0]>maxx) maxx=xyz_list[i][0];
4249  if(xyz_list[i][1]<miny) miny=xyz_list[i][1];
4250  if(xyz_list[i][1]>maxy) maxy=xyz_list[i][1];
4251  }
4252  IssmDouble dx=maxx-minx;
4253  IssmDouble dy=maxy-miny;
4254 
4255  /*CFL criterion: */
4256  IssmDouble dt = C/(maxabsvx/dx+maxabsvy/dy);
4257 
4258  return dt;
4259 }

◆ TotalCalvingFluxLevelset()

IssmDouble Tria::TotalCalvingFluxLevelset ( bool  scaled)
virtual

Reimplemented from Element.

Definition at line 4261 of file Tria.cpp.

4261  {/*{{{*/
4262 
4263  /*Make sure there is an ice front here*/
4264  if(!IsIceInElement() || !IsZeroLevelset(MaskIceLevelsetEnum)) return 0;
4265 
4266  /*Scaled not implemented yet...*/
4267  _assert_(!scaled);
4268 
4269  int domaintype,index1,index2;
4270  const IssmPDouble epsilon = 1.e-15;
4271  IssmDouble s1,s2;
4272  IssmDouble gl[NUMVERTICES];
4273  IssmDouble xyz_front[2][3];
4274 
4275 
4276  IssmDouble *xyz_list = NULL;
4277  this->GetVerticesCoordinates(&xyz_list);
4278 
4279  /*Recover parameters and values*/
4280  parameters->FindParam(&domaintype,DomainTypeEnum);
4282 
4283  /*Be sure that values are not zero*/
4284  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
4285  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
4286  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
4287 
4288  if(domaintype==Domain2DverticalEnum){
4289  _error_("not implemented");
4290  }
4291  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
4292  int pt1 = 0;
4293  int pt2 = 1;
4294  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
4295 
4296  /*Portion of the segments*/
4297  s1=gl[2]/(gl[2]-gl[1]);
4298  s2=gl[2]/(gl[2]-gl[0]);
4299  if(gl[2]<0.){
4300  pt1 = 1; pt2 = 0;
4301  }
4302  xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
4303  xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
4304  xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
4305  xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
4306  xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
4307  xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
4308  }
4309  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
4310 
4311  /*Portion of the segments*/
4312  s1=gl[0]/(gl[0]-gl[1]);
4313  s2=gl[0]/(gl[0]-gl[2]);
4314  if(gl[0]<0.){
4315  pt1 = 1; pt2 = 0;
4316  }
4317 
4318  xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
4319  xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
4320  xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
4321  xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
4322  xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
4323  xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
4324  }
4325  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
4326 
4327  /*Portion of the segments*/
4328  s1=gl[1]/(gl[1]-gl[0]);
4329  s2=gl[1]/(gl[1]-gl[2]);
4330  if(gl[1]<0.){
4331  pt1 = 1; pt2 = 0;
4332  }
4333 
4334  xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
4335  xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
4336  xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
4337  xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
4338  xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
4339  xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
4340  }
4341  else{
4342  _error_("case not possible");
4343  }
4344 
4345  }
4346  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
4347 
4348  /*Some checks in debugging mode*/
4349  _assert_(s1>=0 && s1<=1.);
4350  _assert_(s2>=0 && s2<=1.);
4351 
4352  /*Get normal vector*/
4353  IssmDouble normal[3];
4354  this->NormalSection(&normal[0],&xyz_front[0][0]);
4355  normal[0] = -normal[0];
4356  normal[1] = -normal[1];
4357 
4358  /*Get inputs*/
4359  IssmDouble flux = 0.;
4360  IssmDouble calvingratex,calvingratey,thickness,Jdet;
4362  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
4363  Input2* calvingratex_input=NULL;
4364  Input2* calvingratey_input=NULL;
4365  if(domaintype==Domain2DhorizontalEnum){
4366  calvingratex_input=this->GetInput2(CalvingratexEnum); _assert_(calvingratex_input);
4367  calvingratey_input=this->GetInput2(CalvingrateyEnum); _assert_(calvingratey_input);
4368  }
4369  else{
4370  calvingratex_input=this->GetInput2(CalvingratexAverageEnum); _assert_(calvingratex_input);
4371  calvingratey_input=this->GetInput2(CalvingrateyAverageEnum); _assert_(calvingratey_input);
4372  }
4373 
4374  /*Start looping on Gaussian points*/
4375  Gauss* gauss=this->NewGauss(xyz_list,&xyz_front[0][0],3);
4376  for(int ig=gauss->begin();ig<gauss->end();ig++){
4377 
4378  gauss->GaussPoint(ig);
4379  thickness_input->GetInputValue(&thickness,gauss);
4380  calvingratex_input->GetInputValue(&calvingratex,gauss);
4381  calvingratey_input->GetInputValue(&calvingratey,gauss);
4382  this->JacobianDeterminantSurface(&Jdet,&xyz_front[0][0],gauss);
4383 
4384  flux += rho_ice*Jdet*gauss->weight*thickness*(calvingratex*normal[0] + calvingratey*normal[1]);
4385  }
4386 
4387  return flux;
4388 }

◆ TotalCalvingMeltingFluxLevelset()

IssmDouble Tria::TotalCalvingMeltingFluxLevelset ( bool  scaled)
virtual

Reimplemented from Element.

Definition at line 4390 of file Tria.cpp.

4390  {/*{{{*/
4391 
4392  /*Make sure there is an ice front here*/
4393  if(!IsIceInElement() || !IsZeroLevelset(MaskIceLevelsetEnum)) return 0;
4394 
4395  /*Scaled not implemented yet...*/
4396  _assert_(!scaled);
4397 
4398  int domaintype,index1,index2;
4399  const IssmPDouble epsilon = 1.e-15;
4400  IssmDouble s1,s2;
4401  IssmDouble gl[NUMVERTICES];
4402  IssmDouble xyz_front[2][3];
4403 
4404 
4405  IssmDouble *xyz_list = NULL;
4406  this->GetVerticesCoordinates(&xyz_list);
4407 
4408  /*Recover parameters and values*/
4409  parameters->FindParam(&domaintype,DomainTypeEnum);
4411 
4412  /*Be sure that values are not zero*/
4413  if(gl[0]==0.) gl[0]=gl[0]+epsilon;
4414  if(gl[1]==0.) gl[1]=gl[1]+epsilon;
4415  if(gl[2]==0.) gl[2]=gl[2]+epsilon;
4416 
4417  if(domaintype==Domain2DverticalEnum){
4418  _error_("not implemented");
4419  }
4420  else if(domaintype==Domain2DhorizontalEnum || domaintype==Domain3DEnum || domaintype==Domain3DsurfaceEnum){
4421  int pt1 = 0;
4422  int pt2 = 1;
4423  if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
4424 
4425  /*Portion of the segments*/
4426  s1=gl[2]/(gl[2]-gl[1]);
4427  s2=gl[2]/(gl[2]-gl[0]);
4428  if(gl[2]<0.){
4429  pt1 = 1; pt2 = 0;
4430  }
4431  xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
4432  xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
4433  xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
4434  xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
4435  xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
4436  xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
4437  }
4438  else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
4439 
4440  /*Portion of the segments*/
4441  s1=gl[0]/(gl[0]-gl[1]);
4442  s2=gl[0]/(gl[0]-gl[2]);
4443  if(gl[0]<0.){
4444  pt1 = 1; pt2 = 0;
4445  }
4446 
4447  xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
4448  xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
4449  xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
4450  xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
4451  xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
4452  xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
4453  }
4454  else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
4455 
4456  /*Portion of the segments*/
4457  s1=gl[1]/(gl[1]-gl[0]);
4458  s2=gl[1]/(gl[1]-gl[2]);
4459  if(gl[1]<0.){
4460  pt1 = 1; pt2 = 0;
4461  }
4462 
4463  xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
4464  xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
4465  xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
4466  xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
4467  xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
4468  xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
4469  }
4470  else{
4471  _error_("case not possible");
4472  }
4473 
4474  }
4475  else _error_("mesh type "<<EnumToStringx(domaintype)<<"not supported yet ");
4476 
4477  /*Some checks in debugging mode*/
4478  _assert_(s1>=0 && s1<=1.);
4479  _assert_(s2>=0 && s2<=1.);
4480 
4481  /*Get normal vector*/
4482  IssmDouble normal[3];
4483  this->NormalSection(&normal[0],&xyz_front[0][0]);
4484  normal[0] = -normal[0];
4485  normal[1] = -normal[1];
4486 
4487  /*Get inputs*/
4488  IssmDouble flux = 0.;
4489  IssmDouble calvingratex,calvingratey,vx,vy,vel,meltingrate,meltingratex,meltingratey,thickness,Jdet;
4491  Input2* thickness_input=this->GetInput2(ThicknessEnum); _assert_(thickness_input);
4492  Input2* calvingratex_input=NULL;
4493  Input2* calvingratey_input=NULL;
4494  Input2* vx_input=NULL;
4495  Input2* vy_input=NULL;
4496  Input2* meltingrate_input=NULL;
4497  if(domaintype==Domain2DhorizontalEnum){
4498  calvingratex_input=this->GetInput2(CalvingratexEnum); _assert_(calvingratex_input);
4499  calvingratey_input=this->GetInput2(CalvingrateyEnum); _assert_(calvingratey_input);
4500  vx_input=this->GetInput2(VxEnum); _assert_(vx_input);
4501  vy_input=this->GetInput2(VyEnum); _assert_(vy_input);
4502  meltingrate_input=this->GetInput2(CalvingMeltingrateEnum); _assert_(meltingrate_input);
4503  }
4504  else{
4505  calvingratex_input=this->GetInput2(CalvingratexAverageEnum); _assert_(calvingratex_input);
4506  calvingratey_input=this->GetInput2(CalvingrateyAverageEnum); _assert_(calvingratey_input);
4507  }
4508 
4509  /*Start looping on Gaussian points*/
4510  Gauss* gauss=this->NewGauss(xyz_list,&xyz_front[0][0],3);
4511  for(int ig=gauss->begin();ig<gauss->end();ig++){
4512 
4513  gauss->GaussPoint(ig);
4514  thickness_input->GetInputValue(&thickness,gauss);
4515  calvingratex_input->GetInputValue(&calvingratex,gauss);
4516  calvingratey_input->GetInputValue(&calvingratey,gauss);
4517  vx_input->GetInputValue(&vx,gauss);
4518  vy_input->GetInputValue(&vy,gauss);
4519  vel=vx*vx+vy*vy;
4520  meltingrate_input->GetInputValue(&meltingrate,gauss);
4521  meltingratex=meltingrate*vx/(sqrt(vel)+1.e-14);
4522  meltingratey=meltingrate*vy/(sqrt(vel)+1.e-14);
4523  this->JacobianDeterminantSurface(&Jdet,&xyz_front[0][0],gauss);
4524 
4525  flux += rho_ice*Jdet*gauss->weight*thickness*((calvingratex+meltingratex)*normal[0] + (calvingratey+meltingratey)*normal[1]);
4526  }
4527 
4528  return flux;
4529 }

◆ TotalFloatingBmb()

IssmDouble Tria::TotalFloatingBmb ( bool  scaled)
virtual

Implements Element.

Definition at line 4531 of file Tria.cpp.

4531  {/*{{{*/
4532 
4533  /*The fbmb[kg yr-1] of one element is area[m2] * melting_rate [kg m^-2 yr^-1]*/
4534  int point1;
4535  bool mainlyfloating;
4536  IssmDouble fbmb=0;
4537  IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet,scalefactor;
4538  IssmDouble Total_Fbmb=0;
4539  IssmDouble xyz_list[NUMVERTICES][3];
4540  Gauss* gauss = NULL;
4541 
4542  if(!IsIceInElement())return 0;
4543 
4544  /*Get material parameters :*/
4545  rho_ice=FindParam(MaterialsRhoIceEnum);
4546  Input2* floatingmelt_input = this->GetInput2(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input);
4547  Input2* gllevelset_input = this->GetInput2(MaskOceanLevelsetEnum); _assert_(gllevelset_input);
4548  Input2* scalefactor_input = NULL;
4549  if(scaled==true){
4550  scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
4551  }
4553 
4554  this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
4555  /* Start looping on the number of gaussian points: */
4556  gauss = this->NewGauss(point1,fraction1,fraction2,1-mainlyfloating,3);
4557  for(int ig=gauss->begin();ig<gauss->end();ig++){
4558 
4559  gauss->GaussPoint(ig);
4560  this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
4561  floatingmelt_input->GetInputValue(&floatingmelt,gauss);
4562  if(scaled==true){
4563  scalefactor_input->GetInputValue(&scalefactor,gauss);
4564  }
4565  else scalefactor=1;
4566  fbmb+=floatingmelt*Jdet*gauss->weight*scalefactor;
4567  }
4568 
4569  Total_Fbmb=rho_ice*fbmb; // from volume to mass
4570 
4571  /*Return: */
4572  delete gauss;
4573  return Total_Fbmb;
4574 }

◆ TotalGroundedBmb()

IssmDouble Tria::TotalGroundedBmb ( bool  scaled)
virtual

Implements Element.

Definition at line 4576 of file Tria.cpp.

4576  {/*{{{*/
4577 
4578  /*The gbmb[kg yr-1] of one element is area[m2] * gounded melting rate [kg m^-2 yr^-1]*/
4579  int point1;
4580  bool mainlyfloating;
4581  IssmDouble gbmb=0;
4582  IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet,scalefactor;
4583  IssmDouble Total_Gbmb=0;
4584  IssmDouble xyz_list[NUMVERTICES][3];
4585  Gauss* gauss = NULL;
4586 
4587  if(!IsIceInElement())return 0;
4588 
4589  /*Get material parameters :*/
4590  rho_ice=FindParam(MaterialsRhoIceEnum);
4591  Input2* groundedmelt_input = this->GetInput2(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input);
4592  Input2* gllevelset_input = this->GetInput2(MaskOceanLevelsetEnum); _assert_(gllevelset_input);
4593  Input2* scalefactor_input = NULL;
4594  if(scaled==true){
4595  scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
4596  }
4598 
4599  this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
4600  /* Start looping on the number of gaussian points: */
4601  gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
4602  for(int ig=gauss->begin();ig<gauss->end();ig++){
4603 
4604  gauss->GaussPoint(ig);
4605  this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
4606  groundedmelt_input->GetInputValue(&groundedmelt,gauss);
4607  if(scaled==true){
4608  scalefactor_input->GetInputValue(&scalefactor,gauss);
4609  }
4610  else scalefactor=1;
4611  gbmb+=groundedmelt*Jdet*gauss->weight*scalefactor;
4612  }
4613 
4614  Total_Gbmb=rho_ice*gbmb; // from volume to mass
4615 
4616  /*Return: */
4617  delete gauss;
4618  return Total_Gbmb;
4619 }

◆ TotalSmb()

IssmDouble Tria::TotalSmb ( bool  scaled)
virtual

Implements Element.

Definition at line 4621 of file Tria.cpp.

4621  {/*{{{*/
4622 
4623  /*The smb[kg yr-1] of one element is area[m2] * smb [kg m^-2 yr^-1]*/
4624  IssmDouble base,smb,rho_ice,scalefactor;
4625  IssmDouble Total_Smb=0;
4626  IssmDouble xyz_list[NUMVERTICES][3];
4627 
4628  /*Get material parameters :*/
4629  rho_ice=FindParam(MaterialsRhoIceEnum);
4630 
4631  if(!IsIceInElement())return 0;
4632 
4634 
4635  /*First calculate the area of the base (cross section triangle)
4636  * http://en.wikipedia.org/wiki/Triangle
4637  * base = 1/2 abs((xA-xC)(yB-yA)-(xA-xB)(yC-yA))*/
4638  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])); // area of element in m2
4639 
4640  /*Now get the average SMB over the element*/
4641  Input2* smb_input = this->GetInput2(SmbMassBalanceEnum); _assert_(smb_input);
4642  smb_input->GetInputAverage(&smb); // average smb on element in m ice s-1
4643  if(scaled==true){
4644  Input2* scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
4645  scalefactor_input->GetInputAverage(&scalefactor);// average scalefactor on element
4646  }
4647  else{
4648  scalefactor=1.;
4649  }
4650  Total_Smb=rho_ice*base*smb*scalefactor; // smb on element in kg s-1
4651 
4652  /*Return: */
4653  return Total_Smb;
4654 }

◆ Update()

void Tria::Update ( Inputs2 inputs2,
int  index,
IoModel iomodel,
int  analysis_counter,
int  analysis_type,
int  finitelement 
)
virtual

Implements Element.

Definition at line 4656 of file Tria.cpp.

4656  {/*{{{*/
4657 
4658  /*Intermediaries*/
4659  int numnodes;
4660  int* tria_node_ids = NULL;
4661 
4662  /*Checks if debuging*/
4663  _assert_(iomodel->elements);
4664  _assert_(index==this->sid);
4665 
4666  /*Recover element type*/
4667  this->element_type_list[analysis_counter]=finiteelement_type;
4668 
4669  /*Recover nodes ids needed to initialize the node hook.*/
4670  switch(finiteelement_type){
4671  case P0DGEnum:
4672  numnodes = 1;
4673  tria_node_ids = xNew<int>(numnodes);
4674  tria_node_ids[0]= index + 1;
4675  break;
4676  case P1Enum:
4677  numnodes = 3;
4678  tria_node_ids = xNew<int>(numnodes);
4679  tria_node_ids[0]=iomodel->elements[3*index+0];
4680  tria_node_ids[1]=iomodel->elements[3*index+1];
4681  tria_node_ids[2]=iomodel->elements[3*index+2];
4682  break;
4683  case P1DGEnum:
4684  numnodes = 3;
4685  tria_node_ids = xNew<int>(numnodes);
4686  tria_node_ids[0]=3*index+1;
4687  tria_node_ids[1]=3*index+2;
4688  tria_node_ids[2]=3*index+3;
4689  break;
4691  numnodes = 4;
4692  tria_node_ids = xNew<int>(numnodes);
4693  tria_node_ids[0]=iomodel->elements[3*index+0];
4694  tria_node_ids[1]=iomodel->elements[3*index+1];
4695  tria_node_ids[2]=iomodel->elements[3*index+2];
4696  tria_node_ids[3]=iomodel->numberofvertices+index+1;
4697  break;
4698  case P2Enum:
4699  numnodes = 6;
4700  tria_node_ids = xNew<int>(numnodes);
4701  tria_node_ids[0]=iomodel->elements[3*index+0];
4702  tria_node_ids[1]=iomodel->elements[3*index+1];
4703  tria_node_ids[2]=iomodel->elements[3*index+2];
4704  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+0]+1;
4705  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+1]+1;
4706  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+2]+1;
4707  break;
4709  numnodes = 7;
4710  tria_node_ids = xNew<int>(numnodes);
4711  tria_node_ids[0]=iomodel->elements[3*index+0];
4712  tria_node_ids[1]=iomodel->elements[3*index+1];
4713  tria_node_ids[2]=iomodel->elements[3*index+2];
4714  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+0]+1;
4715  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+1]+1;
4716  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+2]+1;
4717  tria_node_ids[6]=iomodel->numberofvertices+iomodel->numberofedges+index+1;
4718  break;
4719  case P1P1Enum: case P1P1GLSEnum:
4720  numnodes = 6;
4721  tria_node_ids = xNew<int>(numnodes);
4722  tria_node_ids[0]=iomodel->elements[3*index+0];
4723  tria_node_ids[1]=iomodel->elements[3*index+1];
4724  tria_node_ids[2]=iomodel->elements[3*index+2];
4725 
4726  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elements[3*index+0];
4727  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elements[3*index+1];
4728  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elements[3*index+2];
4729  break;
4730  case MINIEnum: case MINIcondensedEnum:
4731  numnodes = 7;
4732  tria_node_ids = xNew<int>(numnodes);
4733  tria_node_ids[0]=iomodel->elements[3*index+0];
4734  tria_node_ids[1]=iomodel->elements[3*index+1];
4735  tria_node_ids[2]=iomodel->elements[3*index+2];
4736  tria_node_ids[3]=iomodel->numberofvertices+index+1;
4737 
4738  tria_node_ids[4]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[3*index+0];
4739  tria_node_ids[5]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[3*index+1];
4740  tria_node_ids[6]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[3*index+2];
4741  break;
4742  case TaylorHoodEnum:
4743  case XTaylorHoodEnum:
4744  numnodes = 9;
4745  tria_node_ids = xNew<int>(numnodes);
4746  tria_node_ids[0]=iomodel->elements[3*index+0];
4747  tria_node_ids[1]=iomodel->elements[3*index+1];
4748  tria_node_ids[2]=iomodel->elements[3*index+2];
4749  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+0]+1;
4750  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+1]+1;
4751  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+2]+1;
4752 
4753  tria_node_ids[6]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[3*index+0];
4754  tria_node_ids[7]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[3*index+1];
4755  tria_node_ids[8]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[3*index+2];
4756  break;
4757  case LATaylorHoodEnum:
4758  numnodes = 6;
4759  tria_node_ids = xNew<int>(numnodes);
4760  tria_node_ids[0]=iomodel->elements[3*index+0];
4761  tria_node_ids[1]=iomodel->elements[3*index+1];
4762  tria_node_ids[2]=iomodel->elements[3*index+2];
4763  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+0]+1;
4764  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+1]+1;
4765  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+2]+1;
4766  break;
4767  case CrouzeixRaviartEnum:
4768  numnodes = 10;
4769  tria_node_ids = xNew<int>(numnodes);
4770  tria_node_ids[0]=iomodel->elements[3*index+0];
4771  tria_node_ids[1]=iomodel->elements[3*index+1];
4772  tria_node_ids[2]=iomodel->elements[3*index+2];
4773  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+0]+1;
4774  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+1]+1;
4775  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+2]+1;
4776  tria_node_ids[6]=iomodel->numberofvertices+iomodel->numberofedges+index+1;
4777 
4778  tria_node_ids[7]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->numberofelements+3*index+1;
4779  tria_node_ids[8]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->numberofelements+3*index+2;
4780  tria_node_ids[9]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->numberofelements+3*index+3;
4781  break;
4782  case LACrouzeixRaviartEnum:
4783  numnodes = 7;
4784  tria_node_ids = xNew<int>(numnodes);
4785  tria_node_ids[0]=iomodel->elements[3*index+0];
4786  tria_node_ids[1]=iomodel->elements[3*index+1];
4787  tria_node_ids[2]=iomodel->elements[3*index+2];
4788  tria_node_ids[3]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+0]+1;
4789  tria_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+1]+1;
4790  tria_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[3*index+2]+1;
4791  tria_node_ids[6]=iomodel->numberofvertices+iomodel->numberofedges+index+1;
4792  break;
4793  default:
4794  _error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
4795  }
4796 
4797  /*hooks: */
4798  this->SetHookNodes(tria_node_ids,numnodes,analysis_counter); this->nodes=NULL;
4799  xDelete<int>(tria_node_ids);
4800 }

◆ UpdatePotentialUngrounding()

int Tria::UpdatePotentialUngrounding ( IssmDouble vertices_potentially_ungrounding,
Vector< IssmDouble > *  vec_nodes_on_iceshelf,
IssmDouble nodes_on_iceshelf 
)
virtual

Implements Element.

Definition at line 4849 of file Tria.cpp.

4849  {/*{{{*/
4850 
4851  int i;
4852  int nflipped=0;
4853 
4854  /*Go through nodes, and whoever is on the potential_ungrounding, ends up in nodes_on_iceshelf: */
4855  for(i=0;i<3;i++){
4856  if (reCast<bool>(vertices_potentially_ungrounding[vertices[i]->Pid()])){
4857  vec_nodes_on_iceshelf->SetValue(vertices[i]->Pid(),-1.,INS_VAL);
4858 
4859  /*If node was not on ice shelf, we flipped*/
4860  if(nodes_on_iceshelf[vertices[i]->Pid()]>=0.){
4861  nflipped++;
4862  }
4863  }
4864  }
4865  return nflipped;
4866 }

◆ ValueP1DerivativesOnGauss()

void Tria::ValueP1DerivativesOnGauss ( IssmDouble dvalue,
IssmDouble values,
IssmDouble xyz_list,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 4868 of file Tria.cpp.

4868  {/*{{{*/
4869  TriaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss,P1Enum);
4870 }

◆ ValueP1OnGauss()

void Tria::ValueP1OnGauss ( IssmDouble pvalue,
IssmDouble values,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 4872 of file Tria.cpp.

4872  {/*{{{*/
4873  TriaRef::GetInputValue(pvalue,values,gauss,P1Enum);
4874 }

◆ VelocityInterpolation()

int Tria::VelocityInterpolation ( void  )
virtual

Implements Element.

Definition at line 4876 of file Tria.cpp.

4876  {/*{{{*/
4878 }

◆ VertexConnectivity()

int Tria::VertexConnectivity ( int  vertexindex)
virtual

Implements Element.

Definition at line 4880 of file Tria.cpp.

4880  {/*{{{*/
4881  _assert_(this->vertices);
4882  return this->vertices[vertexindex]->Connectivity();
4883 }

◆ VerticalSegmentIndices()

void Tria::VerticalSegmentIndices ( int **  pindices,
int *  pnumseg 
)
inlinevirtual

Implements Element.

Definition at line 153 of file Tria.h.

153 {_error_("not implemented yet");};

◆ VerticalSegmentIndicesBase()

void Tria::VerticalSegmentIndicesBase ( int **  pindices,
int *  pnumseg 
)
inlinevirtual

Implements Element.

Definition at line 154 of file Tria.h.

154 {_error_("not implemented yet");};

◆ WriteFieldIsovalueSegment()

void Tria::WriteFieldIsovalueSegment ( DataSet segments,
int  fieldenum,
IssmDouble  fieldvalue 
)
virtual

Reimplemented from Element.

Definition at line 4885 of file Tria.cpp.

4885  {/*{{{*/
4886 
4887  _assert_(fieldvalue==0.); //field value != 0 not implemented yet
4888 
4889  /*Get field on vertices (we do not allow for higher order elements!!)*/
4890  IssmDouble lsf[NUMVERTICES];
4891  Element::GetInputListOnVertices(&lsf[0],fieldenum);
4892 
4893  /*1. check that we do cross fieldvalue in this element*/
4894  IssmDouble minvalue = lsf[0];
4895  IssmDouble maxvalue = lsf[0];
4896  for(int i=1;i<NUMVERTICES;i++){
4897  if(lsf[i]>maxvalue) maxvalue = lsf[i];
4898  if(lsf[i]<minvalue) minvalue = lsf[i];
4899  }
4900  if(minvalue>fieldvalue) return;
4901  if(maxvalue<fieldvalue) return;
4902 
4903  /*2. Find coordinates of where levelset crosses 0*/
4904  int numiceverts;
4905  IssmDouble s[2],x[2],y[2];
4906  int *indices = NULL;
4907  this->GetLevelsetIntersection(&indices, &numiceverts,&s[0],fieldenum,fieldvalue);
4908  _assert_(numiceverts);
4909 
4910  /*3 Write coordinates*/
4911  IssmDouble xyz_list[NUMVERTICES][3];
4912  ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
4913  int counter = 0;
4914  if((numiceverts>0) && (numiceverts<NUMVERTICES)){
4915  for(int i=0;i<numiceverts;i++){
4916  for(int n=numiceverts;n<NUMVERTICES;n++){ // iterate over no-ice vertices
4917  x[counter] = xyz_list[indices[i]][0]+s[counter]*(xyz_list[indices[n]][0]-xyz_list[indices[i]][0]);
4918  y[counter] = xyz_list[indices[i]][1]+s[counter]*(xyz_list[indices[n]][1]-xyz_list[indices[i]][1]);
4919  counter++;
4920  }
4921  }
4922  }
4923  else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge
4924 
4925  for(int i=0;i<NUMVERTICES;i++){
4926  if(lsf[indices[i]]==0.){
4927  x[counter]=xyz_list[indices[i]][0];
4928  y[counter]=xyz_list[indices[i]][1];
4929  counter++;
4930  }
4931  if(counter==2) break;
4932  }
4933  if(counter==1){
4934  /*We actually have only 1 vertex on levelset, write a single point as a segment*/
4935  x[counter]=x[0];
4936  y[counter]=y[0];
4937  counter++;
4938  }
4939  }
4940  else{
4941  _error_("not sure what's going on here...");
4942  }
4943 
4944  /*4. Write segment*/
4945  _assert_(counter==2);
4946  segments->AddObject(new Contour<IssmDouble>(segments->Size()+1,2,&x[0],&y[0],false));
4947 
4948  /*Cleanup and return*/
4949  xDelete<int>(indices);
4950 }

◆ AddBasalInput2()

void Tria::AddBasalInput2 ( int  input_enum,
IssmDouble values,
int  interpolation_enum 
)
virtual

Reimplemented from Element.

Definition at line 165 of file Tria.cpp.

165  {/*{{{*/
166 
167  /*Call inputs method*/
168  _assert_(this->inputs2);
169 
170  int domaintype;
171  parameters->FindParam(&domaintype,DomainTypeEnum);
172  switch(domaintype){
174  this->AddInput2(input_enum,values,interpolation_enum);
175  break;
176  case Domain2DverticalEnum:{
177  _error_("not implemented yet");
178  }
179  break;
180  default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
181  }
182 
183 }

◆ AddInput2()

void Tria::AddInput2 ( int  input_enum,
IssmDouble values,
int  interpolation_enum 
)
virtual

Reimplemented from Element.

Definition at line 185 of file Tria.cpp.

185  {/*{{{*/
186 
187  /*Intermediaries*/
188  int vertexlids[NUMVERTICES];
189 
190  /*Call inputs method*/
191  if(!this->inputs2){
192  int* temp = xNew<int>(3);
193  _error_("inputs2 not set");
194  }
195  _assert_(this->inputs2);
196  switch(interpolation_enum){
197  case P1Enum:
198  for(int i=0;i<NUMVERTICES;i++) vertexlids[i]=this->vertices[i]->lid;
199  inputs2->SetTriaInput(input_enum,interpolation_enum,NUMVERTICES,vertexlids,values);
200  break;
201  case P1DGEnum:
202  for(int i=0;i<NUMVERTICES;i++) vertexlids[i]=this->vertices[i]->lid;
203  inputs2->SetTriaInput(input_enum,interpolation_enum,this->lid,NUMVERTICES,values);
204  break;
205  default:
206  inputs2->SetTriaInput(input_enum,interpolation_enum,this->lid,this->GetNumberOfNodes(interpolation_enum),values);
207  }
208 
209 }

◆ AddControlInput()

void Tria::AddControlInput ( int  input_enum,
Inputs2 inputs2,
IoModel iomodel,
IssmDouble values,
IssmDouble values_min,
IssmDouble values_max,
int  interpolation_enum,
int  id 
)
virtual

Reimplemented from Element.

Definition at line 211 of file Tria.cpp.

211  {/*{{{*/
212 
213  /*Intermediaries*/
214  int vertexlids[NUMVERTICES];
215 
216  _assert_(iomodel->elements);
217  for(int i=0;i<NUMVERTICES;i++){
218  int vertexid =reCast<int>(iomodel->elements[NUMVERTICES*this->Sid()+i]); //ids for vertices are in the elements array from Matlab
219  vertexlids[i]=iomodel->my_vertices_lids[vertexid-1];
220  }
221 
222  /*Call inputs method*/
223  switch(interpolation_enum){
224  case P1Enum:
225  inputs2->SetTriaControlInput(input_enum,TriaInput2Enum,interpolation_enum,id,NUMVERTICES,vertexlids,values,values_min,values_max);
226  break;
227  default:
228  _error_("Cannot add \""<<EnumToStringx(input_enum)<<"\" interpolation "<<EnumToStringx(interpolation_enum)<<" not supported");
229  }
230 
231 }

◆ DatasetInputCreate()

void Tria::DatasetInputCreate ( IssmDouble array,
int  M,
int  N,
int *  individual_enums,
int  num_inputs,
Inputs2 inputs2,
IoModel iomodel,
int  input_enum 
)
virtual

Reimplemented from Element.

Definition at line 233 of file Tria.cpp.

233  {/*{{{*/
234 
235  /*Intermediaries*/
236  int vertexsids[NUMVERTICES];
237  int vertexlids[NUMVERTICES];
238  IssmDouble nodeinputs[NUMVERTICES];
239 
240  /*Some sanity checks*/
241  if(num_inputs<1) _error_("Cannot create a DatasetInput of size <1");
242  if(M!=iomodel->numberofvertices) _error_("Input size not supported yet");
243  if(N!=num_inputs) _error_("Sizes are not consistent");
244 
245  /*Get indices*/
246  _assert_(iomodel->elements);
247  for(int i=0;i<NUMVERTICES;i++){
248  vertexsids[i] = reCast<int>(iomodel->elements[NUMVERTICES*this->Sid()+i])-1;
249  vertexlids[i] = iomodel->my_vertices_lids[vertexsids[i]];
250  }
251 
252  /*Create inputs and add to DataSetInput*/
253  for(int i=0;i<num_inputs;i++){
254  for(int j=0;j<NUMVERTICES;j++) nodeinputs[j]=array[vertexsids[j]*N+i];
255  inputs2->SetTriaDatasetInput(input_enum,individual_enums[i],P1Enum,NUMVERTICES,vertexlids,nodeinputs);
256  }
257 }

◆ CreateInputTimeAverage()

void Tria::CreateInputTimeAverage ( int  transientinput_enum,
int  averagedinput_enum,
IssmDouble  init_time,
IssmDouble  end_time,
int  averaging_method 
)
virtual

Reimplemented from Element.

Definition at line 2116 of file Tria.cpp.

2116  {/*{{{*/
2117 
2118  _assert_(end_time>start_time);
2119 
2120  /*Get transient input time steps*/
2121  TransientInput2* transient_input = this->inputs2->GetTransientInput(transientinput_enum);
2122  TriaInput2* averaged_input = transient_input->GetTriaInput(start_time,end_time,averaging_method);
2123  Input2* averaged_copy = averaged_input->copy();
2124 
2125  averaged_copy->ChangeEnum(averagedinput_enum);
2126  this->inputs2->AddInput(averaged_copy);
2127 }

◆ GetInputAveragesUpToCurrentTime()

void Tria::GetInputAveragesUpToCurrentTime ( int  input_enum,
IssmDouble **  pvalues,
IssmDouble **  ptimes,
int *  pnumtimes,
IssmDouble  currenttime 
)

Definition at line 2129 of file Tria.cpp.

2129  {/*{{{*/
2130 
2131  /*Get transient input time steps*/
2132  int numtimesteps;
2133  IssmDouble *timesteps = NULL;
2134  TransientInput2* transient_input = this->inputs2->GetTransientInput(input_enum);
2135 
2136  transient_input->GetAllTimes(&timesteps,&numtimesteps);
2137 
2138  /*Figure out how many time steps we are going to return: */
2139  int numsteps = 0;
2140  bool iscurrenttime_included = false;
2141  for(int i=0;i<numtimesteps;i++){
2142  if(timesteps[i]==currenttime) iscurrenttime_included=true;
2143  if(timesteps[i]>currenttime) break;
2144  else numsteps++;
2145  }
2146  if(iscurrenttime_included==false)numsteps++;
2147 
2148  /*allocate: */
2149  IssmDouble* times=xNew<IssmDouble>(numsteps);
2150  IssmDouble* values=xNew<IssmDouble>(numsteps);
2151 
2152  for(int i=0;i<numsteps;i++){
2153  if((iscurrenttime_included==false) && (i==(numsteps-1))){
2154  Input2* input = this->GetInput2(input_enum,currenttime);
2155  input->GetInputAverage(&values[i]);
2156  times[i]=currenttime;
2157  }
2158  else{
2159  TriaInput2* input = transient_input->GetTriaInput(i);
2160  this->InputServe(input);
2161  input->GetInputAverage(&values[i]);
2162  times[i]=timesteps[i];
2163  }
2164  }
2165 
2166  /*Assign output pointers*/
2167  *pvalues=values;
2168  *ptimes=times;
2169  *pnumtimes=numtimesteps;
2170 }

◆ GetArea()

IssmDouble Tria::GetArea ( void  )

Definition at line 1423 of file Tria.cpp.

1423  {/*{{{*/
1424 
1425  IssmDouble xyz_list[NUMVERTICES][3];
1426  IssmDouble x1,y1,x2,y2,x3,y3;
1427 
1428  /*Get xyz list: */
1430  x1=xyz_list[0][0]; y1=xyz_list[0][1];
1431  x2=xyz_list[1][0]; y2=xyz_list[1][1];
1432  x3=xyz_list[2][0]; y3=xyz_list[2][1];
1433 
1434  _assert_(x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1>0);
1435  return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2;
1436 }

◆ GetHorizontalSurfaceArea()

IssmDouble Tria::GetHorizontalSurfaceArea ( void  )
virtual

Reimplemented from Element.

Definition at line 1438 of file Tria.cpp.

1438  {/*{{{*/
1439 
1440  return this->GetArea();
1441 }

◆ GetArea3D()

IssmDouble Tria::GetArea3D ( void  )

Definition at line 1443 of file Tria.cpp.

1443  {/*{{{*/
1444 
1445  IssmDouble xyz_list[NUMVERTICES][3];
1446  IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3;
1447  IssmDouble detm1,detm2,detm3;
1448 
1449  /*Get xyz list: */
1451  x1=xyz_list[0][0]; y1=xyz_list[0][1]; z1=xyz_list[0][2];
1452  x2=xyz_list[1][0]; y2=xyz_list[1][1]; z2=xyz_list[1][2];
1453  x3=xyz_list[2][0]; y3=xyz_list[2][1]; z3=xyz_list[2][2];
1454 
1455  detm1=x1*y2 - x2*y1 - x1*y3 + x3*y1 + x2*y3 - x3*y2;
1456  detm2=y1*z2 - y2*z1 - y1*z3 + y3*z1 + y2*z3 - y3*z2;
1457  detm3=x2*z1 - x1*z2 + x1*z3 - x3*z1 - x2*z3 + x3*z2;
1458 
1459  return sqrt(pow(detm1,2) + pow(detm2,2) + pow(detm3,2))/2;
1460 }

◆ GetAreaIce()

IssmDouble Tria::GetAreaIce ( void  )

Definition at line 1462 of file Tria.cpp.

1462  {/*{{{*/
1463 
1464  /*return area of element covered by ice*/
1465  /*Intermediaries*/
1466  int numiceverts;
1467  IssmDouble area_fraction;
1468  IssmDouble s[2]; // s:fraction of intersected triangle edges that lie inside ice
1469  int* indices=NULL;
1470 
1471  this->GetLevelsetIntersection(&indices, &numiceverts, s, MaskIceLevelsetEnum, 0.);
1472 
1473  switch (numiceverts){
1474  case 0: // no vertex has ice: element is ice free
1475  area_fraction=0.;
1476  break;
1477  case 1: // one vertex has ice: get area of triangle
1478  area_fraction=s[0]*s[1];
1479  break;
1480  case 2: // two vertices have ice: get area of quadrangle
1481  area_fraction=s[0]+s[1]-s[0]*s[1];
1482  break;
1483  case NUMVERTICES: // all vertices have ice: return triangle area
1484  area_fraction=1.;
1485  break;
1486  default:
1487  _error_("Wrong number of ice vertices in Tria::GetAreaIce!");
1488  break;
1489  }
1490  _assert_((area_fraction>=0.) && (area_fraction<=1.));
1491 
1492  xDelete<int>(indices);
1493  return area_fraction*this->GetArea();
1494 }/*}}}*/

◆ GetAreaSpherical()

IssmDouble Tria::GetAreaSpherical ( void  )

Definition at line 1495 of file Tria.cpp.

1495  {/*{{{*/
1496 
1497  bool spherical=true;
1498  IssmDouble llr_list[NUMVERTICES][3];
1499  IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3;
1500  IssmDouble arc12,arc23,arc31,semi_peri,excess;
1501 
1502  /*retrieve coordinates: lat,long,radius */
1503  ::GetVerticesCoordinates(&llr_list[0][0],vertices,NUMVERTICES,spherical);
1504  x1=llr_list[0][0]/180*PI; y1=llr_list[0][1]/180*PI; z1=llr_list[0][2];
1505  x2=llr_list[1][0]/180*PI; y2=llr_list[1][1]/180*PI; z2=llr_list[1][2];
1506  x3=llr_list[2][0]/180*PI; y3=llr_list[2][1]/180*PI; z3=llr_list[2][2];
1507 
1508  /*compute great circle distance between vertices */
1509  arc12=2.*asin(sqrt(pow(sin((x2-x1)/2),2.0)+cos(x1)*cos(x2)*pow(sin((y2-y1)/2),2)));
1510  arc23=2.*asin(sqrt(pow(sin((x3-x2)/2),2.0)+cos(x2)*cos(x3)*pow(sin((y3-y2)/2),2)));
1511  arc31=2.*asin(sqrt(pow(sin((x1-x3)/2),2.0)+cos(x3)*cos(x1)*pow(sin((y1-y3)/2),2)));
1512 
1513  /*semi parameter */
1514  semi_peri=(arc12+arc23+arc31)/2;
1515 
1516  /*spherical excess */
1517  excess=4.*atan(sqrt(tan(semi_peri/2)*tan((semi_peri-arc12)/2)*tan((semi_peri-arc23)/2)*tan((semi_peri-arc31)/2)));
1518 
1519  /*area = excess*radius^2 */
1520  return excess*pow((z1+z2+z3)/3,2);
1521 }

◆ GetAreaCoordinates()

void Tria::GetAreaCoordinates ( IssmDouble area_coordinates,
IssmDouble xyz_zero,
IssmDouble xyz_list,
int  numpoints 
)

Definition at line 1523 of file Tria.cpp.

1523  {/*{{{*/
1524  /*Computeportion of the element that is grounded*/
1525 
1526  int i,j,k;
1527  IssmDouble area_init,area_portion;
1528  IssmDouble xyz_bis[NUMVERTICES][3];
1529 
1530  area_init=GetArea();
1531 
1532  /*Initialize xyz_list with original xyz_list of triangle coordinates*/
1533  for(j=0;j<3;j++){
1534  for(k=0;k<3;k++){
1535  xyz_bis[j][k]=xyz_list[j*3+k];
1536  }
1537  }
1538  for(i=0;i<numpoints;i++){
1539  for(j=0;j<3;j++){
1540  for(k=0;k<3;k++){
1541  /*Change appropriate line*/
1542  xyz_bis[j][k]=xyz_zero[i*3+k];
1543  }
1544 
1545  /*Compute area fraction*/
1546  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.;
1547  *(area_coordinates+3*i+j)=area_portion/area_init;
1548 
1549  /*Reinitialize xyz_list*/
1550  for(k=0;k<3;k++){
1551  /*Reinitialize xyz_list with original coordinates*/
1552  xyz_bis[j][k]=xyz_list[j*3+k];
1553  }
1554  }
1555  }
1556 }

◆ GetElementType()

int Tria::GetElementType ( void  )
virtual

Implements Element.

Definition at line 1558 of file Tria.cpp.

1558  {/*{{{*/
1559 
1560  /*return TriaRef field*/
1561  return this->element_type;
1562 
1563 }

◆ GetInput2() [1/3]

Input2 * Tria::GetInput2 ( int  enumtype)
virtual

Implements Element.

Definition at line 1880 of file Tria.cpp.

1880  {/*{{{*/
1881 
1882  /*Get Input from dataset*/
1883  if(this->iscollapsed){
1884  PentaInput2* input = this->inputs2->GetPentaInput(inputenum);
1885  if(!input) return input;
1886 
1887  this->InputServe(input);
1888  return input;
1889  }
1890  else{
1891  TriaInput2* input = this->inputs2->GetTriaInput(inputenum);
1892  if(!input) return input;
1893 
1894  this->InputServe(input);
1895  return input;
1896  }
1897 }/*}}}*/

◆ GetInput2() [2/3]

Input2 * Tria::GetInput2 ( int  enumtype,
IssmDouble  time 
)
virtual

Implements Element.

Definition at line 1898 of file Tria.cpp.

1898  {/*{{{*/
1899 
1900  /*Get Input from dataset*/
1901  if(this->iscollapsed){
1902  PentaInput2* input = this->inputs2->GetPentaInput(inputenum,time);
1903  if(!input) return input;
1904 
1905  this->InputServe(input);
1906  return input;
1907  }
1908  else{
1909  TriaInput2* input = this->inputs2->GetTriaInput(inputenum,time);
1910  if(!input) return input;
1911 
1912  this->InputServe(input);
1913  return input;
1914  }
1915 }/*}}}*/

◆ GetInput2() [3/3]

Input2 * Tria::GetInput2 ( int  inputenum,
IssmDouble  start_time,
IssmDouble  end_time,
int  averaging_method 
)
virtual

Implements Element.

Definition at line 1916 of file Tria.cpp.

1916  {/*{{{*/
1917 
1918  /*Get Input from dataset*/
1919  if(this->iscollapsed){
1920  PentaInput2* input = this->inputs2->GetPentaInput(inputenum,start_time,end_time,averaging_method);
1921  if(!input) return input;
1922 
1923  this->InputServe(input);
1924  return input;
1925  }
1926  else{
1927  TriaInput2* input = this->inputs2->GetTriaInput(inputenum,start_time,end_time,averaging_method);
1928  if(!input) return input;
1929 
1930  this->InputServe(input);
1931  return input;
1932  }
1933 }/*}}}*/

◆ GetDatasetInput2()

DatasetInput2 * Tria::GetDatasetInput2 ( int  inputenum)
virtual

Reimplemented from Element.

Definition at line 2044 of file Tria.cpp.

2044  {/*{{{*/
2045 
2046  DatasetInput2* datasetinput = this->inputs2->GetDatasetInput2(inputenum);
2047  if(!datasetinput) return NULL;
2048 
2049  for(int i=0;i<datasetinput->GetNumIds();i++){
2050 
2051  /*Get Input from dataset*/
2052  if(this->iscollapsed){
2053 
2054  PentaInput2* input = datasetinput->GetPentaInputByOffset(i); _assert_(input);
2055 
2056  /*Intermediaries*/
2057  int numindices;
2058  int indices[3];
2059 
2060  /*Check interpolation*/
2061  int interpolation = input->GetInterpolation();
2062  switch(interpolation){
2063  case P0Enum:
2064  numindices = 1;
2065  indices[0] = this->lid;
2066  input->Serve(numindices,&indices[0]);
2067  break;
2068  case P1Enum:
2069  numindices = 3;
2070  for(int i=0;i<3;i++) indices[i] = vertices[i]->lid;
2071  input->Serve(numindices,&indices[0]);
2072  break;
2073  case P1DGEnum:
2074  case P1bubbleEnum:
2075  input->ServeCollapsed(this->lid,this->iscollapsed);
2076  break;
2077  default: _error_("interpolation "<<EnumToStringx(interpolation)<<" not supported");
2078  }
2079 
2080  /*Flag as collapsed for later use*/
2081  input->SetServeCollapsed(true);
2082  }
2083  else{
2084 
2085  TriaInput2* input = datasetinput->GetTriaInputByOffset(i); _assert_(input);
2086 
2087  /*Intermediaries*/
2088  int numindices;
2089  int indices[7];
2090 
2091  /*Check interpolation*/
2092  int interpolation = input->GetInterpolation();
2093  switch(interpolation){
2094  case P0Enum:
2095  numindices = 1;
2096  indices[0] = this->lid;
2097  input->Serve(numindices,&indices[0]);
2098  break;
2099  case P1Enum:
2100  numindices = 3;
2101  for(int i=0;i<3;i++) indices[i] = vertices[i]->lid;
2102  input->Serve(numindices,&indices[0]);
2103  break;
2104  case P1DGEnum:
2105  numindices = 3;
2106  input->Serve(this->lid,numindices);
2107  break;
2108  default: _error_("interpolation "<<EnumToStringx(interpolation)<<" not supported");
2109  }
2110 
2111  }
2112  }
2113 
2114  return datasetinput;
2115 }/*}}}*/

◆ GetInputValue() [1/2]

void Tria::GetInputValue ( IssmDouble pvalue,
Node node,
int  enumtype 
)
virtual

Reimplemented from Element.

Definition at line 2172 of file Tria.cpp.

2172  {/*{{{*/
2173 
2174  Input2* input=this->GetInput2(enumtype);
2175  if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
2176 
2177  int index = this->GetNodeIndex(node);
2178 
2179  GaussTria* gauss=new GaussTria();
2180  gauss->GaussNode(this->element_type,index);
2181 
2182  input->GetInputValue(pvalue,gauss);
2183  delete gauss;
2184 }

◆ GetInputValue() [2/2]

void Tria::GetInputValue ( IssmDouble pvalue,
Vertex vertex,
int  enumtype 
)
virtual

Reimplemented from Element.

Definition at line 2186 of file Tria.cpp.

2186  {/*{{{*/
2187 
2188  Input2* input=this->GetInput2(enumtype);
2189  if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
2190 
2191  int index = this->GetVertexIndex(vertex);
2192 
2193  GaussTria* gauss=new GaussTria();
2194  gauss->GaussVertex(index);
2195 
2196  input->GetInputValue(pvalue,gauss);
2197  delete gauss;
2198 }

◆ GetLevelsetIntersection()

void Tria::GetLevelsetIntersection ( int **  pindices,
int *  pnumiceverts,
IssmDouble fraction,
int  levelset_enum,
IssmDouble  level 
)

Definition at line 2239 of file Tria.cpp.

2239  {/*{{{*/
2240 
2241  /* GetLevelsetIntersection computes:
2242  * 1. indices of element, sorted in [iceverts, noiceverts] in counterclockwise fashion,
2243  * 2. fraction of intersected triangle edges intersected by levelset, lying below level*/
2244 
2245  /*Intermediaries*/
2246  int i, numiceverts, numnoiceverts;
2247  int ind0, ind1, lastindex;
2248  int indices_ice[NUMVERTICES],indices_noice[NUMVERTICES];
2249  IssmDouble lsf[NUMVERTICES];
2250  int* indices = xNew<int>(NUMVERTICES);
2251 
2252  /*Retrieve all inputs and parameters*/
2253  Element::GetInputListOnVertices(&lsf[0],levelset_enum);
2254 
2255  /* Determine distribution of ice over element.
2256  * Exploit: ice/no-ice parts are connected, so find starting vertex of segment*/
2257  lastindex=0;
2258  for(i=0;i<NUMVERTICES;i++){ // go backwards along vertices, and check for sign change
2259  ind0=(NUMVERTICES-i)%NUMVERTICES;
2260  ind1=(ind0-1+NUMVERTICES)%NUMVERTICES;
2261  if((lsf[ind0]-level)*(lsf[ind1]-level)<=0.){ // levelset has been crossed, find last index belonging to segment
2262  if(lsf[ind1]==level) //if levelset intersects 2nd vertex, choose this vertex as last
2263  lastindex=ind1;
2264  else
2265  lastindex=ind0;
2266  break;
2267  }
2268  }
2269 
2270  numiceverts=0;
2271  numnoiceverts=0;
2272  for(i=0;i<NUMVERTICES;i++){
2273  ind0=(lastindex+i)%NUMVERTICES;
2274  if(lsf[i]<=level){
2275  indices_ice[numiceverts]=i;
2276  numiceverts++;
2277  }
2278  else{
2279  indices_noice[numnoiceverts]=i;
2280  numnoiceverts++;
2281  }
2282  }
2283  //merge indices
2284  for(i=0;i<numiceverts;i++){indices[i]=indices_ice[i];}
2285  for(i=0;i<numnoiceverts;i++){indices[numiceverts+i]=indices_noice[i];}
2286 
2287  switch (numiceverts){
2288  case 0: // no vertex has ice: element is ice free, no intersection
2289  for(i=0;i<2;i++)
2290  fraction[i]=0.;
2291  break;
2292  case 1: // one vertex has ice:
2293  for(i=0;i<2;i++){
2294  fraction[i]=(level-lsf[indices[0]])/(lsf[indices[numiceverts+i]]-lsf[indices[0]]);
2295  }
2296  break;
2297  case 2: // two vertices have ice: fraction is computed from first ice vertex to last in CCW fashion
2298  for(i=0;i<2;i++){
2299  fraction[i]=(level-lsf[indices[i]])/(lsf[indices[numiceverts]]-lsf[indices[i]]);
2300  }
2301  break;
2302  case NUMVERTICES: // all vertices have ice: return triangle area
2303  for(i=0;i<2;i++)
2304  fraction[i]=1.;
2305  break;
2306  default:
2307  _error_("Wrong number of ice vertices in Tria::GetLevelsetIntersection!");
2308  break;
2309  }
2310 
2311  *pindices=indices;
2312  *pnumiceverts=numiceverts;
2313 }

◆ GetMaterialInputValue()

void Tria::GetMaterialInputValue ( IssmDouble pvalue,
Node node,
int  enumtype 
)

◆ InputUpdateFromSolutionOneDof()

void Tria::InputUpdateFromSolutionOneDof ( IssmDouble solution,
int  enum_type 
)
virtual

Implements Element.

Definition at line 3092 of file Tria.cpp.

3092  {/*{{{*/
3093 
3094  /*Intermediary*/
3095  int* doflist = NULL;
3096 
3097  /*Fetch number of nodes for this finite element*/
3098  int numnodes = this->NumberofNodes(this->element_type);
3099 
3100  /*Fetch dof list and allocate solution vector*/
3102  IssmDouble* values = xNew<IssmDouble>(numnodes);
3103 
3104  /*Use the dof list to index into the solution vector: */
3105  for(int i=0;i<numnodes;i++){
3106  values[i]=solution[doflist[i]];
3107  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
3108  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector, SID = " << this->Sid());
3109  }
3110 
3111  /*Add input to the element: */
3112  this->AddInput2(enum_type,values,this->element_type);
3113 
3114  /*Free ressources:*/
3115  xDelete<IssmDouble>(values);
3116  xDelete<int>(doflist);
3117 }

◆ InputUpdateFromSolutionOneDofCollapsed()

void Tria::InputUpdateFromSolutionOneDofCollapsed ( IssmDouble solution,
int  enum_type 
)
inlinevirtual

Implements Element.

Definition at line 200 of file Tria.h.

200 {_error_("not implemented yet");};

◆ JacobianDeterminant()

void Tria::JacobianDeterminant ( IssmDouble pJdet,
IssmDouble xyz_list,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3291 of file Tria.cpp.

3291  {/*{{{*/
3292 
3293  _assert_(gauss->Enum()==GaussTriaEnum);
3294  this->GetJacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
3295 
3296 }

◆ JacobianDeterminantBase()

void Tria::JacobianDeterminantBase ( IssmDouble pJdet,
IssmDouble xyz_list_base,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3298 of file Tria.cpp.

3298  {/*{{{*/
3299 
3300  _assert_(gauss->Enum()==GaussTriaEnum);
3301  this->GetSegmentJacobianDeterminant(pJdet,xyz_list_base,(GaussTria*)gauss);
3302 
3303 }

◆ JacobianDeterminantLine()

void Tria::JacobianDeterminantLine ( IssmDouble Jdet,
IssmDouble xyz_list,
Gauss gauss 
)
inlinevirtual

Implements Element.

Definition at line 203 of file Tria.h.

203 {_error_("not implemented yet");};

◆ JacobianDeterminantSurface()

void Tria::JacobianDeterminantSurface ( IssmDouble pJdet,
IssmDouble xyz_list,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3305 of file Tria.cpp.

3305  {/*{{{*/
3306 
3307  _assert_(gauss->Enum()==GaussTriaEnum);
3308  this->GetSegmentJacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
3309 
3310 }

◆ JacobianDeterminantTop()

void Tria::JacobianDeterminantTop ( IssmDouble pJdet,
IssmDouble xyz_list_base,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3312 of file Tria.cpp.

3312  {/*{{{*/
3313 
3314  _assert_(gauss->Enum()==GaussTriaEnum);
3315  this->GetSegmentJacobianDeterminant(pJdet,xyz_list_top,(GaussTria*)gauss);
3316 
3317 }

◆ MinEdgeLength()

IssmDouble Tria::MinEdgeLength ( IssmDouble xyz_list)
inlinevirtual

Implements Element.

Definition at line 206 of file Tria.h.

206 {_error_("not implemented yet");};

◆ NewGauss() [1/6]

Gauss * Tria::NewGauss ( void  )
virtual

Implements Element.

Definition at line 3515 of file Tria.cpp.

3515  {/*{{{*/
3516  return new GaussTria();
3517 }

◆ NewGauss() [2/6]

Gauss * Tria::NewGauss ( int  order)
virtual

Implements Element.

Definition at line 3519 of file Tria.cpp.

3519  {/*{{{*/
3520  return new GaussTria(order);
3521 }

◆ NewGauss() [3/6]

Gauss * Tria::NewGauss ( IssmDouble xyz_list,
IssmDouble xyz_list_front,
int  order 
)
virtual

Implements Element.

Definition at line 3523 of file Tria.cpp.

3523  {/*{{{*/
3524 
3525  IssmDouble area_coordinates[2][3];
3526  GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
3527  return new GaussTria(area_coordinates,order);
3528 }

◆ NewGauss() [4/6]

Gauss * Tria::NewGauss ( int  point1,
IssmDouble  fraction1,
IssmDouble  fraction2,
bool  mainlyfloating,
int  order 
)
virtual

Implements Element.

Definition at line 3530 of file Tria.cpp.

3530  {/*{{{*/
3531 
3532  return new GaussTria(point1,fraction1,fraction2,mainlyfloating,order);
3533 }

◆ NewGauss() [5/6]

Gauss * Tria::NewGauss ( int  point1,
IssmDouble  fraction1,
IssmDouble  fraction2,
int  order 
)
virtual

Implements Element.

Definition at line 3535 of file Tria.cpp.

3535  {/*{{{*/
3536 
3537  return new GaussTria(point1,fraction1,fraction2,order);
3538 }

◆ NewGauss() [6/6]

Gauss * Tria::NewGauss ( IssmDouble xyz_list,
IssmDouble xyz_list_front,
int  order_horiz,
int  order_vert 
)
virtual

Implements Element.

Definition at line 3540 of file Tria.cpp.

3540  {/*{{{*/
3541 
3542  IssmDouble area_coordinates[2][3];
3543  GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
3544  return new GaussTria(area_coordinates,order_vert);
3545 }

◆ NewGaussBase()

Gauss * Tria::NewGaussBase ( int  order)
virtual

Implements Element.

Definition at line 3547 of file Tria.cpp.

3547  {/*{{{*/
3548 
3549  int indices[2];
3550  this->EdgeOnBaseIndices(&indices[0],&indices[1]);
3551  return new GaussTria(indices[0],indices[1],order);
3552 }

◆ NewGaussLine()

Gauss* Tria::NewGaussLine ( int  vertex1,
int  vertex2,
int  order 
)
inlinevirtual

Implements Element.

Definition at line 214 of file Tria.h.

214 {_error_("not implemented yet");};

◆ NewGaussTop()

Gauss * Tria::NewGaussTop ( int  order)
virtual

Implements Element.

Definition at line 3554 of file Tria.cpp.

3554  {/*{{{*/
3555 
3556  int indices[2];
3557  this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
3558  return new GaussTria(indices[0],indices[1],order);
3559 }

◆ NodalFunctions()

void Tria::NodalFunctions ( IssmDouble basis,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3561 of file Tria.cpp.

3561  {/*{{{*/
3562 
3563  _assert_(gauss->Enum()==GaussTriaEnum);
3564  this->GetNodalFunctions(basis,(GaussTria*)gauss,this->element_type);
3565 
3566 }

◆ NodalFunctionsDerivatives()

void Tria::NodalFunctionsDerivatives ( IssmDouble dbasis,
IssmDouble xyz_list,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3568 of file Tria.cpp.

3568  {/*{{{*/
3569 
3570  _assert_(gauss->Enum()==GaussTriaEnum);
3571  this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss,this->element_type);
3572 
3573 }

◆ NodalFunctionsDerivativesVelocity()

void Tria::NodalFunctionsDerivativesVelocity ( IssmDouble dbasis,
IssmDouble xyz_list,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3575 of file Tria.cpp.

3575  {/*{{{*/
3576 
3577  _assert_(gauss->Enum()==GaussTriaEnum);
3578  this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss,this->VelocityInterpolation());
3579 
3580 }

◆ NodalFunctionsMINIDerivatives()

void Tria::NodalFunctionsMINIDerivatives ( IssmDouble dbasis,
IssmDouble xyz_list,
Gauss gauss 
)
inlinevirtual

Implements Element.

Definition at line 219 of file Tria.h.

219 {_error_("not implemented yet");};

◆ NodalFunctionsPressure()

void Tria::NodalFunctionsPressure ( IssmDouble basis,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3582 of file Tria.cpp.

3582  {/*{{{*/
3583 
3584  _assert_(gauss->Enum()==GaussTriaEnum);
3585  this->GetNodalFunctions(basis,(GaussTria*)gauss,this->PressureInterpolation());
3586 
3587 }

◆ NodalFunctionsP1()

void Tria::NodalFunctionsP1 ( IssmDouble basis,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3589 of file Tria.cpp.

3589  {/*{{{*/
3590 
3591  _assert_(gauss->Enum()==GaussTriaEnum);
3592  this->GetNodalFunctions(basis,(GaussTria*)gauss,P1Enum);
3593 
3594 }

◆ NodalFunctionsP1Derivatives()

void Tria::NodalFunctionsP1Derivatives ( IssmDouble dbasis,
IssmDouble xyz_list,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3596 of file Tria.cpp.

3596  {/*{{{*/
3597 
3598  _assert_(gauss->Enum()==GaussTriaEnum);
3599  this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss,P1Enum);
3600 
3601 }

◆ NodalFunctionsP2()

void Tria::NodalFunctionsP2 ( IssmDouble basis,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3603 of file Tria.cpp.

3603  {/*{{{*/
3604 
3605  _assert_(gauss->Enum()==GaussTriaEnum);
3606  this->GetNodalFunctions(basis,(GaussTria*)gauss,P2Enum);
3607 
3608 }

◆ NodalFunctionsTensor()

void Tria::NodalFunctionsTensor ( IssmDouble basis,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3610 of file Tria.cpp.

3610  {/*{{{*/
3611 
3612  _assert_(gauss->Enum()==GaussTriaEnum);
3613  this->GetNodalFunctions(basis,(GaussTria*)gauss,this->TensorInterpolation());
3614 
3615 }

◆ NodalFunctionsVelocity()

void Tria::NodalFunctionsVelocity ( IssmDouble basis,
Gauss gauss 
)
virtual

Implements Element.

Definition at line 3617 of file Tria.cpp.

3617  {/*{{{*/
3618 
3619  _assert_(gauss->Enum()==GaussTriaEnum);
3620  this->GetNodalFunctions(basis,(GaussTria*)gauss,this->VelocityInterpolation());
3621 
3622 }

◆ NormalBase()

void Tria::NormalBase ( IssmDouble normal,
IssmDouble xyz_list 
)
virtual

Implements Element.

Definition at line 3655 of file Tria.cpp.

3655  {/*{{{*/
3656 
3657  /*Build unit outward pointing vector*/
3658  IssmDouble vector[2];
3659  IssmDouble norm;
3660 
3661  vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
3662  vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
3663 
3664  norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
3665 
3666  bed_normal[0]= + vector[1]/norm;
3667  bed_normal[1]= - vector[0]/norm;
3668  _assert_(bed_normal[1]<0);
3669 }

◆ NormalSection()

void Tria::NormalSection ( IssmDouble normal,
IssmDouble xyz_list 
)
virtual

Implements Element.

Definition at line 3671 of file Tria.cpp.

3671  {/*{{{*/
3672 
3673  /*Build unit outward pointing vector*/
3674  IssmDouble vector[2];
3675  IssmDouble norm;
3676 
3677  vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
3678  vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
3679 
3680  norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
3681 
3682  normal[0]= + vector[1]/norm;
3683  normal[1]= - vector[0]/norm;
3684 }

◆ NormalTop()

void Tria::NormalTop ( IssmDouble normal,
IssmDouble xyz_list 
)
virtual

Implements Element.

Definition at line 3686 of file Tria.cpp.

3686  {/*{{{*/
3687 
3688  /*Build unit outward pointing vector*/
3689  int index1,index2;
3690  IssmDouble vector[2];
3691  IssmDouble norm;
3692 
3693  this->EdgeOnSurfaceIndices(&index1,&index2);
3694  vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
3695  vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
3696 
3697  norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
3698 
3699  top_normal[0]= + vector[1]/norm;
3700  top_normal[1]= - vector[0]/norm;
3701  _assert_(top_normal[1]>0);
3702 }

◆ SetTemporaryElementType()

void Tria::SetTemporaryElementType ( int  element_type_in)
inlinevirtual

Implements Element.

Definition at line 229 of file Tria.h.

229 {_error_("not implemented yet");};

◆ InputServe()

void Tria::InputServe ( Input2 input_in)

Definition at line 1974 of file Tria.cpp.

1974  {/*{{{*/
1975 
1976  /*Return NULL pointer if input is NULL*/
1977  if(!input_in) return;
1978 
1979  /*Get Input from dataset*/
1980  if(this->iscollapsed){
1981  _assert_(input_in->ObjectEnum()==PentaInput2Enum);
1982  PentaInput2* input = xDynamicCast<PentaInput2*>(input_in);
1983 
1984  /*Intermediaries*/
1985  int numindices;
1986  int indices[3];
1987 
1988  /*Check interpolation*/
1989  int interpolation = input->GetInterpolation();
1990  switch(interpolation){
1991  case P0Enum:
1992  numindices = 1;
1993  indices[0] = this->lid;
1994  input->Serve(numindices,&indices[0]);
1995  break;
1996  case P1Enum:
1997  numindices = 3;
1998  for(int i=0;i<3;i++) indices[i] = vertices[i]->lid;
1999  input->Serve(numindices,&indices[0]);
2000  break;
2001  case P1DGEnum:
2002  case P1bubbleEnum:
2003  input->ServeCollapsed(this->lid,this->iscollapsed);
2004  break;
2005  default: _error_("interpolation "<<EnumToStringx(interpolation)<<" not supported");
2006  }
2007 
2008  /*Flag as collapsed for later use*/
2009  input->SetServeCollapsed(true);
2010  return;
2011  }
2012  else{
2013  _assert_(input_in->ObjectEnum()==TriaInput2Enum);
2014  TriaInput2* input = xDynamicCast<TriaInput2*>(input_in);
2015 
2016  /*Intermediaries*/
2017  int numindices;
2018  int indices[7];
2019 
2020  /*Check interpolation*/
2021  int interpolation = input->GetInterpolation();
2022  switch(interpolation){
2023  case P0Enum:
2024  numindices = 1;
2025  indices[0] = this->lid;
2026  input->Serve(numindices,&indices[0]);
2027  break;
2028  case P1Enum:
2029  numindices = 3;
2030  for(int i=0;i<3;i++) indices[i] = vertices[i]->lid;
2031  input->Serve(numindices,&indices[0]);
2032  break;
2033  case P1DGEnum:
2034  numindices = 3;
2035  input->Serve(this->lid,numindices);
2036  break;
2037  default:
2038  input->Serve(this->lid,this->GetNumberOfNodes(interpolation));
2039  break;
2040  }
2041  return;
2042  }
2043 }/*}}}*/

◆ SpawnSeg()

Seg * Tria::SpawnSeg ( int  index1,
int  index2 
)

Definition at line 4050 of file Tria.cpp.

4050  {/*{{{*/
4051 
4052  int analysis_counter;
4053 
4054  /*go into parameters and get the analysis_counter: */
4055  this->parameters->FindParam(&analysis_counter,AnalysisCounterEnum);
4056 
4057  /*Create Seg*/
4058  Seg* seg=new Seg();
4059  seg->id=this->id;
4060  seg->sid=this->sid;
4061  seg->lid=this->lid;
4062  seg->inputs2=this->inputs2;
4063  seg->parameters=this->parameters;
4064  seg->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED)
4065  this->SpawnSegHook(xDynamicCast<ElementHook*>(seg),index1,index2);
4066 
4067  seg->iscollapsed = 1;
4068  seg->collapsed_ids[0] = index1;
4069  seg->collapsed_ids[1] = index2;
4070 
4071  /*Spawn material*/
4072  seg->material=(Material*)this->material->copy2(seg);
4073 
4074  /*recover nodes, material*/
4075  seg->nodes = (Node**)seg->hnodes[analysis_counter]->deliverp();
4076  seg->vertices = (Vertex**)seg->hvertices->deliverp();
4077 
4078  /*Return new Seg*/
4079  return seg;
4080 }

◆ StabilizationParameter()

IssmDouble Tria::StabilizationParameter ( IssmDouble  u,
IssmDouble  v,
IssmDouble  w,
IssmDouble  diameter,
IssmDouble  kappa 
)
inlinevirtual

Implements Element.

Definition at line 232 of file Tria.h.

232 {_error_("not implemented yet");};

◆ StabilizationParameterAnisotropic()

void Tria::StabilizationParameterAnisotropic ( IssmDouble tau_parameter_ansiotropic,
IssmDouble  u,
IssmDouble  v,
IssmDouble  w,
IssmDouble  hx,
IssmDouble  hy,
IssmDouble  hz,
IssmDouble  kappa 
)
inlinevirtual

Implements Element.

Definition at line 233 of file Tria.h.

233 {_error_("not implemented yet");};

◆ UpdateConstraintsExtrudeFromBase()

void Tria::UpdateConstraintsExtrudeFromBase ( void  )
virtual

Implements Element.

Definition at line 4802 of file Tria.cpp.

4802  {/*{{{*/
4803 
4804  if(!HasNodeOnBase()) return;
4805 
4806  int extrusioninput;
4807  IssmDouble value,isonbase;
4808 
4809  this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
4810  Input2* input = this->GetInput2(extrusioninput); _assert_(input);
4811  Input2* onbase = this->GetInput2(MeshVertexonbaseEnum); _assert_(onbase);
4812 
4813  GaussTria* gauss=new GaussTria();
4814  for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
4815  gauss->GaussNode(this->element_type,iv);
4816  onbase->GetInputValue(&isonbase,gauss);
4817  if(isonbase==1.){
4818  input->GetInputValue(&value,gauss);
4819  this->nodes[iv]->ApplyConstraint(0,value);
4820  }
4821  }
4822  delete gauss;
4823 
4824 }

◆ UpdateConstraintsExtrudeFromTop()

void Tria::UpdateConstraintsExtrudeFromTop ( void  )
virtual

Implements Element.

Definition at line 4826 of file Tria.cpp.

4826  {/*{{{*/
4827 
4828  if(!HasNodeOnSurface()) return;
4829 
4830  int extrusioninput;
4831  IssmDouble value,isonsurface;
4832 
4833  this->parameters->FindParam(&extrusioninput,InputToExtrudeEnum);
4834  Input2* input = this->GetInput2(extrusioninput); _assert_(input);
4835  Input2* onsurf = this->GetInput2(MeshVertexonsurfaceEnum); _assert_(onsurf);
4836 
4837  GaussTria* gauss=new GaussTria();
4838  for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
4839  gauss->GaussNode(this->element_type,iv);
4840  onsurf->GetInputValue(&isonsurface,gauss);
4841  if(isonsurface==1.){
4842  input->GetInputValue(&value,gauss);
4843  this->nodes[iv]->ApplyConstraint(0,value);
4844  }
4845  }
4846  delete gauss;
4847 }

Field Documentation

◆ iscollapsed

int Tria::iscollapsed

Definition at line 32 of file Tria.h.


The documentation for this class was generated from the following files:
DataSet::Size
int Size()
Definition: DataSet.cpp:399
Tria::iscollapsed
int iscollapsed
Definition: Tria.h:32
ElementHook::ElementHook
ElementHook()
Definition: ElementHook.cpp:18
Element::StrainRateESA
void StrainRateESA(IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
Definition: Element.cpp:4035
ElementInput2::SetInput
virtual void SetInput(int interp_in, int row, IssmDouble value_in)=0
Element::GetVerticesConnectivityList
void GetVerticesConnectivityList(int *connectivitylist)
Definition: Element.cpp:1440
Element::lid
int lid
Definition: Element.h:46
TransientInput2::GetAllTimes
void GetAllTimes(IssmDouble **ptimesteps, int *pnumtimesteps)
Definition: TransientInput2.cpp:258
CrouzeixRaviartEnum
@ CrouzeixRaviartEnum
Definition: EnumDefinitions.h:1023
BaseEnum
@ BaseEnum
Definition: EnumDefinitions.h:495
StressTensorxxEnum
@ StressTensorxxEnum
Definition: EnumDefinitions.h:811
TriaRef::GetJacobianDeterminant
void GetJacobianDeterminant(IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: TriaRef.cpp:107
ElementVector::StaticCondensation
void StaticCondensation(ElementMatrix *Ke, int numindices, int *indices)
Definition: ElementVector.cpp:266
CalvingStressThresholdGroundediceEnum
@ CalvingStressThresholdGroundediceEnum
Definition: EnumDefinitions.h:506
SmbMassBalanceEnum
@ SmbMassBalanceEnum
Definition: EnumDefinitions.h:748
TransientInput2Enum
@ TransientInput2Enum
Definition: EnumDefinitions.h:1315
ElementInput2::Serve
virtual void Serve(int numindices, int *indices)=0
DeviatoricStressxzEnum
@ DeviatoricStressxzEnum
Definition: EnumDefinitions.h:526
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmDouble
double IssmDouble
Definition: types.h:37
HOApproximationEnum
@ HOApproximationEnum
Definition: EnumDefinitions.h:1095
Element::IsOnBase
bool IsOnBase()
Definition: Element.cpp:1984
DatasetInput2
Definition: DatasetInput2.h:14
FrontalForcingsBasinIcefrontAreaEnum
@ FrontalForcingsBasinIcefrontAreaEnum
Definition: EnumDefinitions.h:152
Element::GetDofList
void GetDofList(int **pdoflist, int approximation_enum, int setenum)
Definition: Element.cpp:961
Tria::EdgeOnSurfaceIndices
void EdgeOnSurfaceIndices(int *pindex1, int *pindex)
Definition: Tria.cpp:1252
PentaInput2::GetInterpolation
int GetInterpolation()
Definition: PentaInput2.cpp:266
ElementHook::SpawnSegHook
void SpawnSegHook(ElementHook *triahook, int ndex1, int index2)
Definition: ElementHook.cpp:192
Element::FindParam
void FindParam(bool *pvalue, int paramenum)
Definition: Element.cpp:933
ElementHook::SetHookNodes
void SetHookNodes(int *node_ids, int numnodes, int analysis_counter)
Definition: ElementHook.cpp:188
CalvingMeltingFluxLevelsetEnum
@ CalvingMeltingFluxLevelsetEnum
Definition: EnumDefinitions.h:513
DeviatoricStressyzEnum
@ DeviatoricStressyzEnum
Definition: EnumDefinitions.h:528
TriaRef::GetSegmentJacobianDeterminant
void GetSegmentJacobianDeterminant(IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: TriaRef.cpp:229
DataSet::AddObject
int AddObject(Object *object)
Definition: DataSet.cpp:252
Element::HasNodeOnSurface
bool HasNodeOnSurface()
Definition: Element.cpp:1565
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
MaskOceanLevelsetEnum
@ MaskOceanLevelsetEnum
Definition: EnumDefinitions.h:640
Hook::deliverp
Object ** deliverp(void)
Definition: Hook.cpp:187
SSAHOApproximationEnum
@ SSAHOApproximationEnum
Definition: EnumDefinitions.h:1257
DeviatoricStress2Enum
@ DeviatoricStress2Enum
Definition: EnumDefinitions.h:531
MaskIceLevelsetEnum
@ MaskIceLevelsetEnum
Definition: EnumDefinitions.h:641
MeshVertexonboundaryEnum
@ MeshVertexonboundaryEnum
Definition: EnumDefinitions.h:654
TriaRef::GetJacobianDeterminant3D
void GetJacobianDeterminant3D(IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: TriaRef.cpp:121
ADD_VAL
@ ADD_VAL
Definition: toolkitsenums.h:14
MaterialsRhoFreshwaterEnum
@ MaterialsRhoFreshwaterEnum
Definition: EnumDefinitions.h:263
MARSHALLING_ENUM
#define MARSHALLING_ENUM(EN)
Definition: Marshalling.h:14
CalvinglevermannCoeffEnum
@ CalvinglevermannCoeffEnum
Definition: EnumDefinitions.h:507
Seg::collapsed_ids
int collapsed_ids[2]
Definition: Seg.h:31
DeviatoricStressxxEnum
@ DeviatoricStressxxEnum
Definition: EnumDefinitions.h:524
MINIEnum
@ MINIEnum
Definition: EnumDefinitions.h:1156
Inputs2::SetTriaControlInput
void SetTriaControlInput(int enum_in, int layout, int interpolation, int id, int numindices, int *indices, IssmDouble *values, IssmDouble *values_min, IssmDouble *values_max)
Definition: Inputs2.cpp:692
IoModel::my_vertices_lids
int * my_vertices_lids
Definition: IoModel.h:73
BedEnum
@ BedEnum
Definition: EnumDefinitions.h:499
Seg::iscollapsed
int iscollapsed
Definition: Seg.h:30
P0Enum
@ P0Enum
Definition: EnumDefinitions.h:661
TransientInput2
Definition: TransientInput2.h:13
TriaInput2::Serve
void Serve(int numindices, int *indices)
Definition: TriaInput2.cpp:202
EsaRotationrateEnum
@ EsaRotationrateEnum
Definition: EnumDefinitions.h:562
MeshVertexonbaseEnum
@ MeshVertexonbaseEnum
Definition: EnumDefinitions.h:653
Material::copy2
virtual Material * copy2(Element *element)=0
StressTensorzzEnum
@ StressTensorzzEnum
Definition: EnumDefinitions.h:816
CalvingCrevasseDepthEnum
@ CalvingCrevasseDepthEnum
Definition: EnumDefinitions.h:96
EsaYmotionEnum
@ EsaYmotionEnum
Definition: EnumDefinitions.h:568
Material::ViscosityHO
virtual void ViscosityHO(IssmDouble *pviscosity, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)=0
GaussTria::GaussNode
void GaussNode(int finitelement, int iv)
Definition: GaussTria.cpp:492
PressureEnum
@ PressureEnum
Definition: EnumDefinitions.h:664
MaterialsRhoIceEnum
@ MaterialsRhoIceEnum
Definition: EnumDefinitions.h:264
P1DGEnum
@ P1DGEnum
Definition: EnumDefinitions.h:1215
Tria::EdgeOnBaseIndices
void EdgeOnBaseIndices(int *pindex1, int *pindex)
Definition: Tria.cpp:1214
TransientInput2::numtimesteps
int numtimesteps
Definition: TransientInput2.h:21
Element::vertices
Vertex ** vertices
Definition: Element.h:49
Material
Definition: Material.h:21
TransientInputEnum
@ TransientInputEnum
Definition: EnumDefinitions.h:1314
AnalysisCounterEnum
@ AnalysisCounterEnum
Definition: EnumDefinitions.h:35
PentaInput2::Serve
void Serve(int numindices, int *indices)
Definition: PentaInput2.cpp:208
VertexLIdEnum
@ VertexLIdEnum
Definition: EnumDefinitions.h:1323
FrontalForcingsThermalForcingEnum
@ FrontalForcingsThermalForcingEnum
Definition: EnumDefinitions.h:587
Gauss::GaussNode
virtual void GaussNode(int finitelement, int iv)=0
BedSlopeXEnum
@ BedSlopeXEnum
Definition: EnumDefinitions.h:500
ControlInputSizeMEnum
@ ControlInputSizeMEnum
Definition: EnumDefinitions.h:105
Contour
Definition: Contour.h:15
Tria::PressureInterpolation
int PressureInterpolation()
Definition: Tria.cpp:3745
P1bubblecondensedEnum
@ P1bubblecondensedEnum
Definition: EnumDefinitions.h:1219
ConstantsYtsEnum
@ ConstantsYtsEnum
Definition: EnumDefinitions.h:104
GaussTria::begin
int begin(void)
Definition: GaussTria.cpp:356
MaterialsRheologyNEnum
@ MaterialsRheologyNEnum
Definition: EnumDefinitions.h:651
Element::IsFloating
bool IsFloating()
Definition: Element.cpp:1987
Vertex::Lid
int Lid(void)
Definition: Vertex.cpp:166
DeviatoricStressxyEnum
@ DeviatoricStressxyEnum
Definition: EnumDefinitions.h:525
Element::Sid
int Sid()
Definition: Element.cpp:3578
Input2::copy
virtual Input2 * copy()=0
StressTensorxyEnum
@ StressTensorxyEnum
Definition: EnumDefinitions.h:812
Inputs2::SetTriaInput
void SetTriaInput(int enum_in, int interpolation, int row, IssmDouble values)
Definition: Inputs2.cpp:768
Element::isonbase
bool isonbase
Definition: Element.h:53
FSApproximationEnum
@ FSApproximationEnum
Definition: EnumDefinitions.h:1060
StrainRateperpendicularEnum
@ StrainRateperpendicularEnum
Definition: EnumDefinitions.h:803
Tria::MassFlux
IssmDouble MassFlux(IssmDouble *segment)
Definition: Tria.cpp:3433
VyEnum
@ VyEnum
Definition: EnumDefinitions.h:850
GaussTria::GaussFromCoords
void GaussFromCoords(IssmDouble x1, IssmDouble y1, IssmDouble *xyz_list)
Definition: GaussTria.cpp:453
Hook::reset
void reset(void)
Definition: Hook.cpp:211
TriaRef::VelocityInterpolation
int VelocityInterpolation(int fe_stokes)
Definition: TriaRef.cpp:518
Tria::HasEdgeOnSurface
bool HasEdgeOnSurface()
Definition: Tria.cpp:2573
EsaStrainrateyyEnum
@ EsaStrainrateyyEnum
Definition: EnumDefinitions.h:565
Input2::GetInputMaxAbs
virtual IssmDouble GetInputMaxAbs(void)
Definition: Input2.h:35
Input2::ChangeEnum
void ChangeEnum(int newenumtype)
Definition: Input2.h:26
Tria::SpawnSeg
Seg * SpawnSeg(int index1, int index2)
Definition: Tria.cpp:4050
CalvingMeltingrateEnum
@ CalvingMeltingrateEnum
Definition: EnumDefinitions.h:504
ElementHook::hmaterial
Hook * hmaterial
Definition: ElementHook.h:17
ElementInput2
Definition: ElementInput2.h:7
EsaStrainratexyEnum
@ EsaStrainratexyEnum
Definition: EnumDefinitions.h:564
MaterialsRheologyBbarEnum
@ MaterialsRheologyBbarEnum
Definition: EnumDefinitions.h:644
GaussTria::GaussVertex
void GaussVertex(int iv)
Definition: GaussTria.cpp:550
Tria::GetLevelsetPositivePart
void GetLevelsetPositivePart(int *point1, IssmDouble *fraction1, IssmDouble *fraction2, bool *mainlynegative, IssmDouble *levelsetvalues)
Definition: Tria.cpp:2315
P0DGEnum
@ P0DGEnum
Definition: EnumDefinitions.h:1214
Element::nodes
Node ** nodes
Definition: Element.h:48
DeviatoricStresszzEnum
@ DeviatoricStresszzEnum
Definition: EnumDefinitions.h:529
Tria::VelocityInterpolation
int VelocityInterpolation()
Definition: Tria.cpp:4876
IoModel::numberofvertices
int numberofvertices
Definition: IoModel.h:99
P1Enum
@ P1Enum
Definition: EnumDefinitions.h:662
TriaInput2::copy
Input2 * copy()
Definition: TriaInput2.cpp:72
Domain2DhorizontalEnum
@ Domain2DhorizontalEnum
Definition: EnumDefinitions.h:534
ElementMatrix::StaticCondensation
void StaticCondensation(int numindices, int *indices)
Definition: ElementMatrix.cpp:524
TaylorHoodEnum
@ TaylorHoodEnum
Definition: EnumDefinitions.h:1299
CalvingrateyEnum
@ CalvingrateyEnum
Definition: EnumDefinitions.h:511
GaussTria
Definition: GaussTria.h:12
Tria::InputServe
void InputServe(Input2 *input_in)
Definition: Tria.cpp:1974
TriaRef::PressureInterpolation
int PressureInterpolation(int fe_stokes)
Definition: TriaRef.cpp:491
LATaylorHoodEnum
@ LATaylorHoodEnum
Definition: EnumDefinitions.h:1139
TriaInput2::GetInputAverage
void GetInputAverage(IssmDouble *pvalue)
Definition: TriaInput2.cpp:256
IoModel::numberofelements
int numberofelements
Definition: IoModel.h:96
PentaInput2::ServeCollapsed
void ServeCollapsed(int row, int state)
Definition: PentaInput2.cpp:240
PentaInput2::SetServeCollapsed
void SetServeCollapsed(int)
Definition: PentaInput2.cpp:263
TriaInput2Enum
@ TriaInput2Enum
Definition: EnumDefinitions.h:1124
Tria::NormalBase
void NormalBase(IssmDouble *normal, IssmDouble *xyz_list)
Definition: Tria.cpp:3655
ConstantsGEnum
@ ConstantsGEnum
Definition: EnumDefinitions.h:102
Tria::GetLevelsetIntersection
void GetLevelsetIntersection(int **pindices, int *pnumiceverts, IssmDouble *fraction, int levelset_enum, IssmDouble level)
Definition: Tria.cpp:2239
Hook::delivers
Object * delivers(void)
Definition: Hook.cpp:191
VertexSIdEnum
@ VertexSIdEnum
Definition: EnumDefinitions.h:1325
BasalforcingsGroundediceMeltingRateEnum
@ BasalforcingsGroundediceMeltingRateEnum
Definition: EnumDefinitions.h:478
InputToExtrudeEnum
@ InputToExtrudeEnum
Definition: EnumDefinitions.h:205
Element::inputs2
Inputs2 * inputs2
Definition: Element.h:47
NoneApproximationEnum
@ NoneApproximationEnum
Definition: EnumDefinitions.h:1201
Element::id
int id
Definition: Element.h:44
TransientInput2::GetTimeByOffset
IssmDouble GetTimeByOffset(int offset)
Definition: TransientInput2.cpp:539
CalvingratexAverageEnum
@ CalvingratexAverageEnum
Definition: EnumDefinitions.h:508
Element::sid
int sid
Definition: Element.h:45
Vector::SetValues
void SetValues(int ssize, int *list, doubletype *values, InsMode mode)
Definition: Vector.h:153
DomainTypeEnum
@ DomainTypeEnum
Definition: EnumDefinitions.h:124
VxAverageEnum
@ VxAverageEnum
Definition: EnumDefinitions.h:845
ApproximationEnum
@ ApproximationEnum
Definition: EnumDefinitions.h:470
FrontalForcingsNumberofBasinsEnum
@ FrontalForcingsNumberofBasinsEnum
Definition: EnumDefinitions.h:153
TimesteppingCflCoefficientEnum
@ TimesteppingCflCoefficientEnum
Definition: EnumDefinitions.h:428
DeviatoricStress1Enum
@ DeviatoricStress1Enum
Definition: EnumDefinitions.h:530
TriaRef::GetNodalFunctions
void GetNodalFunctions(IssmDouble *basis, Gauss *gauss, int finiteelement)
Definition: TriaRef.cpp:147
SurfaceCrevasseEnum
@ SurfaceCrevasseEnum
Definition: EnumDefinitions.h:822
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
TriaInput2
Definition: TriaInput2.h:8
Hook
Definition: Hook.h:16
DeviatoricStressyyEnum
@ DeviatoricStressyyEnum
Definition: EnumDefinitions.h:527
Element::element_type_list
int * element_type_list
Definition: Element.h:55
Tria::JacobianDeterminantSurface
void JacobianDeterminantSurface(IssmDouble *pJdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: Tria.cpp:3305
Hook::configure
void configure(DataSet *dataset)
Definition: Hook.cpp:145
NodesEnum
@ NodesEnum
Definition: EnumDefinitions.h:275
GsetEnum
@ GsetEnum
Definition: EnumDefinitions.h:1093
IoModel::elementtoedgeconnectivity
int * elementtoedgeconnectivity
Definition: IoModel.h:83
Matrix2x2Eigen
void Matrix2x2Eigen(IssmDouble *plambda1, IssmDouble *plambda2, IssmDouble *pvx, IssmDouble *pvy, IssmDouble a11, IssmDouble a21, IssmDouble a22)
Definition: MatrixUtils.cpp:348
BasalforcingsFloatingiceMeltingRateEnum
@ BasalforcingsFloatingiceMeltingRateEnum
Definition: EnumDefinitions.h:476
Domain3DsurfaceEnum
@ Domain3DsurfaceEnum
Definition: EnumDefinitions.h:1039
ElementEnum
@ ElementEnum
Definition: EnumDefinitions.h:1049
alpha
IssmDouble alpha(IssmDouble x, IssmDouble y, IssmDouble z, int testid)
Definition: fsanalyticals.cpp:221
Tria::GetNumberOfNodes
int GetNumberOfNodes(void)
Definition: Tria.cpp:2377
Tria::GetAreaCoordinates
void GetAreaCoordinates(IssmDouble *area_coordinates, IssmDouble *xyz_zero, IssmDouble *xyz_list, int numpoints)
Definition: Tria.cpp:1523
IoModel::FindConstant
void FindConstant(bool *pvalue, const char *constant_name)
Definition: IoModel.cpp:2362
DamageDEnum
@ DamageDEnum
Definition: EnumDefinitions.h:516
P2bubbleEnum
@ P2bubbleEnum
Definition: EnumDefinitions.h:1224
StrainRateeffectiveEnum
@ StrainRateeffectiveEnum
Definition: EnumDefinitions.h:801
Element::GetInput2Value
void GetInput2Value(bool *pvalue, int enum_type)
Definition: Element.cpp:1185
Material::ViscosityFS
virtual void ViscosityFS(IssmDouble *pviscosity, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)=0
MARSHALLING
#define MARSHALLING(FIELD)
Definition: Marshalling.h:29
Element::GetVerticesCoordinates
void GetVerticesCoordinates(IssmDouble **xyz_list)
Definition: Element.cpp:1446
DatasetInput2::GetPentaInputByOffset
PentaInput2 * GetPentaInputByOffset(int i)
Definition: DatasetInput2.cpp:237
Tria::NormalSection
void NormalSection(IssmDouble *normal, IssmDouble *xyz_list)
Definition: Tria.cpp:3671
StressTensoryyEnum
@ StressTensoryyEnum
Definition: EnumDefinitions.h:814
P1P1Enum
@ P1P1Enum
Definition: EnumDefinitions.h:1216
MINIcondensedEnum
@ MINIcondensedEnum
Definition: EnumDefinitions.h:1157
SigmaVMEnum
@ SigmaVMEnum
Definition: EnumDefinitions.h:705
INS_VAL
@ INS_VAL
Definition: toolkitsenums.h:14
TriaRef::Marshall
void Marshall(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
Definition: TriaRef.h:30
ElementInput2::GetInterpolation
virtual int GetInterpolation()=0
GaussTria::GaussPoint
void GaussPoint(int ig)
Definition: GaussTria.cpp:479
Tria::Tria
Tria()
Definition: Tria.h:35
SurfaceEnum
@ SurfaceEnum
Definition: EnumDefinitions.h:823
Gauss::Enum
virtual int Enum(void)=0
PentaInput2
Definition: PentaInput2.h:8
TriaInput2::GetInterpolation
int GetInterpolation()
Definition: TriaInput2.cpp:253
TriaRef::GetInputDerivativeValue
void GetInputDerivativeValue(IssmDouble *pp, IssmDouble *plist, IssmDouble *xyz_list, Gauss *gauss, int finiteelement)
Definition: TriaRef.cpp:34
Domain3DEnum
@ Domain3DEnum
Definition: EnumDefinitions.h:536
MaterialsRhoSeawaterEnum
@ MaterialsRhoSeawaterEnum
Definition: EnumDefinitions.h:265
PI
const double PI
Definition: constants.h:11
Tria::FiniteElement
int FiniteElement(void)
Definition: Tria.cpp:1318
Hook::copy
Object * copy(void)
Definition: Hook.cpp:61
IsInputEnum
bool IsInputEnum(int enum_in)
Definition: EnumToStringx.cpp:1368
P1bubbleEnum
@ P1bubbleEnum
Definition: EnumDefinitions.h:1218
Inputs2::GetPentaInput
PentaInput2 * GetPentaInput(int enum_type)
Definition: Inputs2.cpp:363
ElementHook::Marshall
void Marshall(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
Definition: ElementHook.cpp:67
DamageDbarEnum
@ DamageDbarEnum
Definition: EnumDefinitions.h:518
Object::ObjectEnum
virtual int ObjectEnum()=0
Vertex::Connectivity
int Connectivity(void)
Definition: Vertex.cpp:138
StrainRateparallelEnum
@ StrainRateparallelEnum
Definition: EnumDefinitions.h:802
Tria::copy
Object * copy()
Definition: Tria.cpp:86
Input2
Definition: Input2.h:18
Element::GetDofListLocal
void GetDofListLocal(int **pdoflist, int approximation_enum, int setenum)
Definition: Element.cpp:984
Element::GetVerticesSidList
void GetVerticesSidList(int *sidlist)
Definition: Element.cpp:1456
DeviatoricStresseffectiveEnum
@ DeviatoricStresseffectiveEnum
Definition: EnumDefinitions.h:523
VertexPIdEnum
@ VertexPIdEnum
Definition: EnumDefinitions.h:1324
DatasetInput2::GetNumIds
int GetNumIds() const
Definition: DatasetInput2.h:24
Seg
Definition: Seg.h:27
Tria::GetIcefrontCoordinates
void GetIcefrontCoordinates(IssmDouble **pxyz_front, IssmDouble *xyz_list, int levelsetenum)
Definition: Tria.cpp:1844
SealevelEnum
@ SealevelEnum
Definition: EnumDefinitions.h:675
Gauss::GaussVertex
virtual void GaussVertex(int iv)=0
Inputs2::GetControlInput2Data
ElementInput2 * GetControlInput2Data(int enum_type, const char *data)
Definition: Inputs2.cpp:423
CalvingFluxLevelsetEnum
@ CalvingFluxLevelsetEnum
Definition: EnumDefinitions.h:512
Inputs2::GetTransientInput
TransientInput2 * GetTransientInput(int enum_type)
Definition: Inputs2.cpp:406
TriaRef::GetNodalFunctionsDerivatives
void GetNodalFunctionsDerivatives(IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss, int finiteelement)
Definition: TriaRef.cpp:202
TriaRef::TensorInterpolation
int TensorInterpolation(int fe_stokes)
Definition: TriaRef.cpp:509
Material::GetBbar
virtual IssmDouble GetBbar(Gauss *gauss)=0
LACrouzeixRaviartEnum
@ LACrouzeixRaviartEnum
Definition: EnumDefinitions.h:1138
Element::IsIceInElement
bool IsIceInElement()
Definition: Element.cpp:2021
IoModel::Data
IssmDouble * Data(const char *data_name)
Definition: IoModel.cpp:437
PentaInput2Enum
@ PentaInput2Enum
Definition: EnumDefinitions.h:1125
Node
Definition: Node.h:23
Tria::GetGroundedPortion
IssmDouble GetGroundedPortion(IssmDouble *xyz_list)
Definition: Tria.cpp:1619
Node::Sid
int Sid(void)
Definition: Node.cpp:622
ElementInput2::ObjectEnum
virtual int ObjectEnum()=0
CalvingStressThresholdFloatingiceEnum
@ CalvingStressThresholdFloatingiceEnum
Definition: EnumDefinitions.h:505
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
ElementHook::hvertices
Hook * hvertices
Definition: ElementHook.h:16
EsaXmotionEnum
@ EsaXmotionEnum
Definition: EnumDefinitions.h:567
Tria
Definition: Tria.h:29
Tria::GetAreaIce
IssmDouble GetAreaIce(void)
Definition: Tria.cpp:1462
Inputs2::GetTriaInput
TriaInput2 * GetTriaInput(int enum_type)
Definition: Inputs2.cpp:318
MeshScaleFactorEnum
@ MeshScaleFactorEnum
Definition: EnumDefinitions.h:652
Node::DofInFSet
void DofInFSet(int dof)
Definition: Node.cpp:694
XZvectorsToCoordinateSystem
void XZvectorsToCoordinateSystem(IssmDouble *T, IssmDouble *xzvectors)
Definition: XZvectorsToCoordinateSystem.cpp:8
MaterialsRheologyBEnum
@ MaterialsRheologyBEnum
Definition: EnumDefinitions.h:643
Element::parameters
Parameters * parameters
Definition: Element.h:51
Inputs2::SetTriaControlInputGradient
void SetTriaControlInputGradient(int enum_in, int interpolation, int numindices, int *indices, IssmDouble *values)
Definition: Inputs2.cpp:717
Tria::JacobianDeterminant
void JacobianDeterminant(IssmDouble *pJdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: Tria.cpp:3291
Gauss::begin
virtual int begin(void)=0
VxEnum
@ VxEnum
Definition: EnumDefinitions.h:846
MeshVertexonsurfaceEnum
@ MeshVertexonsurfaceEnum
Definition: EnumDefinitions.h:655
Node::DofInSSet
void DofInSSet(int dof)
Definition: Node.cpp:709
Material::ViscositySSA
virtual void ViscositySSA(IssmDouble *pviscosity, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)=0
min
IssmDouble min(IssmDouble a, IssmDouble b)
Definition: extrema.cpp:14
Tria::GetArea
IssmDouble GetArea(void)
Definition: Tria.cpp:1423
P2bubblecondensedEnum
@ P2bubblecondensedEnum
Definition: EnumDefinitions.h:1225
CalvingCalvingrateEnum
@ CalvingCalvingrateEnum
Definition: EnumDefinitions.h:502
ElementInput2::GetInputInterpolationType
int GetInputInterpolationType()
Definition: ElementInput2.cpp:32
Gauss::GaussPoint
virtual void GaussPoint(int ig)=0
TriaRef::GetInputValue
void GetInputValue(IssmDouble *pp, IssmDouble *plist, Gauss *gauss, int finiteelement)
Definition: TriaRef.cpp:68
NodeSIdEnum
@ NodeSIdEnum
Definition: EnumDefinitions.h:1200
GaussTriaEnum
@ GaussTriaEnum
Definition: EnumDefinitions.h:1081
StressTensorxzEnum
@ StressTensorxzEnum
Definition: EnumDefinitions.h:813
VyAverageEnum
@ VyAverageEnum
Definition: EnumDefinitions.h:849
Tria::IsIcefront
bool IsIcefront(void)
Definition: Tria.cpp:3239
TriaRef::NumberofNodes
int NumberofNodes(int finiteelement)
Definition: TriaRef.cpp:463
ElementHook::hneighbors
Hook * hneighbors
Definition: ElementHook.h:18
Parameters::FindParam
void FindParam(bool *pinteger, int enum_type)
Definition: Parameters.cpp:262
ThicknessEnum
@ ThicknessEnum
Definition: EnumDefinitions.h:840
ElementInput2::element_values
IssmDouble * element_values
Definition: ElementInput2.h:18
WaterheightEnum
@ WaterheightEnum
Definition: EnumDefinitions.h:863
Element::GetVerticesPidList
void GetVerticesPidList(int *pidlist)
Definition: Element.cpp:1433
NUMVERTICES
#define NUMVERTICES
Definition: Tria.cpp:29
Element::GetNodeIndex
int GetNodeIndex(Node *node)
Definition: Element.cpp:1212
SSAApproximationEnum
@ SSAApproximationEnum
Definition: EnumDefinitions.h:1255
FrontalForcingsBasinIdEnum
@ FrontalForcingsBasinIdEnum
Definition: EnumDefinitions.h:585
P2Enum
@ P2Enum
Definition: EnumDefinitions.h:1223
VelEnum
@ VelEnum
Definition: EnumDefinitions.h:844
Inputs2::GetDatasetInput2
DatasetInput2 * GetDatasetInput2(int enum_type)
Definition: Inputs2.cpp:438
ElementHook::hnodes
Hook ** hnodes
Definition: ElementHook.h:15
Node::ApplyConstraint
void ApplyConstraint(int dof, IssmDouble value)
Definition: Node.cpp:646
IoModel::elements
int * elements
Definition: IoModel.h:79
Element::StrainRateSSA
void StrainRateSSA(IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input)
Definition: Element.cpp:4138
Element::MarshallElement
void MarshallElement(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction, int numanalyses)
Definition: Element.cpp:2222
Tria::AddInput2
void AddInput2(int input_enum, IssmDouble *values, int interpolation_enum)
Definition: Tria.cpp:185
Input2::GetInputValue
virtual void GetInputValue(IssmDouble *pvalue, Gauss *gauss)
Definition: Input2.h:38
Tria::IsZeroLevelset
bool IsZeroLevelset(int levelset_enum)
Definition: Tria.cpp:3272
Vertex
Definition: Vertex.h:19
Gauss::weight
IssmDouble weight
Definition: Gauss.h:11
P1P1GLSEnum
@ P1P1GLSEnum
Definition: EnumDefinitions.h:1217
Element::HasNodeOnBase
bool HasNodeOnBase()
Definition: Element.cpp:1561
Tria::SetElementInput
void SetElementInput(int enum_in, IssmDouble values)
Definition: Tria.cpp:4012
Inputs2::SetTriaDatasetInput
void SetTriaDatasetInput(int enum_in, int id, int interpolation, int numindices, int *indices, IssmDouble *values)
Definition: Inputs2.cpp:743
SigmaNNEnum
@ SigmaNNEnum
Definition: EnumDefinitions.h:704
max
IssmDouble max(IssmDouble a, IssmDouble b)
Definition: extrema.cpp:24
IssmPDouble
IssmDouble IssmPDouble
Definition: types.h:38
TransientInput2::GetTriaInput
TriaInput2 * GetTriaInput()
Definition: TransientInput2.cpp:270
Tria::NewGauss
Gauss * NewGauss(void)
Definition: Tria.cpp:3515
Element::GetInputListOnVertices
void GetInputListOnVertices(IssmDouble *pvalue, int enumtype)
Definition: Element.cpp:1131
IoModel::domaintype
int domaintype
Definition: IoModel.h:78
Tria::GetGroundedPart
void GetGroundedPart(int *point1, IssmDouble *fraction1, IssmDouble *fraction2, bool *mainlyfloating)
Definition: Tria.cpp:1565
EsaStrainratexxEnum
@ EsaStrainratexxEnum
Definition: EnumDefinitions.h:563
Domain2DverticalEnum
@ Domain2DverticalEnum
Definition: EnumDefinitions.h:535
BasalCrevasseEnum
@ BasalCrevasseEnum
Definition: EnumDefinitions.h:475
FrontalForcingsSubglacialDischargeEnum
@ FrontalForcingsSubglacialDischargeEnum
Definition: EnumDefinitions.h:586
Element::GetInputListOnNodesVelocity
void GetInputListOnNodesVelocity(IssmDouble *pvalue, int enumtype)
Definition: Element.cpp:1114
Inputs2::AddInput
void AddInput(Input2 *in_input)
Definition: Inputs2.cpp:147
Element::GradientIndexing
void GradientIndexing(int *indexing, int control_index)
Definition: Element.cpp:1510
CalvingrateyAverageEnum
@ CalvingrateyAverageEnum
Definition: EnumDefinitions.h:510
Tria::NumberofNodesVelocity
int NumberofNodesVelocity(void)
Definition: Tria.cpp:3714
Input2::GetInputAverage
virtual void GetInputAverage(IssmDouble *pvalue)
Definition: Input2.h:33
Element::isonsurface
bool isonsurface
Definition: Element.h:52
CrevasseDepthEnum
@ CrevasseDepthEnum
Definition: EnumDefinitions.h:515
Element::element_type
int element_type
Definition: Element.h:56
Node::GetNumberOfDofs
int GetNumberOfDofs(int approximation_enum, int setenum)
Definition: Node.cpp:741
Gauss
Definition: Gauss.h:8
Element::material
Material * material
Definition: Element.h:50
Tria::GetInput2
Input2 * GetInput2(int enumtype)
Definition: Tria.cpp:1880
TriaEnum
@ TriaEnum
Definition: EnumDefinitions.h:1318
Tria::GetVertexIndex
int GetVertexIndex(Vertex *vertex)
Definition: Tria.cpp:2368
CalvingratexEnum
@ CalvingratexEnum
Definition: EnumDefinitions.h:509
Element::GetVerticesLidList
void GetVerticesLidList(int *lidlist)
Definition: Element.cpp:1426
Vector::SetValue
void SetValue(int dof, doubletype value, InsMode mode)
Definition: Vector.h:163
GetNumberOfDofs
int GetNumberOfDofs(Node **nodes, int numnodes, int setenum, int approximation)
Definition: Node.cpp:1129
Vertex::Sid
int Sid(void)
Definition: Vertex.cpp:168
XTaylorHoodEnum
@ XTaylorHoodEnum
Definition: EnumDefinitions.h:1329
Tria::HasEdgeOnBase
bool HasEdgeOnBase()
Definition: Tria.cpp:2552
DatasetInput2::GetTriaInputByOffset
TriaInput2 * GetTriaInputByOffset(int i)
Definition: DatasetInput2.cpp:222
IoModel::numberofedges
int numberofedges
Definition: IoModel.h:93
StressTensoryzEnum
@ StressTensoryzEnum
Definition: EnumDefinitions.h:815
ElementInput2::GetInputValue
virtual void GetInputValue(IssmDouble *pvalue, Gauss *gauss)=0
Tria::GetVerticesCoordinatesBase
void GetVerticesCoordinatesBase(IssmDouble **pxyz_list)
Definition: Tria.cpp:2491
ElementHook::numanalyses
int numanalyses
Definition: ElementHook.h:14
Tria::TensorInterpolation
int TensorInterpolation()
Definition: Tria.cpp:4219