00001
00002
00003 #ifndef CEMHYDMAT_H
00004 #define CEMHYDMAT_H
00005
00006
00007
00008
00009
00010 #include <stdio.h>
00011
00012 #define TRFEL_CEM
00013
00014 #ifdef TRFEL_CEM
00015 #include "genfile.h"
00016 #else
00017 #include"cmlfile.h"
00018 #endif
00019
00020 typedef struct FCOMPLEX {float r,i;} fcomplex_cem;
00021
00022 class cemhydmat
00023 {
00024 public:
00025 cemhydmat (void);
00026 cemhydmat (cemhydmat *CemP);
00027 ~cemhydmat (void);
00028 FILE *in;
00029 void read (char *inp);
00030 double GetHeat(double GiveTemp, double TargTime);
00031 double MoveCycles(double GiveTemp, int cycles);
00032 int MoveToDoH(double GiveTemp, double DesiredDoH, int maxcyc);
00033 int MoveToTime(double GiveTemp, double TargTime);
00034 double GetTotCemHeat(void);
00035 double GetTotHeat(void);
00036 double GetCp(void);
00037 double GetDoHLastCyc(void);
00038 double GetDoHActual(void);
00039 int GetCycNum(void);
00040 double GetCycTime(void);
00041 void CreateHDCSH(void);
00042 void PercolateForOutput(void);
00043 double GetWcr(void);
00044 void GetInputParams(char *my_string);
00045 void constructor_init(void);
00046 void AnalyticHomogenizationPaste(double &E, double &nu, int perc_unperc_flag);
00047 void AnalyticHomogenizationConcrete(double E_paste_inp, double nu_paste_inp, double *E_paste, double *nu_paste, double *E_mortar, double *nu_mortar, double &E_concrete, double &nu_concrete);
00048 void GetInitClinkerPhases(double &c3s, double &c2s, double &c3a, double &c4af, double &gypsum, double &hemi, double & anh);
00049
00050 #ifdef TRFEL_CEM
00051
00052 void matcond (matrix &d,long ri,long ci,long ipp);
00053 void matcond1d (matrix &d,long ri,long ci,long ipp);
00054 void matcond2d (matrix &d,long ri,long ci,long ipp);
00055 void matcond3d (matrix &d,long ri,long ci,long ipp);
00056 void matcap (double &cc,long ri,long ci,long ipp);
00057 double get_k();
00058 double get_c();
00059 void read (XFILE *in);
00060 void print (FILE *out);
00061 void updateval(long ipp,long im,long ido);
00062 void initvalues(long ipp,long im,long ido);
00063 double get_source(long ipp,long im,long ido);
00064
00065
00066 double average_temp;
00067
00068 long n_ipp;
00069
00070 double init_material_time;
00071
00072 double conductivity;
00073
00074 double capacity;
00075 char *files;
00076 #endif
00077
00078
00079 int readcem (char *inp);
00080 int SYSSIZE;
00081 int SYSIZE;
00082 private:
00083
00084 double TargTime_glob;
00085
00086
00087 int NEIGHBORS;
00088
00089 int BoxSize;
00090 int SolidLimit;
00091 long MAXTRIES;
00092 long int MAXCYC_SEAL;
00093
00094
00095 long SYSIZE_POW3;
00096
00097
00098 int CEM;
00099 int CEMID;
00100 int C2SID;
00101 int GYPID;
00102 int HEMIHYDRATE;
00103 int POZZID;
00104 int INERTID;
00105 int SLAGID;
00106 int AGG;
00107 int FLYASH;
00108
00109 long NPARTC;
00110 long BURNTG;
00111 int NUMSIZES;
00112
00113
00114 long MAXSPH;
00115 double PI;
00116
00117
00118
00119 double Cp_pozz;
00120 double Cp_CH;
00121 double Cp_h2o;
00122 double Cp_bh2o;
00123 double WN;
00124 double WCHSH;
00125
00126 int CUBEMAX;
00127 int CUBEMIN;
00128 long SYSIZEM1;
00129
00130 double DISBIAS;
00131 double DISMIN;
00132 double DISMIN2;
00133 double DISMINSLAG;
00134 double DISMINASG;
00135 double DISMINCAS2;
00136 double DISMIN_C3A_0;
00137 double DISMIN_C4AF_0;
00138 double DETTRMAX;
00139 double DGYPMAX;
00140 double DCACO3MAX;
00141 double DCACL2MAX;
00142 double DCAS2MAX;
00143 double CHCRIT;
00144 double C3AH6CRIT;
00145 double C3AH6GROW;
00146 double CHGROW;
00147 double CHGROWAGG;
00148 double ETTRGROW;
00149 double C3AETTR;
00150 double C3AGYP;
00151
00152 double SOLIDC3AGYP;
00153 double SOLIDC4AFGYP;
00154 double PPOZZ;
00155 double PCSH2CSH;
00156
00157 double A0_CHSOL;
00158 double A1_CHSOL;
00159
00160 double CSHSCALE;
00161 double C3AH6_SCALE;
00162
00163 int BURNT;
00164 long SIZE2D;
00165
00166
00167 long cx(int x,int y,int z,int a,int b,int c);
00168 long cy(int x,int y,int z,int a,int b,int c);
00169 long cz(int x,int y,int z,int a,int b,int c);
00170
00171 long SIZESET;
00172 double AGRATE;
00173 double VOLFACTOR;
00174 double MASSFACTOR;
00175 double MMNa;
00176 double MMK;
00177 double MMNa2O;
00178 double MMK2O;
00179 double BNa;
00180 double BK;
00181 double BprimeNa;
00182 double BprimeK;
00183 double KspCH25C;
00184 double KspGypsum;
00185 double KspSyngenite;
00186 double SpecgravSyngenite;
00187 double KperSyn;
00188
00189 double activeA0;
00190 double activeB0;
00191
00192 double zCa;
00193 double zSO4;
00194 double zOH;
00195 double zNa;
00196 double zK;
00197
00198 double aK;
00199 double aCa;
00200 double aOH;
00201 double aNa;
00202 double aSO4;
00203
00204
00205
00206
00207
00208 double lambdaOH_0;
00209 double lambdaNa_0;
00210 double lambdaK_0;
00211 double lambdaSO4_0;
00212 double lambdaCa_0;
00213 double GOH;
00214 double GK;
00215 double GNa;
00216 double GCa;
00217 double GSO4;
00218 double cm2perL2m;
00219 double EPSS;
00220 double MAXIT;
00221 double EPSP;
00222 int MAXM;
00223
00224 int xoff[27];
00225 int yoff[27];
00226 int zoff[27];
00227
00228
00229 long IA;
00230 long IM;
00231 long IQ;
00232 int IR;
00233 int NTAB;
00234 double EPS;
00235 double NDIV;
00236 double RNMX;
00237 double AM;
00238 int iy;
00239 int *iv;
00240
00241
00242 int POROSITY;
00243 int C3S;
00244 int C2S;
00245 int C3A;
00246 int C4AF;
00247 int GYPSUM;
00248 int HEMIHYD;
00249 int ANHYDRITE;
00250 int POZZ;
00251 int INERT;
00252 int SLAG;
00253 int ASG;
00254 int CAS2;
00255 int CH;
00256 int CSH;
00257 int C3AH6;
00258 int ETTR;
00259 int ETTRC4AF;
00260 int AFM;
00261 int FH3;
00262 int POZZCSH;
00263 int SLAGCSH;
00264 int CACL2;
00265 int FREIDEL;
00266 int STRAT;
00267 int GYPSUMS;
00268 int CACO3;
00269 int AFMC;
00270 int INERTAGG;
00271 int ABSGYP;
00272 int DIFFCSH;
00273 int DIFFCH;
00274 int DIFFGYP;
00275 int DIFFC3A;
00276 int DIFFC4A;
00277 int DIFFFH3;
00278 int DIFFETTR;
00279 int DIFFCACO3;
00280 int DIFFAS;
00281 int DIFFANH;
00282 int DIFFHEM;
00283 int DIFFCAS2;
00284 int DIFFCACL2;
00285 int EMPTYP;
00286 int HDCSH;
00287 int OFFSET;
00288
00289
00290
00291
00292 char ***mic;
00293 private:
00294 cmlfile *F;
00295 double ran1(int *idum);
00296 void addagg(void);
00297 int chksph(int xin,int yin,int zin,int radd,int wflg,int phasein,int phase2);
00298 int gsphere(int numgen,long int *numeach,int *sizeeach, int *pheach);
00299 int create(void);
00300 void drawfloc(int xin,int yin,int zin,int radd,int phasein,int phase2);
00301 int chkfloc(int xin,int yin,int zin,int radd);
00302 void makefloc(void);
00303 void measure(void);
00304 void measagg(void);
00305 void connect(void);
00306 void outmic(void);
00307 int genpartnew(void);
00308 void alloc_char_3D(char***(&mic), long SYSIZE);
00309 void dealloc_char_3D(char***(&mic), long SYSIZE);
00310 void alloc_long_3D(long***(&mic), long SYSIZE);
00311 void dealloc_long_3D(long***(&mic), long SYSIZE);
00312 void alloc_int_3D(int ***(&mask), long SYSIZE);
00313 void dealloc_int_3D(int ***(&mask), long SYSIZE);
00314 void alloc_shortint_3D(short int ***(&mic), long SYSIZE);
00315 void dealloc_shortint_3D(short int ***(&mic), long SYSIZE);
00316 void alloc_double_3D(double ***(&mic), long SYSIZE);
00317 void dealloc_double_3D(double ***(&mic), long SYSIZE);
00318
00319 char ***micorig;
00320 long int ***micpart;
00321
00322
00323
00324 struct cluster{
00325 int partid;
00326 int clustid;
00327 int partphase;
00328 int x,y,z,r;
00329 struct cluster *nextpart;
00330 };
00331
00332
00333
00334
00335
00336 long int ***cement;
00337
00338 long int ***cemreal;
00339
00340 int npart,aggsize;
00341 int iseed, nseed, *seed;
00342 int dispdist;
00343 int clusleft;
00344
00345 long int n_sulfate,target_sulfate,n_total,target_total,volpart[47];
00346 long int n_anhydrite,target_anhydrite,n_hemi,target_hemi;
00347 double probgyp,probhem,probanh;
00348
00349
00350
00351 struct cluster **clust;
00352
00353
00354 int maketemp(int size);
00355 void phcount(void);
00356 int surfpix(int xin,int yin,int zin);
00357 float rhcalc(int phin);
00358 int countem(int xp,int yp,int zp,int phin);
00359 void sysinit(int ph1,int ph2);
00360 void sysscan(int ph1,int ph2);
00361 int procsol(int nsearch);
00362 int procair(int nsearch);
00363 int movepix(int ntomove,int ph1,int ph2);
00364 void sinter3d(int ph1id,int ph2id,float rhtarget);
00365 void stat3d(void);
00366 void rand3d(int phasein,int phaseout, float xpt);
00367 void distrib3d(void);
00368
00369
00370 int ***mask;
00371
00372 int ***curvature;
00373 long int volume[50],surface[50];
00374 int nsph;
00375 int *xsph,*ysph,*zsph;
00376 long int nsolid[1500],nair[1500];
00377
00378
00379 public:
00380 int ***mic_CSH;
00381 int ***ArrPerc;
00382 int ***ConnNumbers;
00383 double *PhaseFrac;
00384
00385
00386
00387 private:
00388 void init(void);
00389 int chckedge(int xck,int yck,int zck);
00390 void passone(int low,int high,int cycid,int cshexflag);
00391 int loccsh(int xcur,int ycur,int zcur,int extent);
00392 int countbox(int boxsize,int qx,int qy,int qz);
00393 int countboxc(int boxsize,int qx,int qy,int qz);
00394 void makeinert(long int ndesire);
00395 void extslagcsh(int xpres,int ypres,int zpres);
00396 void dissolve(int cycle);
00397 void addrand(int randid,long int nneed);
00398 void measuresurf(void);
00399 void resaturate(void);
00400 void outputUnpercImageFile(void);
00401 void readhydrparam(void);
00402 void disrealnew_init(void);
00403 void disrealnew(double GiveTemp, double TargTime, int flag);
00404 int burn3d(int npix, int d1, int d2, int d3);
00405 int burnset(int d1, int d2, int d3);
00406 void parthyd(void);
00407 int moveone(int *xloc, int *yloc,int *zloc,int *act, int sumold);
00408 int edgecnt(int xck, int yck, int zck, int ph1, int ph2, int ph3);
00409 void extcsh(void);
00410 int movecsh(int xcur, int ycur, int zcur, int finalstep, int cycorig);
00411 void extfh3(int xpres, int ypres, int zpres);
00412 int extettr(int xpres, int ypres, int zpres, int etype);
00413 void extch(void);
00414 void extgyps(int xpres, int ypres, int zpres);
00415 int moveanh(int xcur, int ycur, int zcur, int finalstep, float nucprgyp);
00416 int movehem(int xcur, int ycur, int zcur, int finalstep, float nucprgyp);
00417 int extfreidel(int xpres, int ypres, int zpres);
00418 int extstrat(int xpres, int ypres, int zpres);
00419 int movegyp(int xcur, int ycur, int zcur, int finalstep);
00420 int movecacl2(int xcur, int ycur, int zcur, int finalstep);
00421 int movecas2(int xcur, int ycur, int zcur, int finalstep);
00422 int moveas(int xcur, int ycur, int zcur, int finalstep);
00423 int movecaco3(int xcur,int ycur,int zcur,int finalstep);
00424 void extafm(int xpres, int ypres, int zpres);
00425 int moveettr(int xcur, int ycur, int zcur, int finalstep);
00426 void extpozz(int xpres, int ypres, int zpres);
00427 int movefh3(int xcur, int ycur, int zcur, int finalstep, float nucprob);
00428 int movech(int xcur, int ycur, int zcur, int finalstep, float nucprob);
00429 void extc3ah6(int xpres, int ypres, int zpres);
00430 int movec3a(int xcur, int ycur, int zcur, int finalstep, float nucprob);
00431 int movec4a(int xcur, int ycur, int zcur, int finalstep, float nucprob);
00432 void hydrate(int fincyc, int stepmax, float chpar1, float chpar2, float hgpar1, float hgpar2, float fhpar1, float fhpar2, float gypar1, float gypar2);
00433 void laguer(fcomplex_cem a[],int m,fcomplex_cem *x,float eps,int polish);
00434 void zroots(fcomplex_cem a[],int m,fcomplex_cem roots[],int polish);
00435 void pHpred(void);
00436
00437 int IsSolidPhase(int phase);
00438 void burn_phases(int d1, int d2, int d3);
00439 int IsConnected(int cx, int cy, int cz, int dx, int dy, int dz);
00440 void GenerateConnNumbers(void);
00441 void outputImageFilePerc(void);
00442 void WriteUnsortedList(int px, int py, int pz);
00443 void CountPercolation(int &tot_perc, int &tot_unperc);
00444 inline int AdjCoord(int coord);
00445 int NumSol(int cx, int cy, int cz);
00446 void CSHbox(unsigned int *CSH_vicinity);
00447 void nrerror(const char *error_text);
00448 float* vector(int nl,int nh);
00449 int* ivector(int nl,int nh);
00450 double* dvector(int nl,int nh);
00451
00452 float** matrix_cem(int nrl,int nrh,int ncl,int nch);
00453 double** dmatrix(int nrl,int nrh,int ncl,int nch);
00454 int** imatrix(int nrl,int nrh,int ncl,int nch);
00455 float** submatrix(float **a,int oldrl,int oldrh,int oldcl,int oldch,int newrl,int newcl);
00456 void free_vector(float *v, int nl);
00457 void free_ivector(int *v,int nl);
00458 void free_dvector(double *v,int nl);
00459 void free_matrix(float **m,int nrl,int nrh, int ncl);
00460 void free_dmatrix(double **m,int nrl,int nrh, int ncl);
00461 void free_imatrix(int **m,int nrl,int nrh,int ncl);
00462 void free_submatrix(float *b,int nrl);
00463 float** convert_matrix(float *a,int nrl,int nrh,int ncl,int nch);
00464 void free_convert_matrix(float **b,int nrl);
00465 double *last_values;
00466 long int *phase;
00467
00468 fcomplex_cem Cadd(fcomplex_cem a,fcomplex_cem b);
00469 fcomplex_cem Csub(fcomplex_cem a,fcomplex_cem b);
00470 fcomplex_cem Cmul(fcomplex_cem a,fcomplex_cem b);
00471 fcomplex_cem Complex(float re,float im);
00472 fcomplex_cem Conjg(fcomplex_cem z);
00473 fcomplex_cem Cdiv(fcomplex_cem a,fcomplex_cem b);
00474 float Cabs(fcomplex_cem z);
00475 fcomplex_cem Csqrt(fcomplex_cem z);
00476 fcomplex_cem RCmul(float x,fcomplex_cem a);
00477
00478
00479
00480
00481
00482
00483
00484 struct ants{
00485 unsigned char x,y,z,id;
00486 int cycbirth;
00487 struct ants *nextant;
00488 struct ants *prevant;
00489 };
00490
00491
00492
00493 struct togo{
00494 int x,y,z,npore;
00495 struct togo *nexttogo;
00496 struct togo *prevtogo;
00497 };
00498
00499 short int ***cshage;
00500
00501 short int ***faces;
00502 unsigned int *CSH_vicinity;
00503
00504 long int *discount, *count;
00505 long int ncshplategrow,ncshplateinit;
00506
00507
00508 long int npr,nfill,ncsbar,netbar,porinit,nasr,nslagr,slagemptyp;
00509
00510 long int c3sinit,c2sinit,c3ainit,c4afinit,anhinit,heminit,chold,chnew;
00511 long int nmade,ngoing,gypready,poregone,poretodo,countpore;
00512 long int countkeep,water_left,water_off,pore_off;
00513 int ncyc,cyccnt,cubesize,sealed,outfreq,ImgOut;
00514 int icyc,burnfreq,setfreq,setflag,sf1,sf2,sf3,porefl1,porefl2,porefl3;
00515
00516 double ind_time,temp_0,temp_cur,time_step,time_cur,E_act,beta;
00517
00518
00519 double heat_cf;
00520 float w_to_c,s_to_c,krate,totfract,tfractw04,fractwithfill;
00521 float tfractw05,surffract,pfract,pfractw05,sulf_conc;
00522 long int scntcement,scnttotal;
00523 float U_coeff,T_ambient;
00524 double alpha_cur,alpha_last,heat_old,heat_new,cemmass,mass_agg,mass_water,mass_fill,Cp_now, Cp_agg,Cp_cement, cem_m3;
00525 double alpha,CH_mass,mass_CH,mass_fill_pozz,E_act_pozz,chs_new,cemmasswgyp;
00526 float flyashmass,alpha_fa_cur;
00527 double E_act_slag;
00528 double TargDoHelas;
00529
00530 float *molarvcsh,*watercsh;
00531 float heatsum,molesh2o,saturation;
00532
00533 float *disprob,*disbase;
00534 float gypabsprob,ppozz;
00535
00536
00537 float *specgrav,*molarv,*heatf,*waterc;
00538
00539
00540 int *soluble,*creates;
00541 int csh2flag,adiaflag,chflag,nummovsl;
00542 float cs_acc;
00543 float ca_acc;
00544 float dismin_c3a;
00545 float dismin_c4af;
00546 float gsratio2,onepixelbias;
00547
00548 float p1slag;
00549 float p2slag;
00550 float p3slag;
00551 float p4slag;
00552 float p5slag;
00553 double slagcasi,slaghydcasi;
00554 float slagh2osi;
00555 double slagc3a;
00556 double siperslag;
00557 double slagreact;
00558 long int DIFFCHdeficit,slaginit;
00559 long int slagcum,chgone;
00560 long int nch_slag;
00561 long int sulf_cur;
00562 long int sulf_solid;
00563 char heatname[80],adianame[80],phasname[80],ppsname[80],ptsaname[80],phrname[80];
00564 char chshrname[80],micname[80];
00565 char cmdnew[120],pHname[80],fileroot[80];
00566 struct ants *headant,*tailant;
00567 FILE *heatfile,*chsfile,*ptmpfile,*movfile,*pHfile,*micfile, *fileperc,*percfile, *disprobfile, *phasfile, *perc_phases, *CSHfile;
00568
00569
00570 double pH_cur,totsodium,totpotassium,rssodium,rspotassium;
00571
00572 float *pHeffect;
00573 float pHfactor;
00574 int pHactive,resatcyc,cshgeom;
00575
00576
00577 double conccaplus,moles_syn_precip,concsulfate;
00578 int primevalues[6];
00579 int cshboxsize;
00580
00581
00582 struct percolatedpath{
00583 int x, y, z;
00584 struct percolatedpath *next;
00585 struct percolatedpath *prev;
00586 };
00587
00588 struct percolatedpath *last, *current;
00589
00590
00591 long int adiabatic_curing;
00592 int ntimes;
00593 int cycflag;
00594 int phydfreq;
00595 double InitTime;
00596 double pnucch,pscalech,pnuchg,pscalehg,pnucfh3,pscalefh3;
00597 double pnucgyp,pscalegyp;
00598 float thtimelo,thtimehi,thtemplo,thtemphi;
00599 double mass_cement,mass_cem_now,mass_cur,kpozz,kslag;
00600 FILE *adiafile,*thfile,*elasfile;
00601 double LastHydrTime, LastCallTime,PrevHydrTime;
00602 double LastCycHeat, LastTotHeat, PrevCycHeat;
00603 long int LastCycCnt, Calculate_elastic_homogenization;
00604 double Vol_cement_clinker_gypsum, Vol_cement_SCM, Vol_water, Vol_FA, Vol_CA, Vol_inert_filler, Vol_entrained_entrapped_air, Grain_average_FA, Grain_average_CA, ITZ_thickness, ITZ_Young_red, Young_SCM, Poisson_SCM, Young_FA, Poisson_FA, Young_CA, Poisson_CA, Young_inert, Poisson_inert;
00605
00606 };
00607
00608 #endif