Flow123d  JS_before_hm-896-g486f41f
che_semchem.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file che_semchem.h
15  * @brief
16  */
17 
18 #ifndef BIGHEAD
19 #define BIGHEAD
20 /********************************************************************/
21 /* BIG-HEAD.H GEN-TRAN Verse 1.0 */
22 /********************************************************************/
23 #define DOS /* Prepinac DOS X UNIX */
24 #define VERB /* Upovidany vystup */
25 #define S_BOOL int
26 
27 #ifdef MAIN
28  #define EX
29 #else
30  #define EX extern
31 #endif
32 
33 #ifndef MAXPATH
34  #define MAXPATH 2048
35 #endif
36 #define MAX_POC_LATEK 200
37 #define MAX_POC_PARAM_SORPCE 5
38 #define ACCURACY 1e-12
39 
40 #define fnsplit _splitpath // ! Dressler 24.08.2001
41 #define fnmerge _makepath // ! Dressler 24.08.2001
42 #ifdef DOS
43  #include <dirent.h>
44 #endif
45 #include <stdlib.h> // ! Dressler 24.08.2001
46 #include <math.h>
47 #include <stdio.h>
48 #include <time.h>
49 #ifdef MAIN
50  #define EX
51 #else
52  #define EX extern
53 #endif
54 
55 /********************************************************************/
56 
57 // mh: kompiluju flow/tran
58 #define PROGRAM_TRAN
59 
60 /********************************************************************/
61 
62 #ifndef SKUPINY_MATERIALU
63  #define SKUPINY_MATERIALU
64 #endif //SKUPINY_MATERIALU
65 /*------------------------------------------------------------------*/
66 
67 #ifndef SKUPINA_SCENAR
68  #define SKUPINA_SCENAR
69 #endif // SKUPINA_SCENAR
70 /*------------------------------------------------------------------*/
71 
72 #ifndef SKUPINA_STENY
73  #define SKUPINA_STENY
74 #endif // SKUPINA_STENY
75 /*------------------------------------------------------------------*/
76 
77 #ifndef SKUPINA_RESICE
78  #define SKUPINA_RESICE
79 #endif // SKUPINA_RESICE
80 /*------------------------------------------------------------------*/
81 
82 #ifndef SKUPINA_TRANSPORT
83  #define SKUPINA_TRANSPORT
84 #endif // SKUPINA_TRANSPORT
85 /*------------------------------------------------------------------*/
86 
87 #ifndef SKUPINA_DUALPOROSITY
88  #define SKUPINA_DUALPOROSITY
89 #endif // SKUPINA_DUALPOROSITY
90 
91 /*------------------------------------------------------------------*/
92 
93 #ifndef SKUPINA_REAKCE
94  #define SKUPINA_REAKCE
95 #endif // SKUPINA_REAKCE
96 /********************************************************************/
97 #define MAXK1LM1 2 /* Max. pocet koeficientu v MELM */
98 #define MAXELKOEF 10 /* Max. pocet koeficientu v ELM */
99 #define MAXMATRKOEF 7 /* Max. pocet koef. v matr. */
100 #define MAXDPORKOEF 3 /* Max. pocet koef. v DUAL POROSITY */
101 /********************************************************************/
102 #define NLENSPO 16 /* Pocet znaku popisu slozky R + H */
103 #define NLENPVR 5 /* Maximalni delka popisu vrstev */
104 /********************************************************************/
105 #define RUN_OK 0
106 #define RUN_ERROR 1
107 /********************************************************************/
108 // mh: kompiluju flow/tran
109 #define PRG_NAME "tran"
110 /********************************************************************/
111 /********************************************************************/
112 /* Definice globalnich promennych */
113 /********************************************************************/
114 /* Vseobecne paramatry */
115 /********************************************************************/
116 EX int G_argc;
117 EX char **G_argv;
121 EX int NULA;
123 /*------------------------------------------------------------------*/
124 #ifdef SKUPINA_RESICE
126 #endif // SKUPINA_RESICE
127 /*------------------------------------------------------------------*/
128 #ifdef SKUPINA_CHEMIE
129 EX int G_cas_chemie;
130 #endif // SKUPINA_CHEMIE
131 /********************************************************************/
132 /* Seznam sousedu danych sten ( -1 = vnejsi stena ) */
133 /********************************************************************/
134 #ifdef SKUPINA_STENY
135  EX int *P_Steny;
136 #endif // SKUPINA_STENY
137 /********************************************************************/
138 /* Vektory pro ulozeni soustavy linearnich rovnic */
139 /********************************************************************/
140 #ifdef SKUPINA_RESICE
141  EX int *P_i, *P_j;
142  EX double *P_MM, *P_MR, *P_MX;
143 #endif // SKUPINA_RESICE
144 /********************************************************************/
145 /* Vektory pro ulozeni slozek pro transport */
146 /********************************************************************/
147 #ifdef SKUPINA_TRANSPORT
148  EX double *P_rslo;
149  EX double *P_rslo_new;
150  #ifdef SKUPINA_DUALPOROSITY
151  EX double *P_rslo_por;
152  #endif // SKUPINA_DUALPOROSITY
153  EX double *P_sod;
154 #endif // SKUPINA_TRANSPORT
155 /********************************************************************/
156 /* Definice datovych struktur */
157 /********************************************************************/
158 /* Globalni parametry modelu */
159 /********************************************************************/
160 struct S_glp
161 {
163 /*------------------------------------------------------------------*/
165 /*------------------------------------------------------------------*/
166  int nmuzl; /* pocet multiuzlu rovinnych */
167  int nuzl; /* pocet uzlu prostorovych */
168  int nmelm; /* pocet multielm rovinnych */
169  int nmkoef; /* pocet koeficientu pro MElm */
170  int nelm; /* pocet elementu prostorovych */
171  int nelm_0; /* pocet placatych elementu */
172  int nkoef; /* pocet koeficientu pro element */
173  int nsmume; /* pocet sousedu MU->ME */
174 /*------------------------------------------------------------------*/
175  int nstnex; /* pocet vnejsich sten */
176  int nstnin; /* pocet vnitrnich sten */
177 /*------------------------------------------------------------------*/
178  int nvrst; /* pocet vrstev v siti */
179 /*------------------------------------------------------------------*/
180  int nsez; /* pocet kroku scenare vypoctu */
181  int noke; /* pocet radku OKE */
182 /*------------------------------------------------------------------*/
183 #ifdef SKUPINY_MATERIALU
184  int nmatr; /* pocet skupin materialu */
185 #endif // SKUPINY_MATERIALU
186 /*------------------------------------------------------------------*/
187 #ifdef SKUPINA_DUALPOROSITY
188  S_BOOL sw_DP_apply; /* pocitat s dvoji porozitou */
189  int ndpor; /* pocet skupin DUAL_POROSITY */
190 #endif // SKUPINA_DUALPOROSITY
191 /*------------------------------------------------------------------*/
192 #ifdef SKUPINA_INTERTRANSFER
193  S_BOOL sw_CTR_apply; /* pocitat INTERTRANSFER */
194  int nctr; /* pocet skupin INTERTRANSFER */
195 #endif // SKUPINA_INTERTRANSFER
196 /*------------------------------------------------------------------*/
197 #ifdef SKUPINA_TRANSPORT
198  int nvod; /* pocet typu vod */
199 /*------------------------------------------------------------------*/
200  S_BOOL time_analysis; /* rozbor casoveho kroku */
201  S_BOOL quazi_unsteady; /* kvazi nestacionarni uloha */
202  S_BOOL write_waters; /* vypsat nalezene vody */
203 /*..................................................................*/
206 #ifdef SKUPINA_DUALPOROSITY
207  char jmeno_sini[ MAXPATH ]; // mh: zvlast POC pro slepe pory
208  char jmeno_spop[ MAXPATH ]; // mh: zvlast POP pro slepe pory
209 #endif // SKUPINA_DUALPOROSITY
210  int nrslo; /* pocet slozek Roztoku - POP */
211 /*..................................................................*/
212  int nrlimit; /* pocet limitu Roztoku */
213  char plimit[ NLENSPO +1 ]; /* popis limitni slozky Roztoku */
214  double *rlimit; /* hodnoty limitu Roztoku */
215  int irlimit; /* index limitni slozky Roztoku */
216 /*..................................................................*/
217  double Eps_Qs; /* Maximalni chyba bilance vnitrni steny */
218  double Eps_Qe; /* Maximalni chyba bilance Elementu */
219 #endif // SKUPINA_TRANSPORT
220 /*------------------------------------------------------------------*/
221 #ifdef SKUPINA_CHEMIE
222  S_BOOL sw_Chem_WriteSet; /* Vypsat nastaveni chemie 0-NE, 1-ano */
223  S_BOOL sw_Chem_Consist; /* Vyzadovat konzistenci 0-ne, 1-ANO */
224  char jmeno_chem_cfg[ MAXPATH ];
225  char jmeno_chem_err[ MAXPATH ];
226  TChemie *Chem_Chem;
227  TChemieBloku **Chem_Blok;
228  char jmeno_hini[ MAXPATH ];
229  char jmeno_hpop[ MAXPATH ];
230  int nhslo; /* pocet slozek Horniny - POP */
231  S_BOOL sw_kapalna; /* Pocita se s KAPALNOU fazi */
232  S_BOOL sw_pevna; /* Pocita se s PEVNOU fazi */
233  S_BOOL sw_plyn; /* Pocita se s PLYNNOU fazi */
234 // S_BOOL sw_sorpce; /* Pocita se s SORBOVANOU fazi */
235  S_BOOL sw_redox; /* Pocita se s REDOX fazi */
236  S_BOOL sw_radio; /* Pocita se s RADIO fazi */
237  S_BOOL sw_vlastnosti; /* Pocita se s VLASTNOSTMI */
238 #endif // SKUPINA_CHEMIE
239 /*------------------------------------------------------------------*/
240  int pis_log;
241 /*------------------------------------------------------------------*/
242  char sit_popis[ 80 ]; /* popis site */
243  float sit_alfa; /* uhel anizotropie */
244  int sit_nvrst; /* max. pocet vrstev site */
245 };
246 EX struct S_glp G_glp;
247 /********************************************************************/
248 /* Popis MultiElementu a Elementu ( soubor .STE ) */
249 /********************************************************************/
250 struct S_melm // multielement
251 {
252  int oznac; /* oznaceni Melementu < 0 zrusen */
253  int ipelm; /* inter. cislo prvniho elementu */
254  int npelm; /* pocet elementu v tomtom Melm */
255  int muzl[ 3 ]; /* interni cisla prirazenych Muzlu */
256  int ipz0[ 3 ]; /* poradove cislo startovni z-ovky */
257  float k1lm1[ MAXK1LM1 ]; /* koeficienty MElm */
258  int oblast; /* cislo oblasti obsahujici Melm */
259  int odv; /**/
260  int dov; /**/
261 /*------------------------------------------------------------------*/
262  double sumtok; /* souhrny prutok MELM do okoli */
263 };
264 EX struct S_melm *P_melm;
265 /********************************************************************/
266 struct S_elm // element
267 {
268  int imelm; /* interni cislo Multielementu */
269  int ivrst; /* cislo vrtvy */
270  int imatr; /* cislo materialu */
271  // sem je nactena hodnota z *.stm, je kopirovano do idpor (pro dvoji porozitu, jinak se nepouziva)
272  float koef[ MAXELKOEF ]; /* koeficienty elementu */
273 /*------------------------------------------------------------------*/
274 #ifdef SKUPINA_DUALPOROSITY
275  int idpor; /* index S_DPOR */
276 #endif // SKUPINA_DUALPOROSITY
277 /*------------------------------------------------------------------*/
278  double vyska; /* piezometricka vyska v T ELM */
279  double tlak; /* tlak v T ELM */
280  double stntlk[ 5 ]; /* tlak v T steny */
281  double stntok[ 5 ]; /* pretok stenou */
282  double bilance; /* bilance ELM */
283  int stnvod[ 6 ]; /* typ vody prochazejici stenou */
284 /*------------------------------------------------------------------*/
285  double objem; /* objem ELM */
286  double porobjm; /* porovy objem ELM */
287  double porobjm_por; /* porovy objem ELM poru */
288 /*------------------------------------------------------------------*/
289 #ifdef SKUPINA_TRANSPORT
290  double *rslo; /* koncentrace slozek roztoku */
291  double *rslonew; /* koncentrace slozek roztoku */
292  #ifdef SKUPINA_DUALPOROSITY
293  double *rslo_por; /* koncentrace slozek poroveho roztoku */
294  double *rslonew_por; /* koncentrace slozek poroveho roztoku */
295  #endif // SKUPINA_DUALPOROSITY
296 #endif // SKUPINA_TRANSPORT
297 /*------------------------------------------------------------------*/
298 #ifdef SKUPINA_CHEMIE
299  TChemieElementuD *Chem;
300  double *vslo; /* slozky vlastnost */
301  double *hslo; /* koncentrace slozek horniny */
302  double *pslo; /* koncentrace slozek plynny */
303  #ifdef SKUPINA_DUALPOROSITY
304  TChemieElementuD *Chem_por;
305  double *vslo_por; /* slozky porove vlastnost */
306  double *hslo_por; /* koncentrace slozek porove horniny */
307  double *pslo_por; /* koncentrace slozek porove plynny */
308  #endif // SKUPINA_DUALPOROSITY
309 #endif // SKUPINA_CHEMIE
310 /*------------------------------------------------------------------*/
311 #ifdef SKUPINA_REAKCE
312  double sorpcni_plocha; /* sorpcni plocha ELM poru */
313  double *hslo; /* koncentrace slozek horniny */
314  double *pslo; /* koncentrace slozek plynny */
315  #ifdef SKUPINA_DUALPOROSITY
316  double sorpcni_plocha_por; /* sorpcni plocha ELM porove horniny*/
317  double *hslo_por; /* koncentrace slozek porove horniny */
318  double *pslo_por; /* koncentrace slozek porove plynny */
319  #endif // SKUPINA_DUALPOROSITY
320 #endif // SKUPINA_REAKCE
321 /*------------------------------------------------------------------*/
322  double cas_koef;
324 };
325 EX struct S_elm *P_elm;
326 /********************************************************************/
327 /* Popis MultiUzlu a Uzlu ( soubor .STU ) */
328 /********************************************************************/
329 struct S_muzl
330 {
331  int oznac; /* oznaceni multiuzlu */
332  int ismelm; /* prvni sousedni multielem */
333  int nsmelm; /* pocet sousednich multielem */
334  int ipuzl; /* interni cislo prvniho uzlu */
335  int npuzl; /* pocet uzlu v multiuzlu */
336  double x, y; /* souradnice multiuzlu */
337  double z_povrch; /* Z-tova souradnice povrchu */
338  int odp; /**/
339  int dop; /**/
340 };
341 EX struct S_muzl *P_muzl;
342 /********************************************************************/
343 struct S_uzl
344 {
345  int imuzl; /* interni cislo MultiUzlu */
346  double z0; /* vyska daneho uzlu */
347 };
348 EX struct S_uzl *P_uzl;
349 /********************************************************************/
350 /* Popis sousednich MultiElm k danemu MultiUzl */
351 /********************************************************************/
352 struct S_smume
353 {
354  int muzl; /* multiuzel */
355  int melm; /* sousedni multielement */
356 };
358 /********************************************************************/
359 /* Popis typu cerpanych a vtlacenych vod */
360 /********************************************************************/
361 struct S_vod
362 {
363  int typ; /* typ vody */
364  char nazev[ 128 ]; /* nazev typu vody */
365 /*------------------------------------------------------------------*/
366  S_BOOL sw_OSM; /* Zapisovat hmotnosti vy. latek */
367  S_BOOL sw_OSC; /* Zapisovat koncentraci */
368 /*------------------------------------------------------------------*/
369 // Okamzite koncentrace
370  double *vrslo; /* koncentrace slozek vtlaceneho ROZTOKU */
371  double *crslo; /* koncentrace slozek cerpaneho ROZTOKU */
372 /*------------------------------------------------------------------*/
373 // Absolutni objemy a hmotnosti od casu NULA
374  double Cobjem; /* objem cerpane vody */
375  double *Chmota; /* hmotnost cerpanych slozek */
376  double Vobjem; /* objem vtlacene vody */
377  double *Vhmota; /* hmotnost vtlacenych slozek */
378 /*------------------------------------------------------------------*/
379 // Relativni objemy a hmotnosti od zacatku kroku TRAN
380  double CKobjem; /* objem cerpane vody */
381  double *CKhmota; /* hmotnost cerpanych slozek */
382  double VKobjem; /* objem vtlacene vody */
383  double *VKhmota; /* hmotnost vtlacenych slozek */
384 /*------------------------------------------------------------------*/
385 // Pracovni objemy a hmotnosti
386  double WCobjem; /* objem cerpane vody */
387  double *WChmota; /* hmotnost cerpanych slozek */
388  double WVobjem; /* objem vtlacene vody */
389  double *WVhmota; /* hmotnost vtlacenych slozek */
390 };
391 #ifdef SKUPINA_TRANSPORT
392 EX struct S_vod *P_vod;
393 #endif // SKUPINA_TRANSPORT
394 /********************************************************************/
395 /* Popis a obsah vrstev */
396 /********************************************************************/
397 struct S_pvr
398 {
399  char popis[ NLENPVR +1 ]; /* popis (oznaceni) vrstvy */
400  int ipslo; /* interni cislo prvni slozky */
401 };
402 EX struct S_pvr *P_pvr;
403 /********************************************************************/
404 /* Popis slozek Roztoku */
405 /********************************************************************/
406 struct S_rpo
407 {
408  char popis[ NLENSPO +1 ]; /* popis slozky Roztoku */
409  char unit[ 5 ]; /* jednotka slozky [g/l mg/l] */
410  int to_chem; /* ukazatel do vektoru chemie */
411 #ifdef SKUPINA_DUALPOROSITY
412  // mh:
413  double difus_koef_DP; /* relativni koef difuze pro dualni porozitu*/
414 #endif // SKUPINA_DUALPOROSITY
415 
416 /*------------------------------------------------------------------*/
417 };
418 #ifdef SKUPINA_TRANSPORT
419  EX struct S_rpo *P_rpo;
420 #endif // SKUPINA_TRANSPORT
421 /********************************************************************/
422 /* Popis slozek Horniny */
423 /********************************************************************/
424 struct S_hpo
425 {
426  char popis[ NLENSPO +1 ]; /* popis slozky Horniny */
427  char unit[ 4 ]; /* jednotka slozky [hm%] */
428  int to_chem; /* ukazatel do vektoru chemie */
429 /*------------------------------------------------------------------*/
430 };
431 #ifdef SKUPINA_CHEMIE
432  EX struct S_hpo *P_hpo;
433 #endif // SKUPINA_CHEMIE
434 /********************************************************************/
435 /* Seznam okrajovych podminek */
436 /********************************************************************/
437 struct S_sez
438 {
439  char fname[ MAXPATH ];
440  char txt[ 80 ]; /* Popis dane OKP */
441  int ipoke; /* interni cislo OKE */
442  int npoke; /* Pocet OKE */
443  double srazky; /* Destove srazky v mm . rok^-1 */
444  double dt; /* Casovy krok */
445  int NK_Flow; /* Pocet casovych kroku FLOW */
446 /*------------------------------------------------------------------*/
447 #ifdef SKUPINA_TRANSPORT
448  char iname[ MAXPATH ]; /* Jmeno INI souboru OKP */
449  int NK_Tran; /* Pocet casovych kroku TRAN */
450 #endif // SKUPINA_TRANSPORT
451 /*------------------------------------------------------------------*/
452 #ifdef SKUPINA_CHEMIE
453  int NK_Chem; /* Pocet casovych kroku CHEM */
454 #endif // SKUPINA_CHEMIE
455 /*------------------------------------------------------------------*/
456  int NK_Result; // pocet casovych kroku pro vystup do TS3 a BIN
457  int NK_sez; /* Pocet casovych kroku F_T_Ch */
458 };
459 #ifdef SKUPINA_SCENAR
460  EX struct S_sez *P_sez;
461 #endif // SKUPINA_SCENAR
462 /********************************************************************/
463 /* Popis okrajovych podminek - novy typ OKE */
464 /********************************************************************/
465 struct S_oke
466 {
467  int typ; /* typ okrajove podminky */
468  int ivoda; /* typ vody */
469  float hodnota_oke; /* zadana hodnota OKE */
470  float koeficient_oke; /* koeficient OKE */
471 /*------------------------------------------------------------------*/
472  int ie_od; /* interni cislo Elm (dolniho) */
473  int ie_do; /* interni cislo Elm (horniho) */
474  int iis; /* interni cislo steny */
475 /*------------------------------------------------------------------*/
476  int zapnuto; /* priznak zapnuti OKE */
477 };
478 #ifdef SKUPINA_SCENAR
479  EX struct S_oke *P_oke;
480 #endif // SKUPINA_SCENAR
481 /********************************************************************/
482 /* Popis typu materialu pro nenasycene proudeni (z INI souboru) */
483 /********************************************************************/
484 struct S_matr
485 {
486  int typ; /* typ materialu */
487  int funkce; /* funkce pro dany material */
488  double S_min; /* Minimalni saturace */
489  double Kr_min; /* Minimalni koef. rel. prop. */
490  int nkoef; /* pocet koef dane funkce */
491  double koef[ MAXMATRKOEF ]; /* koeficienty pro danou funkci */
492 };
493 #ifdef SKUPINY_MATERIALU
494  EX struct S_matr *P_matr;
495 #endif // SKUPINY_MATERIALU
496 /********************************************************************/
497 /* Popis typu materialu pro DUAL POROSITY (z INI souboru) */
498 /********************************************************************/
499 struct S_dpor
500 {
501  int typ; /* typ materialu */
502  int funkce; /* funkce pro dany material */
503  int nkoef; /* pocet koef. dane funkce */
504  double koef[ MAXDPORKOEF ]; /* koeficienty pro danou funkci */
505 };
506 #ifdef SKUPINA_DUALPOROSITY
507  EX struct S_dpor *P_dpor;
508 #endif // SKUPINA_DUALPOROSITY
509 /********************************************************************/
510 /* Popis prechodu pro INTERTRANSFER (z INI souboru) */
511 /********************************************************************/
512 struct S_ctr
513 {
514  int ivrst; /* index sledovane vrstvy */
515  int ikoef_melm; /* index prepocivaciho koef. */
516  double UP_hmota;
517  double DOWN_hmota;
518 };
519 #ifdef SKUPINA_INTERTRANSFER
520  EX struct S_ctr *P_ctr;
521 #endif // SKUPINA_INTERTRANSFER
522 //
523 /********************************************************************/
524 /* Definice funkci */
525 /********************************************************************/
526 /* Cteni vstupnich dat */
527 /********************************************************************/
528 void ctimmf( void ); /* Nacteni parametru ze souboru .INI */
529 void ctiuzl( void ); /* Nacteni uzlu ze souboru .UZL */
530 void ctielm( void ); /* Nacteni elementu ze souboru .ELM */
531 void ctistu( void ); /* Nacteni uzlu ze souboru .STU */
532 void ctiste( void ); /* Nacteni elementu ze souboru .STE */
533 void ctistm( void ); /* Nacteni koef. Elm ze souboru .STM */
534 void smume( void ); /* Vytvoreni struktury SMUME */
535 /*------------------------------------------------------------------*/
536 void ctihdm( int, int ); /* Nacteni souboru hydrodynamiky .HDM */
537 void nastav_slozky( void );
538 void uvolni_slozky( void );
539 void ctipop( int ); /* Nacteni pocatecnich podminek .POP */
540 /*------------------------------------------------------------------*/
541 void inicializace_S_vod( void );
542 void uvolneni_S_vod( void );
543 /*------------------------------------------------------------------*/
544 void sumace( double );
545 
546 //mh:
547 #ifdef SKUPINA_DUALPOROSITY
548  void init_DP_mater( void ); // nastaveni indexu materialu pro DP
549 #endif // SKUPINA_DUALPOROSITY
550 
551 /********************************************************************/
552 /* Zapis vystupnich dat */
553 /********************************************************************/
554 void pis_TS2( double ); /* Zapis souboru roztoku po vrst. .TS2 */
555 #ifdef SKUPINA_DUALPOROSITY
556  int pisTS34( int, int, double ); /* Zapis vysledku do .TS3 nebo .TS4 */
557  #else //SKUPINA_DUALPOROSITY
558  int pisTS34( int, double ); /* Zapis vysledku do .TS3 nebo .TS4 */
559 #endif // SKUPINA_DUALPOROSITY
560 int pisDF0( double, double, int ); /* Zapis vysledku do .DF0 */
561 int pisDF1( double, double, int ); /* Zapis vysledku do .DF1 */
562 int pisDF2( double, double, int ); /* Zapis vysledku do .DF2 */
563 // mh: (doplneno df3 na vystup koncentraci)
564 int pisDF3( double, double, int ); /* Zapis vysledku do .DF3 */
565 void otevri_bin( int );
566 void pis_bin( int, float * );
567 void zavri_bin( void );
568 int pisPOP(char*) ; // zapis POP z hodnot na konci vypoctu
569 /********************************************************************/
570 /* Pripravne vypocty */
571 /********************************************************************/
572 void *seznam_sten( int ); /* Vytvari seznam sousednich sten */
573 /********************************************************************/
574 /* Utility pro pripravne vypocty */
575 /********************************************************************/
576 int uzl_pro_elm( int, int ); /* vraci cislo uzlu pro ELM a iUZL */
577 int iuzl_pro_elm( int, int ); /* vraci iUZL pro ELM a UZL */
578 void buble_sort( int *, int ); /* Bublinove trideni */
579 /********************************************************************/
580 /* Vlastni vypocet */
581 /********************************************************************/
582 void vypocet( void ); /* Ridici program vypoctu */
583 void sestmat( void ); /* Sestaveni globalni matice */
584 void objemy( void ); /* vypocet objemu elementu */
585 void nej_spolky( int, int, int, int *, int * );
586 int caskrok( double ); /* vypocet casoveho kroku */
587 /********************************************************************/
588 /* Souborove UTILITY */
589 /********************************************************************/
590 char *fjmeno( char *, char * ); /* Cele jmenu souboru */
591 FILE *fotevri( char *, const char * ); /* Otevreni souboru */
592 int aktualnejsi_soubor( char *, char * );
593 /********************************************************************/
594 /* Behove UTILITY */
595 /********************************************************************/
596 void Start_programu( char * ); /* Pocatecni hlavicka programu */
597 void Konec_programu( char * ); /* Hlavicka ukonceni behu program */
598 void Prerus_program( char *, int ); /* Hlavicka ukonceni behu programu */
599 /********************************************************************/
600 /* Casove UTILITY */
601 /********************************************************************/
602 char *mezi_cas( int ); /* Vraci string - mezicas vypoctu */
603 /********************************************************************/
604 /* Pametove UTILITY */
605 /********************************************************************/
606 void malo_pameti( char *, char *, int ); /* Hlaska malo pameti */
607 void pole_je_male( int, char *, int, char * ); /* Hlaska male pole */
608 /********************************************************************/
609 /* Logovaci UTILITY */
610 /********************************************************************/
611 void smazlog( void );
612 void pislog( char *, ... );
613 void pisscr( char *, ... );
614 /********************************************************************/
615 /* Vystup na obrazovku pro TRANSPORT */
616 /********************************************************************/
617 void win_tran_START( char * );
618 void win_tran_STOP( void );
619 void pis_Tran( char *fmt, ... );
620 /*------------------------------------------------------------------*/
621 /* Testy */
622 /*------------------------------------------------------------------*/
623 void cesta_k_souboru_sestav( char *, char *, char * );
624 /********************************************************************/
625 /* copied from che_head.h to simplify structure of inclusions */
626 /********************************************************************/
627 /* vim: set ts=3 sw=3 expandtab: */
628 
629 struct TS_prm //typedef struct
630 {
631  char jmeno_ich[ MAXPATH ];
640  double T; //long long double
641  double TGf; //long long double
642  double Afi; //long double
643  double b; //long double
644  double epsilon; //long double
645  double omega; //long double
646  double deltaT; //long double
647  double objem; //long double
648  double splocha; //long double
650  int vypisy;
654 }; //TS_prm;
655 
656 struct TS_lat //typedef struct
657 {
658  char nazev[ 80 ]; /* Jmeno latky */
659  double m0; /* pocatecni molalita *///long double
660  double m; /* konecna molalita *///long double
661  double M; /* molarni hmotnost *///long double
662  double dGf; /* prispevek ke Gibbsove energii *///long double
663  double dHf; /* prispevek k entalpii *///long double
664  int Q; /* naboj */
665  double aktivita; /* aktivita *///long double
666  int typ_sorpce; /* typ sorpce */
667  double param_sorpce[MAX_POC_PARAM_SORPCE];//long double
668 }; //TS_lat;
669 
670 struct TS_che //typedef struct
671 {
672  char nazev[ 80 ]; /* Jmeno reakce */
673  int stech_koef_p[MAX_POC_LATEK]; /* Stechiom.koef.slozek vpravo*/
674  double K; /*rovnovazna, nebo kineticka konstanta, nebo bilance*///long double
675  int typ_reakce; /* 0==rovnovazna, 1==kineticka, 2==bilancni, 3==pomala kinetika */
676  double exponent[MAX_POC_LATEK]; /* exponenty pro kinetiku*///long double
677  double zeta0; /*pocatecni posunuti reakce*///long double
678 }; //TS_che;
679 
680 //---------------------------------------------------------------------------
681 // Funkce z che_semchem.cpp
682 //---------------------------------------------------------------------------
683 void che_nactenichemie( void ); /* funkce nacteni chemie */
684 void ctiich (void); /*pomocna funkce nacteni chemie*/
685 
686 /********************************************************************/
687 /* copied from cti_ichnew.c to simplify structure of inclusions */
688 /********************************************************************/
689 
690 float che_poradi(int param1, double param2, double param3);
691 void ctiich_obecne(void);
692 void ctiich_latkyvefazi(void);
693 void ctiich_dalsilatky(void);
694 void ctiich_reakce(void);
695 float che_poradi (int typ_reakce, double max, double K);
696 void che_pocitej_soubor(char *soubor, int *poc_krok);
697 void che_presun_poc_p_(void);
698 
699 /********************************************************************/
700 /* copied from semchem_interface.hh to simplify structure of inclusions */
701 /********************************************************************/
702 void che_outpocp_soubor(FILE *fw);
703 void che_pocitej_soubor(char *soubor, int *poc_krok);
704 void che_vypis_soubor(char *soubor);
705 void che_presun_poc_p_(void);
706 void che_vypis__soubor(char *soubor);
707 
708 
709 #endif
int oblast
Definition: che_semchem.h:258
double Cobjem
Definition: che_semchem.h:374
int oznac
Definition: che_semchem.h:331
double * hslo_por
Definition: che_semchem.h:317
void win_tran_STOP(void)
int ipelm
Definition: che_semchem.h:253
double * rslonew
Definition: che_semchem.h:291
void ctiich_reakce(void)
Definition: che_read.cc:420
double omega
Definition: che_semchem.h:645
EX struct S_dpor * P_dpor
Definition: che_semchem.h:507
FILE * fotevri(char *, const char *)
int melm
Definition: che_semchem.h:355
double difus_koef_DP
Definition: che_semchem.h:413
#define MAX_POC_LATEK
Definition: che_semchem.h:36
double K
Definition: che_semchem.h:674
int pisDF1(double, double, int)
int pocet_kinetik
Definition: che_semchem.h:637
int ipuzl
Definition: che_semchem.h:334
int nsmelm
Definition: che_semchem.h:333
int muzl
Definition: che_semchem.h:354
char jmeno_spop[MAXPATH]
Definition: che_semchem.h:208
double porobjm_por
Definition: che_semchem.h:287
int odv
Definition: che_semchem.h:259
int pocet_latekvefazi
Definition: che_semchem.h:633
double * VKhmota
Definition: che_semchem.h:383
double * CKhmota
Definition: che_semchem.h:381
char plimit[NLENSPO+1]
Definition: che_semchem.h:213
EX int G_cas_resice
Definition: che_semchem.h:125
void che_vypis_soubor(char *soubor)
Definition: che_semchem.cc:40
int skaluj_matici
Definition: che_semchem.h:652
EX double * P_rslo_new
Definition: che_semchem.h:149
int typ
Definition: che_semchem.h:486
void smume(void)
void win_tran_START(char *)
#define MAXMATRKOEF
Definition: che_semchem.h:99
int pisDF2(double, double, int)
int ivrst
Definition: che_semchem.h:514
int imelm
Definition: che_semchem.h:268
#define MAXELKOEF
Definition: che_semchem.h:98
int typ
Definition: che_semchem.h:363
void uvolni_slozky(void)
void smazlog(void)
EX char ** G_argv
Definition: che_semchem.h:117
int typ_reakce
Definition: che_semchem.h:675
int nkoef
Definition: che_semchem.h:490
S_BOOL sw_OSC
Definition: che_semchem.h:367
char jmeno_MMF[MAXPATH]
Definition: che_semchem.h:162
int typ
Definition: che_semchem.h:501
double Eps_Qs
Definition: che_semchem.h:217
void pisscr(char *,...)
int ie_od
Definition: che_semchem.h:472
char jmeno_site[MAXPATH]
Definition: che_semchem.h:164
int NK_sez
Definition: che_semchem.h:457
int pisDF0(double, double, int)
void ctiich_obecne(void)
Definition: che_read.cc:27
EX int G_argc
Definition: che_semchem.h:116
double WVobjem
Definition: che_semchem.h:388
double sorpcni_plocha_por
Definition: che_semchem.h:316
double z0
Definition: che_semchem.h:346
int dop
Definition: che_semchem.h:339
char jmeno_rpop[MAXPATH]
Definition: che_semchem.h:205
int npelm
Definition: che_semchem.h:254
int iis
Definition: che_semchem.h:474
#define MAX_POC_PARAM_SORPCE
Definition: che_semchem.h:37
void objemy(void)
int nmelm
Definition: che_semchem.h:168
void ctipop(int)
int nelm_0
Definition: che_semchem.h:171
S_BOOL sw_OSM
Definition: che_semchem.h:366
EX struct S_melm * P_melm
Definition: che_semchem.h:264
EX struct S_uzl * P_uzl
Definition: che_semchem.h:348
int cas_kroku
Definition: che_semchem.h:649
double * hslo
Definition: che_semchem.h:313
void uvolneni_S_vod(void)
double * rslo
Definition: che_semchem.h:290
void che_outpocp_soubor(FILE *fw)
Definition: che_semchem.cc:65
int funkce
Definition: che_semchem.h:502
EX struct S_elm * P_elm
Definition: che_semchem.h:325
char * fjmeno(char *, char *)
EX char * G_mezi_cas
Definition: che_semchem.h:120
void che_vypis__soubor(char *soubor)
Definition: che_semchem.cc:52
double y
Definition: che_semchem.h:336
#define MAXDPORKOEF
Definition: che_semchem.h:100
void ctiich_latkyvefazi(void)
Definition: che_read.cc:161
double deltaT
Definition: che_semchem.h:646
#define NLENSPO
Definition: che_semchem.h:102
int uzl_pro_elm(int, int)
EX int * P_j
Definition: che_semchem.h:141
void pislog(char *,...)
char * mezi_cas(int)
int nrslo
Definition: che_semchem.h:210
int ismelm
Definition: che_semchem.h:332
int iuzl_pro_elm(int, int)
int pisTS34(int, int, double)
double epsilon
Definition: che_semchem.h:644
int pocet_pom_kin
Definition: che_semchem.h:638
#define S_BOOL
Definition: che_semchem.h:25
int pocet_reakci_pro_matici
Definition: che_semchem.h:635
double tlak
Definition: che_semchem.h:279
double b
Definition: che_semchem.h:643
void ctielm(void)
void malo_pameti(char *, char *, int)
int ivrst
Definition: che_semchem.h:269
int vypisy
Definition: che_semchem.h:650
int npoke
Definition: che_semchem.h:442
double Afi
Definition: che_semchem.h:642
int oznac
Definition: che_semchem.h:252
void ctihdm(int, int)
EX struct S_smume * P_smume
Definition: che_semchem.h:357
int nvrst
Definition: che_semchem.h:178
EX int * P_i
Definition: che_semchem.h:141
int odp
Definition: che_semchem.h:338
float che_poradi(int param1, double param2, double param3)
#define MAXK1LM1
Definition: che_semchem.h:97
void otevri_bin(int)
EX char * G_Program_name
Definition: che_semchem.h:118
int pocet_rovnovah
Definition: che_semchem.h:636
EX struct S_vod * P_vod
Definition: che_semchem.h:392
int typ
Definition: che_semchem.h:467
double * crslo
Definition: che_semchem.h:371
EX struct S_matr * P_matr
Definition: che_semchem.h:494
S_BOOL quazi_unsteady
Definition: che_semchem.h:201
EX int G_exit_code
Definition: che_semchem.h:122
int pis_log
Definition: che_semchem.h:240
EX time_t G_start_time
Definition: che_semchem.h:119
void ctiich(void)
Definition: che_read.cc:577
double M
Definition: che_semchem.h:661
int nkoef
Definition: che_semchem.h:172
double * Vhmota
Definition: che_semchem.h:377
double dt
Definition: che_semchem.h:444
int npuzl
Definition: che_semchem.h:335
int ndpor
Definition: che_semchem.h:189
int nvod
Definition: che_semchem.h:198
void che_pocitej_soubor(char *soubor, int *poc_krok)
double * pslo
Definition: che_semchem.h:314
EX struct S_muzl * P_muzl
Definition: che_semchem.h:341
int nrlimit
Definition: che_semchem.h:212
double Eps_Qe
Definition: che_semchem.h:218
double * pslo_por
Definition: che_semchem.h:318
int imatr
Definition: che_semchem.h:270
int nuzl
Definition: che_semchem.h:167
int celkovy_pocet_reakci
Definition: che_semchem.h:634
void che_nactenichemie(void)
EX double * P_rslo
Definition: che_semchem.h:148
int pisDF3(double, double, int)
int noke
Definition: che_semchem.h:181
#define MAXPATH
Definition: che_semchem.h:34
int ivoda
Definition: che_semchem.h:468
EX struct S_oke * P_oke
Definition: che_semchem.h:479
double splocha
Definition: che_semchem.h:648
double dGf
Definition: che_semchem.h:662
void che_presun_poc_p_(void)
double Kr_min
Definition: che_semchem.h:489
double aktivita
Definition: che_semchem.h:665
double sorpcni_plocha
Definition: che_semchem.h:312
int to_chem
Definition: che_semchem.h:410
void Start_programu(char *)
int sit_nvrst
Definition: che_semchem.h:244
double * Chmota
Definition: che_semchem.h:375
int ipoke
Definition: che_semchem.h:441
double T
Definition: che_semchem.h:640
void pis_bin(int, float *)
double z_povrch
Definition: che_semchem.h:337
int nsmume
Definition: che_semchem.h:173
void Prerus_program(char *, int)
int aktualnejsi_soubor(char *, char *)
int nelm
Definition: che_semchem.h:170
EX double * P_MX
Definition: che_semchem.h:142
int abs_norma
Definition: che_semchem.h:653
int nmuzl
Definition: che_semchem.h:166
double WCobjem
Definition: che_semchem.h:386
int caskrok(double)
int nmatr
Definition: che_semchem.h:184
int funkce
Definition: che_semchem.h:487
int pocet_latek
Definition: che_semchem.h:632
float hodnota_oke
Definition: che_semchem.h:469
EX struct S_rpo * P_rpo
Definition: che_semchem.h:419
int idpor
Definition: che_semchem.h:275
S_BOOL cas_typ
Definition: che_semchem.h:323
EX struct S_pvr * P_pvr
Definition: che_semchem.h:402
void ctistm(void)
int imuzl
Definition: che_semchem.h:345
void inicializace_S_vod(void)
void sumace(double)
int NK_Result
Definition: che_semchem.h:456
double UP_hmota
Definition: che_semchem.h:516
int nkoef
Definition: che_semchem.h:503
void cesta_k_souboru_sestav(char *, char *, char *)
#define NLENPVR
Definition: che_semchem.h:103
double vyska
Definition: che_semchem.h:278
double sumtok
Definition: che_semchem.h:262
void nej_spolky(int, int, int, int *, int *)
void Konec_programu(char *)
#define EX
Definition: che_semchem.h:52
double * WVhmota
Definition: che_semchem.h:389
int nsez
Definition: che_semchem.h:180
double cas_koef
Definition: che_semchem.h:322
double m
Definition: che_semchem.h:660
int ipslo
Definition: che_semchem.h:400
void pis_TS2(double)
double objem
Definition: che_semchem.h:285
EX struct S_sez * P_sez
Definition: che_semchem.h:460
void pole_je_male(int, char *, int, char *)
char sit_popis[80]
Definition: che_semchem.h:242
EX double * P_MM
Definition: che_semchem.h:142
int nstnin
Definition: che_semchem.h:176
void zavri_bin(void)
int ie_do
Definition: che_semchem.h:473
EX double * P_rslo_por
Definition: che_semchem.h:151
char jmeno_sini[MAXPATH]
Definition: che_semchem.h:207
int dov
Definition: che_semchem.h:260
double * rlimit
Definition: che_semchem.h:214
double TGf
Definition: che_semchem.h:641
int NK_Tran
Definition: che_semchem.h:449
void ctiuzl(void)
EX int * P_Steny
Definition: che_semchem.h:135
int pisPOP(char *)
int zapnuto
Definition: che_semchem.h:476
void ctiste(void)
double * WChmota
Definition: che_semchem.h:387
EX double * P_MR
Definition: che_semchem.h:142
double zeta0
Definition: che_semchem.h:677
EX double * P_sod
Definition: che_semchem.h:153
int NK_Flow
Definition: che_semchem.h:445
Definition: format.cc:82
void * seznam_sten(int)
void nastav_slozky(void)
EX struct S_glp G_glp
Definition: che_semchem.h:246
int pocet_rozpadu
Definition: che_semchem.h:639
double srazky
Definition: che_semchem.h:443
double dHf
Definition: che_semchem.h:663
char jmeno_rini[MAXPATH]
Definition: che_semchem.h:204
double porobjm
Definition: che_semchem.h:286
S_BOOL sw_DP_apply
Definition: che_semchem.h:188
double objem
Definition: che_semchem.h:647
void ctistu(void)
double DOWN_hmota
Definition: che_semchem.h:517
void ctimmf(void)
double m0
Definition: che_semchem.h:659
double bilance
Definition: che_semchem.h:282
int nstnex
Definition: che_semchem.h:175
float koeficient_oke
Definition: che_semchem.h:470
S_BOOL write_waters
Definition: che_semchem.h:202
void sestmat(void)
double * vrslo
Definition: che_semchem.h:370
void pis_Tran(char *fmt,...)
void init_DP_mater(void)
void buble_sort(int *, int)
double * rslo_por
Definition: che_semchem.h:293
EX int NULA
Definition: che_semchem.h:121
int to_chem
Definition: che_semchem.h:428
double S_min
Definition: che_semchem.h:488
void ctiich_dalsilatky(void)
Definition: che_read.cc:285
S_BOOL time_analysis
Definition: che_semchem.h:200
double Vobjem
Definition: che_semchem.h:376
int deleni_RK
Definition: che_semchem.h:651
int typ_sorpce
Definition: che_semchem.h:666
double CKobjem
Definition: che_semchem.h:380
EX int G_cas_rozhrani
Definition: che_semchem.h:125
double * rslonew_por
Definition: che_semchem.h:294
double VKobjem
Definition: che_semchem.h:382
float sit_alfa
Definition: che_semchem.h:243
int irlimit
Definition: che_semchem.h:215
int ikoef_melm
Definition: che_semchem.h:515
void vypocet(void)
int nmkoef
Definition: che_semchem.h:169