/trunk/SIFEL/MEFEL/SRC/camclaycoup.cpp |
---|
294,8 → 294,6 |
// specific volume for intial stress state |
v_ini = Mm->ip[ipp].eqother[ido+ncompstr+4]; |
//s = Mm->nonmechq[ipp][4]; // suction pressure s |
//sr = Mm->nonmechq[ipp][5]; // degree of saturation S_r |
s = Mm->givenonmechq(suction, ipp); // suction pressure s |
sr = Mm->givenonmechq(saturation_degree, ipp); // degree of saturation S_r |
460,8 → 458,6 |
// v_{pc} = v_{\lambda1} - \lambda \ln(p_c/p_1) |
v_pc = v_lambda1 - lambda * log(pc_new/p1); |
//s = Mm->nonmechq[ipp][4]; // suction pressure s |
//sr = Mm->nonmechq[ipp][5]; // degree of saturation S_r |
s = Mm->givenonmechq(suction, ipp); // suction pressure s |
sr = Mm->givenonmechq(saturation_degree, ipp); // degree of saturation S_r |
682,14 → 678,6 |
Mm->ip[ipp].eqother[ido+n+7] = Mm->ip[ipp].other[ido+n+7]; // epsv; |
Mm->ip[ipp].eqother[ido+n+8] = Mm->ip[ipp].other[ido+n+8]; // epsvp; |
//data storing for coupled problems 12/06/2012 TKr |
/* |
if(Mm->nonmechq != NULL){ |
Mm->nonmechq[ipp][1] = Mm->ip[ipp].eqother[ido+n+5]; //i1s |
Mm->nonmechq[ipp][2] = Mm->ip[ipp].eqother[ido+n+3] - 1.0; //e_lambda1 |
Mm->nonmechq[ipp][3] = Mm->ip[ipp].eqother[ido+n+4]*(1.0 + Mm->ip[ipp].eqother[ido+n+7]) - 1.0; //e_ini; |
} |
*/ |
// saturation degree |
Mm->ip[ipp].eqother[ido+n+9] = 1.0; |
} |
/trunk/SIFEL/MEFEL/SRC/lintet.cpp |
---|
109,9 → 109,9 |
} |
/** |
function approximates function defined by nodal values |
The function computes approximated function value with the help of nodal values. |
@param volcoord - volume coordinates |
@param xi, eta, zeta - natural coordinates |
@param nodval - nodal values |
20.8.2001 |
/trunk/SIFEL/MEFEL/SRC/mechmat.cpp |
---|
678,7 → 678,7 |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@return The function does not return anything but sets the Mm->aip_ic. |
@return The function does not return anything but sets the aip_ic. |
Created by Tomas Koudelka, 28.11.2017 |
*/ |
3979,16 → 3979,16 |
break; |
} |
case mean_stress_eff:{ |
vector sig(Mm->ip[ipp].ncompstr); |
vector sig(ip[ipp].ncompstr); |
vector sigt(ASTCKVEC(6)); |
givestress(0,ipp,sig); |
give_full_vector(sigt,sig,Mm->ip[ipp].ssst); |
give_full_vector(sigt,sig,ip[ipp].ssst); |
// total mean stress |
ret = first_invar(sigt)/3.0; |
if (Mm->givestatusnmq(pore_pressure)) |
if (givestatusnmq(pore_pressure)) |
{ |
// effective stress concept model was employed => \sigma_{eff} = \sigma_{tot} - p m^T |
ret -= Mm->givenonmechq(pore_pressure, ipp); |
ret -= givenonmechq(pore_pressure, ipp); |
} |
break; |
} |
6892,13 → 6892,13 |
if ((ip[ipp].tm[0] == time_switchmat) && (ip[ipp].idm[0] == k)) |
{ |
ret = 1; |
Mm->ip[ipp].hmt = 0; |
Mm->update_hmt(ipp, 0); |
Mm->ip[ipp].ncompother = Mm->givencompother(ipp, ami); |
Mm->ip[ipp].ncompeqother = Mm->givencompeqother(ipp, ami); |
Mm->ip[ipp].clean_other(); |
ip[ipp].hmt = 0; |
update_hmt(ipp, 0); |
ip[ipp].ncompother = givencompother(ipp, ami); |
ip[ipp].ncompeqother = givencompeqother(ipp, ami); |
ip[ipp].clean_other(); |
if (tswmat[k].store_eigstr == yes) |
Mm->storeeqother(ipp, 0, Mm->ip[ipp].ncompstr, Mm->ip[ipp].strain); |
storeeqother(ipp, 0, ip[ipp].ncompstr, ip[ipp].strain); |
// if the material model has changed (ami != oami) then the |
// initialization of the material model must be performed if required (init == 1) |
if (init) |
6911,14 → 6911,14 |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with AUXILIARY integration points |
tmp_ip = Mm->ip; |
tmp_elip = Mm->elip; |
tmp_nmq = Mm->nonmechq; |
tmp_ic = Mm->ic; |
Mm->ip = Mm->aip; |
Mm->elip = Mm->elaip; |
Mm->nonmechq = Mm->aip_nonmechq; |
Mm->ic = Mm->aip_ic; |
tmp_ip = ip; |
tmp_elip = elip; |
tmp_nmq = nonmechq; |
tmp_ic = ic; |
ip = aip; |
elip = elaip; |
nonmechq = aip_nonmechq; |
ic = aip_ic; |
// init == 1 => initialization of all integration points with the k-th timeswitching material |
for (app=0; app<tnaip; app++) |
{ |
6934,13 → 6934,13 |
if ((ip[app].tm[0] == time_switchmat) && (ip[app].idm[0] == k)) |
{ |
ret = 1; |
Mm->ip[app].hmt = 0; |
Mm->update_hmt(app, 0); |
Mm->ip[app].ncompother = Mm->givencompother(app, ami); |
Mm->ip[app].ncompeqother = Mm->givencompeqother(app, ami); |
Mm->ip[app].clean_other(); |
ip[app].hmt = 0; |
update_hmt(app, 0); |
ip[app].ncompother = givencompother(app, ami); |
ip[app].ncompeqother = givencompeqother(app, ami); |
ip[app].clean_other(); |
if (tswmat[k].store_eigstr == yes) |
Mm->storeeqother(app, 0, Mm->ip[app].ncompstr, Mm->ip[app].strain); |
storeeqother(app, 0, ip[app].ncompstr, ip[app].strain); |
// if the material model has changed (ami != oami) then the |
// initialization of the material model must be performed if required (init == 1) |
if (init) |
6951,10 → 6951,10 |
} |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with REGULAR integration points |
Mm->ip = tmp_ip; |
Mm->elip = tmp_elip; |
Mm->nonmechq = tmp_nmq; |
Mm->ic = tmp_ic; |
ip = tmp_ip; |
elip = tmp_elip; |
nonmechq = tmp_nmq; |
ic = tmp_ic; |
} |
return ret; |
} |
8178,7 → 8178,7 |
idem = ip[ipp].gemid(); |
/* if (ip[ipp].ssst == planestress) |
{ |
nu = Mm->give_actual_nu(ipp); |
nu = give_actual_nu(ipp); |
epsn[3] = -nu / (1.0 - nu) * (epsn[0]-epsp[0]+epsn[1]-epsp[1]); |
} |
*/ |
8203,7 → 8203,7 |
if (f<err) break; |
if (i==ni-1 && f>err){ |
print_err("yield surface was not reached on element %ld (ip=%ld)\n f=%le ni %ld",__FILE__,__LINE__,__func__, Mm->elip[ipp]+1, ipp+1, f, i); |
print_err("yield surface was not reached on element %ld (ip=%ld)\n f=%le ni %ld",__FILE__,__LINE__,__func__, elip[ipp]+1, ipp+1, f, i); |
fprintf (Out,"\n yield surface was not reached"); |
fflush(Out); |
} |
8304,7 → 8304,7 |
mxv (d,epsa,sig); |
//if (sig[0]+sig[1]+sig[3] > 0.0) //debug??!! |
//fprintf(stdout, "Kladne stredni napeti %le v bode %ld\n",sig[0]+sig[1]+sig[3]/3, Mm->elip[ipp]+1); |
//fprintf(stdout, "Kladne stredni napeti %le v bode %ld\n",sig[0]+sig[1]+sig[3]/3, elip[ipp]+1); |
// updating hardening variables from previous step |
updateq(ipp, im, ido, dgamma, epsn, epsp, sig, q); |
8388,7 → 8388,7 |
void mechmat::cutting_plane3 (long ipp,long im,long ido,double &gamma,vector &epsn,vector &epsp,vector &q,long ni,double err) |
{ |
long j,n=Mm->ip[ipp].ncompstr; |
long j,n=ip[ipp].ncompstr; |
matrix d(n,n); |
double pom,nu; |
8401,27 → 8401,27 |
epsp[3] = epsp[2]; |
epsp[2] = pom; |
nu = Mm->give_actual_nu(ipp); |
nu = give_actual_nu(ipp); |
epsn[2] = -nu/(1-nu)*(epsn[0]-epsp[0]+epsn[1]-epsp[1])+epsp[2]; // trial transverse strain |
// iteration loop for transverse stress correction |
for (j=0;j<ni;j++) |
{ |
Mm->cutting_plane (ipp,im,ido,gamma,epsn,epsp,q,ni,err); |
if (abs(Mm->ip[ipp].stress[2])<err) // trasnverse stress testing |
cutting_plane (ipp,im,ido,gamma,epsn,epsp,q,ni,err); |
if (abs(ip[ipp].stress[2])<err) // trasnverse stress testing |
break; |
if (j==ni-1 && abs(Mm->ip[ipp].stress[2])>err) |
if (j==ni-1 && abs(ip[ipp].stress[2])>err) |
{ |
print_err("transverse stress correction was not successful",__FILE__,__LINE__,__func__); |
fprintf (Out,"\n transverse stress correction was not successful"); |
} |
Mm->elmatstiff (d,ipp); |
epsn[2]+= -Mm->ip[ipp].stress[2]/d(2,2); // correction of the transverse strain |
elmatstiff (d,ipp); |
epsn[2]+= -ip[ipp].stress[2]/d(2,2); // correction of the transverse strain |
} |
pom = Mm->ip[ipp].stress[3]; // switching stress components according to original plane stress problem |
Mm->ip[ipp].stress[3] = Mm->ip[ipp].stress[2]; |
Mm->ip[ipp].stress[2] = pom; |
pom = ip[ipp].stress[3]; // switching stress components according to original plane stress problem |
ip[ipp].stress[3] = ip[ipp].stress[2]; |
ip[ipp].stress[2] = pom; |
pom = epsp[3]; // switching plastic strain components according to original plane stress problem |
epsp[3] = epsp[2]; |
8430,7 → 8430,7 |
ip[ipp].ssst = planestress; |
} |
else |
Mm->cutting_plane (ipp,im,ido,gamma,epsn,epsp,q,ni,err); |
cutting_plane (ipp,im,ido,gamma,epsn,epsp,q,ni,err); |
} |
8633,7 → 8633,7 |
// hardening parameters may be omitted |
// strain/stress state in actual integration point |
ssst = Mm->ip[ipp].ssst; |
ssst = ip[ipp].ssst; |
// array containing matrix of the system (Jacobian matrix) |
matrix a(ASTCKMAT(n,n)); |
9574,7 → 9574,7 |
return 0.0; |
} |
if ((Mp->matmodel == local) || ((Mm->ip[ipp].hmt & 2) == 0)) // model is not nonlocal |
if ((Mp->matmodel == local) || ((ip[ipp].hmt & 2) == 0)) // model is not nonlocal |
// local model is used |
{ |
damfuncpar(ipp, im, eps, updkappa); |
10082,18 → 10082,18 |
// ***************************************** |
// ***************************************** |
// ************************************************* |
// ************************************************* |
// |
// Funtions for backup of int. point content |
// Funtions for backup of regular int. point content |
// |
// ***************************************** |
// ***************************************** |
// ************************************************* |
// ************************************************* |
/** |
Function saves data from integration points into auxiliary file |
Function saves data from regular integration points into backup file |
in text format. |
@param aux - pointer to auxiliary file |
10119,8 → 10119,8 |
if (nonmechq) // write table of indices of non-mechanical quantities |
{ |
for (i=0; i<Mm->tnknmq; i++) |
fprintf(aux, "%ld ", Mm->nmqid[i]); |
for (i=0; i<tnknmq; i++) |
fprintf(aux, "%ld ", nmqid[i]); |
fprintf(aux, "\n"); |
} |
10145,7 → 10145,7 |
if (nonmechq) |
{ |
for (k=0; k<nnmq; k++) |
fprintf (aux,"%.*le ",prec, Mm->nonmechq[k][ipp]); |
fprintf (aux,"%.*le ",prec, nonmechq[k][ipp]); |
fprintf(aux, "\n"); |
} |
ipp++; |
10156,7 → 10156,7 |
/** |
Function saves data from integration points into several files |
Function saves data from regular integration points into several backup files |
in text format. |
@param ni - time step id |
10181,8 → 10181,8 |
char emsg[FNAMELEN+100]; |
int prec = (int)Mp->hdbcont.prec; |
sprintf(name, "%s.%ld.strain.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
sprintf(name, "%s.%ld.strain.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
10189,16 → 10189,16 |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++) |
for (i=0; i<tnip; i++) |
{ |
fprintf (aux,"%ld %ld %ld\n",i, Mb->nlc, ip[i].ncompstr); |
for (j=0;j<Mb->nlc*ip[i].ncompstr;j++) |
fprintf (aux, "%.*le\n",prec , ip[i].strain[j]); |
fprintf (aux, "%ld %ld %ld\n", i, Mb->nlc, ip[i].ncompstr); |
for (j=0; j<Mb->nlc*ip[i].ncompstr; j++) |
fprintf (aux, "%.*le\n", prec, ip[i].strain[j]); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.stress.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
sprintf(name, "%s.%ld.stress.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
10205,16 → 10205,16 |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++) |
for (i=0; i<tnip; i++) |
{ |
fprintf (aux,"%ld %ld %ld\n",i, Mb->nlc, ip[i].ncompstr); |
for (j=0;j<Mb->nlc*ip[i].ncompstr;j++) |
fprintf (aux, "%.*le\n",prec , ip[i].stress[j]); |
fprintf (aux, "%ld %ld %ld\n", i, Mb->nlc, ip[i].ncompstr); |
for (j=0; j<Mb->nlc*ip[i].ncompstr; j++) |
fprintf (aux, "%.*le\n", prec, ip[i].stress[j]); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.other.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
sprintf(name, "%s.%ld.other.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
10221,7 → 10221,7 |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<Mt->ne;i++) |
for (i=0; i<Mt->ne; i++) |
{ |
ipp = Mt->elements[i].ipp[0][0]; |
nip = Mt->give_totnip(i); |
10232,16 → 10232,16 |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fprintf (aux,"%ld %ld\n",ipp, n); |
fprintf (aux, "%ld %ld\n", ipp, n); |
if (n==0) |
{ |
ipp++; |
continue; |
} |
for (k=0;k<ip[ipp].ncompeqother;k++) |
for (k=0; k<ip[ipp].ncompeqother; k++) |
{ |
if (selother[ir].presence_id(k)) |
fprintf (aux, "%.*le\n",prec , ip[ipp].eqother[k]); |
fprintf (aux, "%.*le\n", prec, ip[ipp].eqother[k]); |
} |
ipp++; |
} |
10251,8 → 10251,8 |
// writing TRFEL quantities |
if (nonmechq) |
{ |
sprintf(name, "%s.%ld.trfquant.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
sprintf(name, "%s.%ld.trfquant.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
10260,15 → 10260,15 |
abort(); |
} |
// write table of indices of non-mechanical quantities |
for (i=0; i<Mm->tnknmq; i++) |
fprintf(aux, "%ld ", Mm->nmqid[i]); |
for (i=0; i<tnknmq; i++) |
fprintf(aux, "%ld ", nmqid[i]); |
fprintf(aux, "\n"); |
for (i=0;i<tnip;i++) |
for (i=0; i<tnip; i++) |
{ |
fprintf (aux,"%ld ",i); |
fprintf (aux, "%ld ", i); |
for (j=0; j<nnmq; j++) |
fprintf (aux,"%.*le ",prec , nonmechq[j][i]); |
fprintf (aux,"%.*le ", prec, nonmechq[j][i]); |
fprintf(aux, "\n"); |
} |
10279,7 → 10279,7 |
/** |
Function saves data from integration points into auxiliary file |
Function saves data from regular integration points into backup file |
in binary format. |
@param aux - pointer to auxiliary file |
10327,7 → 10327,7 |
if (nonmechq) |
{ |
for (k=0; k<nnmq; k++) |
fwrite (&Mm->nonmechq[k][ipp], sizeof(Mm->nonmechq[k][ipp]), 1, aux); |
fwrite (&nonmechq[k][ipp], sizeof(nonmechq[k][ipp]), 1, aux); |
} |
ipp++; |
} |
10337,7 → 10337,7 |
/** |
Function saves data from integration points into several files |
Function saves data from regular integration points into several backup files |
in binary format. |
@param ni - time step id |
10358,7 → 10358,6 |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
double tmp; |
sprintf(name, "%s.%ld.strain.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
10419,13 → 10418,10 |
ipp++; |
continue; |
} |
for (k=0;k<n;k++)//for (k=0;k<ip[ipp].ncompeqother;k++)//tady??!! |
for (k=0; k<ip[ipp].ncompeqother; k++) |
{ |
if (selother[ir].presence_id(k)){ |
tmp = ip[ipp].eqother[k]; |
//fwrite (ip[ipp].eqother+k, sizeof(*ip[ipp].eqother), 1, aux);//tady??!! |
fwrite (&tmp, sizeof(tmp), 1, aux); |
} |
if (selother[ir].presence_id(k)) |
fwrite (ip[ipp].eqother+k, sizeof(*ip[ipp].eqother), 1, aux); |
} |
ipp++; |
} |
10450,7 → 10446,7 |
{ |
fwrite(&ipp, sizeof(ipp), 1, aux); |
for (j=0; j<nnmq; j++) |
fwrite(&Mm->nonmechq[j][ipp], sizeof(Mm->nonmechq[j][ipp]), 1, aux); |
fwrite(&nonmechq[j][ipp], sizeof(nonmechq[j][ipp]), 1, aux); |
} |
fclose(aux); |
} |
10459,7 → 10455,7 |
/** |
Function restores data from auxiliary text file into integration points. |
Function restores data from text backup file into regular integration points. |
@param aux - pointer to auxiliary file |
@param selelems - selection of elements whose eqother array will be restored |
10485,8 → 10481,8 |
if (nonmechq) // read table of indices of non-mechanical quantities |
{ |
for (i=0; i<Mm->tnknmq; i++) |
fscanf(aux, "%ld", &Mm->nmqid[i]); |
for (i=0; i<tnknmq; i++) |
fscanf(aux, "%ld", &nmqid[i]); |
} |
for (i=0;i<tnip;i++) |
10517,7 → 10513,7 |
if (nonmechq) |
{ |
for (j=0; j<nnmq; j++) |
fscanf(aux,"%le", &Mm->nonmechq[j][ipp]); |
fscanf(aux,"%le", &nonmechq[j][ipp]); |
} |
} |
} |
10525,7 → 10521,7 |
/** |
Function restores data from several text files into integration points. |
Function restores data from several text backup files into regular integration points. |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
10657,8 → 10653,8 |
} |
// read table of indices of non-mechanical quantities |
for (i=0; i<Mm->tnknmq; i++) |
fscanf(aux, "%ld ", &Mm->nmqid[i]); |
for (i=0; i<tnknmq; i++) |
fscanf(aux, "%ld ", &nmqid[i]); |
for (i=0;i<tnip;i++) |
{ |
10678,7 → 10674,7 |
/** |
Function restores data from auxiliary binary file into integration points. |
Function restores data from binary backup file into regular integration points. |
@param aux - pointer to auxiliary file |
@param selelems - selection of elements whose eqother array will be restored |
10733,7 → 10729,7 |
if (nonmechq) |
{ |
for (j=0; j<nnmq; j++) |
fread(&Mm->nonmechq[j][ipp], sizeof(Mm->nonmechq[j][ipp]), 1, aux); |
fread(&nonmechq[j][ipp], sizeof(nonmechq[j][ipp]), 1, aux); |
} |
} |
} |
10741,7 → 10737,7 |
/** |
Function restores data from several binary files into integration points. |
Function restores data from several binary backup files into regular integration points. |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
10883,8 → 10879,716 |
abort(); |
} |
for (k=0; k<nnmq; k++) |
fread(&Mm->nonmechq[k][ipp], sizeof(Mm->nonmechq[k][ipp]), 1, aux); |
fread(&nonmechq[k][ipp], sizeof(nonmechq[k][ipp]), 1, aux); |
} |
fclose(aux); |
} |
} |
// *************************************************** |
// *************************************************** |
// |
// Funtions for backup of auxiliary int. point content |
// |
// *************************************************** |
// *************************************************** |
/** |
Function saves data from auxiliary integration points into backup file |
in text format. |
@param aux - pointer to auxiliary file [in] |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved [in] |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled [in] |
@return The function does not return anything. |
Created by TKo, 19.12.2017 |
*/ |
void mechmat::save_auxintpoints_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, ir, app, eid, nsc; |
sel selno; // selection with no selected components |
selno.n=1; |
fprintf(aux, "\n"); |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(eid, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fprintf (aux, "%ld %ld %ld %ld\n", app, Mb->nlc, aip[app].ncompstr, nsc); |
if (ir < 0) |
aip[app].save_data_txt(aux, Mb->nlc, selno); |
else |
aip[app].save_data_txt(aux, Mb->nlc, selother[ir]); |
// writing TRFEL quantities is not needed, their values can be recalculated after restorage |
} |
} |
/** |
Function saves data from auxiliary integration points into several backup files |
in text format. |
@param ni - time step id |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved [in] |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled [in] |
@return The function does not return anything. |
Created by TKo, 20.12.2017 |
*/ |
void mechmat::save_auxintpoints_txt (long ni, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, j, k, ir, eid, nsc, app; |
sel selno; // selection with no selected components |
selno.n=1; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
int prec = (int)Mp->hdbcont.prec; |
sprintf(name, "%s.%ld.astrain.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fprintf (aux,"%ld %ld %ld\n", app, Mb->nlc, aip[app].ncompstr); |
for (j=0; j<Mb->nlc*aip[app].ncompstr; j++) |
fprintf (aux, "%.*le\n", prec, aip[app].strain[j]); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.astress.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fprintf (aux, "%ld %ld %ld\n", app, Mb->nlc, aip[app].ncompstr); |
for (j=0; j<Mb->nlc*aip[app].ncompstr; j++) |
fprintf (aux, "%.*le\n", prec, aip[app].stress[j]); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.aother.bac", Mp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(eid, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fprintf (aux, "%ld %ld\n", app, nsc); |
if (n==0) |
continue; |
for (k=0; k<aip[app].ncompeqother; k++) |
{ |
if (selother[ir].presence_id(k)) |
fprintf (aux, "%.*le\n", prec, aip[app].eqother[k]); |
} |
} |
fclose(aux); |
// writing TRFEL quantities (nonmechq) is not needed, their values can be recalculated after restorage |
} |
/** |
Function saves data from auxiliary integration points into backup file |
in binary format. |
@param aux - pointer to auxiliary file [in] |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved [in] |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled [in] |
@return The function does not return anything. |
Created by Tomas Koudelka, 20.12.2017 |
*/ |
void mechmat::save_auxintpoints_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, ir, eid, nsc, app; |
sel selno; // selection with no selected components |
selno.n=1; |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(eid, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&Mb->nlc, sizeof(Mb->nlc), 1, aux); |
fwrite(&aip[app].ncompstr, sizeof(aip[app].ncompstr), 1, aux); |
fwrite(&nsc, sizeof(nsc), 1, aux); |
if (ir < 0) |
aip[app].save_data_bin(aux, Mb->nlc, selno); |
else |
aip[app].save_data_bin(aux, Mb->nlc, selother[ir]); |
// writing TRFEL quantities is not needed, their values can be recalculated after restorage |
} |
} |
/** |
Function saves data from auxiliary integration points into several backup files |
in binary format. |
@param ni - time step id |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka 9.2008 |
*/ |
void mechmat::save_auxintpoints_bin (long ni, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, k, ir, eid, nsc, app; |
sel selno; // selection with no selected components |
selno.n=1; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
sprintf(name, "%s.%ld.astrain.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fwrite(&i, sizeof(app), 1, aux); |
fwrite(&Mb->nlc, sizeof(Mb->nlc), 1, aux); |
fwrite(&aip[app].ncompstr, sizeof(aip[app].ncompstr), 1, aux); |
fwrite(aip[app].strain, sizeof(*aip[app].strain), Mb->nlc*aip[app].ncompstr, aux); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.astress.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&Mb->nlc, sizeof(Mb->nlc), 1, aux); |
fwrite(&aip[app].ncompstr, sizeof(aip[app].ncompstr), 1, aux); |
fwrite(aip[app].stress, sizeof(*aip[app].stress), Mb->nlc*aip[app].ncompstr, aux); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.aother.bac",Mp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(eid, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&nsc, sizeof(nsc), 1, aux); |
if (nsc==0) |
continue; |
for (k=0; k<aip[app].ncompeqother; k++) |
{ |
if (selother[ir].presence_id(k)) |
fwrite (aip[app].eqother+k, sizeof(*aip[app].eqother), 1, aux); |
} |
} |
fclose(aux); |
// writing TRFEL quantities is not needed, their values can be recalculated after restorage |
} |
/** |
Function restores data from text backup file into auxiliary integration points. |
@param aux - pointer to auxiliary file |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled for each selection of elements |
Created by Tomas Koudelka, 20.12.2017 |
*/ |
void mechmat::restore_auxintpoints_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, ir, eid, app, tapp; |
long nlc, ncompstr, ncompother; |
sel selno; // selection with no selected components |
selno.n=1; |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fscanf (aux,"%ld %ld %ld %ld",&tapp, &nlc, &ncompstr, &ncompother); |
if (tapp != app) |
{ |
print_err("invalid auxiliary integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nlc != Mb->nlc) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompstr != aip[app].ncompstr) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
if (ir < 0) |
aip[app].restore_data_txt(aux, nlc, ncompother, selno, NULL); |
else |
aip[app].restore_data_txt(aux, nlc, ncompother, selother[ir], selid[ir]); |
// restoring TRFEL quantities is not needed, they are recalculated from other stored values |
} |
} |
/** |
Function restores data from several text backup files into auxiliary integration points. |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled for each selection of elements |
@return The function does not return anything. |
Created by Tomas Koudelka, 20.12.2017 |
*/ |
void mechmat::restore_auxintpoints_txt (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, j, k, ir, ik, is, eid, app, tapp; |
long nlc, ncompstr, ncompother; |
double tmp; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
// restoring of strain arrays |
sprintf(name, "%s.astrain.bac",Mp->hdbcont.hdbnamer); |
aux = fopen(name,"rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fscanf(aux, "%ld %ld %ld",&tapp, &nlc, &ncompstr); |
if (tapp != app) |
{ |
print_err("invalid auxiliary integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nlc != Mb->nlc) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompstr != aip[app].ncompstr) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0; j<Mb->nlc*aip[app].ncompstr; j++) |
fscanf(aux, "%le", aip[app].strain+j); |
} |
// restoring of stress arrays |
sprintf(name, "%s.astress.bac",Mp->hdbcont.hdbnamer); |
aux = fopen(name,"rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fscanf(aux, "%ld %ld %ld", &tapp, &nlc, &ncompstr); |
if (tapp != app) |
{ |
print_err("invalid auxiliary integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nlc != Mb->nlc) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompstr != aip[app].ncompstr) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0; j<nlc*ncompstr; j++) |
fscanf(aux, "%le", aip[app].stress+j); |
} |
// restoring of other arrays |
sprintf(name, "%s.aother.bac",Mp->hdbcont.hdbnamer); |
aux = fopen(name,"rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fscanf (aux, "%ld %ld", &tapp, &ncompother); |
if (tapp != app) |
{ |
print_err("invalid auxiliary integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
for (k=0; k<ncompother; k++) |
{ |
fscanf(aux, "%le", &tmp); |
if (ir < 0) |
continue; |
if (selother[ir].presence_id(k,ik)) |
{ |
is = selid[ir][ik]+k-selother[ir].id1[ik]; // storage index in eqother array |
if (is >= aip[app].ncompeqother) |
print_err("invalid index for eqother restoring is required in app=%ld", __FILE__, __LINE__, __func__, app); |
else |
aip[app].eqother[is] = tmp; |
} |
} |
} |
fclose(aux); |
} |
/** |
Function restores data from binary backup file into auxiliary integration points. |
@param aux - pointer to auxiliary file |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled for each selection of elements |
@return The function does not return anything. |
Created by Tomas Koudelka 20.12.2017 |
*/ |
void mechmat::restore_auxintpoints_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, nlc, ncompstr, ncompother, eid, app, tapp; |
long ir; |
sel selno; // selection with no selected components |
if (nonmechq) // read table of indices of non-mechanical quantities |
fread (nmqid, sizeof(*nmqid), sizeof(nmqid), aux); |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) |
continue; |
eid = ipm[i].eid; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&nlc, sizeof(nlc), 1, aux); |
fread(&ncompstr, sizeof(ncompstr), 1, aux); |
fread(&ncompother, sizeof(ncompother), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid auxiliary integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nlc != Mb->nlc) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompstr != aip[app].ncompstr) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
if (ir < 0) |
aip[app].restore_data_bin(aux, Mb->nlc, ncompother, selno, NULL); |
else |
aip[app].restore_data_bin(aux, Mb->nlc, ncompother, selother[ir], selid[ir]); |
} |
} |
/** |
Function restores data from several binary backup files into auxliary integration points. |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 20.12.2017 |
*/ |
void mechmat::restore_auxintpoints_bin (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, k, ir, ik, is, eid, app, tapp; |
long nlc, ncompstr, ncompother; |
double tmp; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
// restoring of strain arrays |
sprintf(name, "%s.astrain.bac",Mp->hdbcont.hdbnamer); |
aux = fopen(name,"rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) |
continue; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&nlc, sizeof(nlc), 1, aux); |
fread(&ncompstr, sizeof(ncompstr), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid auxiliary integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nlc != Mb->nlc) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompstr != aip[app].ncompstr) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
fread (aip[app].strain, sizeof(*aip[app].strain),Mb->nlc*aip[app].ncompstr, aux); |
} |
// restoring of stress arrays |
sprintf(name, "%s.astress.bac",Mp->hdbcont.hdbnamer); |
aux = fopen(name,"rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&nlc, sizeof(nlc), 1, aux); |
fread(&ncompstr, sizeof(ncompstr), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nlc != Mb->nlc) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompstr != aip[app].ncompstr) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
fread(aip[app].stress, sizeof(*aip[app].stress),Mb->nlc*aip[app].ncompstr, aux); |
} |
// restoring of other arrays |
sprintf(name, "%s.aother.bac",Mp->hdbcont.hdbnamer); |
aux = fopen(name,"rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fread (&tapp, sizeof(tapp), 1, aux); |
fread (&ncompother, sizeof(ncompother), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
for (k=0;k<n;k++) |
{ |
fread (&tmp, sizeof(tmp), 1, aux); |
if (ir < 0) |
continue; |
if (selother[ir].presence_id(k,ik)) |
{ |
is = selid[ir][ik]+k-selother[ir].id1[ik]; // storage index in eqother array |
if (is >= aip[app].ncompeqother) |
print_err("invalid index for eqother restoring is required", __FILE__, __LINE__, __func__); |
else |
aip[app].eqother[is] = tmp; |
} |
} |
} |
fclose(aux); |
} |
/trunk/SIFEL/MEFEL/SRC/mechmat.h |
---|
602,7 → 602,6 |
/// returns the second derivative of lenjones potential |
double give_second_derivative (long ipp,double r); |
// ***************************************** |
// Funtions for backup of int. point content |
// ***************************************** |
631,7 → 630,34 |
/// restore content of int. points to several binary files according to stored quantity |
void restore_intpoints_bin (sel &selelems, sel *selother, long **selid); |
// *************************************************** |
// Funtions for backup of auxiliary int. point content |
// *************************************************** |
/// save content of int. points to one huge text file |
void save_auxintpoints_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother); |
/// save content of int. points to several text files according to stored quantity |
void save_auxintpoints_txt (long ni, long n, ipmap *ipm, sel &selelems, sel *selother); |
/// save content of int. points to one huge binary file |
void save_auxintpoints_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother); |
/// save content of int. points to several binary files according to stored quantity |
void save_auxintpoints_bin (long ni, long n, ipmap *ipm, sel &selelems, sel *selother); |
/// restore content of int. points to one huge text file |
void restore_auxintpoints_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to several text files according to stored quantity |
void restore_auxintpoints_txt (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to one huge binary file |
void restore_auxintpoints_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to several binary files according to stored quantity |
void restore_auxintpoints_bin (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
/trunk/SIFEL/MEFEL/SRC/viselast.cpp |
---|
63,7 → 63,6 |
{ |
long i, n = Mm->ip[ipp].ncompstr; |
vector eps(n),sig(n); |
strastrestate ssst = Mm->ip[ipp].ssst; |
matrix d(n,n); |
// initial values |
/trunk/SIFEL/TRFEL/SRC/elemswitcht.cpp |
---|
1,6 → 1,7 |
#include "elemswitcht.h" |
#include "globalt.h" |
#include "globmatt.h" |
#include "ipmap.h" |
/** |
function computes conductivity %matrix of one element |
157,7 → 158,115 |
} |
/** |
The function computes gradient %matrix of the given element element at point with |
natural coordinates xi, eta, zeta. |
@param eid - element id [in] |
@param x, y ,z - vectors of nodal coordinates of the given element [in] |
@param xi, eta, zeta - natural coordinates of the point for which the %matrix will be calculated |
@param gm - resulting gradient %matrix [out] |
@return The function returns resulting stiffness matrix in the argument gm. |
Created by Tomas Koudelka, 19.12.2017 |
*/ |
void grad_matrix (long eid, vector &x, vector &y, vector &z, double xi, double eta, double zeta, matrix &gm) |
{ |
elemtypet te; |
double jac, det; |
vector b, c, d; |
te=Tt->give_elem_type (eid); |
switch (te){ |
case barlint:{ |
Lbt->grad_matrix(gm, x, xi, jac); |
break; |
} |
case barlintax:{ |
Lbat->grad_matrix(gm, x, xi, jac); |
break; |
} |
case barquadt:{ |
Qbt->grad_matrix(gm, x, xi, jac); |
break; |
} |
case barquadtax:{ |
Qbat->grad_matrix(gm, x, xi, jac); |
break; |
} |
case trlint:{ |
det = (x[1]-x[0])*(y[2]-y[0])-(x[2]-x[0])*(y[1]-y[0]); |
reallocv(RSTCKVEC(3, b)); |
reallocv(RSTCKVEC(3, c)); |
plsb(b.a, y.a, det); |
plsc(c.a, x.a, det); |
Ltt->grad_matrix(gm, b, c); |
break; |
} |
case trlaxisym:{ |
det = (x[1]-x[0])*(y[2]-y[0])-(x[2]-x[0])*(y[1]-y[0]); |
reallocv(RSTCKVEC(3, b)); |
reallocv(RSTCKVEC(3, c)); |
plsb(b.a, y.a, det); |
plsc(c.a, x.a, det); |
Ltat->grad_matrix(gm, b, c); |
break; |
} |
case quadlint:{ |
Lqt->grad_matrix(gm, x, y, xi, eta, jac); |
break; |
} |
case quadquadt:{ |
Qqt->grad_matrix(gm, x, y, xi, eta, jac); |
break; |
} |
case quadquadtax:{ |
Qqat->grad_matrix(gm, x, y, xi, eta, jac); |
break; |
} |
case quadlaxisym:{ |
Lqat->grad_matrix(gm, x, y, xi, eta, jac); |
break; |
} |
/* |
case ifacequadel:{ |
// virtual width of the element |
h = Tm->ifacemat[Tm->ip[app].idm].h; |
Ifcquadt->grad_matrix(gm, x, y, l, h); |
break; |
} |
*/ |
case lineartett:{ |
reallocv(RSTCKVEC(3, b)); |
reallocv(RSTCKVEC(3, c)); |
reallocv(RSTCKVEC(3, d)); |
det = det3d (x.a, y.a, z.a); |
volb_3d (b.a, y.a, z.a, det); |
volc_3d (c.a, x.a, z.a, det); |
vold_3d (d.a, x.a, y.a, det); |
Ltett->grad_matrix(gm, b, c, d); |
break; |
} |
case linearhext:{ |
Lht->grad_matrix(gm, x, y, z, xi, eta, zeta, jac); |
break; |
} |
case quadratichext:{ |
Qht->grad_matrix(gm, x, y, z, xi, eta, zeta, jac); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
} |
} |
/** |
function computes advection %matrix of one element |
@param eid - element id |
308,6 → 417,7 |
} |
/** |
function computes gradients on integration points |
827,6 → 937,87 |
/** |
The function approximates quantity given by nodal values nv to the point given by natural coordinates |
in vector ncoord on the given element eid. |
@param eid - element id [in] |
@param xi, eta, zeta - natural coordinates of the point for which the value is computed |
@param nv - vector of nodal values of the given quantity [in] |
@return The function returns approximated quantity value. |
Created by Tomas Koudelka, 19.12.2017 |
*/ |
double approx(long eid, double xi, double eta, double zeta, vector &nv) |
{ |
elemtypet te; |
double ret = 0.0; |
te = Tt->give_elem_type(eid); |
switch (te){ |
case barlint:{ |
ret = Lbt->approx(xi, nv); |
break; |
} |
case barlintax:{ |
ret = Lbat->approx(xi, nv); |
break; |
} |
case barquadt:{ |
ret = Qbt->approx(xi, nv); |
break; |
} |
case barquadtax:{ |
ret = Qbat->approx(xi, nv); |
break; |
} |
case trlint:{ |
ret = Ltt->approx_nat(xi, eta, nv); |
break; |
} |
case trlaxisym:{ |
ret = Ltat->approx_nat(xi, eta, nv); |
break; |
} |
case quadlint:{ |
ret = Lqt->approx(xi, eta, nv); |
break; |
} |
case quadquadt:{ |
ret = Qqt->approx(xi, eta, nv); |
break; |
} |
case quadquadtax:{ |
ret = Qqat->approx(xi, eta, nv); |
break; |
} |
case quadlaxisym:{ |
ret = Lqat->approx(xi, eta, nv); |
break; |
} |
case lineartett:{ |
ret = Ltett->approx_nat(xi, eta, zeta, nv); |
break; |
} |
case linearhext:{ |
ret = Lht->approx(xi, eta, zeta, nv); |
break; |
} |
case quadratichext:{ |
ret = Qht->approx(xi, eta, zeta, nv); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
} |
return ret; |
} |
/** |
The function computes gradients at integration points. |
All components at all integration points are evaluated. |
2378,7 → 2569,7 |
/** |
The function returns netural coordinates of the given integration point ipp of element eid. |
The function returns natural coordinates of the given integration point ipp of element eid. |
@param eid - element id (input) |
@param ipp - integration point pointer (input) |
2515,3 → 2706,224 |
/** |
The function computes gradients at auxiliary integration points. |
All components at all integration points are evaluated. |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@return The function does not return anything but stores computed values |
in particular auxiliary integration points of the transmat aip array. |
Created by Tomas Koudelka, 8.12.2017 |
*/ |
void compute_aipgrads(long n, ipmap *ipm) |
{ |
intpointst *tmp_ip; |
long *tmp_elip; |
double **tmp_ntq; |
double *tmp_iv; |
long app, eid, i, j, k; |
long nne, ndofe, ncomp; |
long **dofe, **ordering; |
vector x, y, z, r, t, grad; |
ivector cn; |
matrix gm; |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with AUXILIARY integration points |
tmp_ip = Tm->ip; |
tmp_elip = Tm->elip; |
tmp_ntq = Tm->nontransq; |
tmp_iv = Tm->initval; |
Tm->ip = Tm->aip; |
Tm->elip = Tm->elaip; |
Tm->nontransq = Tm->aip_nontransq; |
Tm->initval = Tm->aip_initval; |
for (i=0; i<n; i++) // loop over all auxiliary integration points in the mapping |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point => gardients have already been computed |
continue; |
// id of element connected with the given auxiliary integration point |
eid = Tm->elip[app]; |
// only elements switched on are taken into account |
if (Gtt->leso[eid] == 1) |
{ |
// nodal coordinates of the given element |
nne = Tt->give_nne(eid); |
reallocv(RSTCKVEC(nne, x)); |
reallocv(RSTCKVEC(nne, y)); |
reallocv(RSTCKVEC(nne, z)); |
Tt->give_node_coord3d(x, y, z, eid); |
// code numbers of DOFs on element |
ndofe = Tt->give_ndofe(eid); |
reallocv(RSTCKIVEC(ndofe, cn)); |
Tt->give_code_numbers(eid, cn.a); |
// assemble vector of nodal values of all variables on element |
reallocv(RSTCKVEC(ndofe, r)); |
reallocv(RSTCKVEC(ndofe, t)); |
elemvalues(0, eid, r.a, cn.a, ndofe); |
// array of number of element DOFs for particular transported media |
dofe = Tt->give_dofe(eid); |
// ordering of variables in the vector of unknowns |
ordering = Tt->give_ordering(eid); |
for (j=0; j<Tp->ntm; j++) // loop over all variables of transported media |
{ |
// collect nodal values of j-th single variable in the vector t |
for (k=0; k<dofe[j][j]; k++) |
t[k]=r[ordering[j][k]-1]; |
// number of gradient components |
ncomp = Tm->ip[app].ncompgrad; |
// allocate matrix for the correct dimensions |
reallocm(RSTCKMAT(ncomp, nne, gm)); |
// get the gradient matrix at the given auxiliary integration point |
grad_matrix(eid, x, y, z, ipm[i].xi, ipm[i].eta, ipm[i].zeta, gm); |
// grad t = gm.t |
mxv(gm, t, grad); |
// store gradients at auxiliary integration point app |
Tm->storegrad(j, app, grad); |
} |
} |
} |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with REGULAR integration points |
Tm->ip = tmp_ip; |
Tm->elip = tmp_elip; |
Tm->nontransq = tmp_ntq; |
Tm->initval = tmp_iv; |
} |
/** |
The function computes fluxes at auxiliary integration points. |
All components at all integration points are evaluated. |
@return The function does not return anything but stores computed values |
in particular auxiliary integration points of the transmat aip array. |
Created by Tomas Koudelka, 8.12.2017 |
*/ |
void compute_aipfluxes() |
{ |
intpointst *tmp_ip; |
long *tmp_elip; |
double **tmp_ntq; |
double *tmp_iv; |
long app, i; |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with AUXILIARY integration points |
tmp_ip = Tm->ip; |
tmp_elip = Tm->elip; |
tmp_ntq = Tm->nontransq; |
tmp_iv = Tm->initval; |
Tm->ip = Tm->aip; |
Tm->elip = Tm->elaip; |
Tm->nontransq = Tm->aip_nontransq; |
Tm->initval = Tm->aip_initval; |
for (app=0; app<Tm->tnaip; app++) |
{ |
// only elements switched on are taken into account |
if (Gtt->leso[Tm->elip[app]] == 1) |
{ |
for (i=0; i<Tp->ntm; i++) |
Tm->computenlfluxes(i, app); |
} |
} |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with REGULAR integration points |
Tm->ip = tmp_ip; |
Tm->elip = tmp_elip; |
Tm->nontransq = tmp_ntq; |
Tm->initval = tmp_iv; |
} |
/** |
The function computes other values at auxiliary integration points. |
All components at all integration points are evaluated. |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@return The function does not return anything but stores computed values |
in particular auxiliary integration points of the transmat aip array. |
Created by Tomas Koudelka, 8.12.2017 |
*/ |
void compute_aipotherst(long n, ipmap *ipm) |
{ |
intpointst *tmp_ip; |
long *tmp_elip; |
double **tmp_ntq; |
double *tmp_iv; |
long app, eid, i, j, k; |
long nne, ncompo; |
vector x, y, z, r, t; |
ivector nodes, cn; |
matrix gm; |
double val; |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with AUXILIARY integration points |
tmp_ip = Tm->ip; |
tmp_elip = Tm->elip; |
tmp_ntq = Tm->nontransq; |
tmp_iv = Tm->initval; |
Tm->ip = Tm->aip; |
Tm->elip = Tm->elaip; |
Tm->nontransq = Tm->aip_nontransq; |
Tm->initval = Tm->aip_initval; |
for (i=0; i<n; i++) // loop over all auxiliary integration points in the mapping |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point => gardients have already been computed |
continue; |
// id of element connected with the given auxiliary integration point |
eid = Tm->elip[app]; |
// only elements switched on are taken into account |
if (Gtt->leso[eid] == 1) |
{ |
// nodes of required element |
nne = Tt->give_nne(eid); |
reallocv(RSTCKIVEC(nne, nodes)); |
Tt->give_elemnodes (eid,nodes); |
// allocate vector of nodal values of quantities |
ncompo = Tt->nodes[nodes[0]].ncompother; |
reallocv(RSTCKVEC(ncompo*nne, r)); |
// nodal values of array other |
nodalotherval(r.a, nodes); |
// allocate vector of nodal values for a single other value |
reallocv(RSTCKVEC(nne, t)); |
for (j=0; j<ncompo; j++) |
{ |
// nodal values of a single other value |
for (k=0; k<nne; k++) |
t[k] = r[k*ncompo+j]; |
// approximation of the other value |
val = approx(eid, ipm[i].xi, ipm[i].eta, ipm[i].zeta, t); |
// storage of the j-th componet in the other array |
Tm->storeother(app, j, val); |
} |
} |
} |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with REGULAR integration points |
Tm->ip = tmp_ip; |
Tm->elip = tmp_elip; |
Tm->nontransq = tmp_ntq; |
Tm->initval = tmp_iv; |
} |
/trunk/SIFEL/TRFEL/SRC/elemswitcht.h |
---|
9,6 → 9,8 |
void conductmat (long eid,long lcid,matrix &km); |
void capacmat (long eid,long lcid,matrix &cm); |
void advectmat (long eid,long lcid,matrix &hm); |
/// computes a gradient %matrix at the given point of element |
void grad_matrix (long eid, vector &x, vector &y, vector &z, double xi, double eta, double zeta, matrix &gm); |
void intpointvalues (long eid); |
void intpointvalues_puc (long eid); |
17,15 → 19,32 |
void averageflux (long lcid,long eid,vector &fl); |
void intpointothers (long eid); |
void intpointeqothers (long eid); |
/// function computes approximated value of the qunatity given by nodal values |
double approx(long eid, double xi, double eta, double zeta, vector &nv); |
void source_vector (long lcid,long eid,vector &nodval,vector &lv); |
void compute_ipfluxes (); |
void compute_average_fluxes (long lcid, vector &fl); |
void compute_ipgrads (); |
void compute_ipotherst (); |
void compute_ipeqotherst (); |
void compute_ipfluxes (); |
void compute_ipgrads (); |
void compute_ipotherst (); |
void compute_ipeqotherst (); |
// compute quantities for auxiliary integration points |
/// computes fluxes at auxiliary integration points |
void compute_ipfluxes (); |
/// computes gradients of primary unknowns at auxiliary integration points |
void compute_ipgrads (); |
/// computes other values/state variables at auxiliary integration points |
void compute_ipotherst (); |
/// computes eqother values/state variables at auxiliary integration points |
void compute_ipeqotherst (); |
void compute_nodegrads (); |
void compute_nodefluxes (); |
void compute_nodeotherst (); |
34,6 → 53,7 |
void compute_nodeeqotherst_comp (); |
void internal_fluxes (double *intflux,long n); |
void compute_average_fluxes (long lcid, vector &fl); |
void elem_neumann_vector (vector &lv,long lcid,long eid,long i); |
void elem_newton_vector (vector &lv,long lcid,long eid,long i); |
70,5 → 90,8 |
void compute_aipgrads(long lcid, long n, ipmap *ipm); |
/// function computes fluxes and eventual state variables at auxiliary integration points |
void compute_aipfluxes(long lcid, long n, ipmap *ipm); |
void compute_aipfluxes(); |
/// function computes other values at auxiliary integration points |
void compute_aipotherst(long n, ipmap *ipm); |
#endif |
/trunk/SIFEL/TRFEL/SRC/linbart.cpp |
---|
1926,12 → 1926,12 |
ncompo = Tm->ip[ipnum[i]].ncompeqother; |
if (ncompo){ |
// take eqother values for the given node from the closest integration point |
Tm->storeeqother(ipid, ncompo, Tm->ip[ipnum[i]].eqother); |
Tm->storeeqother(ipid, 0, ncompo, Tm->ip[ipnum[i]].eqother); |
} |
ncompo = Tm->ip[ipnum[i]].ncompother; |
if (ncompo){ |
// take eqother values for the given node from the closest integration point |
Tm->storeother(ipid, ncompo, Tm->ip[ipnum[i]].other); |
Tm->storeother(ipid, 0, ncompo, Tm->ip[ipnum[i]].other); |
} |
Tm->mat_aux_values(ipid); |
/trunk/SIFEL/TRFEL/SRC/linhext.cpp |
---|
1789,7 → 1789,7 |
for (i=0;i<nne;i++){ |
ncompo = Tm->givencompeqother (ipnum[i],0); |
reallocv (ncompo,eqother); |
Tm->giveeqother (ipnum[i],ncompo,eqother.a); |
Tm->giveeqother (ipnum[i],0,ncompo,eqother.a); |
// storage of eqother components to the node |
j=nod[i]; |
/trunk/SIFEL/TRFEL/SRC/lintett.cpp |
---|
183,7 → 183,34 |
return f; |
} |
/** |
The function computes approximated function value with the help of nodal values. |
@param xi, eta, zeta - natural coordinates |
@param nodval - nodal values |
20.8.2001 |
*/ |
double lintett::approx_nat(double xi, double eta, double zeta, vector &nodval) |
{ |
double f; |
vector volcoord(ASTCKVEC(4)); |
volcoord[0]=xi; |
volcoord[1]=eta; |
volcoord[2]=zeta; |
volcoord[3]=1.0-volcoord[0]-volcoord[1]-volcoord[2]; |
scprd (volcoord,nodval,f); |
return f; |
} |
/** |
function computes values in integration points from nodal values |
@param eid - element id |
1587,7 → 1614,7 |
for (i=0;i<nne;i++){ |
ncompo = Tm->givencompeqother (ipnum[i],0); |
reallocv (ncompo,eqother); |
Tm->giveeqother (ipnum[i],ncompo,eqother.a); |
Tm->giveeqother (ipnum[i],0,ncompo,eqother.a); |
// storage of eqother components to the node |
j=nod[i]; |
/trunk/SIFEL/TRFEL/SRC/lintett.h |
---|
15,6 → 15,7 |
void codnum (long *cn,long ri); |
double element_volume (long eid); |
double approx (vector &volcoord,vector &nodval); |
double approx_nat(double xi, double eta, double zeta, vector &nodval); |
void intpointval (long eid); |
void intpointval_puc (long eid); |
void intpointgrad (long eid); |
/trunk/SIFEL/TRFEL/SRC/quadlinaxisym.cpp |
---|
1748,12 → 1748,12 |
ncompo = Tm->ip[ipnum[i]].ncompeqother; |
if (ncompo){ |
// take eqother values for the given node from the closest integration point |
Tm->storeeqother(ipid, ncompo, Tm->ip[ipnum[i]].eqother); |
Tm->storeeqother(ipid, 0, ncompo, Tm->ip[ipnum[i]].eqother); |
} |
ncompo = Tm->ip[ipnum[i]].ncompother; |
if (ncompo){ |
// take eqother values for the given node from the closest integration point |
Tm->storeother(ipid, ncompo, Tm->ip[ipnum[i]].other); |
Tm->storeother(ipid, 0, ncompo, Tm->ip[ipnum[i]].other); |
} |
Tm->mat_aux_values(ipid); |
/trunk/SIFEL/TRFEL/SRC/quadlineart.cpp |
---|
1404,7 → 1404,7 |
*/ |
void quadlineart::averd_matrix (long eid,matrix &lm) |
{ |
long i,j,ii,*rcn,*ccn,nii,k,l; |
long i,j,ii,*rcn,*ccn; |
matrix d(ncomp,ncomp); |
matrix dd(ncomp,ncomp); |
1479,8 → 1479,8 |
*/ |
void quadlineart::averc_matrix (long eid,matrix &lm) |
{ |
long i,j,ii,nii,k,l; |
double c,cc,rho; |
long i,j,ii; |
double c,rho; |
ivector nodes(nne); |
vector dens(nne); |
2622,7 → 2622,7 |
for (i=0;i<nne;i++){ |
ncompo = Tm->givencompeqother (ipnum[i],0); |
reallocv (ncompo,eqother); |
Tm->giveeqother (ipnum[i],ncompo,eqother.a); |
Tm->giveeqother (ipnum[i],0,ncompo,eqother.a); |
// storage of eqother components to the node |
j=nod[i]; |
2914,12 → 2914,12 |
ncompo = Tm->ip[ipnum[i]].ncompeqother; |
if (ncompo){ |
// take eqother values for the given node from the closest integration point |
Tm->storeeqother(ipid, ncompo, Tm->ip[ipnum[i]].eqother); |
Tm->storeeqother(ipid, 0, ncompo, Tm->ip[ipnum[i]].eqother); |
} |
ncompo = Tm->ip[ipnum[i]].ncompother; |
if (ncompo){ |
// take eqother values for the given node from the closest integration point |
Tm->storeother(ipid, ncompo, Tm->ip[ipnum[i]].other); |
Tm->storeother(ipid, 0, ncompo, Tm->ip[ipnum[i]].other); |
} |
Tm->mat_aux_values(ipid); |
/trunk/SIFEL/TRFEL/SRC/transmat.cpp |
---|
1120,14 → 1120,7 |
print_err("unknown number of transported media is required",__FILE__,__LINE__,__func__); |
abort (); |
} |
} |
destrm(d); |
destrv (gr); |
destrv (v11); |
destrv (v12); |
destrv (v21); |
destrv (v22); |
} |
} |
2125,64 → 2118,90 |
/** |
function stores components of array other |
(function stores all components of array comp to |
the array other, first position in the array other is fi) |
The function stores all components of array comp to integration point array other, |
first position in the array other is fi. |
@param ipp - integration point pointer |
@param ncomp - number of components |
@param comp - %vector containing components |
@param ipp - integration point pointer |
@param fi - first index |
@param ncomp - number of required components |
@param comp - %vector containing components |
5.11.2002 |
@return The function does not return anything. |
5.11.2002 |
Modified by TKo, 19.12.2017 |
*/ |
void transmat::storeother (long ipp,long ncomp,double *comp) |
void transmat::storeother (long ipp, long fi, long ncomp,double *comp) |
{ |
long i; |
long i, j; |
for (i=0;i<ncomp;i++){ |
ip[ipp].other[i]=comp[i]; |
} |
for (i=fi, j=0; i<fi+ncomp; i++, j++) |
ip[ipp].other[i]=comp[j]; |
} |
/** |
function stores components of array eq_other |
(function stores all components of array compeq to |
the array eqother, first position in the array other is fi) |
The function stores one component to integration point array other, |
position in the array other is given by id. |
@param ipp - integration point pointer |
@param id - component index |
@param comp - component value |
@param ipp - integration point pointer |
@param ncomp - number of components |
@param compeq - %vector containing components |
@return The function does not return anything. |
Created by TKo, 19.12.2017 |
*/ |
void transmat::storeother (long ipp, long id, double comp) |
{ |
ip[ipp].other[id]=comp; |
} |
/** |
The function stores all components of array comp to integration point array eqother, |
first position in the array eqother is fi. |
@param ipp - integration point pointer |
@param fi - first index |
@param ncomp - number of required components |
@param comp - %vector containing components |
31.1.2007 |
@return The function does not return anything. |
31.1.2007 |
Modified by TKo, 19.12.2017 |
*/ |
void transmat::storeeqother (long ipp,long ncompeq,double *compeq) |
void transmat::storeeqother (long ipp, long fi, long ncompeq, double *compeq) |
{ |
long i; |
long i, j; |
for (i=0;i<ncompeq;i++){ |
ip[ipp].eqother[i]=compeq[i]; |
} |
for (i=fi, j=0; i<fi+ncompeq; i++, j++) |
ip[ipp].eqother[i]=compeq[j]; |
} |
/** |
function restores array other to %vector comp |
(function selects all components of array comp from |
the array other, first index in array other is fi) |
The function restores part of array other to the array comp. |
It selects ncomp components from the integration point array other starting from fi-th component, |
and stores them in comp array. |
@param ipp - integration point pointer |
@param ncomp - number of components |
@param comp - %vector containing components |
@param ipp - integration point pointer |
@param fi - first index |
@param ncomp - number of required components |
@param comp - %vector containing components |
5.11.2002 |
@return The function does not return anything. |
5.11.2002 |
Modified by TKo, 19.12.2017 |
*/ |
void transmat::giveother (long ipp,long ncomp,double *comp) |
void transmat::giveother(long ipp, long fi, long ncomp, double *comp) |
{ |
long i; |
long i, j; |
for (i=0;i<ncomp;i++){ |
comp[i]=ip[ipp].other[i]; |
for (i=fi, j=0; i<fi+ncomp; i++, j++){ |
comp[j]=ip[ipp].other[i]; |
} |
} |
2197,13 → 2216,14 |
@param compeq - %vector containing components |
5.11.2002 |
Modified by TKo, 19.12.2017 |
*/ |
void transmat::giveeqother (long ipp,long ncompeq,double *compeq) |
void transmat::giveeqother(long ipp, long fi, long ncompeq, double *compeq) |
{ |
long i; |
for (i=0;i<ncompeq;i++){ |
compeq[i]=ip[ipp].eqother[i]; |
long i, j; |
for (i=fi, j=0; i<fi+ncompeq; i++, j++){ |
compeq[j]=ip[ipp].eqother[i]; |
} |
} |
4330,7 → 4350,7 |
double **tmp_ntq; |
double *tmp_iv; |
// switch regular integration point auxiliary integration point arrays |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with AUXILIARY integration points |
tmp_ip = ip; |
tmp_elip = elip; |
4347,7 → 4367,7 |
initvalues(app, 0, 0); |
} |
// switch regular integration point auxiliary integration point arrays |
// swap regular integration point auxiliary integration point arrays |
// from now, all functions will work with REGULAR integration points |
ip = tmp_ip; |
elip = tmp_elip; |
4957,19 → 4977,27 |
/** |
Function saves data from integration points into auxiliary file |
in text format. |
//************************************************** |
// Functions for backup of regular integration points |
//*************************************************** |
/* |
Function saves data from regular integration points into backup file |
in text format. |
@param aux - pointer to auxiliary file |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param aux - pointer to auxiliary file |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
JK, 19.9.2004 |
TKo, 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
JK, 19.9.2004 |
TKo, 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::save_intpointst_txt (FILE *aux, sel &selelems, sel *selother) |
{ |
4979,42 → 5007,44 |
selno.n=1; |
fprintf(aux, "\n"); |
for (i=0;i<Tt->ne;i++) |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
if (ir < 0) |
n = 0; |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fprintf (aux,"%ld %ld %ld %ld\n",ipp, Tp->ntm, ip[ipp].ncompgrad, n); |
if (ir < 0) |
n = 0; |
ip[ipp].save_data_txt(aux, selno); |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fprintf (aux,"%ld %ld %ld %ld\n",ipp, Tp->ntm, ip[ipp].ncompgrad, n); |
if (ir < 0) |
ip[ipp].save_data_txt(aux, selno); |
else |
ip[ipp].save_data_txt(aux, selother[ir]); |
ip[ipp].save_data_txt(aux, selother[ir]); |
fprintf(aux, "\n"); |
ipp++; |
} |
fprintf(aux, "\n"); |
ipp++; |
} |
} |
} |
/** |
Function saves data from integration points into several files |
in text format. |
Function saves data from regular integration points into several backup files |
in text format. |
@param ni - time step id |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param ni - time step id |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
JK, 19.9.2004 |
TKo, 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
JK, 19.9.2004 |
TKo, 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::save_intpointst_txt (long ni, sel &selelems, sel *selother) |
{ |
5029,70 → 5059,70 |
sprintf(name, "%s.%ld.grad.bac",Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++) |
{ |
fprintf (aux,"%ld %ld %ld\n",i, Tp->ntm, ip[i].ncompgrad); |
for (j=0;j<Tp->ntm;j++) |
for (k=0;k<Tm->ip[i].ncompgrad;k++) |
fprintf (aux, "%.*le\n",prec , ip[i].grad[j][k]); |
} |
{ |
fprintf(aux,"%ld %ld %ld\n",i, Tp->ntm, ip[i].ncompgrad); |
for (j=0;j<Tp->ntm;j++) |
for (k=0;k<ip[i].ncompgrad;k++) |
fprintf (aux, "%.*le\n",prec , ip[i].grad[j][k]); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.flux.bac",Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++) |
{ |
fprintf (aux,"%ld %ld %ld\n",i, Tp->ntm, ip[i].ncompgrad); |
for (j=0;j<Tp->ntm;j++) |
for (k=0;k<Tm->ip[i].ncompgrad;k++) |
fprintf (aux, "%.*le\n",prec , ip[i].fluxes[j][k]); |
} |
{ |
fprintf (aux,"%ld %ld %ld\n",i, Tp->ntm, ip[i].ncompgrad); |
for (j=0;j<Tp->ntm;j++) |
for (k=0;k<ip[i].ncompgrad;k++) |
fprintf(aux, "%.*le\n",prec , ip[i].fluxes[j][k]); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.other.bac",Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<Tt->ne;i++) |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
if (ir < 0) |
n = 0; |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
fprintf (aux,"%ld %ld\n",ipp, n); |
if (n==0) |
{ |
ipp++; |
continue; |
} |
for (k=0;k<ip[ipp].ncompeqother;k++) |
{ |
if (selother[ir].presence_id(k)) |
fprintf (aux, "%.*le\n",prec , ip[ipp].eqother[k]); |
} |
ipp++; |
} |
for (i=0;i<Tt->ne;i++) |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
if (ir < 0) |
n = 0; |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fprintf (aux,"%ld %ld\n",ipp, n); |
if (n==0) |
{ |
ipp++; |
continue; |
} |
for (k=0;k<ip[ipp].ncompeqother;k++) |
{ |
if (selother[ir].presence_id(k)) |
fprintf (aux, "%.*le\n",prec , ip[ipp].eqother[k]); |
} |
ipp++; |
} |
} |
} |
fclose(aux); |
} |
5099,7 → 5129,7 |
/** |
Function saves data from integration points into auxiliary file |
Function saves data from regular integration points into backup file |
in binary format. |
@param aux - pointer to auxiliary file |
5118,49 → 5148,51 |
selno.n=1; |
for (i=0;i<Tt->ne;i++) |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
if (ir < 0) |
n = 0; |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fwrite(&ipp, sizeof(ipp), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&ip[ipp].ncompgrad, sizeof(ip[ipp].ncompgrad), 1, aux); |
fwrite(&n, sizeof(n), 1, aux); |
if (ir < 0) |
n = 0; |
ip[ipp].save_data_bin(aux, selno); |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fwrite(&ipp, sizeof(ipp), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&ip[ipp].ncompgrad, sizeof(ip[ipp].ncompgrad), 1, aux); |
fwrite(&n, sizeof(n), 1, aux); |
if (ir < 0) |
ip[ipp].save_data_bin(aux, selno); |
else |
ip[ipp].save_data_bin(aux, selother[ir]); |
ipp++; |
} |
ip[ipp].save_data_bin(aux, selother[ir]); |
ipp++; |
} |
} |
} |
/** |
Function saves data from integration points into several files |
in binary format. |
Function saves data from regular integration points into several backup files |
in binary format. |
@param ni - time step id |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param ni - time step id |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
TKo 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
TKo 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::save_intpointst_bin (long ni, sel &selelems, sel *selother) |
{ |
long i,j,k,ir,n,nip,ipp; |
long i, j, k, ir, n, nip, ipp; |
sel selno; // selection with no selected components |
selno.n=1; |
FILE *aux; |
5167,76 → 5199,75 |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
sprintf(name, "%s.%ld.grad.bac",Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
sprintf(name, "%s.%ld.grad.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++){ |
fwrite(&i, sizeof(i), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&ip[i].ncompgrad, sizeof(ip[i].ncompgrad), 1, aux); |
for (j=0;j<Tp->ntm;j++) |
fwrite (ip[i].grad[j], sizeof(*ip[i].grad[j]),ip[i].ncompgrad, aux); |
for (j=0; j<Tp->ntm; j++) |
fwrite(ip[i].grad[j], sizeof(*ip[i].grad[j]), ip[i].ncompgrad, aux); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.flux.bac",Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
sprintf(name, "%s.%ld.flux.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++) |
{ |
fwrite(&i, sizeof(i), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&ip[i].ncompgrad, sizeof(ip[i].ncompgrad), 1, aux); |
for (j=0;j<Tp->ntm;j++) |
fwrite (ip[i].fluxes[j], sizeof(*ip[i].fluxes[j]),ip[i].ncompgrad, aux); |
} |
{ |
fwrite(&i, sizeof(i), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&ip[i].ncompgrad, sizeof(ip[i].ncompgrad), 1, aux); |
for (j=0; j<Tp->ntm; j++) |
fwrite(ip[i].fluxes[j], sizeof(*ip[i].fluxes[j]), ip[i].ncompgrad, aux); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.other.bac",Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wb"); |
sprintf(name, "%s.%ld.other.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<Tt->ne;i++) |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
if (ir < 0) |
n = 0; |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
fwrite(&ipp, sizeof(ipp), 1, aux); |
fwrite(&n, sizeof(n), 1, aux); |
if (n==0) |
{ |
ipp++; |
continue; |
} |
for (k=0;k<ip[ipp].ncompeqother;k++) |
{ |
if (selother[ir].presence_id(k)) |
fwrite(ip[ipp].eqother+k, sizeof(*ip[ipp].eqother), 1, aux); |
} |
ipp++; |
} |
for (i=0;i<Tt->ne;i++) |
{ |
ipp = Tt->elements[i].ipp[0][0]; |
nip = Tt->give_tnip(i); |
selelems.presence_id(i, ir); |
if (ir < 0) |
n = 0; |
else |
n = selother[ir].give_nselcomp(ip[ipp].ncompeqother); |
for (j=0; j<nip; j++) |
{ |
fwrite(&ipp, sizeof(ipp), 1, aux); |
fwrite(&n, sizeof(n), 1, aux); |
if (n==0) |
{ |
ipp++; |
continue; |
} |
for (k=0;k<ip[ipp].ncompeqother;k++) |
{ |
if (selother[ir].presence_id(k)) |
fwrite (ip[ipp].eqother+k, sizeof(*ip[ipp].eqother), 1, aux); |
} |
ipp++; |
} |
} |
} |
fclose(aux); |
} |
5243,7 → 5274,7 |
/** |
Function restores data from auxiliary text file into integration points. |
Function restores data from text backup file into regular integration points. |
@param aux - pointer to auxiliary file |
@param selelems - selection of elements whose eqother array will be restored |
5255,34 → 5286,36 |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::restore_intpointst_txt (FILE *aux, sel &selelems, sel *selother, long **selid) |
{ |
long i,n,ir,ipp; |
long i, n, ir, ipp; |
long ntm, ncompgrad; |
sel selno; // selection with no selected components |
selno.n=1; |
for (i=0;i<tnip;i++){ |
fscanf (aux,"%ld %ld %ld %ld",&ipp, &ntm, &ncompgrad, &n); |
fscanf(aux, "%ld %ld %ld %ld", &ipp, &ntm, &ncompgrad, &n); |
if ((ipp < 0) || (ipp >= tnip)) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != ip[ipp].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(elip[ipp], ir); |
if (ir < 0) |
ip[ipp].restore_data_txt(aux, n, selno, NULL); |
5295,7 → 5328,7 |
/** |
Function restores data from several text files into integration points. |
Function restores data from several backup text files into regular integration points. |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
5306,13 → 5339,15 |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::restore_intpointst_txt (sel &selelems, sel *selother, long **selid) |
{ |
long i,j,k,n,ir,ik,is,ipp; |
long i, j, k, n, ir, ik, is, ipp; |
long ntm, ncompgrad; |
double tmp; |
FILE *aux; |
5320,46 → 5355,46 |
char emsg[FNAMELEN+100]; |
// restoring of gradient arrays |
sprintf(name, "%s.grad.bac",Tp->hdbcont.hdbnamer); |
sprintf(name, "%s.grad.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name,"rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++){ |
fscanf (aux,"%ld %ld %ld",&ipp, &ntm, &ncompgrad); |
if ((ipp < 0) || (ipp >= tnip)) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++){ |
fscanf (aux,"%ld %ld %ld",&ipp, &ntm, &ncompgrad); |
if ((ipp < 0) || (ipp >= tnip)) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != ip[ipp].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0;j<Tp->ntm;j++) |
for (k=0;k<Tm->ip[i].ncompgrad;k++) |
fscanf (aux, "%le", ip[i].grad[j]+k); |
for (k=0;k<ip[i].ncompgrad;k++) |
fscanf(aux, "%le", ip[i].grad[j]+k); |
} |
// restoring of flux arrays |
sprintf(name, "%s.flux.bac",Tp->hdbcont.hdbnamer); |
aux = fopen(name,"rt"); |
sprintf(name, "%s.flux.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0;i<tnip;i++){ |
fscanf (aux,"%ld %ld %ld",&ipp, &ntm, &ncompgrad); |
fscanf(aux, "%ld %ld %ld", &ipp, &ntm, &ncompgrad); |
if ((ipp < 0) || (ipp >= tnip)) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
5375,13 → 5410,13 |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0;j<Tp->ntm;j++) |
for (k=0;k<Tm->ip[i].ncompgrad;k++) |
fscanf (aux, "%le", ip[i].fluxes[j]+k); |
for (j=0; j<Tp->ntm; j++) |
for (k=0;k<ip[ipp].ncompgrad;k++) |
fscanf(aux, "%le", ip[ipp].fluxes[j]+k); |
} |
// restoring of other arrays |
sprintf(name, "%s.other.bac",Tp->hdbcont.hdbnamer); |
aux = fopen(name,"rt"); |
sprintf(name, "%s.other.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
5390,7 → 5425,7 |
} |
for (i=0;i<tnip;i++) |
{ |
fscanf (aux,"%ld %ld",&ipp, &n); |
fscanf(aux,"%ld %ld",&ipp, &n); |
if ((ipp < 0) || (ipp >= tnip)) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
5419,7 → 5454,7 |
/** |
Function restores data from auxiliary binary file into integration points. |
Function restores data from binary backup file into regular integration points. |
@param aux - pointer to auxiliary file |
@param selelems - selection of elements whose eqother array will be restored |
5430,10 → 5465,12 |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::restore_intpointst_bin (FILE *aux, sel &selelems, sel *selother, long **selid) |
{ |
5463,9 → 5500,9 |
} |
selelems.presence_id(elip[ipp], ir); |
if (ir < 0) |
ip[ipp].restore_data_bin(aux, n, selno, NULL); |
ip[ipp].restore_data_bin(aux, n, selno, NULL); |
else |
ip[ipp].restore_data_bin(aux, n, selother[ir], selid[ir]); |
ip[ipp].restore_data_bin(aux, n, selother[ir], selid[ir]); |
} |
} |
5472,7 → 5509,7 |
/** |
Function restores data from several binary files into integration points. |
Function restores data from several binary backup files into regular integration points. |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
5482,10 → 5519,12 |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
@return The function does not return anything. |
JK, 19.9.2004 |
TKo 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::restore_intpointst_bin (sel &selelems, sel *selother, long **selid) |
{ |
5497,8 → 5536,8 |
char emsg[FNAMELEN+100]; |
// restoring of gradient arrays |
sprintf(name, "%s.grad.bac",Tp->hdbcont.hdbnamer); |
aux = fopen(name,"rb"); |
sprintf(name, "%s.grad.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
5525,11 → 5564,11 |
abort(); |
} |
for (j=0;j<Tp->ntm;j++) |
fread (ip[i].grad[j], sizeof(*ip[i].grad[j]),ip[i].ncompgrad, aux); |
fread(ip[i].grad[j], sizeof(*ip[i].grad[j]), ip[i].ncompgrad, aux); |
} |
// restoring of flux arrays |
sprintf(name, "%s.flux.bac",Tp->hdbcont.hdbnamer); |
aux = fopen(name,"rb"); |
sprintf(name, "%s.flux.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
5556,11 → 5595,11 |
abort(); |
} |
for (j=0;j<Tp->ntm;j++) |
fread (ip[i].fluxes[j], sizeof(*ip[i].fluxes[j]),ip[i].ncompgrad, aux); |
fread(ip[i].fluxes[j], sizeof(*ip[i].fluxes[j]), ip[i].ncompgrad, aux); |
} |
// restoring of other arrays |
sprintf(name, "%s.other.bac",Tp->hdbcont.hdbnamer); |
aux = fopen(name,"rb"); |
sprintf(name, "%s.other.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
5568,8 → 5607,8 |
abort(); |
} |
for (i=0;i<tnip;i++){ |
fread (&ipp, sizeof(ipp), 1, aux); |
fread (&n, sizeof(n), 1, aux); |
fread(&ipp, sizeof(ipp), 1, aux); |
fread(&n, sizeof(n), 1, aux); |
if ((ipp < 0) || (ipp >= tnip)) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
5578,7 → 5617,7 |
selelems.presence_id(elip[ipp], ir); |
for (k=0;k<n;k++) |
{ |
fread (&tmp, sizeof(tmp), 1, aux); |
fread(&tmp, sizeof(tmp), 1, aux); |
if (ir < 0) |
continue; |
if (selother[ir].presence_id(k,ik)) |
5595,7 → 5634,726 |
} |
//***************************************************** |
// Functions for backup of auxiliary integration points |
//***************************************************** |
/* |
Function saves data from auxiliary integration points into backup file |
in text format. |
@param aux - pointer to auxiliary file |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 22.12.2017 |
*/ |
void transmat::save_auxintpointst_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, ir, app, nsc, eid; |
sel selno; // selection with no selected components |
selno.n=1; |
fprintf(aux, "\n"); |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(i, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(ip[app].ncompeqother); |
fprintf(aux,"%ld %ld %ld %ld\n",app, Tp->ntm, aip[app].ncompgrad, nsc); |
if (ir < 0) |
aip[app].save_data_txt(aux, selno); |
else |
aip[app].save_data_txt(aux, selother[ir]); |
fprintf(aux, "\n"); |
} |
} |
/** |
Function saves data from auxiliary integration points into several backup files |
in text format. |
@param ni - time step id |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 22.12.2017 |
*/ |
void transmat::save_auxintpointst_txt (long ni, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, j, k, ir, eid, nsc, app; |
sel selno; // selection with no selected components |
selno.n=1; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
int prec = (int)Tp->hdbcont.prec; |
sprintf(name, "%s.%ld.agrad.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fprintf(aux, "%ld %ld %ld\n", i, Tp->ntm, aip[app].ncompgrad); |
for (j=0; j<Tp->ntm; j++) |
{ |
for (k=0; k<aip[app].ncompgrad; k++) |
fprintf(aux, "%.*le\n", prec, aip[app].grad[j][k]); |
} |
} |
fclose(aux); |
sprintf(name, "%s.%ld.aflux.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fprintf(aux, "%ld %ld %ld\n", i, Tp->ntm, aip[app].ncompgrad); |
for (j=0;j<Tp->ntm;j++) |
{ |
for (k=0; k<aip[app].ncompgrad; k++) |
fprintf(aux, "%.*le\n", prec, aip[app].fluxes[j][k]); |
} |
} |
fclose(aux); |
sprintf(name, "%s.%ld.aother.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name,"wt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(i, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fprintf (aux, "%ld %ld\n", app, nsc); |
if (nsc==0) |
continue; |
for (k=0; k<aip[app].ncompeqother; k++) |
{ |
if (selother[ir].presence_id(k)) |
fprintf (aux, "%.*le\n", prec, aip[app].eqother[k]); |
} |
} |
fclose(aux); |
} |
/** |
Function saves data from auxiliary integration points into backup file |
in binary format. |
@param aux - pointer to auxiliary file |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 20.12.2017 |
*/ |
void transmat::save_auxintpointst_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, ir, eid, nsc, app; |
sel selno; // selection with no selected components |
selno.n=1; |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(i, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&aip[app].ncompgrad, sizeof(aip[app].ncompgrad), 1, aux); |
fwrite(&nsc, sizeof(nsc), 1, aux); |
if (ir < 0) |
aip[app].save_data_bin(aux, selno); |
else |
aip[app].save_data_bin(aux, selother[ir]); |
} |
} |
/** |
Function saves data from auxiliary integration points into several backup files |
in binary format. |
@param ni - time step id |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be saved |
@param selother - selection of components of saved eqother array which will be saved on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@return The function does not return anything. |
TKo 9.2008 |
TKr, 12.2008 |
*/ |
void transmat::save_auxintpointst_bin (long ni, long n, ipmap *ipm, sel &selelems, sel *selother) |
{ |
long i, j, k, ir, eid, nsc, app; |
sel selno; // selection with no selected components |
selno.n=1; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
sprintf(name, "%s.%ld.agrad.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&aip[app].ncompgrad, sizeof(aip[app].ncompgrad), 1, aux); |
for (j=0; j<Tp->ntm; j++) |
fwrite(aip[app].grad[j], sizeof(*aip[app].grad[j]), aip[app].ncompgrad, aux); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.aflux.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&Tp->ntm, sizeof(Tp->ntm), 1, aux); |
fwrite(&aip[app].ncompgrad, sizeof(aip[app].ncompgrad), 1, aux); |
for (j=0;j<Tp->ntm;j++) |
fwrite(aip[app].fluxes[j], sizeof(*aip[app].fluxes[j]), aip[app].ncompgrad, aux); |
} |
fclose(aux); |
sprintf(name, "%s.%ld.aother.bac", Tp->hdbcont.hdbnames, ni); |
aux = fopen(name, "wb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
selelems.presence_id(i, ir); |
if (ir < 0) |
nsc = 0; |
else |
nsc = selother[ir].give_nselcomp(aip[app].ncompeqother); |
fwrite(&app, sizeof(app), 1, aux); |
fwrite(&nsc, sizeof(nsc), 1, aux); |
if (nsc==0) |
continue; |
for (k=0; k<aip[app].ncompeqother; k++) |
{ |
if (selother[ir].presence_id(k)) |
fwrite(aip[app].eqother+k, sizeof(*aip[app].eqother), 1, aux); |
} |
} |
fclose(aux); |
} |
/** |
Function restores data from text backup file into auxiliary integration points. |
@param aux - pointer to auxiliary file |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 22.12.2017 |
*/ |
void transmat::restore_auxintpointst_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, ir, eid, app, tapp; |
long ntm, ncompgrad, ncompother; |
sel selno; // selection with no selected components |
selno.n=1; |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fscanf(aux, "%ld %ld %ld %ld", &tapp, &ntm, &ncompgrad, &ncompother); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != aip[app].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
if (ir < 0) |
aip[app].restore_data_txt(aux, ncompother, selno, NULL); |
else |
aip[app].restore_data_txt(aux, ncompother, selother[ir], selid[ir]); |
} |
} |
/** |
Function restores data from several text backup files into auxiliary integration points. |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 22.12.2017 |
*/ |
void transmat::restore_auxintpointst_txt (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, j, k, ir, ik, is, eid, tapp, app; |
long ntm, ncompgrad, ncompother; |
double tmp; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
// restoring of gradient arrays |
sprintf(name, "%s.agrad.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fscanf(aux, "%ld %ld %ld", &tapp, &ntm, &ncompgrad); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != aip[app].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0; j<Tp->ntm; j++) |
for (k=0; k<aip[app].ncompgrad; k++) |
fscanf(aux, "%le", aip[app].grad[j]+k); |
} |
// restoring of flux arrays |
sprintf(name, "%s.aflux.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
fscanf(aux, "%ld %ld %ld", &tapp, &ntm, &ncompgrad); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != aip[app].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0; j<Tp->ntm; j++) |
for (k=0; k<aip[app].ncompgrad; k++) |
fscanf(aux, "%le", aip[app].fluxes[j]+k); |
} |
// restoring of other arrays |
sprintf(name, "%s.aother.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rt"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fscanf(aux, "%ld %ld", &tapp, &ncompother); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
for (k=0; k<ncompother; k++) |
{ |
fscanf(aux, "%le", &tmp); |
if (ir < 0) |
continue; |
if (selother[ir].presence_id(k, ik)) |
{ |
is = selid[ir][ik]+k-selother[ir].id1[ik]; // storage index in eqother array |
if (is >= aip[app].ncompeqother) |
print_err("invalid index for eqother restoring is required", __FILE__, __LINE__, __func__); |
else |
aip[app].eqother[is] = tmp; |
} |
} |
} |
fclose(aux); |
} |
/** |
Function restores data from binary backup file into auxiliary integration points. |
@param aux - pointer to auxiliary file |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka 22.12.2017 |
*/ |
void transmat::restore_auxintpointst_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, ntm, ncompgrad, ncompother, eid, app, tapp; |
long ir; |
sel selno; // selection with no selected components |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) //direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&ntm, sizeof(ntm), 1, aux); |
fread(&ncompgrad, sizeof(ncompgrad), 1, aux); |
fread(&ncompother, sizeof(ncompother), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != aip[app].ncompgrad) |
{ |
print_err("incompatible number of stress/strain components", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
if (ir < 0) |
aip[app].restore_data_bin(aux, ncompother, selno, NULL); |
else |
aip[app].restore_data_bin(aux, ncompother, selother[ir], selid[ir]); |
} |
} |
/** |
Function restores data from several binary backup files into auxliary integration points. |
@param n - the number of components in the ipm array [in] |
@param ipm - the array of integration point mapping objects [in] |
@param selelems - selection of elements whose eqother array will be restored |
@param selother - selection of components of saved eqother array which will be resored on selected elements |
for each range or list item in selelems an individual selection of eqother components |
is enabled |
@param selid - array of indices of positions in eqother array to which will be |
restored selected saved eqother components |
for each range or list item in selother an individual selection of position |
of eqother components is enabled |
@return The function does not return anything. |
Created by Tomas Koudelka, 20.12.2017 |
*/ |
void transmat::restore_auxintpointst_bin (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid) |
{ |
long i, j, k, ir, ik, is, eid, app, tapp; |
long ntm, ncompgrad, ncompother; |
double tmp; |
FILE *aux; |
char name[FNAMELEN+20]; |
char emsg[FNAMELEN+100]; |
// restoring of gradient arrays |
sprintf(name, "%s.agrad.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) //direct mapping to the regular integration point |
continue; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&ntm, sizeof(ntm), 1, aux); |
fread(&ncompgrad, sizeof(ncompgrad), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of transported matter", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != aip[app].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0;j<Tp->ntm;j++) |
fread(aip[app].grad[j], sizeof(*aip[app].grad[j]), aip[app].ncompgrad, aux); |
} |
// restoring of flux arrays |
sprintf(name, "%s.aflux.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) //direct mapping to the regular integration point |
continue; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&ntm, sizeof(ntm), 1, aux); |
fread(&ncompgrad, sizeof(ncompgrad), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ntm != Tp->ntm) |
{ |
print_err("invalid number of load cases", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (ncompgrad != aip[app].ncompgrad) |
{ |
print_err("incompatible number of flux/grad components", __FILE__, __LINE__, __func__); |
abort(); |
} |
for (j=0; j<Tp->ntm; j++) |
fread(aip[app].fluxes[j], sizeof(*aip[app].fluxes[j]), aip[app].ncompgrad, aux); |
} |
// restoring of other arrays |
sprintf(name, "%s.aother.bac", Tp->hdbcont.hdbnamer); |
aux = fopen(name, "rb"); |
if (aux==NULL) |
{ |
sprintf(emsg, "cannot open backup file %s", name); |
print_err(emsg, __FILE__, __LINE__, __func__); |
abort(); |
} |
for (i=0; i<n; i++) |
{ |
app = ipm[i].app; |
if (app < 0) // direct mapping to the regular integration point |
continue; |
eid = ipm[i].eid; |
fread(&tapp, sizeof(tapp), 1, aux); |
fread(&ncompother, sizeof(ncompother), 1, aux); |
if (tapp != app) |
{ |
print_err("invalid integration point number", __FILE__, __LINE__, __func__); |
abort(); |
} |
selelems.presence_id(eid, ir); |
for (k=0; k<ncompother; k++) |
{ |
fread(&tmp, sizeof(tmp), 1, aux); |
if (ir < 0) |
continue; |
if (selother[ir].presence_id(k, ik)) |
{ |
is = selid[ir][ik]+k-selother[ir].id1[ik]; // storage index in eqother array |
if (is >= aip[app].ncompeqother) |
print_err("invalid index for eqother restoring is required", __FILE__, __LINE__, __func__); |
else |
aip[app].eqother[is] = tmp; |
} |
} |
} |
fclose(aux); |
} |
/** |
function returns the extinction coefficient |
@param mt - type of material |
/trunk/SIFEL/TRFEL/SRC/transmat.h |
---|
193,18 → 193,22 |
void givefluxes (long lcid,long ipp,vector &fl); |
void storeother (long ipp,long ncomp,double *comp); |
/// storage of given other variable components on given int. point |
void storeother (long ipp, long fi, long ncomp, double *comp); |
/// storage of id-th component to the other array on the given int. point |
void storeother (long ipp, long id, double comp); |
void storeeqother (long ipp,long ncompeq,double *compeq); |
/// storage of given eqother variable components on given int. point |
void storeeqother (long ipp, long fi, long ncompeq, double *compeq); |
/// returns given other variable components on given int. point |
void giveother (long ipp, long fi, long ncomp, double *comp); |
void giveother (long ipp,long ncomp,double *comp); |
/// returns given eqother variable components on given int. point |
void giveeqother (long ipp, long fi, long ncompeq, double *compeq); |
void giveeqother (long ipp,long ncompeq,double *compeq); |
long givencompother (); |
283,39 → 287,70 |
void advection_velocities (XFILE *in); |
// ******************** |
// Functions for backup |
// ******************** |
// ***************************************** |
// Funtions for backup of int. point content |
// ***************************************** |
long cycle_detection (double *r,double *pr,double *ppr,long ipp); |
/// save content of int. points to one huge text file |
void save_intpointst_txt (FILE *aux, sel &selelems, sel *selother); |
/// save content of int. points to several text files according to stored quantity |
void save_intpointst_txt (long ni, sel &selelems, sel *selother); |
void save_intpointst_txt (FILE *aux, sel &selelems, sel *selother); |
/// save content of int. points to one huge binary file |
void save_intpointst_bin (FILE *aux, sel &selelems, sel *selother); |
/// save content of int. points to several binary files according to stored quantity |
void save_intpointst_bin (long ni, sel &selelems, sel *selother); |
void save_intpointst_txt (long ni, sel &selelems, sel *selother); |
/// restore content of int. points to one huge text file |
void restore_intpointst_txt (FILE *aux, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to several text files according to stored quantity |
void restore_intpointst_txt (sel &selelems, sel *selother, long **selid); |
void save_intpointst_bin (FILE *aux, sel &selelems, sel *selother); |
/// restore content of int. points to one huge binary file |
void restore_intpointst_bin (FILE *aux, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to several binary files according to stored quantity |
void restore_intpointst_bin (sel &selelems, sel *selother, long **selid); |
void save_intpointst_bin (long ni, sel &selelems, sel *selother); |
// *************************************************** |
// Funtions for backup of auxiliary int. point content |
// *************************************************** |
/// save content of int. points to one huge text file |
void save_auxintpointst_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother); |
void restore_intpointst_txt (FILE *aux, sel &selelems, sel *selother, long **selid); |
/// save content of int. points to several text files according to stored quantity |
void save_auxintpointst_txt (long ni, long n, ipmap *ipm, sel &selelems, sel *selother); |
/// save content of int. points to one huge binary file |
void save_auxintpointst_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother); |
void restore_intpointst_txt (sel &selelems, sel *selother, long **selid); |
/// save content of int. points to several binary files according to stored quantity |
void save_auxintpointst_bin (long ni, long n, ipmap *ipm, sel &selelems, sel *selother); |
/// restore content of int. points to one huge text file |
void restore_auxintpointst_txt (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
void restore_intpointst_bin (FILE *aux, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to several text files according to stored quantity |
void restore_auxintpointst_txt (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to one huge binary file |
void restore_auxintpointst_bin (FILE *aux, long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
void restore_intpointst_bin (sel &selelems, sel *selother, long **selid); |
/// restore content of int. points to several binary files according to stored quantity |
void restore_auxintpointst_bin (long n, ipmap *ipm, sel &selelems, sel *selother, long **selid); |
long cycle_detection (double *r,double *pr,double *ppr,long ipp); |
/// number of material types |
long nmt; |
/// material types |
/trunk/SIFEL/TRFEL/SRC/transtop.cpp |
---|
486,6 → 486,84 |
/** |
The function returns array of number of DOFs of element for particular |
tarnsported media. Dimensions of the array dofe is (ntm x ntm) |
@param eid - element id |
TKo, 19.12.2017 |
*/ |
long** transtop::give_dofe (long eid) |
{ |
long **dofe; |
elemtypet te; |
te = give_elem_type (eid); |
switch (te){ |
case barlint:{ dofe=Lbt->dofe; break; } |
case barlintax:{ dofe=Lbat->dofe; break; } |
case barquadt:{ dofe=Qbt->dofe; break; } |
case barquadtax:{ dofe=Qbat->dofe; break; } |
case trlint:{ dofe=Ltt->dofe; break; } |
case trlaxisym:{ dofe=Ltat->dofe; break; } |
case quadlint:{ dofe=Lqt->dofe; break; } |
case quadquadt:{ dofe=Qqt->dofe; break; } |
case quadquadtax:{ dofe=Qqat->dofe; break; } |
case quadlaxisym:{ dofe=Lqat->dofe; break; } |
case ifacequadel:{ dofe=Ifcquadt->dofe; break; } |
case lineartett:{ dofe=Ltett->dofe; break; } |
case linearhext:{ dofe=Lht->dofe; break; } |
case quadratichext:{ dofe=Qht->dofe; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
} |
return dofe; |
} |
/** |
The function returns array of DOF ordering of element for particular |
tarnsported media. Dimensions of the returned array ordering is (ntm x nne). |
@param eid - element id |
TKo, 19.12.2017 |
*/ |
long** transtop::give_ordering (long eid) |
{ |
long **ordering; |
elemtypet te; |
te = give_elem_type (eid); |
switch (te){ |
case barlint:{ ordering=Lbt->ordering; break; } |
case barlintax:{ ordering=Lbat->ordering; break; } |
case barquadt:{ ordering=Qbt->ordering; break; } |
case barquadtax:{ ordering=Qbat->ordering; break; } |
case trlint:{ ordering=Ltt->ordering; break; } |
case trlaxisym:{ ordering=Ltat->ordering; break; } |
case quadlint:{ ordering=Lqt->ordering; break; } |
case quadquadt:{ ordering=Qqt->ordering; break; } |
case quadquadtax:{ ordering=Qqat->ordering; break; } |
case quadlaxisym:{ ordering=Lqat->ordering; break; } |
case ifacequadel:{ ordering=Ifcquadt->ordering; break; } |
case lineartett:{ ordering=Ltett->ordering; break; } |
case linearhext:{ ordering=Lht->ordering; break; } |
case quadratichext:{ ordering=Qht->ordering; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
} |
return ordering; |
} |
/** |
function returns number of DOFs of node |
@param nid - node id |
/trunk/SIFEL/TRFEL/SRC/transtop.h |
---|
39,6 → 39,10 |
void give_node_coord2d (vector &x,vector &y,long eid); |
void give_node_coord3d (vector &x,vector &y,vector &z,long eid); |
long give_ndofe (long eid); |
/// returns dofe array of the given element |
long** give_dofe (long eid); |
/// returns ordering array of the given element |
long** give_ordering (long eid); |
long give_ndofn (long nid); |
long give_ncomp (long eid); |
long give_ned (long eid); |
/trunk/SIFEL/TRFEL/SRC/trlineart.cpp |
---|
1658,7 → 1658,7 |
for (i=0;i<nne;i++){ |
ncompo = Tm->givencompeqother (ipp,0); |
reallocv (ncompo,eqother); |
Tm->giveeqother (ipp,ncompo,eqother.a); |
Tm->giveeqother (ipp,0,ncompo,eqother.a); |
// storage of eqother components to the node |
j=nod[i]; |
1892,7 → 1892,7 |
*/ |
void trlineart::transmission_vector (vector &v,long lcid,long eid,long leid,long cid) |
{ |
long i,ipp,ii; |
long i,ipp; |
bocontypet *bc; |
ivector nodes(nne); |
vector x(nne),y(nne),z(nne),w(intordkm[lcid][cid]),gp(intordkm[lcid][cid]),t(nne); |