CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
radflowload.c File Reference
#include <unistd.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <pthread.h>
#include "CalculiX.h"
Include dependency graph for radflowload.c:

Go to the source code of this file.

Functions

void radflowload (ITG *itg, ITG *ieg, ITG *ntg, ITG *ntr, double *adrad, double *aurad, double *bcr, ITG *ipivr, double *ac, double *bc, ITG *nload, char *sideload, ITG *nelemload, double *xloadact, char *lakon, ITG *ipiv, ITG *ntmat_, double *vold, double *shcon, ITG *nshcon, ITG *ipkon, ITG *kon, double *co, ITG *kontri, ITG *ntri, ITG *nloadtr, double *tarea, double *tenv, double *physcon, double *erad, double **adviewp, double **auviewp, ITG *nflow, ITG *ikboun, double *xbounact, ITG *nboun, ITG *ithermal, ITG *iinc, ITG *iit, double *cs, ITG *mcs, ITG *inocs, ITG *ntrit, ITG *nk, double *fenv, ITG *istep, double *dtime, double *ttime, double *time, ITG *ilboun, ITG *ikforc, ITG *ilforc, double *xforcact, ITG *nforc, double *cam, ITG *ielmat, ITG *nteq, double *prop, ITG *ielprop, ITG *nactdog, ITG *nacteq, ITG *nodeboun, ITG *ndirboun, ITG *network, double *rhcon, ITG *nrhcon, ITG *ipobody, ITG *ibody, double *xbodyact, ITG *nbody, ITG *iviewfile, char *jobnamef, double *ctrl, double *xloadold, double *reltime, ITG *nmethod, char *set, ITG *mi, ITG *istartset, ITG *iendset, ITG *ialset, ITG *nset, ITG *ineighe, ITG *nmpc, ITG *nodempc, ITG *ipompc, double *coefmpc, char *labmpc, ITG *iemchange, ITG *nam, ITG *iamload, ITG *jqrad, ITG *irowrad, ITG *nzsrad, ITG *icolrad, ITG *ne, ITG *iaxial, double *qa, double *cocon, ITG *ncocon, ITG *iponoel, ITG *inoel, ITG *nprop, char *amname, ITG *namta, double *amta)
 
void * calcviewmt (ITG *i)
 

Variables

static char * sideload1
 
static char * covered1 =NULL
 
static ITGkontri1
 
static ITGnloadtr1
 
static ITGidist =NULL
 
static ITGntrit1
 
static ITGmi1
 
static ITGjqrad1
 
static ITGirowrad1
 
static ITGnzsrad1
 
static ITG num_cpus
 
static ITGntri1
 
static ITGntr1
 
static ITG ng1
 
static double * vold1
 
static double * co1
 
static double * pmid1
 
static double * e11
 
static double * e21
 
static double * e31
 
static double * adview =NULL
 
static double * auview =NULL
 
static double * dist =NULL
 
static double * area1
 
static double sidemean1
 

Function Documentation

◆ calcviewmt()

void* calcviewmt ( ITG i)
633  {
634 
635  ITG indexad,indexau,indexdi,ntria,ntrib,nedelta,indexcovered;
636 
637  indexad=*i**ntr1;
638  indexau=*i*2**nzsrad1;
639  indexdi=*i**ntrit1;
640  indexcovered=*i*ng1*ng1;
641 
642  nedelta=(ITG)ceil(*ntri1/(double)num_cpus);
643  ntria=*i*nedelta+1;
644  ntrib=(*i+1)*nedelta;
645  if(ntrib>*ntri1) ntrib=*ntri1;
646 
647 // printf("i=%" ITGFORMAT ",ntria=%" ITGFORMAT ",ntrib=%" ITGFORMAT "\n",i,ntria,ntrib);
648 // printf("indexad=%" ITGFORMAT ",indexau=%" ITGFORMAT ",indexdi=%" ITGFORMAT "\n",indexad,indexau,indexdi);
649 
651  kontri1,nloadtr1,&adview[indexad],
652  &auview[indexau],&dist[indexdi],&idist[indexdi],area1,
653  ntrit1,mi1,jqrad1,irowrad1,nzsrad1,&sidemean1,
654  &ntria,&ntrib,&covered1[indexcovered],&ng1));
655 
656  return NULL;
657 }
static ITG * mi1
Definition: radflowload.c:39
static double * co1
Definition: radflowload.c:42
static ITG ng1
Definition: radflowload.c:39
static double * pmid1
Definition: radflowload.c:42
static ITG * ntri1
Definition: radflowload.c:39
static char * covered1
Definition: radflowload.c:37
static ITG * ntrit1
Definition: radflowload.c:39
void FORTRAN(actideacti,(char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, char *objectset, ITG *ipkon, ITG *ibject, ITG *ne))
static ITG * nloadtr1
Definition: radflowload.c:39
static ITG * ntr1
Definition: radflowload.c:39
static double * e31
Definition: radflowload.c:42
static ITG * idist
Definition: radflowload.c:39
static double sidemean1
Definition: radflowload.c:42
static char * sideload1
Definition: radflowload.c:37
static double * dist
Definition: radflowload.c:42
static double * area1
Definition: radflowload.c:42
static double * vold1
Definition: radflowload.c:42
static double * e21
Definition: radflowload.c:42
subroutine calcview(sideload, vold, co, pmid, e1, e2, e3, kontri, nloadtr, adview, auview, dist, idist, area, ntrit, mi, jqrad, irowrad, nzsrad, sidemean, ntria, ntrib, covered, ng)
Definition: calcview.f:30
static double * adview
Definition: radflowload.c:42
static ITG * jqrad1
Definition: radflowload.c:39
static double * e11
Definition: radflowload.c:42
static ITG * nzsrad1
Definition: radflowload.c:39
static ITG * kontri1
Definition: radflowload.c:39
static ITG num_cpus
Definition: radflowload.c:39
#define ITG
Definition: CalculiX.h:51
static ITG * irowrad1
Definition: radflowload.c:39
static double * auview
Definition: radflowload.c:42

◆ radflowload()

void radflowload ( ITG itg,
ITG ieg,
ITG ntg,
ITG ntr,
double *  adrad,
double *  aurad,
double *  bcr,
ITG ipivr,
double *  ac,
double *  bc,
ITG nload,
char *  sideload,
ITG nelemload,
double *  xloadact,
char *  lakon,
ITG ipiv,
ITG ntmat_,
double *  vold,
double *  shcon,
ITG nshcon,
ITG ipkon,
ITG kon,
double *  co,
ITG kontri,
ITG ntri,
ITG nloadtr,
double *  tarea,
double *  tenv,
double *  physcon,
double *  erad,
double **  adviewp,
double **  auviewp,
ITG nflow,
ITG ikboun,
double *  xbounact,
ITG nboun,
ITG ithermal,
ITG iinc,
ITG iit,
double *  cs,
ITG mcs,
ITG inocs,
ITG ntrit,
ITG nk,
double *  fenv,
ITG istep,
double *  dtime,
double *  ttime,
double *  time,
ITG ilboun,
ITG ikforc,
ITG ilforc,
double *  xforcact,
ITG nforc,
double *  cam,
ITG ielmat,
ITG nteq,
double *  prop,
ITG ielprop,
ITG nactdog,
ITG nacteq,
ITG nodeboun,
ITG ndirboun,
ITG network,
double *  rhcon,
ITG nrhcon,
ITG ipobody,
ITG ibody,
double *  xbodyact,
ITG nbody,
ITG iviewfile,
char *  jobnamef,
double *  ctrl,
double *  xloadold,
double *  reltime,
ITG nmethod,
char *  set,
ITG mi,
ITG istartset,
ITG iendset,
ITG ialset,
ITG nset,
ITG ineighe,
ITG nmpc,
ITG nodempc,
ITG ipompc,
double *  coefmpc,
char *  labmpc,
ITG iemchange,
ITG nam,
ITG iamload,
ITG jqrad,
ITG irowrad,
ITG nzsrad,
ITG icolrad,
ITG ne,
ITG iaxial,
double *  qa,
double *  cocon,
ITG ncocon,
ITG iponoel,
ITG inoel,
ITG nprop,
char *  amname,
ITG namta,
double *  amta 
)
73  {
74 
75  /* network=0: no network
76  network=1: purely thermal (presence of "Dx"- and/or of "D " network elements; declared
77  by the user to be purely thermal (on the *STEP card); simultaneous solution)
78  network=2: purely thermal (alternating solution; this becomes a simultaneous solution in
79  the absence of "Dx"-elements)
80  network=3: general case (temperatures, fluxes and pressures unknown)
81  network=4: purely aerodynamic, i.e. only fluxes and pressures unknown
82 
83  "D "-elements (D followed by a blank) alone do not trigger the alternating solution
84  (are not counted in envtemp.f as true network elements) */
85 
86  ITG nhrs=1,info=0,i,j,iin=0,icntrl,icutb=0,iin_abs=0,mt=mi[1]+1,im,
87  symmetryflag=2,inputformat=1,node,channel,*ithread=NULL,iplausi;
88 
89  static ITG ifactorization=0;
90 
91  double camt[2],camf[2],camp[2],qat,qaf,ramt,ramf,ramp,
92  cam1t=0.,cam1f=0.,cam1p=0.,sidemean,qa0,qau,ea,*prop_store=NULL,
93  cam2t=0.,cam2f=0.,cam2p=0.,dtheta=1.,*v=NULL,cama[2],cam1a=0.,
94  cam2a=0.,vamt=0.,vamf=0.,vamp=0.,vama=0.,cam0t=0.,cam0f=0.,
95  cam0p=0.,cam0a=0.,sigma=0.,*adbrad=NULL,*aubrad=NULL,*q=NULL,
96  *area=NULL,*pmid=NULL,*e1=NULL,*e2=NULL,*e3=NULL,
97  qamt,qamf,qamtold,qamfold;
98 
99  adview=*adviewp;auview=*auviewp;
100 
101  qa0=ctrl[20];qau=ctrl[21];ea=ctrl[23];
102 
103  /* check whether there are any gas temperature nodes; this check should
104  NOT be done on nteq, since also for zero equations the temperature
105  of the gas nodes with boundary conditions must be stored in v
106  (in initialgas) */
107 
108  NNEW(v,double,mt**nk);
109 
110  /* gas networks */
111 
112  if(*ntg!=0) {
113 #ifdef COMPANY
114  NNEW(prop_store,double,*nprop);
115  memcpy(&prop_store[0],&prop[0],sizeof(double)**nprop);
116  FORTRAN(propertynet,(ieg,nflow,prop,ielprop,lakon,&iin,
117  prop_store,ttime,time,nam,amname,namta,amta));
118  FORTRAN(checkinputvaluesnet,(ieg,nflow,prop,ielprop,lakon));
119 #else
120  if(*iit==-1) FORTRAN(checkinputvaluesnet,(ieg,nflow,prop,ielprop,lakon));
121 #endif
122  icntrl=0;
123  while(icntrl==0) {
124 
125  if(iin==0){
126 
127  memcpy(&v[0],&vold[0],sizeof(double)*mt**nk);
128 
129  /* resetting ineighe to 0 for renewed call of
130  radflowload (not for cut-backs without
131  leaving radflowload */
132 
133  /* for a cut-back iin is reset to 0, iin_abs is not */
134 
135  if(iin_abs==0) DMEMSET(ineighe,0,*ntg,0);
136 
137 // for(i=0;i<mt**nk;i++) v[i]=vold[i];
138 
139  /* initialization pressurized flow
140  (no free surface: gas networks or
141  water networks with fully wetted perimeter*/
142 
143  FORTRAN(initialnet,(itg,ieg,ntg,ac,bc,lakon,v,
144  ipkon,kon,nflow,
145  ikboun,nboun,prop,ielprop,nactdog,ndirboun,
146  nodeboun,xbounact,ielmat,ntmat_,shcon,nshcon,
147  physcon,ipiv,nteq,rhcon,nrhcon,ipobody,ibody,
148  xbodyact,co,nbody,network,&iin_abs,vold,set,
149  istep,iit,mi,ineighe,ilboun,&channel,iaxial,
150  nmpc,labmpc,ipompc,nodempc,coefmpc,ttime,time,
151  iponoel,inoel));
152 
153  /* initialization for channels with free surface */
154 
155  if(channel==1){
156  FORTRAN(initialchannel,(itg,ieg,ntg,ac,bc,lakon,v,
157  ipkon,kon,nflow,
158  ikboun,nboun,prop,ielprop,nactdog,ndirboun,
159  nodeboun,xbounact,ielmat,ntmat_,shcon,nshcon,
160  physcon,ipiv,nteq,rhcon,nrhcon,ipobody,ibody,
161  xbodyact,co,nbody,network,&iin_abs,vold,set,
162  istep,iit,mi,ineighe,ilboun,ttime,time,iaxial));
163  }
164 
165  /* storing the residual in the rhs vector */
166 
167  FORTRAN(resultnet,(itg,ieg,ntg,bc,nload,sideload,
168  nelemload,xloadact,
169  lakon,ntmat_,v,shcon,nshcon,ipkon,kon,co,nflow,
170  iinc,istep,dtime,ttime,time,
171  ikforc,ilforc,xforcact,
172  nforc,ielmat,nteq,prop,ielprop,nactdog,nacteq,&iin,
173  physcon,camt,camf,camp,rhcon,nrhcon,ipobody,
174  ibody,xbodyact,nbody,&dtheta,vold,xloadold,
175  reltime,nmethod,set,mi,ineighe,cama,&vamt,
176  &vamf,&vamp,&vama,nmpc,nodempc,ipompc,coefmpc,
177  labmpc,iaxial,&qat,&qaf,&ramt,&ramf,&ramp,
178  cocon,ncocon,iponoel,inoel,&iplausi));
179 
180  /* iniializing qamt and qamf (mean typical energy flow
181  and mass flow */
182 
183  if(qau>1.e-10){qamt=qau;}
184  else if(qa0>1.e-10){qamt=qa0;}
185  else if(qat>1.e-10){qamt=qat;}
186  else {qamt=1.e-2;}
187 
188  if(qau>1.e-10){qamf=qau;}
189  else if(qa0>1.e-10){qamf=qa0;}
190  else if(qaf>1.e-10){qamf=qaf;}
191  else {qamf=1.e-2;}
192  }
193 
194  iin++;
195  iin_abs++;
196  printf(" gas iteration %" ITGFORMAT " \n \n",iin);
197 
198  /* store actual values of typical energy flow and
199  mass flow */
200 
201  qamtold=qamt;
202  qamfold=qamf;
203 
204  /* filling the lhs matrix */
205 
206  FORTRAN(mafillnet,(itg,ieg,ntg,ac,nload,sideload,
207  nelemload,xloadact,lakon,ntmat_,v,
208  shcon,nshcon,ipkon,kon,co,nflow,iinc,
209  istep,dtime,ttime,time,
210  ielmat,nteq,prop,ielprop,nactdog,nacteq,
211  physcon,rhcon,nrhcon,ipobody,ibody,xbodyact,
212  nbody,vold,xloadold,reltime,nmethod,set,mi,
213  nmpc,nodempc,ipompc,coefmpc,labmpc,iaxial,
214  cocon,ncocon,iponoel,inoel));
215 
216  /* solving the system of equations */
217 
218  if(*nteq>0){
219  FORTRAN(dgesv,(nteq,&nhrs,ac,nteq,ipiv,bc,nteq,&info));
220  }
221 
222  /*spooles(ac,au,adb,aub,&sigma,bc,icol,irow,nteq,nteq,
223  &symmetryflag,&inputformat);*/
224 
225  if (info!=0) {
226  printf(" *WARNING in radflowload: singular matrix\n");
227 
228  FORTRAN(mafillnet,(itg,ieg,ntg,ac,nload,sideload,
229  nelemload,xloadact,lakon,ntmat_,v,
230  shcon,nshcon,ipkon,kon,co,nflow,iinc,
231  istep,dtime,ttime,time,
232  ielmat,nteq,prop,ielprop,nactdog,nacteq,
233  physcon,rhcon,nrhcon,ipobody,ibody,xbodyact,
234  nbody,vold,xloadold,reltime,nmethod,set,mi,
235  nmpc,nodempc,ipompc,coefmpc,labmpc,iaxial,
236  cocon,ncocon,iponoel,inoel));
237 
238  FORTRAN(equationcheck,(ac,nteq,nactdog,itg,ntg,nacteq,network));
239 
240  iin=0;
241 
242  }
243  else {
244 
245  /* storing the residual in the rhs vector */
246 
247  FORTRAN(resultnet,(itg,ieg,ntg,bc,nload,sideload,nelemload,
248  xloadact,lakon,ntmat_,v,shcon,nshcon,ipkon,kon,co,
249  nflow,iinc,istep,dtime,ttime,time,ikforc,ilforc,xforcact,
250  nforc,ielmat,nteq,prop,ielprop,nactdog,nacteq,
251  &iin,physcon,camt,camf,camp,rhcon,nrhcon,ipobody,
252  ibody,xbodyact,nbody,&dtheta,vold,xloadold,
253  reltime,nmethod,set,mi,ineighe,cama,&vamt,
254  &vamf,&vamp,&vama,nmpc,nodempc,ipompc,coefmpc,labmpc,
255  iaxial,&qat,&qaf,&ramt,&ramf,&ramp,cocon,ncocon,iponoel,
256  inoel,&iplausi));
257 
258  /* updating the mean typical energy flow and mass flow */
259 
260  if(qau<1.e-10){
261  if(qat>ea*qamt){qamt=(qamtold*iin+qat)/(iin+1);}
262  else {qamt=qamtold;}
263  if(qaf>ea*qamf){qamf=(qamfold*iin+qaf)/(iin+1);}
264  else {qamf=qamfold;}
265  }
266 
267  /* printing the largest corrections */
268 
269  if(*network!=4){
270  cam2t=cam1t;
271  cam1t=cam0t;
272  cam0t=camt[0];
273  printf
274  (" mean typical energy flow since start of network iterations= %e\n",qamt);
275  printf
276  (" largest energy flow residual in present network iteration= %e\n",ramt);
277  printf
278  (" largest change of gas temperature since start of network iteratons= %e\n",vamt);
279  if((ITG)camt[1]==0){
280  printf
281  (" largest correction to gas temperature in present network iteration= %e\n\n",
282  camt[0]);
283  }else{
284  printf
285  (" largest correction to gas temperature= %e in node %" ITGFORMAT "\n\n",
286  camt[0],(ITG)camt[1]);
287  }
288  }
289 
290  if(*network>2){
291  cam2f=cam1f;
292  cam1f=cam0f;
293  cam0f=camf[0];
294  printf
295  (" mean typical mass flow since start of network iterations= %e\n",qamf);
296  printf
297  (" largest mass flow residual in present network iteration= %e\n",ramf);
298  printf(" largest change of gas massflow since start of network iterations= %e\n",vamf);
299  if((ITG)camf[1]==0){
300  printf(" largest correction to gas massflow in present network iteration= %e\n\n",
301  camf[0]);
302  }else{
303  printf(" largest correction to gas massflow= %e in node %" ITGFORMAT "\n\n",
304  camf[0],(ITG)camf[1]);
305  }
306 
307  cam2p=cam1p;
308  cam1p=cam0p;
309  cam0p=camp[0];
310  printf
311  (" largest element equation residual in present network iteration= %e\n",ramp);
312  printf(" largest change of gas pressure since start of network iterations= %e\n",vamp);
313  if((ITG)camp[1]==0){
314  printf(" largest correction to gas pressure in present network iteration= %e\n\n",
315  camp[0]);
316  }else{
317  printf(" largest correction to gas pressure= %e in node %" ITGFORMAT "\n\n",
318  camp[0],(ITG)camp[1]);
319  }
320 
321  cam2a=cam1a;
322  cam1a=cam0a;
323  cam0a=cama[0];
324  printf(" largest change of geometry since start of network iterations= %e\n",vama);
325  if((ITG)cama[1]==0){
326  printf(" largest correction to geometry in present network iteration= %e\n",
327  cama[0]);
328  }else{
329  printf(" largest correction to geometry= %e in node %" ITGFORMAT "\n",
330  cama[0],(ITG)cama[1]);
331  }
332  }
333  }
334 
335  printf("\n");
336 
337  /* for purely thermal calculations no iterations are
338  deemed necessary */
339 
340  if(*network<=2) {icntrl=1;}
341  else {
342 
343  /* check the convergence */
344 
345  checkconvnet(&icutb,&iin,
346  &cam1t,&cam1f,&cam1p,&cam2t,&cam2f,&cam2p,&cam0t,&cam0f,
347  &cam0p,&icntrl,&dtheta,ctrl,&cam1a,&cam2a,&cam0a,
348  &vamt,&vamf,&vamp,&vama,qa,&qamt,&qamf,&ramt,&ramf,&ramp,
349  &iplausi);
350  }
351  }
352 
353  /* storing network output as boundary conditions for
354  the structure */
355 
356  FORTRAN(flowresult,(ntg,itg,cam,vold,v,nload,sideload,
357  nelemload,xloadact,nactdog,network,mi,ne,ipkon,lakon,kon));
358 
359  /* extra output for hydraulic jump (fluid channels) */
360 
361 #ifdef NETWORKOUT
362  if(*network>2){
363  FORTRAN(flowoutput,(itg,ieg,ntg,nteq,bc,lakon,ntmat_,
364  v,shcon,nshcon,ipkon,kon,co,nflow, dtime,ttime,time,
365  ielmat,prop,ielprop,nactdog,nacteq,&iin,physcon,
366  camt,camf,camp,rhcon,nrhcon,
367  vold,jobnamef,set,istartset,iendset,ialset,nset,
368  mi,iaxial,istep,iit));
369  }
370 #endif
371 #ifdef COMPANY
372  memcpy(&prop[0],&prop_store[0],sizeof(double)**nprop);
373  SFREE(prop_store);
374 #endif
375  }
376 
377  /* radiation */
378 
379  if(*ntr>0){
380 
381  /* variables for multithreading procedure */
382 
383  ITG sys_cpus;
384  char *env,*envloc,*envsys;
385 
386  num_cpus = 0;
387  sys_cpus=0;
388 
389  /* explicit user declaration prevails */
390 
391  envsys=getenv("NUMBER_OF_CPUS");
392  if(envsys){
393  sys_cpus=atoi(envsys);
394  if(sys_cpus<0) sys_cpus=0;
395  }
396 
397  /* automatic detection of available number of processors */
398 
399  if(sys_cpus==0){
400  sys_cpus = getSystemCPUs();
401  if(sys_cpus<1) sys_cpus=1;
402  }
403 
404  /* local declaration prevails, if strictly positive */
405 
406  envloc = getenv("CCX_NPROC_VIEWFACTOR");
407  if(envloc){
408  num_cpus=atoi(envloc);
409  if(num_cpus<0){
410  num_cpus=0;
411  }else if(num_cpus>sys_cpus){
412  num_cpus=sys_cpus;
413  }
414 
415  }
416 
417  /* else global declaration, if any, applies */
418 
419  env = getenv("OMP_NUM_THREADS");
420  if(num_cpus==0){
421  if (env)
422  num_cpus = atoi(env);
423  if (num_cpus < 1) {
424  num_cpus=1;
425  }else if(num_cpus>sys_cpus){
426  num_cpus=sys_cpus;
427  }
428  }
429 
430 // next line is to be inserted in a similar way for all other paralell parts
431 
432  if(*ntr<num_cpus) num_cpus=*ntr;
433 
434  pthread_t tid[num_cpus];
435 
436  /*the default sink temperature is updated at the start of each
437  increment */
438 
439  for(i=0;i<*ntr;i++){
440  node=nelemload[2*nloadtr[i]-1];
441  if(node!=0){
442  tenv[i]=vold[mt*(node-1)]-physcon[0];
443  }else if(*iit<=0){
444  tenv[i]=xloadact[2*nloadtr[i]-1]-physcon[0];
445  }
446  }
447 
448 /* for pure thermal steps the viewfactors have to be
449  calculated only once, for thermo-mechanical steps
450  (ithermal=3) they are recalculated in each iteration
451  unless they are read from file */
452 
453  if(((*ithermal==3)&&(*iviewfile>=0))||(*iit==-1)){
454  if(*iviewfile<0){
455 
456  /* reading viewfactors from file */
457 
458  FORTRAN(readview,(ntr,adview,auview,fenv,nzsrad,ithermal,
459  jobnamef));
460 
461  }else{
462 
463  /* determining geometric data to calculate the viewfactors */
464 
465  NNEW(area,double,*ntrit);
466  NNEW(pmid,double,3**ntrit);
467  NNEW(e1,double,3**ntrit);
468  NNEW(e2,double,3**ntrit);
469  NNEW(e3,double,4**ntrit);
470 
471  FORTRAN(geomview,(vold,co,pmid,e1,e2,e3,kontri,area,
472  cs,mcs,inocs,ntrit,nk,mi,&sidemean));
473 
474  RENEW(adview,double,num_cpus**ntr);
475  RENEW(auview,double,num_cpus*2**nzsrad);
476 
477  NNEW(dist,double,num_cpus**ntrit);
478  NNEW(idist,ITG,num_cpus**ntrit);
479 
480  DMEMSET(adview,0,num_cpus**ntr,0.);
481  DMEMSET(auview,0,num_cpus*2**nzsrad,0.);
482 
483  sideload1=sideload;vold1=vold;co1=co;pmid1=pmid;
484  e11=e1;e21=e2;e31=e3;kontri1=kontri;ntr1=ntr;
485  nloadtr1=nloadtr;area1=area;ntri1=ntri;
486  ntrit1=ntrit;mi1=mi;jqrad1=jqrad;irowrad1=irowrad;
487  nzsrad1=nzsrad;sidemean1=sidemean;
488 
489  /* size of the square mesh used to detect
490  the visibility of a triangle; the denser
491  the mesh,the more accurate the results */
492 
493  ng1=1280;
494 // ng1=2560;
495  NNEW(covered1,char,num_cpus*ng1*ng1);
496 
497  /* calculating the viewfactors */
498 
499  printf(" Using up to %" ITGFORMAT " cpu(s) for the viewfactor calculation.\n\n", num_cpus);
500 
501  /* create threads and wait */
502 
503  NNEW(ithread,ITG,num_cpus);
504  for(i=0; i<num_cpus; i++) {
505  ithread[i]=i;
506  pthread_create(&tid[i], NULL, (void *)calcviewmt, (void *)&ithread[i]);
507  }
508  for(i=0; i<num_cpus; i++) pthread_join(tid[i], NULL);
509 
510  for(i=0;i<*ntr;i++){
511  for(j=1;j<num_cpus;j++){
512  adview[i]+=adview[i+j**ntr];
513  }
514  }
515  RENEW(adview,double,*ntr);
516 
517  for(i=0;i<2**nzsrad;i++){
518  for(j=1;j<num_cpus;j++){
519  auview[i]+=auview[i+j*2**nzsrad];
520  }
521  }
522  RENEW(auview,double,2**nzsrad);
523 
524 /* for(i=0;i<*ntr;i++){
525  printf("radflowload adview = %" ITGFORMAT " %e\n",i,adview[i]);
526  }
527  for(i=0;i<2**nzsrad;i++){
528  printf("radflowload auview = %" ITGFORMAT " %e\n",i,auview[i]);
529  }*/
530 
531  SFREE(dist);SFREE(idist);SFREE(e1);SFREE(e2);SFREE(e3);
532  SFREE(pmid);SFREE(ithread);SFREE(covered1);
533 
534  /* postprocessing the viewfactors */
535 
536  FORTRAN(postview,(ntr,sideload,nelemload,kontri,ntri,nloadtr,
537  tenv,adview,auview,area,fenv,jqrad,irowrad,
538  nzsrad));
539 
540  SFREE(area);
541 
542  if(*iviewfile>=2){
543 
544  /* writing viewfactors to file */
545 
546  FORTRAN(writeview,(ntr,adview,auview,fenv,nzsrad,
547  jobnamef));
548  }
549 
550  if(*iviewfile==3){
551 
552  /* calculation of viewfactors only */
553 
554  FORTRAN(stop,());
555  }
556 
557  }
558  }
559 
560  /* assembling the radiation matrix */
561 
562  FORTRAN(radmatrix,(ntr,adrad,aurad,bcr,sideload,nelemload,
563  xloadact,lakon,vold,ipkon,kon,co,nloadtr,tarea,tenv,physcon,
564  erad,adview,auview,ithermal,iinc,iit,fenv,istep,dtime,ttime,
565  time,iviewfile,xloadold,reltime,nmethod,mi,iemchange,nam,
566  iamload,jqrad,irowrad,nzsrad));
567 
568  /* factoring the system of equations */
569 
570  /* the left hand side of the radiation matrix has probably
571  changed if
572  - the viewfactors were updated
573  - a new step was started and NO CHANGE is not active
574  - the emissivity coefficients were changed
575  - a new increment was started in a stationary calculation
576  (since the emissivity coefficients are ramped)
577  in that case the LU decomposition has to be repeated
578  (i.e. call of dgesv) */
579 
580  if(((*ithermal==3)&&(*iviewfile>=0))||
581  ((*iit==-1)&&(*iviewfile!=-2))||(*iemchange==1)||((*iit==0)&&(abs(*nmethod)==1))){
582 
583 #if defined(PARDISO)
584  if(ifactorization==1) pardiso_cleanup_as(ntr,&symmetryflag);
585  pardiso_factor_as(adrad,aurad,adbrad,aubrad,&sigma,icolrad,
586  irowrad,ntr,nzsrad,jqrad);
587  ifactorization=1;
588 #elif defined(SPOOLES)
589  if(ifactorization==1) spooles_cleanup_rad();
590  spooles_factor_rad(adrad,aurad,adbrad,aubrad,&sigma,
591  icolrad,irowrad,ntr,nzsrad,
592  &symmetryflag,&inputformat);
593  ifactorization=1;
594 #else
595  printf("*ERROR in radflowload: the SPOOLES library is not linked\n\n");
596  FORTRAN(stop,());
597 #endif
598 
599  }
600 
601  /* solving the system of equations */
602 
603 #if defined(PARDISO)
604  pardiso_solve_as(bcr,ntr);
605 
606 #elif defined(SPOOLES)
607  spooles_solve_rad(bcr,ntr);
608 #endif
609 
610  if (info!=0){
611  printf("*ERROR IN RADFLOWLOAD: SINGULAR MATRIX*\n");}
612 
613  else{
614  NNEW(q,double,*ntr);
615  FORTRAN(radresult,(ntr,xloadact,bcr,nloadtr,tarea,
616  tenv,physcon,erad,auview,fenv,
617  irowrad,jqrad,nzsrad,q));
618  SFREE(q);
619  }
620 
621  }
622 
623  SFREE(v);
624 
625  *adviewp=adview;*auviewp=auview;
626 
627  return;
628 
629 }
static ITG * mi1
Definition: radflowload.c:39
#define ITGFORMAT
Definition: CalculiX.h:52
static double * co1
Definition: radflowload.c:42
subroutine initialchannel(itg, ieg, ntg, ac, bc, lakon, v, ipkon, kon, nflow, ikboun, nboun, prop, ielprop, nactdog, ndirboun, nodeboun, xbounact, ielmat, ntmat_, shcon, nshcon, physcon, ipiv, nteq, rhcon, nrhcon, ipobody, ibody, xbodyact, co, nbody, network, iin_abs, vold, set, istep, iit, mi, ineighe, ilboun, ttime, time, iaxial)
Definition: initialchannel.f:33
static ITG ng1
Definition: radflowload.c:39
int pthread_create(pthread_t *thread_id, const pthread_attr_t *attributes, void *(*thread_function)(void *), void *arguments)
static double * pmid1
Definition: radflowload.c:42
subroutine postview(ntr, sideload, nelemload, kontri, ntri, nloadtr, tenv, adview, auview, area, fenv, jqrad, irowrad, nzsrad)
Definition: postview.f:28
static ITG * ntri1
Definition: radflowload.c:39
static char * covered1
Definition: radflowload.c:37
void checkconvnet(ITG *icutb, ITG *iin, 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 *cam1a, double *cam2a, double *cama, double *vamt, double *vamf, double *vamp, double *vama, double *qa, double *qamt, double *qamf, double *ramt, double *ramf, double *ramp, ITG *iplausi)
Definition: checkconvnet.c:32
void spooles_factor_rad(double *ad, double *au, double *adb, double *aub, double *sigma, ITG *icol, ITG *irow, ITG *neq, ITG *nzs, ITG *symmetryflag, ITG *inputformat)
subroutine resultnet(itg, ieg, ntg, bc, nload, sideload, nelemload, xloadact, lakon, ntmat_, v, shcon, nshcon, ipkon, kon, co, nflow, iinc, istep, dtime, ttime, time, ikforc, ilforc, xforcact, nforc, ielmat, nteq, prop, ielprop, nactdog, nacteq, iin, physcon, camt, camf, camp, rhcon, nrhcon, ipobody, ibody, xbodyact, nbody, dtheta, vold, xloadold, reltime, nmethod, set, mi, ineighe, cama, vamt, vamf, vamp, vama, nmpc, nodempc, ipompc, coefmpc, labmpc, iaxial, qat, qaf, ramt, ramf, ramp, cocon, ncocon, iponoel, inoel, iplausi)
Definition: resultnet.f:31
static ITG * ntrit1
Definition: radflowload.c:39
subroutine propertynet(ieg, nflow, prop, ielprop, lakon, iin, prop_store, ttime, time, nam, amname, namta, amta)
Definition: propertynet.f:21
void FORTRAN(actideacti,(char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, char *objectset, ITG *ipkon, ITG *ibject, ITG *ne))
subroutine geomview(vold, co, pmid, e1, e2, e3, kontri, area, cs, mcs, inocs, ntrit, nk, mi, sidemean)
Definition: geomview.f:28
static ITG * nloadtr1
Definition: radflowload.c:39
subroutine radmatrix(ntr, adrad, aurad, bcr, sideload, nelemload, xloadact, lakon, vold, ipkon, kon, co, nloadtr, tarea, tenv, physcon, erad, adview, auview, ithermal, iinc, iit, fenv, istep, dtime, ttime, time, iviewfile, xloadold, reltime, nmethod, mi, iemchange, nam, iamload, jqrad, irowrad, nzsrad)
Definition: radmatrix.f:31
subroutine equationcheck(ac, nteq, nactdog, itg, ntg, nacteq, network)
Definition: equationcheck.f:23
static ITG * ntr1
Definition: radflowload.c:39
void spooles_solve_rad(double *b, ITG *neq)
ITG getSystemCPUs()
Definition: getSystemCPUs.c:40
#define DMEMSET(a, b, c, d)
Definition: CalculiX.h:45
subroutine dgesv(N, NRHS, A, LDA, IPIV, B, LDB, INFO)
Definition: dgesv.f:58
subroutine stop()
Definition: stop.f:20
static double * e31
Definition: radflowload.c:42
subroutine mafillnet(itg, ieg, ntg, ac, nload, sideload, nelemload, xloadact, lakon, ntmat_, v, shcon, nshcon, ipkon, kon, co, nflow, iinc, istep, dtime, ttime, time, ielmat, nteq, prop, ielprop, nactdog, nacteq, physcon, rhcon, nrhcon, ipobody, ibody, xbodyact, nbody, vold, xloadold, reltime, nmethod, set, mi, nmpc, nodempc, ipompc, coefmpc, labmpc, iaxial, cocon, ncocon, iponoel, inoel)
Definition: mafillnet.f:28
void * calcviewmt(ITG *i)
Definition: radflowload.c:633
static ITG * idist
Definition: radflowload.c:39
static double sidemean1
Definition: radflowload.c:42
static char * sideload1
Definition: radflowload.c:37
static double * dist
Definition: radflowload.c:42
#define RENEW(a, b, c)
Definition: CalculiX.h:40
#define SFREE(a)
Definition: CalculiX.h:41
static double * area1
Definition: radflowload.c:42
static double * vold1
Definition: radflowload.c:42
subroutine radresult(ntr, xloadact, bcr, nloadtr, tarea, tenv, physcon, erad, auview, fenv, irowrad, jqrad, nzsrad, q)
Definition: radresult.f:22
static double * e21
Definition: radflowload.c:42
static double * adview
Definition: radflowload.c:42
static ITG * jqrad1
Definition: radflowload.c:39
static double * e11
Definition: radflowload.c:42
void spooles_cleanup_rad()
static ITG * nzsrad1
Definition: radflowload.c:39
subroutine flowresult(ntg, itg, cam, vold, v, nload, sideload, nelemload, xloadact, nactdog, network, mi, ne, ipkon, lakon, kon)
Definition: flowresult.f:21
int pthread_join(pthread_t thread, void **status_ptr)
subroutine checkinputvaluesnet(ieg, nflow, prop, ielprop, lakon)
Definition: checkinputvaluesnet.f:31
subroutine writeview(ntr, adview, auview, fenv, nzsrad, jobnamef)
Definition: writeview.f:28
static ITG * kontri1
Definition: radflowload.c:39
subroutine flowoutput(itg, ieg, ntg, nteq, bc, lakon, ntmat_, v, shcon, nshcon, ipkon, kon, co, nflow, dtime, ttime, time, ielmat, prop, ielprop, nactdog, nacteq, iin, physcon, camt, camf, camp, rhcon, nrhcon, vold, jobnamef, set, istartset, iendset, ialset, nset, mi, iaxial, istep, iit)
Definition: flowoutput.f:28
static ITG num_cpus
Definition: radflowload.c:39
#define ITG
Definition: CalculiX.h:51
subroutine readview(ntr, adview, auview, fenv, nzsrad, ithermal, jobnamef)
Definition: readview.f:28
subroutine initialnet(itg, ieg, ntg, ac, bc, lakon, v, ipkon, kon, nflow, ikboun, nboun, prop, ielprop, nactdog, ndirboun, nodeboun, xbounact, ielmat, ntmat_, shcon, nshcon, physcon, ipiv, nteq, rhcon, nrhcon, ipobody, ibody, xbodyact, co, nbody, network, iin_abs, vold, set, istep, iit, mi, ineighe, ilboun, channel, iaxial, nmpc, labmpc, ipompc, nodempc, coefmpc, ttime, time, iponoel, inoel)
Definition: initialnet.f:34
#define NNEW(a, b, c)
Definition: CalculiX.h:39
static ITG * irowrad1
Definition: radflowload.c:39
static double * auview
Definition: radflowload.c:42

Variable Documentation

◆ adview

double * adview =NULL
static

◆ area1

double * area1
static

◆ auview

double * auview =NULL
static

◆ co1

double * co1
static

◆ covered1

char * covered1 =NULL
static

◆ dist

double * dist =NULL
static

◆ e11

double * e11
static

◆ e21

double * e21
static

◆ e31

double * e31
static

◆ idist

ITG * idist =NULL
static

◆ irowrad1

ITG * irowrad1
static

◆ jqrad1

ITG * jqrad1
static

◆ kontri1

ITG* kontri1
static

◆ mi1

ITG * mi1
static

◆ ng1

ITG ng1
static

◆ nloadtr1

ITG * nloadtr1
static

◆ ntr1

ITG * ntr1
static

◆ ntri1

ITG * ntri1
static

◆ ntrit1

ITG * ntrit1
static

◆ num_cpus

ITG num_cpus
static

◆ nzsrad1

ITG * nzsrad1
static

◆ pmid1

double * pmid1
static

◆ sideload1

char* sideload1
static

◆ sidemean1

double sidemean1
static

◆ vold1

double* vold1
static
Hosted by OpenAircraft.com, (Michigan UAV, LLC)