Changeset 5844
- Timestamp:
- 09/16/10 11:58:59 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r5843 r5844 2422 2422 double DLprime[2][2] = {0.0}; 2423 2423 double DL_scalar; 2424 double Ke_gg[numdof][numdof] = {0.0};2425 2424 double Ke_gg_gaussian[numdof][numdof] = {0.0}; 2426 2425 double Ke_gg_thickness1[numdof][numdof] = {0.0}; … … 2428 2427 GaussTria *gauss = NULL; 2429 2428 2430 2429 /*Initialize Element matrix and return if necessary*/ 2431 2430 if(IsOnWater()) return NULL; 2432 2431 ElementMatrix* Ke=this->NewElementMatrix(NoneApproximationEnum); … … 2447 2446 } 2448 2447 2449 / /Create Artificial diffusivity once for all if requested2448 /*Create Artificial diffusivity once for all if requested*/ 2450 2449 if(artdiff){ 2451 2450 gauss=new GaussTria(); … … 2460 2459 } 2461 2460 2462 /* Start looping on the number of gaussian points:*/2461 /*Start looping on the number of gaussian points:*/ 2463 2462 gauss=new GaussTria(2); 2464 2463 for (ig=gauss->begin();ig<gauss->end();ig++){ … … 2519 2518 ElementMatrix* Tria::CreateKMatrixBalancedthickness_DG(void){ 2520 2519 2521 /* local declarations */ 2522 const int numdof=NDOF1*NUMVERTICES; 2523 int i,j; 2524 int ig; 2525 double xyz_list[NUMVERTICES][3]; 2526 GaussTria *gauss=NULL; 2527 double B[2][NUMVERTICES]; 2528 double Bprime[2][NUMVERTICES]; 2529 double DL[2][2]={0.0}; 2530 double DLprime[2][2]={0.0}; 2531 double DL_scalar; 2532 double Ke_gg[numdof][numdof]={0.0}; 2533 double Ke_gg2[numdof][numdof]={0.0}; 2534 double Jdettria; 2535 double vx,vy; 2536 int dim; 2520 /*Constants*/ 2521 const int numdof=NDOF1*NUMVERTICES; 2522 2523 /*Intermediaries*/ 2524 int i,j,ig,dim; 2525 double vx,vy,Jdettria; 2526 double xyz_list[NUMVERTICES][3]; 2527 double B[2][NUMVERTICES]; 2528 double Bprime[2][NUMVERTICES]; 2529 double DL[2][2]={0.0}; 2530 double DL_scalar; 2531 double Ke_gg[numdof][numdof]={0.0}; 2532 GaussTria *gauss=NULL; 2537 2533 2538 2534 /*Initialize Element matrix and return if necessary*/ … … 2546 2542 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 2547 2543 2548 /* Start looping on the number of gaussian points:*/2544 /*Start looping on the number of gaussian points:*/ 2549 2545 gauss=new GaussTria(2); 2550 2546 for (ig=gauss->begin();ig<gauss->end();ig++){ … … 2552 2548 gauss->GaussPoint(ig); 2553 2549 2550 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 2554 2551 /*WARNING: B and Bprime are inverted compared to usual prognostic!!!!*/ 2555 2552 GetBPrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); … … 2559 2556 vy_input->GetParameterValue(&vy,gauss); 2560 2557 2561 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);2562 2558 DL_scalar=-gauss->weight*Jdettria; 2563 2564 DLprime[0][0]=DL_scalar*vx; 2565 DLprime[1][1]=DL_scalar*vy; 2559 DL[0][0]=DL_scalar*vx; 2560 DL[1][1]=DL_scalar*vy; 2566 2561 2567 2562 TripleMultiply( &B[0][0],2,numdof,1, 2568 &DL prime[0][0],2,2,0,2563 &DL[0][0],2,2,0, 2569 2564 &Bprime[0][0],2,numdof,0, 2570 &Ke_gg 2[0][0],0);2571 2572 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_gg 2[i][j];2565 &Ke_gg[0][0],0); 2566 2567 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_gg[i][j]; 2573 2568 } 2574 2569 … … 2581 2576 ElementMatrix* Tria::CreateKMatrixBalancedvelocities(void){ 2582 2577 2583 /* local declarations*/2578 /*Constants*/ 2584 2579 const int numdof=NDOF1*NUMVERTICES; 2585 int i,j; 2586 double xyz_list[NUMVERTICES][3]; 2587 int ig; 2588 GaussTria *gauss=NULL; 2589 double L[NUMVERTICES]; 2590 double B[2][NUMVERTICES]; 2591 double Bprime[2][NUMVERTICES]; 2592 double DL[2][2]={0.0}; 2593 double DLprime[2][2]={0.0}; 2594 double DL_scalar; 2595 double Ke_gg[numdof][numdof]={0.0};//local element stiffness matrix 2596 double Ke_gg_gaussian[numdof][numdof]={0.0}; //stiffness matrix evaluated at the gaussian point. 2597 double Ke_gg_velocities1[numdof][numdof]={0.0}; //stiffness matrix evaluated at the gaussian point. 2598 double Ke_gg_velocities2[numdof][numdof]={0.0}; //stiffness matrix evaluated at the gaussian point. 2599 double Jdettria; 2580 2581 /*Intermediaries */ 2582 bool artdiff; 2583 int i,j,ig,dim; 2584 double nx,ny,norm,Jdettria; 2585 double dvx[2],dvy[2]; 2586 double vx,vy,dvxdx,dvydy; 2587 double v_gauss[2]={0.0}; 2600 2588 double surface_normal[3]; 2601 2589 double surface_list[3]; 2602 double nx,ny,norm; 2603 double dvx[2]; 2604 double dvy[2]; 2605 double vx,vy; 2606 double dvxdx,dvydy; 2607 double v_gauss[2]={0.0}; 2590 double xyz_list[NUMVERTICES][3]; 2591 double B[2][NUMVERTICES]; 2592 double Bprime[2][NUMVERTICES]; 2608 2593 double K[2][2]={0.0}; 2609 2594 double KDL[2][2]={0.0}; 2610 int dim; 2611 bool artdiff; 2595 double DLprime[2][2]={0.0}; 2596 double DL_scalar; 2597 double Ke_gg_gaussian[numdof][numdof] = {0.0}; 2598 double Ke_gg_velocities[numdof][numdof] = {0.0}; 2599 GaussTria *gauss=NULL; 2612 2600 2613 2601 /*Initialize Element matrix and return if necessary*/ … … 2644 2632 } 2645 2633 if(nx==0 && ny==0){ 2646 nx=0; 2647 ny=1; 2634 nx=0; ny=1; 2648 2635 } 2649 2636 norm=pow( pow(nx,2)+pow(ny,2) , (double).5); 2650 nx=nx/norm; 2651 ny=ny/norm; 2637 nx=nx/norm; ny=ny/norm; 2652 2638 2653 2639 //Create Artificial diffusivity once for all if requested … … 2660 2646 vxaverage_input->GetParameterAverage(&v_gauss[0]); 2661 2647 vyaverage_input->GetParameterAverage(&v_gauss[1]); 2662 2663 2648 K[0][0]=pow(10,2)*pow(Jdettria,(double).5)/2.0*fabs(v_gauss[0]); //pow should be zero!! 2664 2649 K[1][1]=pow(10,2)*pow(Jdettria,(double).5)/2.0*fabs(v_gauss[1]); … … 2671 2656 gauss->GaussPoint(ig); 2672 2657 2658 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss); 2673 2659 GetBPrognostic(&B[0][0], &xyz_list[0][0], gauss); 2674 2660 GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 2675 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);2676 2661 2677 2662 vxaverage_input->GetParameterValue(&vx,gauss); … … 2679 2664 vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],gauss); 2680 2665 vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],gauss); 2666 2681 2667 dvxdx=dvx[0]; 2682 2668 dvydy=dvy[1]; 2683 2684 2669 DL_scalar=gauss->weight*Jdettria; 2685 2670 … … 2690 2675 &DLprime[0][0],2,2,0, 2691 2676 &Bprime[0][0],2,numdof,0, 2692 &Ke_gg_velocities 2[0][0],0);2693 2694 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_gg_velocities 2[i][j];2677 &Ke_gg_velocities[0][0],0); 2678 2679 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_gg_velocities[i][j]; 2695 2680 2696 2681 if(artdiff){ … … 2704 2689 2705 2690 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_gg_gaussian[i][j]; 2706 2707 2691 } 2708 2709 2692 } 2710 2693 … … 2738 2721 int i,j,ig; 2739 2722 double xyz_list[NUMVERTICES][3]; 2740 GaussTria *gauss = NULL;2741 2723 double viscosity,newviscosity,oldviscosity; 2742 double viscosity_overshoot,thickness; 2743 double epsilon[3]; /* epsilon=[exx,eyy,exy]; */ 2744 double oldepsilon[3]; /* oldepsilon=[exx,eyy,exy]; */ 2724 double viscosity_overshoot,thickness,Jdet; 2725 double epsilon[3],oldepsilon[3]; /* epsilon=[exx,eyy,exy]; */ 2745 2726 double B[3][numdof]; 2746 2727 double Bprime[3][numdof]; … … 2748 2729 double D_scalar; 2749 2730 double Ke_g[numdof][numdof]; 2750 double Jdet;2731 GaussTria *gauss = NULL; 2751 2732 2752 2733 /*Initialize Element matrix and return if necessary*/ … … 2769 2750 gauss->GaussPoint(ig); 2770 2751 2771 thickness_input->GetParameterValue(&thickness, gauss); 2752 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss); 2753 GetBMacAyeal(&B[0][0], &xyz_list[0][0], gauss); 2754 GetBprimeMacAyeal(&Bprime[0][0], &xyz_list[0][0], gauss); 2755 2772 2756 this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input); 2773 2757 this->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss,vxold_input,vyold_input); 2774 2758 matice->GetViscosity2d(&viscosity, &epsilon[0]); 2775 2759 matice->GetViscosity2d(&oldviscosity, &oldepsilon[0]); 2776 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);2760 thickness_input->GetParameterValue(&thickness, gauss); 2777 2761 2778 2762 newviscosity=viscosity+viscosity_overshoot*(viscosity-oldviscosity); 2779 2763 D_scalar=2*newviscosity*thickness*gauss->weight*Jdet; 2780 2764 for (i=0;i<3;i++) D[i][i]=D_scalar; 2781 2782 GetBMacAyeal(&B[0][0], &xyz_list[0][0], gauss);2783 GetBprimeMacAyeal(&Bprime[0][0], &xyz_list[0][0], gauss);2784 2765 2785 2766 TripleMultiply(&B[0][0],3,numdof,1,
Note:
See TracChangeset
for help on using the changeset viewer.