CalculiX  2.8
A Free Software Three-Dimensional Structural Finite Element Program
 All Classes Files Functions Variables Macros
calcresidual.c File Reference
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "CalculiX.h"
Include dependency graph for calcresidual.c:

Go to the source code of this file.

Functions

void calcresidual (ITG *nmethod, ITG *neq, double *b, double *fext, double *f, ITG *iexpl, ITG *nactdof, double *aux2, double *vold, double *vini, double *dtime, double *accold, ITG *nk, double *adb, double *aub, ITG *jq, ITG *irow, ITG *nzl, double *alpha, double *fextini, double *fini, ITG *islavnode, ITG *nslavnode, ITG *mortar, ITG *ntie, double *f_cm, double *f_cs, ITG *mi, ITG *nzs, ITG *nasym, ITG *idamping, double *veold, double *adc, double *auc, double *cvini, double *cv)
 

Function Documentation

void calcresidual ( ITG nmethod,
ITG neq,
double *  b,
double *  fext,
double *  f,
ITG iexpl,
ITG nactdof,
double *  aux2,
double *  vold,
double *  vini,
double *  dtime,
double *  accold,
ITG nk,
double *  adb,
double *  aub,
ITG jq,
ITG irow,
ITG nzl,
double *  alpha,
double *  fextini,
double *  fini,
ITG islavnode,
ITG nslavnode,
ITG mortar,
ITG ntie,
double *  f_cm,
double *  f_cs,
ITG mi,
ITG nzs,
ITG nasym,
ITG idamping,
double *  veold,
double *  adc,
double *  auc,
double *  cvini,
double *  cv 
)

Definition at line 33 of file calcresidual.c.

40  {
41 
42  ITG j,k,mt=mi[1]+1;
43  double scal1;
44 
45  /* residual for a static analysis */
46 
47  if(*nmethod!=4){
48  for(k=0;k<neq[1];++k){
49  b[k]=fext[k]-f[k];
50  }
51  }
52 
53  /* residual for implicit dynamics */
54 
55  else if(*iexpl<=1){
56  for(k=0;k<*nk;++k){
57  if(nactdof[mt*k]!=0){
58  aux2[nactdof[mt*k]-1]=(vold[mt*k]-vini[mt*k])/(*dtime);}
59  for(j=1;j<mt;++j){
60  if(nactdof[mt*k+j]!=0){aux2[nactdof[mt*k+j]-1]=accold[mt*k+j];}
61  }
62  }
63  if(*nasym==0){
64  FORTRAN(op,(&neq[1],aux2,b,adb,aub,jq,irow));
65  }else{
66  FORTRAN(opas,(&neq[1],aux2,b,adb,aub,jq,irow,nzs));
67  }
68  scal1=1.+*alpha;
69  for(k=0;k<neq[0];++k){
70  b[k]=scal1*(fext[k]-f[k])-*alpha*(fextini[k]-fini[k])-b[k];
71  }
72  for(k=neq[0];k<neq[1];++k){
73  b[k]=fext[k]-f[k]-b[k];
74  }
75 
76  /* correction for damping */
77 
78  if(*idamping==1){
79  for(k=0;k<*nk;++k){
80  if(nactdof[mt*k]!=0){aux2[nactdof[mt*k]-1]=0.;}
81  for(j=1;j<mt;++j){
82  if(nactdof[mt*k+j]!=0){
83  aux2[nactdof[mt*k+j]-1]=veold[mt*k+j];}
84  }
85  }
86  if(*nasym==0){
87  FORTRAN(op,(&neq[1],aux2,cv,adc,auc,jq,irow));
88  }else{
89  FORTRAN(opas,(&neq[1],aux2,cv,adc,auc,jq,irow,nzs));
90  }
91  for(k=0;k<neq[0];++k){
92  b[k]-=scal1*cv[k]-*alpha*cvini[k];
93  }
94  }
95  }
96 
97  /* residual for explicit dynamics */
98 
99  else{
100  for(k=0;k<*nk;++k){
101  if(nactdof[mt*k]!=0){
102  aux2[nactdof[mt*k]-1]=(vold[mt*k]-vini[mt*k])/(*dtime);}
103  for(j=1;j<mt;++j){
104  if(nactdof[mt*k+j]!=0){aux2[nactdof[mt*k+j]-1]=accold[mt*k+j];}
105  }
106  }
107  scal1=1.+*alpha;
108  for(k=0;k<neq[0];++k){
109  b[k]=scal1*(fext[k]-f[k])-*alpha*(fextini[k]-fini[k])
110  -adb[k]*aux2[k];
111  }
112  for(k=neq[0];k<neq[1];++k){
113  b[k]=fext[k]-f[k]-adb[k]*aux2[k];
114  }
115  }
116 
117  return;
118 }
void FORTRAN(addimdnodecload,(ITG *nodeforc, ITG *i, ITG *imdnode, ITG *nmdnode, double *xforc, ITG *ikmpc, ITG *ilmpc, ITG *ipompc, ITG *nodempc, ITG *nmpc, ITG *imddof, ITG *nmddof, ITG *nactdof, ITG *mi, ITG *imdmpc, ITG *nmdmpc, ITG *imdboun, ITG *nmdboun, ITG *ikboun, ITG *nboun, ITG *ilboun, ITG *ithermal))
subroutine op(n, x, y, ad, au, jq, irow)
Definition: op.f:25
subroutine opas(n, x, y, ad, au, jq, irow, nzs)
Definition: opas.f:25
#define ITG
Definition: CalculiX.h:51
Hosted by OpenAircraft.com, (Michigan UAV, LLC)