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

Go to the source code of this file.

Functions

void checkconvnet (ITG *icutb, ITG *iin, double *uamt, double *uamf, double *uamp, double *cam1t, double *cam1f, double *cam1p, double *cam2t, double *cam2f, double *cam2p, double *camt, double *camf, double *camp, ITG *icntrl, double *dtheta, double *ctrl, double *uama, double *cam1a, double *cam2a, double *cama, double *vamt, double *vamf, double *vamp, double *vama)
 

Function Documentation

void checkconvnet ( ITG icutb,
ITG iin,
double *  uamt,
double *  uamf,
double *  uamp,
double *  cam1t,
double *  cam1f,
double *  cam1p,
double *  cam2t,
double *  cam2f,
double *  cam2p,
double *  camt,
double *  camf,
double *  camp,
ITG icntrl,
double *  dtheta,
double *  ctrl,
double *  uama,
double *  cam1a,
double *  cam2a,
double *  cama,
double *  vamt,
double *  vamf,
double *  vamp,
double *  vama 
)

Definition at line 32 of file checkconvnet.c.

39  {
40 
41  ITG i0,ir,ip,ic,il,ig,ia,idivergence;
42 
43  double c1t,c1f,c1p,c1a;
44  double df,dc,db,dd,ran,can,rap,ea,cae,ral;
45 
46  i0=ctrl[0];ir=ctrl[1];ip=ctrl[2];ic=ctrl[3];il=ctrl[4];ig=ctrl[5];ia=ctrl[7];
47  df=ctrl[10];dc=ctrl[11];db=ctrl[12];dd=ctrl[16];
48  ran=ctrl[18];can=ctrl[19];rap=ctrl[22];
49  ea=ctrl[23];cae=ctrl[24];ral=ctrl[25];
50 
51  /* temperature */
52 
53  if(*iin<=ip){c1t=0.0001*ran;}
54  else{c1t=0.0001*rap;}
55 
56  /* mass flow */
57 
58  if(*iin<=ip){c1f=0.0001*ran;}
59  else{c1f=0.0001*rap;}
60 
61  /* pressure */
62 
63  if(*iin<=ip){c1p=0.0001*ran;}
64  else{c1p=0.0001*rap;}
65 
66  /* geometry */
67 
68  if(*iin<=ip){c1a=0.0001*ran;}
69  else{c1a=0.0001*rap;}
70 
71  if(*cam1t<*cam2t) {*cam2t=*cam1t;}
72  if(*cam1f<*cam2f) {*cam2f=*cam1f;}
73  if(*cam1p<*cam2p) {*cam2p=*cam1p;}
74  if(*cam1a<*cam2a) {*cam2a=*cam1a;}
75 
76  /* check for convergence or divergence;
77  each call of radflowload.c corresponds to a thermomechanical
78  iteration, let's call the iterations within radflowload.c
79  subiterations;
80  the convergence check consists of a comparison of the change in
81  the latest subiteration with
82  - the largest change in the present thermomechanical iteration
83  - the largest value in the present thermomechanical iteration */
84 
85 /* if(((*camt<=c1t**uamt)||(*camt<1.e-8**vamt))&&
86  ((*camf<=c1f**uamf)||(*camf<1.e-8**vamf))&&
87  ((*camp<=c1p**uamp)||(*camp<1.e-8**vamp))&&
88  ((*cama<=c1a**uama)||(*cama<1.e-8**vama))&&*/
89  if(((*camt<=c1t**uamt)||(*camt<c1t**vamt))&&
90  ((*camf<=c1f**uamf)||(*camf<c1f**vamf))&&
91  ((*camp<=c1p**uamp)||(*camp<c1p**vamp))&&
92  ((*cama<=c1a**uama)||(*cama<c1a**vama))&&
93  (*iin>3)){
94 
95  /* increment convergence reached */
96 
97  printf(" flow network: convergence in gas iteration %" ITGFORMAT " \n\n",*iin);
98  *icntrl=1;
99  *icutb=0;
100  }
101 
102  else {
103 
104  idivergence=0;
105 
106  /* divergence based on temperatures */
107 
108  if((*iin>=20*i0)||(fabs(*camt)>1.e20)){
109  if((*cam1t>=*cam2t)&&(*camt>=*cam2t)&&(*camt>c1t**uamt)){
110  idivergence=1;
111  }
112  }
113 
114  /* divergence based on the mass flux */
115 
116  if((*iin>=20*i0)||(fabs(*camf)>1.e20)){
117  if((*cam1f>=*cam2f)&&(*camf>=*cam2f)&&(*camf>c1f**uamf)){
118  idivergence=1;
119  }
120  }
121 
122  /* divergence based on pressures */
123 
124  if((*iin>=20*i0)||(fabs(*camp)>1.e20)){
125  if((*cam1p>=*cam2p)&&(*camp>=*cam2p)&&(*camp>c1p**uamp)){
126  idivergence=1;
127  }
128  }
129 
130  /* divergence based on geometry */
131 
132  if((*iin>=20*i0)||(fabs(*cama)>1.e20)){
133  if((*cam1a>=*cam2a)&&(*cama>=*cam2a)&&(*cama>c1a**uama)){
134  idivergence=1;
135  }
136  }
137 
138  /* divergence based on the number of iterations */
139 
140  if(*iin>20*ic) idivergence=1;
141 
142  /* divergence based on singular matrix or negative pressures */
143 
144  if(*iin==0) idivergence=1;
145 
146  if(idivergence==1){
147  *dtheta=*dtheta*df;
148  printf("\n divergence; the increment size is decreased to %e\n",*dtheta);
149  printf(" the increment is reattempted\n\n");
150  *iin=0;
151  (*icutb)++;
152  if(*icutb>ia){
153  printf("\n *ERROR: too many cutbacks\n");
154  FORTRAN(stop,());
155  }
156  }else{
157  printf(" no convergence\n\n");
158  }
159  }
160  return;
161 }
#define ITGFORMAT
Definition: CalculiX.h:52
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 df(x, u, uprime, rpar, nev)
Definition: subspace.f:132
subroutine stop()
Definition: stop.f:19
#define ITG
Definition: CalculiX.h:51
Hosted by OpenAircraft.com, (Michigan UAV, LLC)