Changeset 4434
- Timestamp:
- 07/07/10 15:05:40 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r4423 r4434 355 355 else if (analysis_type==DiagnosticHorizAnalysisEnum){ 356 356 InputUpdateFromSolutionDiagnosticHoriz( solution); 357 } 358 else if (analysis_type==DiagnosticHutterAnalysisEnum){ 359 InputUpdateFromSolutionDiagnosticHutter( solution); 357 360 } 358 361 else if (analysis_type==DiagnosticVertAnalysisEnum){ … … 1944 1947 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHoriz {{{1*/ 1945 1948 void Penta::InputUpdateFromSolutionDiagnosticHoriz(double* solution){ 1949 1950 int i; 1951 1952 const int numvertices=6; 1953 const int numdofpervertex=2; 1954 const int numdof=numdofpervertex*numvertices; 1955 1956 int doflist[numdof]; 1957 double values[numdof]; 1958 double vx[numvertices]; 1959 double vy[numvertices]; 1960 double vz[numvertices]; 1961 double vel[numvertices]; 1962 int dummy; 1963 double pressure[numvertices]; 1964 double surface[numvertices]; 1965 double rho_ice,g; 1966 double xyz_list[numvertices][3]; 1967 double gauss[numvertices][numvertices]={{1,0,0,0},{0,1,0,0},{0,0,1,0},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 1968 1969 Input* VzInput=NULL; 1970 double* VzPtr=NULL; 1971 1972 /*Get dof list: */ 1973 GetDofList(&doflist[0],&dummy); 1974 1975 /*Get node data: */ 1976 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices); 1977 1978 /*Use the dof list to index into the solution vector: */ 1979 for(i=0;i<numdof;i++){ 1980 values[i]=solution[doflist[i]]; 1981 } 1982 1983 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 1984 for(i=0;i<numvertices;i++){ 1985 vx[i]=values[i*numdofpervertex+0]; 1986 vy[i]=values[i*numdofpervertex+1]; 1987 } 1988 1989 /*Get Vz*/ 1990 VzInput=inputs->GetInput(VzEnum); 1991 if (VzInput){ 1992 if (VzInput->Enum()!=PentaVertexInputEnum){ 1993 ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(VzInput->Enum())); 1994 } 1995 VzInput->GetValuesPtr(&VzPtr,&dummy); 1996 for(i=0;i<numvertices;i++) vz[i]=VzPtr[i]; 1997 } 1998 else{ 1999 for(i=0;i<numvertices;i++) vz[i]=0.0; 2000 } 2001 2002 /*Now Compute vel*/ 2003 for(i=0;i<numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 2004 2005 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 2006 *so the pressure is just the pressure at the z elevation: */ 2007 rho_ice=matpar->GetRhoIce(); 2008 g=matpar->GetG(); 2009 inputs->GetParameterValues(&surface[0],&gauss[0][0],6,SurfaceEnum); 2010 2011 for(i=0;i<numvertices;i++){ 2012 pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 2013 } 2014 /*Now, we have to move the previous Vx and Vy inputs to old 2015 * status, otherwise, we'll wipe them off: */ 2016 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 2017 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 2018 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 2019 2020 /*Add vx and vy as inputs to the tria element: */ 2021 this->inputs->AddInput(new PentaVertexInput(VxEnum,vx)); 2022 this->inputs->AddInput(new PentaVertexInput(VyEnum,vy)); 2023 this->inputs->AddInput(new TriaVertexInput(VelEnum,vel)); 2024 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 2025 } 2026 2027 /*}}}*/ 2028 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{1*/ 2029 void Penta::InputUpdateFromSolutionDiagnosticHutter(double* solution){ 1946 2030 1947 2031 int i; -
issm/trunk/src/c/objects/Elements/Penta.h
r4402 r4434 171 171 void InputUpdateFromSolutionBalancedvelocities( double* solutiong); 172 172 void InputUpdateFromSolutionDiagnosticHoriz( double* solutiong); 173 void InputUpdateFromSolutionDiagnosticHutter( double* solutiong); 173 174 void InputUpdateFromSolutionDiagnosticVert( double* solutiong); 174 175 void InputUpdateFromSolutionDiagnosticStokes( double* solutiong);
Note:
See TracChangeset
for help on using the changeset viewer.