[3683] | 1 | /*!\file PentaVertexInput.c
|
---|
| 2 | * \brief: implementation of the PentaVertexInput object
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | #ifdef HAVE_CONFIG_H
|
---|
| 6 | #include "config.h"
|
---|
| 7 | #else
|
---|
| 8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 9 | #endif
|
---|
| 10 |
|
---|
| 11 | #include "stdio.h"
|
---|
| 12 | #include <string.h>
|
---|
| 13 | #include "../objects.h"
|
---|
| 14 | #include "../../EnumDefinitions/EnumDefinitions.h"
|
---|
| 15 | #include "../../shared/shared.h"
|
---|
| 16 | #include "../../DataSet/DataSet.h"
|
---|
[3775] | 17 | #include "../../include/include.h"
|
---|
[3683] | 18 |
|
---|
| 19 | /*Object constructors and destructor*/
|
---|
| 20 | /*FUNCTION PentaVertexInput::PentaVertexInput(){{{1*/
|
---|
| 21 | PentaVertexInput::PentaVertexInput(){
|
---|
| 22 | return;
|
---|
| 23 | }
|
---|
| 24 | /*}}}*/
|
---|
[3847] | 25 | /*FUNCTION PentaVertexInput::PentaVertexInput(int in_enum_type,double* values){{{1*/
|
---|
[3683] | 26 | PentaVertexInput::PentaVertexInput(int in_enum_type,double* in_values){
|
---|
| 27 |
|
---|
| 28 | enum_type=in_enum_type;
|
---|
| 29 | values[0]=in_values[0];
|
---|
| 30 | values[1]=in_values[1];
|
---|
| 31 | values[2]=in_values[2];
|
---|
| 32 | values[3]=in_values[3];
|
---|
| 33 | values[4]=in_values[4];
|
---|
| 34 | values[5]=in_values[5];
|
---|
| 35 | }
|
---|
| 36 | /*}}}*/
|
---|
| 37 | /*FUNCTION PentaVertexInput::~PentaVertexInput(){{{1*/
|
---|
| 38 | PentaVertexInput::~PentaVertexInput(){
|
---|
| 39 | return;
|
---|
| 40 | }
|
---|
| 41 | /*}}}*/
|
---|
| 42 |
|
---|
| 43 | /*Object management*/
|
---|
| 44 | /*FUNCTION PentaVertexInput::copy{{{1*/
|
---|
| 45 | Object* PentaVertexInput::copy() {
|
---|
| 46 |
|
---|
| 47 | return new PentaVertexInput(this->enum_type,this->values);
|
---|
| 48 |
|
---|
| 49 | }
|
---|
| 50 | /*}}}*/
|
---|
| 51 | /*FUNCTION PentaVertexInput::DeepEcho{{{1*/
|
---|
| 52 | void PentaVertexInput::DeepEcho(void){
|
---|
| 53 |
|
---|
| 54 | printf("PentaVertexInput:\n");
|
---|
[3847] | 55 | printf(" enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
|
---|
| 56 | printf(" values: [%g %g %g %g %g %g]\n",this->values[0],this->values[1],this->values[2],this->values[3],this->values[4],this->values[5]);
|
---|
[3683] | 57 | }
|
---|
| 58 | /*}}}*/
|
---|
| 59 | /*FUNCTION PentaVertexInput::Demarshall{{{1*/
|
---|
| 60 | void PentaVertexInput::Demarshall(char** pmarshalled_dataset){
|
---|
| 61 |
|
---|
| 62 | char* marshalled_dataset=NULL;
|
---|
| 63 | int i;
|
---|
| 64 |
|
---|
| 65 | /*recover marshalled_dataset: */
|
---|
| 66 | marshalled_dataset=*pmarshalled_dataset;
|
---|
| 67 |
|
---|
| 68 | /*this time, no need to get enum type, the pointer directly points to the beginning of the
|
---|
| 69 | *object data (thanks to DataSet::Demarshall):*/
|
---|
| 70 | memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
|
---|
| 71 | memcpy(&values,marshalled_dataset,sizeof(values));marshalled_dataset+=sizeof(values);
|
---|
| 72 |
|
---|
| 73 | /*return: */
|
---|
| 74 | *pmarshalled_dataset=marshalled_dataset;
|
---|
| 75 | return;
|
---|
| 76 | }
|
---|
| 77 | /*}}}*/
|
---|
| 78 | /*FUNCTION PentaVertexInput::Echo {{{1*/
|
---|
| 79 | void PentaVertexInput::Echo(void){
|
---|
| 80 | this->DeepEcho();
|
---|
| 81 | }
|
---|
| 82 | /*}}}*/
|
---|
| 83 | /*FUNCTION PentaVertexInput::Enum{{{1*/
|
---|
| 84 | int PentaVertexInput::Enum(void){
|
---|
| 85 |
|
---|
| 86 | return PentaVertexInputEnum;
|
---|
| 87 |
|
---|
| 88 | }
|
---|
| 89 | /*}}}*/
|
---|
| 90 | /*FUNCTION PentaVertexInput::EnumType{{{1*/
|
---|
| 91 | int PentaVertexInput::EnumType(void){
|
---|
| 92 |
|
---|
| 93 | return this->enum_type;
|
---|
| 94 |
|
---|
| 95 | }
|
---|
| 96 | /*}}}*/
|
---|
| 97 | /*FUNCTION PentaVertexInput::Id{{{1*/
|
---|
| 98 | int PentaVertexInput::Id(void){ return -1; }
|
---|
| 99 | /*}}}*/
|
---|
| 100 | /*FUNCTION PentaVertexInput::Marshall{{{1*/
|
---|
| 101 | void PentaVertexInput::Marshall(char** pmarshalled_dataset){
|
---|
| 102 |
|
---|
| 103 | char* marshalled_dataset=NULL;
|
---|
| 104 | int enum_value=0;
|
---|
| 105 |
|
---|
| 106 | /*recover marshalled_dataset: */
|
---|
| 107 | marshalled_dataset=*pmarshalled_dataset;
|
---|
| 108 |
|
---|
| 109 | /*get enum value of PentaVertexInput: */
|
---|
| 110 | enum_value=PentaVertexInputEnum;
|
---|
| 111 |
|
---|
| 112 | /*marshall enum: */
|
---|
| 113 | memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);
|
---|
| 114 |
|
---|
| 115 | /*marshall PentaVertexInput data: */
|
---|
| 116 | memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
|
---|
| 117 | memcpy(marshalled_dataset,&values,sizeof(values));marshalled_dataset+=sizeof(values);
|
---|
| 118 |
|
---|
| 119 | *pmarshalled_dataset=marshalled_dataset;
|
---|
| 120 | }
|
---|
| 121 | /*}}}*/
|
---|
| 122 | /*FUNCTION PentaVertexInput::MarshallSize{{{1*/
|
---|
| 123 | int PentaVertexInput::MarshallSize(){
|
---|
| 124 |
|
---|
| 125 | return sizeof(values)+
|
---|
| 126 | +sizeof(enum_type)+
|
---|
| 127 | +sizeof(int); //sizeof(int) for enum value
|
---|
| 128 | }
|
---|
| 129 | /*}}}*/
|
---|
| 130 | /*FUNCTION PentaVertexInput::MyRank{{{1*/
|
---|
| 131 | int PentaVertexInput::MyRank(void){
|
---|
| 132 | extern int my_rank;
|
---|
| 133 | return my_rank;
|
---|
| 134 | }
|
---|
| 135 | /*}}}*/
|
---|
[3847] | 136 | /*FUNCTION PentaVertexInput::SpawnTriaInput{{{1*/
|
---|
| 137 | Input* PentaVertexInput::SpawnTriaInput(int* indices){
|
---|
[3683] | 138 |
|
---|
[3847] | 139 | /*output*/
|
---|
| 140 | TriaVertexInput* outinput=NULL;
|
---|
| 141 | double newvalues[3];
|
---|
| 142 |
|
---|
| 143 | /*Loop over the new indices*/
|
---|
| 144 | for(int i=0;i<3;i++){
|
---|
| 145 |
|
---|
| 146 | /*Check index value*/
|
---|
| 147 | ISSMASSERT(indices[i]>=0 && indices[i]<6);
|
---|
| 148 |
|
---|
| 149 | /*Assign value to new input*/
|
---|
| 150 | newvalues[i]=this->values[indices[i]];
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | /*Create new Tria input*/
|
---|
| 154 | outinput=new TriaVertexInput(this->enum_type,&newvalues[0]);
|
---|
| 155 |
|
---|
| 156 | /*Assign output*/
|
---|
| 157 | return outinput;
|
---|
| 158 |
|
---|
| 159 | }
|
---|
| 160 | /*}}}*/
|
---|
| 161 |
|
---|
[3683] | 162 | /*Object functions*/
|
---|
| 163 | /*FUNCTION PentaVertexInput::GetParameterValue(bool* pvalue) {{{1*/
|
---|
| 164 | void PentaVertexInput::GetParameterValue(bool* pvalue){ISSMERROR(" not supported yet!");}
|
---|
| 165 | /*}}}*/
|
---|
| 166 | /*FUNCTION PentaVertexInput::GetParameterValue(int* pvalue){{{1*/
|
---|
| 167 | void PentaVertexInput::GetParameterValue(int* pvalue){ISSMERROR(" not supported yet!");}
|
---|
| 168 | /*}}}*/
|
---|
| 169 | /*FUNCTION PentaVertexInput::GetParameterValue(double* pvalue){{{1*/
|
---|
| 170 | void PentaVertexInput::GetParameterValue(double* pvalue){ISSMERROR(" not supported yet!");}
|
---|
| 171 | /*}}}*/
|
---|
| 172 | /*FUNCTION PentaVertexInput::GetParameterValue(double* pvalue,Node* node){{{1*/
|
---|
| 173 | void PentaVertexInput::GetParameterValue(double* pvalue,Node* node){ISSMERROR(" not supported yet!");}
|
---|
| 174 | /*}}}*/
|
---|
| 175 | /*FUNCTION PentaVertexInput::GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_coord){{{1*/
|
---|
| 176 | void PentaVertexInput::GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_coord){ISSMERROR(" not supported yet!");}
|
---|
| 177 | /*}}}*/
|
---|
| 178 | /*FUNCTION PentaVertexInput::GetParameterValue(double* pvalue,double* gauss){{{1*/
|
---|
[3840] | 179 | void PentaVertexInput::GetParameterValue(double* pvalue,double* gauss){
|
---|
| 180 | /*P1 interpolation on Gauss point*/
|
---|
| 181 |
|
---|
| 182 | /*intermediary*/
|
---|
| 183 | double l1l6[6];
|
---|
| 184 |
|
---|
| 185 | /*nodal functions: */
|
---|
| 186 | GetNodalFunctionsP1(&l1l6[0],gauss);
|
---|
| 187 |
|
---|
| 188 | /*Assign output pointers:*/
|
---|
| 189 | *pvalue=l1l6[0]*values[0]+l1l6[1]*values[1]+l1l6[2]*values[2]+l1l6[3]*values[3]+l1l6[4]*values[4]+l1l6[5]*values[5];
|
---|
| 190 |
|
---|
| 191 | }
|
---|
[3683] | 192 | /*}}}*/
|
---|
| 193 | /*FUNCTION PentaVertexInput::GetParameterValue(double* pvalue,double* gauss,double defaultvalue){{{1*/
|
---|
| 194 | void PentaVertexInput::GetParameterValue(double* pvalue,double* gauss,double defaultvalue){ISSMERROR(" not supported yet!");}
|
---|
| 195 | /*}}}*/
|
---|
| 196 | /*FUNCTION PentaVertexInput::GetParameterValues(double* values,double* gauss_pointers, int numgauss){{{1*/
|
---|
[3840] | 197 | void PentaVertexInput::GetParameterValues(double* values,double* gauss_pointers, int numgauss){
|
---|
| 198 | /*It is assumed that output values has been correctly allocated*/
|
---|
| 199 |
|
---|
| 200 | int i,j;
|
---|
| 201 | double gauss[4];
|
---|
| 202 |
|
---|
| 203 | for (i=0;i<numgauss;i++){
|
---|
| 204 |
|
---|
| 205 | /*Get current Gauss point coordinates*/
|
---|
| 206 | for (j=0;j<4;j++) gauss[j]=gauss_pointers[i*4+j];
|
---|
| 207 |
|
---|
| 208 | /*Assign parameter value*/
|
---|
| 209 | GetParameterValue(&values[i],&gauss[0]);
|
---|
| 210 | }
|
---|
| 211 | }
|
---|
[3683] | 212 | /*}}}*/
|
---|
| 213 | /*FUNCTION PentaVertexInput::GetParameterDerivativeValue(double* derivativevalues, double* xyz_list, double* gauss){{{1*/
|
---|
[3840] | 214 | void PentaVertexInput::GetParameterDerivativeValue(double* p, double* xyz_list, double* gauss){
|
---|
| 215 | /*From grid values of parameter p (p_list[0], p_list[1], p_list[2], p_list[3], p_list[4] and p_list[4]), return parameter derivative value at gaussian point specified by gauss_coord:
|
---|
| 216 | * dp/dx=p_list[0]*dh1/dx+p_list[1]*dh2/dx+p_list[2]*dh3/dx+p_list[3]*dh4/dx+p_list[4]*dh5/dx+p_list[5]*dh6/dx;
|
---|
| 217 | * dp/dy=p_list[0]*dh1/dy+p_list[1]*dh2/dy+p_list[2]*dh3/dy+p_list[3]*dh4/dy+p_list[4]*dh5/dy+p_list[5]*dh6/dy;
|
---|
| 218 | * dp/dz=p_list[0]*dh1/dz+p_list[1]*dh2/dz+p_list[2]*dh3/dz+p_list[3]*dh4/dz+p_list[4]*dh5/dz+p_list[5]*dh6/dz;
|
---|
| 219 | *
|
---|
| 220 | * p is a vector of size 3x1 already allocated.
|
---|
| 221 | */
|
---|
| 222 |
|
---|
| 223 | const int NDOF3=3;
|
---|
| 224 | const int numgrids=6;
|
---|
| 225 | double dh1dh6[NDOF3][numgrids];
|
---|
| 226 |
|
---|
| 227 | /*Get nodal funnctions derivatives in actual coordinate system: */
|
---|
| 228 | GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],xyz_list, gauss);
|
---|
| 229 |
|
---|
| 230 | p[0]=this->values[0]*dh1dh6[0][0]+this->values[1]*dh1dh6[0][1]+this->values[2]*dh1dh6[0][2]+this->values[3]*dh1dh6[0][3]+this->values[4]*dh1dh6[0][4]+this->values[5]*dh1dh6[0][5];
|
---|
| 231 | p[1]=this->values[0]*dh1dh6[1][0]+this->values[1]*dh1dh6[1][1]+this->values[2]*dh1dh6[1][2]+this->values[3]*dh1dh6[1][3]+this->values[4]*dh1dh6[1][4]+this->values[5]*dh1dh6[1][5];
|
---|
| 232 | p[2]=this->values[0]*dh1dh6[2][0]+this->values[1]*dh1dh6[2][1]+this->values[2]*dh1dh6[2][2]+this->values[3]*dh1dh6[2][3]+this->values[4]*dh1dh6[2][4]+this->values[5]*dh1dh6[2][5];
|
---|
| 233 |
|
---|
| 234 | }
|
---|
[3683] | 235 | /*}}}*/
|
---|
[3855] | 236 | /*FUNCTION PentaVertexInput::GetVxStrainRate3d(double* epsilonvx,double* xyz_list, double* gauss) {{{1*/
|
---|
| 237 | void PentaVertexInput::GetVxStrainRate3d(double* epsilonvx,double* xyz_list, double* gauss){
|
---|
[3840] | 238 | int i,j;
|
---|
| 239 |
|
---|
| 240 | const int numgrids=6;
|
---|
| 241 | const int DOFVELOCITY=3;
|
---|
| 242 | double B[8][27];
|
---|
| 243 | double B_reduced[6][DOFVELOCITY*numgrids];
|
---|
[3875] | 244 | double velocity[numgrids][DOFVELOCITY];
|
---|
[3840] | 245 |
|
---|
| 246 | /*Get B matrix: */
|
---|
| 247 | GetBStokes(&B[0][0], xyz_list, gauss);
|
---|
| 248 | /*Create a reduced matrix of B to get rid of pressure */
|
---|
| 249 | for (i=0;i<6;i++){
|
---|
| 250 | for (j=0;j<3;j++){
|
---|
| 251 | B_reduced[i][j]=B[i][j];
|
---|
| 252 | }
|
---|
| 253 | for (j=4;j<7;j++){
|
---|
| 254 | B_reduced[i][j-1]=B[i][j];
|
---|
| 255 | }
|
---|
| 256 | for (j=8;j<11;j++){
|
---|
| 257 | B_reduced[i][j-2]=B[i][j];
|
---|
| 258 | }
|
---|
| 259 | for (j=12;j<15;j++){
|
---|
| 260 | B_reduced[i][j-3]=B[i][j];
|
---|
| 261 | }
|
---|
| 262 | for (j=16;j<19;j++){
|
---|
| 263 | B_reduced[i][j-4]=B[i][j];
|
---|
| 264 | }
|
---|
| 265 | for (j=20;j<23;j++){
|
---|
| 266 | B_reduced[i][j-5]=B[i][j];
|
---|
| 267 | }
|
---|
| 268 | }
|
---|
| 269 |
|
---|
| 270 | /*Here, we are computing the strain rate of (vx,0,0)*/
|
---|
| 271 | for(i=0;i<numgrids;i++){
|
---|
| 272 | velocity[i][0]=this->values[i];
|
---|
| 273 | velocity[i][1]=0.0;
|
---|
| 274 | velocity[i][2]=0.0;
|
---|
| 275 | }
|
---|
| 276 | /*Multiply B by velocity, to get strain rate: */
|
---|
| 277 | MatrixMultiply(&B_reduced[0][0],6,DOFVELOCITY*numgrids,0,&velocity[0][0],DOFVELOCITY*numgrids,1,0,epsilonvx,0);
|
---|
| 278 |
|
---|
| 279 | }
|
---|
| 280 | /*}}}*/
|
---|
[3855] | 281 | /*FUNCTION PentaVertexInput::GetVyStrainRate3d(double* epsilonvy,double* xyz_list, double* gauss) {{{1*/
|
---|
| 282 | void PentaVertexInput::GetVyStrainRate3d(double* epsilonvy,double* xyz_list, double* gauss){
|
---|
[3840] | 283 | int i,j;
|
---|
| 284 |
|
---|
| 285 | const int numgrids=6;
|
---|
| 286 | const int DOFVELOCITY=3;
|
---|
| 287 | double B[8][27];
|
---|
| 288 | double B_reduced[6][DOFVELOCITY*numgrids];
|
---|
[3875] | 289 | double velocity[numgrids][DOFVELOCITY];
|
---|
[3840] | 290 |
|
---|
| 291 | /*Get B matrix: */
|
---|
| 292 | GetBStokes(&B[0][0], xyz_list, gauss);
|
---|
| 293 | /*Create a reduced matrix of B to get rid of pressure */
|
---|
| 294 | for (i=0;i<6;i++){
|
---|
| 295 | for (j=0;j<3;j++){
|
---|
| 296 | B_reduced[i][j]=B[i][j];
|
---|
| 297 | }
|
---|
| 298 | for (j=4;j<7;j++){
|
---|
| 299 | B_reduced[i][j-1]=B[i][j];
|
---|
| 300 | }
|
---|
| 301 | for (j=8;j<11;j++){
|
---|
| 302 | B_reduced[i][j-2]=B[i][j];
|
---|
| 303 | }
|
---|
| 304 | for (j=12;j<15;j++){
|
---|
| 305 | B_reduced[i][j-3]=B[i][j];
|
---|
| 306 | }
|
---|
| 307 | for (j=16;j<19;j++){
|
---|
| 308 | B_reduced[i][j-4]=B[i][j];
|
---|
| 309 | }
|
---|
| 310 | for (j=20;j<23;j++){
|
---|
| 311 | B_reduced[i][j-5]=B[i][j];
|
---|
| 312 | }
|
---|
| 313 | }
|
---|
| 314 |
|
---|
| 315 | /*Here, we are computing the strain rate of (0,vy,0)*/
|
---|
| 316 | for(i=0;i<numgrids;i++){
|
---|
| 317 | velocity[i][0]=0.0;
|
---|
| 318 | velocity[i][1]=this->values[i];
|
---|
| 319 | velocity[i][2]=0.0;
|
---|
| 320 | }
|
---|
| 321 | /*Multiply B by velocity, to get strain rate: */
|
---|
| 322 | MatrixMultiply(&B_reduced[0][0],6,DOFVELOCITY*numgrids,0,&velocity[0][0],DOFVELOCITY*numgrids,1,0,epsilonvy,0);
|
---|
| 323 |
|
---|
| 324 | }
|
---|
| 325 | /*}}}*/
|
---|
[3855] | 326 | /*FUNCTION PentaVertexInput::GetVzStrainRate3d(double* epsilonvz,double* xyz_list, double* gauss) {{{1*/
|
---|
| 327 | void PentaVertexInput::GetVzStrainRate3d(double* epsilonvz,double* xyz_list, double* gauss){
|
---|
[3840] | 328 | int i,j;
|
---|
| 329 |
|
---|
| 330 | const int numgrids=6;
|
---|
| 331 | const int DOFVELOCITY=3;
|
---|
| 332 | double B[8][27];
|
---|
| 333 | double B_reduced[6][DOFVELOCITY*numgrids];
|
---|
[3875] | 334 | double velocity[numgrids][DOFVELOCITY];
|
---|
[3840] | 335 |
|
---|
| 336 | /*Get B matrix: */
|
---|
| 337 | GetBStokes(&B[0][0], xyz_list, gauss);
|
---|
| 338 | /*Create a reduced matrix of B to get rid of pressure */
|
---|
| 339 | for (i=0;i<6;i++){
|
---|
| 340 | for (j=0;j<3;j++){
|
---|
| 341 | B_reduced[i][j]=B[i][j];
|
---|
| 342 | }
|
---|
| 343 | for (j=4;j<7;j++){
|
---|
| 344 | B_reduced[i][j-1]=B[i][j];
|
---|
| 345 | }
|
---|
| 346 | for (j=8;j<11;j++){
|
---|
| 347 | B_reduced[i][j-2]=B[i][j];
|
---|
| 348 | }
|
---|
| 349 | for (j=12;j<15;j++){
|
---|
| 350 | B_reduced[i][j-3]=B[i][j];
|
---|
| 351 | }
|
---|
| 352 | for (j=16;j<19;j++){
|
---|
| 353 | B_reduced[i][j-4]=B[i][j];
|
---|
| 354 | }
|
---|
| 355 | for (j=20;j<23;j++){
|
---|
| 356 | B_reduced[i][j-5]=B[i][j];
|
---|
| 357 | }
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | /*Here, we are computing the strain rate of (0,0,vz)*/
|
---|
| 361 | for(i=0;i<numgrids;i++){
|
---|
| 362 | velocity[i][0]=0.0;
|
---|
| 363 | velocity[i][1]=0.0;
|
---|
| 364 | velocity[i][2]=this->values[i];
|
---|
| 365 | }
|
---|
| 366 |
|
---|
| 367 | /*Multiply B by velocity, to get strain rate: */
|
---|
| 368 | MatrixMultiply(&B_reduced[0][0],6,DOFVELOCITY*numgrids,0,&velocity[0][0],DOFVELOCITY*numgrids,1,0,epsilonvz,0);
|
---|
| 369 |
|
---|
| 370 | }
|
---|
| 371 | /*}}}*/
|
---|
[3855] | 372 | /*FUNCTION PentaVertexInput::GetVxStrainRate3dPattyn(double* epsilonvx,double* xyz_list, double* gauss) {{{1*/
|
---|
| 373 | void PentaVertexInput::GetVxStrainRate3dPattyn(double* epsilonvx,double* xyz_list, double* gauss){
|
---|
[3840] | 374 |
|
---|
[3855] | 375 | int i;
|
---|
| 376 | const int numgrids=6;
|
---|
| 377 | const int NDOF2=2;
|
---|
| 378 | double B[5][NDOF2*numgrids];
|
---|
| 379 | double velocity[numgrids][NDOF2];
|
---|
| 380 |
|
---|
| 381 | /*Get B matrix: */
|
---|
| 382 | GetBPattyn(&B[0][0], xyz_list, gauss);
|
---|
| 383 |
|
---|
| 384 | /*Here, we are computing the strain rate of (vx,0)*/
|
---|
| 385 | for(i=0;i<numgrids;i++){
|
---|
| 386 | velocity[i][0]=this->values[i];
|
---|
| 387 | velocity[i][1]=0.0;
|
---|
[3840] | 388 | }
|
---|
| 389 |
|
---|
[3855] | 390 | /*Multiply B by velocity, to get strain rate: */
|
---|
| 391 | MatrixMultiply( &B[0][0],5,NDOF2*numgrids,0,
|
---|
| 392 | &velocity[0][0],NDOF2*numgrids,1,0,
|
---|
| 393 | epsilonvx,0);
|
---|
| 394 |
|
---|
[3840] | 395 | }
|
---|
| 396 | /*}}}*/
|
---|
[3855] | 397 | /*FUNCTION PentaVertexInput::GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss) {{{1*/
|
---|
| 398 | void PentaVertexInput::GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss){
|
---|
| 399 |
|
---|
| 400 | int i;
|
---|
| 401 | const int numgrids=6;
|
---|
| 402 | const int NDOF2=2;
|
---|
| 403 | double B[5][NDOF2*numgrids];
|
---|
| 404 | double velocity[numgrids][NDOF2];
|
---|
| 405 |
|
---|
| 406 | /*Get B matrix: */
|
---|
| 407 | GetBPattyn(&B[0][0], xyz_list, gauss);
|
---|
| 408 |
|
---|
| 409 | /*Here, we are computing the strain rate of (0,vy)*/
|
---|
| 410 | for(i=0;i<numgrids;i++){
|
---|
| 411 | velocity[i][0]=0.0;
|
---|
| 412 | velocity[i][1]=this->values[i];
|
---|
| 413 | }
|
---|
| 414 |
|
---|
| 415 | /*Multiply B by velocity, to get strain rate: */
|
---|
| 416 | MatrixMultiply( &B[0][0],5,NDOF2*numgrids,0,
|
---|
| 417 | &velocity[0][0],NDOF2*numgrids,1,0,
|
---|
| 418 | epsilonvy,0);
|
---|
| 419 |
|
---|
| 420 | }
|
---|
| 421 | /*}}}*/
|
---|
[3732] | 422 | /*FUNCTION PentaVertexInput::ChangeEnum(int newenumtype){{{1*/
|
---|
| 423 | void PentaVertexInput::ChangeEnum(int newenumtype){
|
---|
| 424 | this->enum_type=newenumtype;
|
---|
| 425 | }
|
---|
| 426 | /*}}}*/
|
---|
[3830] | 427 | /*FUNCTION PentaVertexInput::GetParameterAverage(double* pvalue){{{1*/
|
---|
| 428 | void PentaVertexInput::GetParameterAverage(double* pvalue){
|
---|
| 429 | *pvalue=1./6.*(values[0]+values[1]+values[2]+values[3]+values[4]+values[5]);
|
---|
| 430 | }
|
---|
| 431 | /*}}}*/
|
---|
[3840] | 432 |
|
---|
| 433 | /*Intermediary*/
|
---|
| 434 | /*FUNCTION PentaVertexInput::GetNodalFunctionsP1 {{{1*/
|
---|
| 435 | void PentaVertexInput::GetNodalFunctionsP1(double* l1l6, double* gauss_coord){
|
---|
| 436 |
|
---|
| 437 | /*This routine returns the values of the nodal functions at the gaussian point.*/
|
---|
| 438 |
|
---|
| 439 | l1l6[0]=gauss_coord[0]*(1-gauss_coord[3])/2.0;
|
---|
| 440 |
|
---|
| 441 | l1l6[1]=gauss_coord[1]*(1-gauss_coord[3])/2.0;
|
---|
| 442 |
|
---|
| 443 | l1l6[2]=gauss_coord[2]*(1-gauss_coord[3])/2.0;
|
---|
| 444 |
|
---|
| 445 | l1l6[3]=gauss_coord[0]*(1+gauss_coord[3])/2.0;
|
---|
| 446 |
|
---|
| 447 | l1l6[4]=gauss_coord[1]*(1+gauss_coord[3])/2.0;
|
---|
| 448 |
|
---|
| 449 | l1l6[5]=gauss_coord[2]*(1+gauss_coord[3])/2.0;
|
---|
| 450 |
|
---|
| 451 | }
|
---|
| 452 | /*}}}*/
|
---|
| 453 | /*FUNCTION PentaVertexInput::GetNodalFunctionsMINI{{{1*/
|
---|
| 454 | void PentaVertexInput::GetNodalFunctionsMINI(double* l1l7, double* gauss_coord){
|
---|
| 455 |
|
---|
| 456 | /*This routine returns the values of the nodal functions at the gaussian point.*/
|
---|
| 457 |
|
---|
| 458 | /*First nodal function: */
|
---|
| 459 | l1l7[0]=gauss_coord[0]*(1.0-gauss_coord[3])/2.0;
|
---|
| 460 |
|
---|
| 461 | /*Second nodal function: */
|
---|
| 462 | l1l7[1]=gauss_coord[1]*(1.0-gauss_coord[3])/2.0;
|
---|
| 463 |
|
---|
| 464 | /*Third nodal function: */
|
---|
| 465 | l1l7[2]=gauss_coord[2]*(1.0-gauss_coord[3])/2.0;
|
---|
| 466 |
|
---|
| 467 | /*Fourth nodal function: */
|
---|
| 468 | l1l7[3]=gauss_coord[0]*(1.0+gauss_coord[3])/2.0;
|
---|
| 469 |
|
---|
| 470 | /*Fifth nodal function: */
|
---|
| 471 | l1l7[4]=gauss_coord[1]*(1.0+gauss_coord[3])/2.0;
|
---|
| 472 |
|
---|
| 473 | /*Sixth nodal function: */
|
---|
| 474 | l1l7[5]=gauss_coord[2]*(1.0+gauss_coord[3])/2.0;
|
---|
| 475 |
|
---|
| 476 | /*Seventh nodal function: */
|
---|
| 477 | l1l7[6]=27*gauss_coord[0]*gauss_coord[1]*gauss_coord[2]*(1.0+gauss_coord[3])*(1.0-gauss_coord[3]);
|
---|
| 478 |
|
---|
| 479 | }
|
---|
| 480 | /*}}}*/
|
---|
| 481 | /*FUNCTION PentaVertexInput::GetNodalFunctionsP1Derivatives {{{1*/
|
---|
| 482 | void PentaVertexInput::GetNodalFunctionsP1Derivatives(double* dh1dh6,double* xyz_list, double* gauss_coord){
|
---|
| 483 |
|
---|
| 484 | /*This routine returns the values of the nodal functions derivatives (with respect to the actual coordinate system: */
|
---|
| 485 | int i;
|
---|
| 486 | const int NDOF3=3;
|
---|
| 487 | const int numgrids=6;
|
---|
| 488 |
|
---|
| 489 | double dh1dh6_ref[NDOF3][numgrids];
|
---|
| 490 | double Jinv[NDOF3][NDOF3];
|
---|
| 491 |
|
---|
| 492 | /*Get derivative values with respect to parametric coordinate system: */
|
---|
| 493 | GetNodalFunctionsP1DerivativesReference(&dh1dh6_ref[0][0], gauss_coord);
|
---|
| 494 |
|
---|
| 495 | /*Get Jacobian invert: */
|
---|
| 496 | GetJacobianInvert(&Jinv[0][0], xyz_list, gauss_coord);
|
---|
| 497 |
|
---|
| 498 | /*Build dh1dh3:
|
---|
| 499 | *
|
---|
| 500 | * [dhi/dx]= Jinv*[dhi/dr]
|
---|
| 501 | * [dhi/dy] [dhi/ds]
|
---|
| 502 | * [dhi/dz] [dhi/dn]
|
---|
| 503 | */
|
---|
| 504 |
|
---|
| 505 | for (i=0;i<numgrids;i++){
|
---|
| 506 | *(dh1dh6+numgrids*0+i)=Jinv[0][0]*dh1dh6_ref[0][i]+Jinv[0][1]*dh1dh6_ref[1][i]+Jinv[0][2]*dh1dh6_ref[2][i];
|
---|
| 507 | *(dh1dh6+numgrids*1+i)=Jinv[1][0]*dh1dh6_ref[0][i]+Jinv[1][1]*dh1dh6_ref[1][i]+Jinv[1][2]*dh1dh6_ref[2][i];
|
---|
| 508 | *(dh1dh6+numgrids*2+i)=Jinv[2][0]*dh1dh6_ref[0][i]+Jinv[2][1]*dh1dh6_ref[1][i]+Jinv[2][2]*dh1dh6_ref[2][i];
|
---|
| 509 | }
|
---|
| 510 |
|
---|
| 511 | }
|
---|
| 512 | /*}}}*/
|
---|
| 513 | /*FUNCTION PentaVertexInput::GetNodalFunctionsMINIDerivatives{{{1*/
|
---|
| 514 | void PentaVertexInput::GetNodalFunctionsMINIDerivatives(double* dh1dh7,double* xyz_list, double* gauss_coord){
|
---|
| 515 |
|
---|
| 516 | /*This routine returns the values of the nodal functions derivatives (with respect to the
|
---|
| 517 | * actual coordinate system: */
|
---|
| 518 |
|
---|
| 519 | int i;
|
---|
| 520 |
|
---|
| 521 | const int numgrids=7;
|
---|
| 522 | double dh1dh7_ref[3][numgrids];
|
---|
| 523 | double Jinv[3][3];
|
---|
| 524 |
|
---|
| 525 |
|
---|
| 526 | /*Get derivative values with respect to parametric coordinate system: */
|
---|
| 527 | GetNodalFunctionsMINIDerivativesReference(&dh1dh7_ref[0][0], gauss_coord);
|
---|
| 528 |
|
---|
| 529 | /*Get Jacobian invert: */
|
---|
| 530 | GetJacobianInvert(&Jinv[0][0], xyz_list, gauss_coord);
|
---|
| 531 |
|
---|
| 532 | /*Build dh1dh6:
|
---|
| 533 | *
|
---|
| 534 | * [dhi/dx]= Jinv'*[dhi/dr]
|
---|
| 535 | * [dhi/dy] [dhi/ds]
|
---|
| 536 | * [dhi/dz] [dhi/dzeta]
|
---|
| 537 | */
|
---|
| 538 |
|
---|
| 539 | for (i=0;i<numgrids;i++){
|
---|
| 540 | *(dh1dh7+numgrids*0+i)=Jinv[0][0]*dh1dh7_ref[0][i]+Jinv[0][1]*dh1dh7_ref[1][i]+Jinv[0][2]*dh1dh7_ref[2][i];
|
---|
| 541 | *(dh1dh7+numgrids*1+i)=Jinv[1][0]*dh1dh7_ref[0][i]+Jinv[1][1]*dh1dh7_ref[1][i]+Jinv[1][2]*dh1dh7_ref[2][i];
|
---|
| 542 | *(dh1dh7+numgrids*2+i)=Jinv[2][0]*dh1dh7_ref[0][i]+Jinv[2][1]*dh1dh7_ref[1][i]+Jinv[2][2]*dh1dh7_ref[2][i];
|
---|
| 543 | }
|
---|
| 544 |
|
---|
| 545 | }
|
---|
| 546 | /*}}}*/
|
---|
| 547 | /*FUNCTION PentaVertexInput::GetNodalFunctionsP1DerivativesReference {{{1*/
|
---|
| 548 | void PentaVertexInput::GetNodalFunctionsP1DerivativesReference(double* dl1dl6,double* gauss_coord){
|
---|
| 549 |
|
---|
| 550 | /*This routine returns the values of the nodal functions derivatives (with respect to the
|
---|
| 551 | * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */
|
---|
| 552 |
|
---|
| 553 | const int numgrids=6;
|
---|
| 554 | double A1,A2,A3,z;
|
---|
| 555 |
|
---|
| 556 | A1=gauss_coord[0]; //first area coordinate value. In term of xi and eta: A1=(1-xi)/2-eta/(2*SQRT3);
|
---|
| 557 | A2=gauss_coord[1]; //second area coordinate value In term of xi and eta: A2=(1+xi)/2-eta/(2*SQRT3);
|
---|
| 558 | A3=gauss_coord[2]; //third area coordinate value In term of xi and eta: A3=y/SQRT3;
|
---|
| 559 | z=gauss_coord[3]; //fourth vertical coordinate value. Corresponding nodal function: (1-z)/2 and (1+z)/2
|
---|
| 560 |
|
---|
| 561 |
|
---|
| 562 | /*First nodal function derivatives. The corresponding nodal function is N=A1*(1-z)/2. Its derivatives follow*/
|
---|
| 563 | *(dl1dl6+numgrids*0+0)=-0.5*(1.0-z)/2.0;
|
---|
| 564 | *(dl1dl6+numgrids*1+0)=-0.5/SQRT3*(1.0-z)/2.0;
|
---|
| 565 | *(dl1dl6+numgrids*2+0)=-0.5*A1;
|
---|
| 566 |
|
---|
| 567 | /*Second nodal function: The corresponding nodal function is N=A2*(1-z)/2. Its derivatives follow*/
|
---|
| 568 | *(dl1dl6+numgrids*0+1)=0.5*(1.0-z)/2.0;
|
---|
| 569 | *(dl1dl6+numgrids*1+1)=-0.5/SQRT3*(1.0-z)/2.0;
|
---|
| 570 | *(dl1dl6+numgrids*2+1)=-0.5*A2;
|
---|
| 571 |
|
---|
| 572 | /*Third nodal function: The corresponding nodal function is N=A3*(1-z)/2. Its derivatives follow*/
|
---|
| 573 | *(dl1dl6+numgrids*0+2)=0.0;
|
---|
| 574 | *(dl1dl6+numgrids*1+2)=1.0/SQRT3*(1.0-z)/2.0;
|
---|
| 575 | *(dl1dl6+numgrids*2+2)=-0.5*A3;
|
---|
| 576 |
|
---|
| 577 | /*Fourth nodal function: The corresponding nodal function is N=A1*(1+z)/2. Its derivatives follow*/
|
---|
| 578 | *(dl1dl6+numgrids*0+3)=-0.5*(1.0+z)/2.0;
|
---|
| 579 | *(dl1dl6+numgrids*1+3)=-0.5/SQRT3*(1.0+z)/2.0;
|
---|
| 580 | *(dl1dl6+numgrids*2+3)=0.5*A1;
|
---|
| 581 |
|
---|
| 582 | /*Fifth nodal function: The corresponding nodal function is N=A2*(1+z)/2. Its derivatives follow*/
|
---|
| 583 | *(dl1dl6+numgrids*0+4)=0.5*(1.0+z)/2.0;
|
---|
| 584 | *(dl1dl6+numgrids*1+4)=-0.5/SQRT3*(1.0+z)/2.0;
|
---|
| 585 | *(dl1dl6+numgrids*2+4)=0.5*A2;
|
---|
| 586 |
|
---|
| 587 | /*Sixth nodal function: The corresponding nodal function is N=A3*(1+z)/2. Its derivatives follow*/
|
---|
| 588 | *(dl1dl6+numgrids*0+5)=0.0;
|
---|
| 589 | *(dl1dl6+numgrids*1+5)=1.0/SQRT3*(1.0+z)/2.0;
|
---|
| 590 | *(dl1dl6+numgrids*2+5)=0.5*A3;
|
---|
| 591 | }
|
---|
| 592 | /*}}}*/
|
---|
| 593 | /*FUNCTION PentaVertexInput::GetNodalFunctionsMINIDerivativesReference{{{1*/
|
---|
| 594 | void PentaVertexInput::GetNodalFunctionsMINIDerivativesReference(double* dl1dl7,double* gauss_coord){
|
---|
| 595 |
|
---|
| 596 | /*This routine returns the values of the nodal functions derivatives (with respect to the
|
---|
| 597 | * natural coordinate system) at the gaussian point. */
|
---|
| 598 |
|
---|
| 599 | int numgrids=7; //six plus bubble grids
|
---|
| 600 |
|
---|
| 601 | double r=gauss_coord[1]-gauss_coord[0];
|
---|
| 602 | double s=-3.0/SQRT3*(gauss_coord[0]+gauss_coord[1]-2.0/3.0);
|
---|
| 603 | double zeta=gauss_coord[3];
|
---|
| 604 |
|
---|
| 605 | /*First nodal function: */
|
---|
| 606 | *(dl1dl7+numgrids*0+0)=-0.5*(1.0-zeta)/2.0;
|
---|
| 607 | *(dl1dl7+numgrids*1+0)=-SQRT3/6.0*(1.0-zeta)/2.0;
|
---|
| 608 | *(dl1dl7+numgrids*2+0)=-0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD);
|
---|
| 609 |
|
---|
| 610 | /*Second nodal function: */
|
---|
| 611 | *(dl1dl7+numgrids*0+1)=0.5*(1.0-zeta)/2.0;
|
---|
| 612 | *(dl1dl7+numgrids*1+1)=-SQRT3/6.0*(1.0-zeta)/2.0;
|
---|
| 613 | *(dl1dl7+numgrids*2+1)=-0.5*(0.5*r-SQRT3/6.0*s+ONETHIRD);
|
---|
| 614 |
|
---|
| 615 | /*Third nodal function: */
|
---|
| 616 | *(dl1dl7+numgrids*0+2)=0;
|
---|
| 617 | *(dl1dl7+numgrids*1+2)=SQRT3/3.0*(1.0-zeta)/2.0;
|
---|
| 618 | *(dl1dl7+numgrids*2+2)=-0.5*(SQRT3/3.0*s+ONETHIRD);
|
---|
| 619 |
|
---|
| 620 | /*Fourth nodal function: */
|
---|
| 621 | *(dl1dl7+numgrids*0+3)=-0.5*(1.0+zeta)/2.0;
|
---|
| 622 | *(dl1dl7+numgrids*1+3)=-SQRT3/6.0*(1.0+zeta)/2.0;
|
---|
| 623 | *(dl1dl7+numgrids*2+3)=0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD);
|
---|
| 624 |
|
---|
| 625 | /*Fith nodal function: */
|
---|
| 626 | *(dl1dl7+numgrids*0+4)=0.5*(1.0+zeta)/2.0;
|
---|
| 627 | *(dl1dl7+numgrids*1+4)=-SQRT3/6.0*(1.0+zeta)/2.0;
|
---|
| 628 | *(dl1dl7+numgrids*2+4)=0.5*(0.5*r-SQRT3/6.0*s+ONETHIRD);
|
---|
| 629 |
|
---|
| 630 | /*Sixth nodal function: */
|
---|
| 631 | *(dl1dl7+numgrids*0+5)=0;
|
---|
| 632 | *(dl1dl7+numgrids*1+5)=SQRT3/3.0*(1.0+zeta)/2.0;
|
---|
| 633 | *(dl1dl7+numgrids*2+5)=0.5*(SQRT3/3.0*s+ONETHIRD);
|
---|
| 634 |
|
---|
| 635 | /*Seventh nodal function: */
|
---|
| 636 | *(dl1dl7+numgrids*0+6)=9.0/2.0*r*(1.0+zeta)*(zeta-1.0)*(SQRT3*s+1.0);
|
---|
| 637 | *(dl1dl7+numgrids*1+6)=9.0/4.0*(1+zeta)*(1-zeta)*(SQRT3*pow(s,2.0)-2.0*s-SQRT3*pow(r,2.0));
|
---|
| 638 | *(dl1dl7+numgrids*2+6)=27*gauss_coord[0]*gauss_coord[1]*gauss_coord[2]*(-2.0*zeta);
|
---|
| 639 |
|
---|
| 640 | }
|
---|
| 641 | /*}}}*/
|
---|
| 642 | /*FUNCTION PentaVertexInput::GetJacobian {{{1*/
|
---|
| 643 | void PentaVertexInput::GetJacobian(double* J, double* xyz_list,double* gauss_coord){
|
---|
| 644 |
|
---|
| 645 | const int NDOF3=3;
|
---|
| 646 | int i,j;
|
---|
| 647 |
|
---|
| 648 | /*The Jacobian is constant over the element, discard the gaussian points.
|
---|
| 649 | * J is assumed to have been allocated of size NDOF2xNDOF2.*/
|
---|
| 650 |
|
---|
| 651 | double A1,A2,A3; //area coordinates
|
---|
| 652 | double xi,eta,zi; //parametric coordinates
|
---|
| 653 |
|
---|
| 654 | double x1,x2,x3,x4,x5,x6;
|
---|
| 655 | double y1,y2,y3,y4,y5,y6;
|
---|
| 656 | double z1,z2,z3,z4,z5,z6;
|
---|
| 657 |
|
---|
| 658 | /*Figure out xi,eta and zi (parametric coordinates), for this gaussian point: */
|
---|
| 659 | A1=gauss_coord[0];
|
---|
| 660 | A2=gauss_coord[1];
|
---|
| 661 | A3=gauss_coord[2];
|
---|
| 662 |
|
---|
| 663 | xi=A2-A1;
|
---|
| 664 | eta=SQRT3*A3;
|
---|
| 665 | zi=gauss_coord[3];
|
---|
| 666 |
|
---|
| 667 | x1=*(xyz_list+3*0+0);
|
---|
| 668 | x2=*(xyz_list+3*1+0);
|
---|
| 669 | x3=*(xyz_list+3*2+0);
|
---|
| 670 | x4=*(xyz_list+3*3+0);
|
---|
| 671 | x5=*(xyz_list+3*4+0);
|
---|
| 672 | x6=*(xyz_list+3*5+0);
|
---|
| 673 |
|
---|
| 674 | y1=*(xyz_list+3*0+1);
|
---|
| 675 | y2=*(xyz_list+3*1+1);
|
---|
| 676 | y3=*(xyz_list+3*2+1);
|
---|
| 677 | y4=*(xyz_list+3*3+1);
|
---|
| 678 | y5=*(xyz_list+3*4+1);
|
---|
| 679 | y6=*(xyz_list+3*5+1);
|
---|
| 680 |
|
---|
| 681 | z1=*(xyz_list+3*0+2);
|
---|
| 682 | z2=*(xyz_list+3*1+2);
|
---|
| 683 | z3=*(xyz_list+3*2+2);
|
---|
| 684 | z4=*(xyz_list+3*3+2);
|
---|
| 685 | z5=*(xyz_list+3*4+2);
|
---|
| 686 | z6=*(xyz_list+3*5+2);
|
---|
| 687 |
|
---|
| 688 | *(J+NDOF3*0+0)=0.25*(x1-x2-x4+x5)*zi+0.25*(-x1+x2-x4+x5);
|
---|
| 689 | *(J+NDOF3*1+0)=SQRT3/12.0*(x1+x2-2*x3-x4-x5+2*x6)*zi+SQRT3/12.0*(-x1-x2+2*x3-x4-x5+2*x6);
|
---|
| 690 | *(J+NDOF3*2+0)=SQRT3/12.0*(x1+x2-2*x3-x4-x5+2*x6)*eta+1/4*(x1-x2-x4+x5)*xi +0.25*(-x1+x5-x2+x4);
|
---|
| 691 |
|
---|
| 692 | *(J+NDOF3*0+1)=0.25*(y1-y2-y4+y5)*zi+0.25*(-y1+y2-y4+y5);
|
---|
| 693 | *(J+NDOF3*1+1)=SQRT3/12.0*(y1+y2-2*y3-y4-y5+2*y6)*zi+SQRT3/12.0*(-y1-y2+2*y3-y4-y5+2*y6);
|
---|
| 694 | *(J+NDOF3*2+1)=SQRT3/12.0*(y1+y2-2*y3-y4-y5+2*y6)*eta+0.25*(y1-y2-y4+y5)*xi+0.25*(y4-y1+y5-y2);
|
---|
| 695 |
|
---|
| 696 | *(J+NDOF3*0+2)=0.25*(z1-z2-z4+z5)*zi+0.25*(-z1+z2-z4+z5);
|
---|
| 697 | *(J+NDOF3*1+2)=SQRT3/12.0*(z1+z2-2*z3-z4-z5+2*z6)*zi+SQRT3/12.0*(-z1-z2+2*z3-z4-z5+2*z6);
|
---|
| 698 | *(J+NDOF3*2+2)=SQRT3/12.0*(z1+z2-2*z3-z4-z5+2*z6)*eta+0.25*(z1-z2-z4+z5)*xi+0.25*(-z1+z5-z2+z4);
|
---|
| 699 |
|
---|
| 700 | }
|
---|
| 701 | /*}}}*/
|
---|
| 702 | /*FUNCTION PentaVertexInput::GetJacobianInvert {{{1*/
|
---|
| 703 | void PentaVertexInput::GetJacobianInvert(double* Jinv, double* xyz_list,double* gauss_coord){
|
---|
| 704 |
|
---|
| 705 | double Jdet;
|
---|
| 706 | const int NDOF3=3;
|
---|
| 707 |
|
---|
| 708 | /*Call Jacobian routine to get the jacobian:*/
|
---|
| 709 | GetJacobian(Jinv, xyz_list, gauss_coord);
|
---|
| 710 |
|
---|
| 711 | /*Invert Jacobian matrix: */
|
---|
| 712 | MatrixInverse(Jinv,NDOF3,NDOF3,NULL,0,&Jdet);
|
---|
| 713 | }
|
---|
| 714 | /*}}}*/
|
---|
| 715 | /*FUNCTION PentaVertexInput::GetBPattyn {{{1*/
|
---|
| 716 | void PentaVertexInput::GetBPattyn(double* B, double* xyz_list, double* gauss_coord){
|
---|
| 717 | /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2.
|
---|
| 718 | * For grid i, Bi can be expressed in the actual coordinate system
|
---|
| 719 | * by:
|
---|
| 720 | * Bi=[ dh/dx 0 ]
|
---|
| 721 | * [ 0 dh/dy ]
|
---|
| 722 | * [ 1/2*dh/dy 1/2*dh/dx ]
|
---|
| 723 | * [ 1/2*dh/dz 0 ]
|
---|
| 724 | * [ 0 1/2*dh/dz ]
|
---|
| 725 | * where h is the interpolation function for grid i.
|
---|
| 726 | *
|
---|
| 727 | * We assume B has been allocated already, of size: 5x(NDOF2*numgrids)
|
---|
| 728 | */
|
---|
| 729 |
|
---|
| 730 | int i;
|
---|
| 731 | const int numgrids=6;
|
---|
| 732 | const int NDOF3=3;
|
---|
| 733 | const int NDOF2=2;
|
---|
| 734 |
|
---|
| 735 | double dh1dh6[NDOF3][numgrids];
|
---|
| 736 |
|
---|
| 737 | /*Get dh1dh6 in actual coordinate system: */
|
---|
| 738 | GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],xyz_list, gauss_coord);
|
---|
| 739 |
|
---|
| 740 | /*Build B: */
|
---|
| 741 | for (i=0;i<numgrids;i++){
|
---|
| 742 | *(B+NDOF2*numgrids*0+NDOF2*i)=dh1dh6[0][i];
|
---|
| 743 | *(B+NDOF2*numgrids*0+NDOF2*i+1)=0.0;
|
---|
| 744 |
|
---|
| 745 | *(B+NDOF2*numgrids*1+NDOF2*i)=0.0;
|
---|
| 746 | *(B+NDOF2*numgrids*1+NDOF2*i+1)=dh1dh6[1][i];
|
---|
| 747 |
|
---|
| 748 | *(B+NDOF2*numgrids*2+NDOF2*i)=(float).5*dh1dh6[1][i];
|
---|
| 749 | *(B+NDOF2*numgrids*2+NDOF2*i+1)=(float).5*dh1dh6[0][i];
|
---|
| 750 |
|
---|
| 751 | *(B+NDOF2*numgrids*3+NDOF2*i)=(float).5*dh1dh6[2][i];
|
---|
| 752 | *(B+NDOF2*numgrids*3+NDOF2*i+1)=0.0;
|
---|
| 753 |
|
---|
| 754 | *(B+NDOF2*numgrids*4+NDOF2*i)=0.0;
|
---|
| 755 | *(B+NDOF2*numgrids*4+NDOF2*i+1)=(float).5*dh1dh6[2][i];
|
---|
| 756 | }
|
---|
| 757 |
|
---|
| 758 | }
|
---|
| 759 | /*}}}*/
|
---|
| 760 | /*FUNCTION PentaVertexInput::GetBStokes {{{1*/
|
---|
| 761 | void PentaVertexInput::GetBStokes(double* B, double* xyz_list, double* gauss_coord){
|
---|
| 762 |
|
---|
| 763 | /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*DOFPERGRID.
|
---|
| 764 | * For grid i, Bi can be expressed in the actual coordinate system
|
---|
| 765 | * by: Bi=[ dh/dx 0 0 0 ]
|
---|
| 766 | * [ 0 dh/dy 0 0 ]
|
---|
| 767 | * [ 0 0 dh/dy 0 ]
|
---|
| 768 | * [ 1/2*dh/dy 1/2*dh/dx 0 0 ]
|
---|
| 769 | * [ 1/2*dh/dz 0 1/2*dh/dx 0 ]
|
---|
| 770 | * [ 0 1/2*dh/dz 1/2*dh/dy 0 ]
|
---|
| 771 | * [ 0 0 0 h ]
|
---|
| 772 | * [ dh/dx dh/dy dh/dz 0 ]
|
---|
| 773 | * where h is the interpolation function for grid i.
|
---|
| 774 | * Same thing for Bb except the last column that does not exist.
|
---|
| 775 | */
|
---|
| 776 |
|
---|
| 777 | int i;
|
---|
| 778 | const int calculationdof=3;
|
---|
| 779 | const int numgrids=6;
|
---|
| 780 | int DOFPERGRID=4;
|
---|
| 781 |
|
---|
| 782 | double dh1dh7[calculationdof][numgrids+1];
|
---|
| 783 | double l1l6[numgrids];
|
---|
| 784 |
|
---|
| 785 |
|
---|
| 786 | /*Get dh1dh7 in actual coordinate system: */
|
---|
| 787 | GetNodalFunctionsMINIDerivatives(&dh1dh7[0][0],xyz_list, gauss_coord);
|
---|
| 788 | GetNodalFunctionsP1(l1l6, gauss_coord);
|
---|
| 789 |
|
---|
| 790 | /*Build B: */
|
---|
| 791 | for (i=0;i<numgrids+1;i++){
|
---|
| 792 | *(B+(DOFPERGRID*numgrids+3)*0+DOFPERGRID*i)=dh1dh7[0][i]; //B[0][DOFPERGRID*i]=dh1dh6[0][i];
|
---|
| 793 | *(B+(DOFPERGRID*numgrids+3)*0+DOFPERGRID*i+1)=0;
|
---|
| 794 | *(B+(DOFPERGRID*numgrids+3)*0+DOFPERGRID*i+2)=0;
|
---|
| 795 | *(B+(DOFPERGRID*numgrids+3)*1+DOFPERGRID*i)=0;
|
---|
| 796 | *(B+(DOFPERGRID*numgrids+3)*1+DOFPERGRID*i+1)=dh1dh7[1][i];
|
---|
| 797 | *(B+(DOFPERGRID*numgrids+3)*1+DOFPERGRID*i+2)=0;
|
---|
| 798 | *(B+(DOFPERGRID*numgrids+3)*2+DOFPERGRID*i)=0;
|
---|
| 799 | *(B+(DOFPERGRID*numgrids+3)*2+DOFPERGRID*i+1)=0;
|
---|
| 800 | *(B+(DOFPERGRID*numgrids+3)*2+DOFPERGRID*i+2)=dh1dh7[2][i];
|
---|
| 801 | *(B+(DOFPERGRID*numgrids+3)*3+DOFPERGRID*i)=(float).5*dh1dh7[1][i];
|
---|
| 802 | *(B+(DOFPERGRID*numgrids+3)*3+DOFPERGRID*i+1)=(float).5*dh1dh7[0][i];
|
---|
| 803 | *(B+(DOFPERGRID*numgrids+3)*3+DOFPERGRID*i+2)=0;
|
---|
| 804 | *(B+(DOFPERGRID*numgrids+3)*4+DOFPERGRID*i)=(float).5*dh1dh7[2][i];
|
---|
| 805 | *(B+(DOFPERGRID*numgrids+3)*4+DOFPERGRID*i+1)=0;
|
---|
| 806 | *(B+(DOFPERGRID*numgrids+3)*4+DOFPERGRID*i+2)=(float).5*dh1dh7[0][i];
|
---|
| 807 | *(B+(DOFPERGRID*numgrids+3)*5+DOFPERGRID*i)=0;
|
---|
| 808 | *(B+(DOFPERGRID*numgrids+3)*5+DOFPERGRID*i+1)=(float).5*dh1dh7[2][i];
|
---|
| 809 | *(B+(DOFPERGRID*numgrids+3)*5+DOFPERGRID*i+2)=(float).5*dh1dh7[1][i];
|
---|
| 810 | *(B+(DOFPERGRID*numgrids+3)*6+DOFPERGRID*i)=0;
|
---|
| 811 | *(B+(DOFPERGRID*numgrids+3)*6+DOFPERGRID*i+1)=0;
|
---|
| 812 | *(B+(DOFPERGRID*numgrids+3)*6+DOFPERGRID*i+2)=0;
|
---|
| 813 | *(B+(DOFPERGRID*numgrids+3)*7+DOFPERGRID*i)=dh1dh7[0][i];
|
---|
| 814 | *(B+(DOFPERGRID*numgrids+3)*7+DOFPERGRID*i+1)=dh1dh7[1][i];
|
---|
| 815 | *(B+(DOFPERGRID*numgrids+3)*7+DOFPERGRID*i+2)=dh1dh7[2][i];
|
---|
| 816 | }
|
---|
| 817 |
|
---|
| 818 | for (i=0;i<numgrids;i++){ //last column not for the bubble function
|
---|
| 819 | *(B+(DOFPERGRID*numgrids+3)*0+DOFPERGRID*i+3)=0;
|
---|
| 820 | *(B+(DOFPERGRID*numgrids+3)*1+DOFPERGRID*i+3)=0;
|
---|
| 821 | *(B+(DOFPERGRID*numgrids+3)*2+DOFPERGRID*i+3)=0;
|
---|
| 822 | *(B+(DOFPERGRID*numgrids+3)*3+DOFPERGRID*i+3)=0;
|
---|
| 823 | *(B+(DOFPERGRID*numgrids+3)*4+DOFPERGRID*i+3)=0;
|
---|
| 824 | *(B+(DOFPERGRID*numgrids+3)*5+DOFPERGRID*i+3)=0;
|
---|
| 825 | *(B+(DOFPERGRID*numgrids+3)*6+DOFPERGRID*i+3)=l1l6[i];
|
---|
| 826 | *(B+(DOFPERGRID*numgrids+3)*7+DOFPERGRID*i+3)=0;
|
---|
| 827 | }
|
---|
| 828 |
|
---|
| 829 | }
|
---|
| 830 | /*}}}*/
|
---|