/trunk/SIFEL/GEFEL/Makefile |
---|
42,7 → 42,7 |
#################################################################### |
# List of source files and directories |
# |
SRCS = aggregator.cpp basefun.cpp bmatrix.cpp cc.cpp cr.cpp csv.cpp densemat.cpp diagmat.cpp difcalc.cpp |
SRCS = aggregator.cpp basefun.cpp bmatrix.cpp boundbox.cpp cc.cpp cr.cpp csv.cpp densemat.cpp diagmat.cpp difcalc.cpp |
SRCS += dskyline.cpp eigsol.cpp elemmat.cpp elemnode.cpp elemtools.cpp endnode.cpp |
SRCS += floatsub.cpp fllopsif.cpp fuzzygen.cpp fuzzynum.cpp gadaptivity.cpp gedge.cpp gelement.cpp gfunct.cpp gmatrix.cpp gfmatrix.cpp |
SRCS += gnode.cpp gphase.cpp gsurf.cpp gtopology.cpp hdbcontr.cpp import_T3d.cpp intools.cpp intp.cpp |
/trunk/SIFEL/GEFEL/basefun.cpp |
---|
1,7 → 1,7 |
#include <stdlib.h> |
#include "basefun.h" |
#include "vector.h" |
#include "difcalc.h" |
#include <stdlib.h> |
/** |
function computes linear base functions on bar element |
/trunk/SIFEL/GEFEL/boundbox.cpp |
---|
0,0 → 1,90 |
#include "boundbox.h" |
#include "iotools.h" |
#include "vector.h" |
#include <stdlib.h> |
/** |
Constructor initializes bounding box limit coordinates. |
Created by TKo, 12.2023 |
*/ |
boundbox::boundbox() |
{ |
xmin = xmax = ymin = ymax = zmin = zmax = 0.0; |
} |
/** |
Initializes bounding box limit coordinates. |
@param[in] xcmin - minimum x-coordinate |
@param[in] xcmax - maximum x-coordinate |
@param[in] ycmin - minimum y-coordinate |
@param[in] ycmax - maximum y-coordinate |
@param[in] zcmin - minimum z-coordinate |
@param[in] zcmax - maximum z-coordinate |
Created by TKo, 12.2023 |
*/ |
void boundbox::init(double xcmin, double xcmax, double ycmin, double ycmax, double zcmin, double zcmax) |
{ |
if ((xcmax < xcmin) || (ycmax < ycmin) || (zcmax < zcmin)){ |
print_err("invalid limits of the bounding box" |
"(xcmax < xcmin)=%d, (ycmax < ycmin)=%d, (zcmax < zcmin)=%d", __FILE__, __LINE__, __func__, |
(xcmax < xcmin), (ycmax < ycmin), (zcmax < zcmin)); |
abort(); |
} |
xmin = xcmin; xmax = xcmax; |
ymin = ycmin; ymax = ycmax; |
zmin = zcmin; zmax = zcmax; |
} |
/** |
The function returns whether the given point is inside of the bounding box. |
@param[in] p - point coordinates collected in three-component %vector. |
@retval true : if the point is inside the given bounding box. |
@retval false : if the point is outside the given bounding box. |
Created by TKo, 12.2023. |
*/ |
bool boundbox::is_inside(const vector &p) |
{ |
if ((p[0] > xmax) || (p[0] < xmin) || |
(p[1] > ymax) || (p[1] < ymin) || |
(p[2] > zmax) || (p[2] < zmin)) |
return false; |
return true; |
} |
/** |
The function returns whether the given point is inside of the bounding box. |
@param[in] x - x-coordinate of the investigated point. |
@param[in] y - y-coordinate of the investigated point. |
@param[in] z - z-coordinate of the investigated point. |
@retval true : if the point is inside the given bounding box. |
@retval false : if the point is outside the given bounding box. |
Created by TKo, 12.2023. |
*/ |
bool boundbox::is_inside(double x, double y, double z) |
{ |
if ((x > xmax) || (x < xmin) || |
(y > ymax) || (y < ymin) || |
(z > zmax) || (z < zmin)) |
return false; |
return true; |
} |
/trunk/SIFEL/GEFEL/boundbox.h |
---|
0,0 → 1,35 |
#ifndef BOUNDBOX_H |
#define BOUNDBOX_H |
struct vector; |
/** |
Class for handling of a bounding box. |
Created by TKo, 12.2023 |
*/ |
class boundbox |
{ |
public: |
boundbox(); |
/// initializes limit bound. box coordinates to the given values |
void init(double xcmin, double xcmax, double ycmin, double ycmax, double zcmin, double zcmax); |
/// test if the given point is inside of the bounding box |
bool is_inside(const vector &p); |
/// test if the given point is inside of the bounding box |
bool is_inside(double x, double y, double z); |
/// minimum x coordinate of bbox |
double xmin; |
/// maximum x coordinate of bbox |
double xmax; |
/// minimum y coordinate of bbox |
double ymin; |
/// maximum y coordinate of bbox |
double ymax; |
/// minimum z coordinate of bbox |
double zmin; |
/// maximum z coordinate of bbox |
double zmax; |
}; |
#endif |
/trunk/SIFEL/GEFEL/difcalc.cpp |
---|
1024,21 → 1024,44 |
} |
} |
if (x.n==10) |
{ |
// quadratic tetrahedron |
reallocv (RSTCKVEC(6,lx)); reallocv (RSTCKVEC(6,ly)); reallocv (RSTCKVEC(6,lz)); |
reallocv (RSTCKIVEC(6,sn)); |
quadtetrahedral_surfnod (sn.a,sid); |
for (i=0; i<6; i++) |
{ |
lx[i] = x[sn[i]]; |
ly[i] = y[sn[i]]; |
lz[i] = z[sn[i]]; |
if (x.n==6){ |
// linear wedge |
reallocv (RSTCKVEC(3,lx)); reallocv (RSTCKVEC(3,ly)); reallocv (RSTCKVEC(3,lz)); |
reallocv (RSTCKIVEC(3,sn)); |
if (sid==0){ |
reallocv (RSTCKVEC(4,lx)); reallocv (RSTCKVEC(4,ly)); reallocv (RSTCKVEC(4,lz)); |
lx[0]=x[2]; lx[1]=x[1]; lx[2]=x[4]; lx[3]=x[5]; |
ly[0]=y[2]; ly[1]=y[1]; ly[2]=y[4]; ly[3]=y[5]; |
lz[0]=z[2]; lz[1]=z[1]; lz[2]=z[4]; lz[3]=z[5]; |
} |
if (sid==1){ |
reallocv (RSTCKVEC(4,lx)); reallocv (RSTCKVEC(4,ly)); reallocv (RSTCKVEC(4,lz)); |
lx[0]=x[0]; lx[1]=x[2]; lx[2]=x[5]; lx[3]=x[3]; |
ly[0]=y[0]; ly[1]=y[2]; ly[2]=y[5]; ly[3]=y[3]; |
lz[0]=z[0]; lz[1]=z[2]; lz[2]=z[5]; lz[3]=z[3]; |
} |
if (sid==2){ |
reallocv (RSTCKVEC(4,lx)); reallocv (RSTCKVEC(4,ly)); reallocv (RSTCKVEC(4,lz)); |
lx[0]=x[1]; lx[1]=x[0]; lx[2]=x[3]; lx[3]=x[4]; |
ly[0]=y[1]; ly[1]=y[0]; ly[2]=y[3]; ly[3]=y[4]; |
lz[0]=z[1]; lz[1]=z[0]; lz[2]=z[3]; lz[3]=z[4]; |
} |
if (sid==3){ |
reallocv (RSTCKVEC(3,lx)); reallocv (RSTCKVEC(3,ly)); reallocv (RSTCKVEC(3,lz)); |
lx[0]=x[0]; lx[1]=x[1]; lx[2]=x[2]; |
ly[0]=y[0]; ly[1]=y[1]; ly[2]=y[2]; |
lz[0]=z[0]; lz[1]=z[1]; lz[2]=z[2]; |
} |
if (sid==4){ |
reallocv (RSTCKVEC(3,lx)); reallocv (RSTCKVEC(3,ly)); reallocv (RSTCKVEC(3,lz)); |
lx[0]=x[4]; lx[1]=x[3]; lx[2]=x[5]; |
ly[0]=y[4]; ly[1]=y[3]; ly[2]=y[5]; |
lz[0]=z[4]; lz[1]=z[3]; lz[2]=z[5]; |
} |
} |
if (x.n==8){ |
// linear hexahedron |
reallocv (RSTCKVEC(4,lx)); reallocv (RSTCKVEC(4,ly)); reallocv (RSTCKVEC(4,lz)); |
1075,6 → 1098,20 |
} |
} |
if (x.n==10) |
{ |
// quadratic tetrahedron |
reallocv (RSTCKVEC(6,lx)); reallocv (RSTCKVEC(6,ly)); reallocv (RSTCKVEC(6,lz)); |
reallocv (RSTCKIVEC(6,sn)); |
quadtetrahedral_surfnod (sn.a,sid); |
for (i=0; i<6; i++) |
{ |
lx[i] = x[sn[i]]; |
ly[i] = y[sn[i]]; |
lz[i] = z[sn[i]]; |
} |
} |
if (x.n==20){ |
// quadratic hexahedron |
reallocv (RSTCKVEC(8,lx)); reallocv (RSTCKVEC(8,ly)); reallocv (RSTCKVEC(8,lz)); |
/trunk/SIFEL/GEFEL/galias.h |
---|
168,11 → 168,11 |
enum gelemtype {noelem=0, |
linbar=1, quadbar=2, |
lintriag=21,quadtriag=22,linquad=25,quadquad=26,cubicquad=27, |
lintetra=41,quadtetra=42,linhexa=45,quadhexa=46,gen2d=50}; |
lintetra=41,quadtetra=42,linhexa=45,quadhexa=46,linwed=47,gen2d=50}; |
const enumstr gelemtypestr[] = {{"noelem",0}, |
{"linbar",1},{"quadbar",2}, |
{"lintriag",21},{"quadtriag",22},{"linquad",25},{"quadquad",26},{"cubicquad",27}, |
{"lintetra",41},{"quadtetra",42},{"linhexa",45},{"quadhexa",46}, |
{"lintetra",41},{"quadtetra",42},{"linhexa",45},{"quadhexa",46},{"linwed",47}, |
{"gen2d",50}}; |
const kwdset gelemtype_kwdset(sizeof(gelemtypestr)/sizeof(*gelemtypestr),gelemtypestr); |
/trunk/SIFEL/GEFEL/gtopology.cpp |
---|
17,6 → 17,7 |
#include "dofrange.h" |
#include "gfunct.h" |
#include "iotools.h" |
#include "boundbox.h" |
gtopology::gtopology () |
{ |
8806,3 → 8807,28 |
return; |
} |
/** |
The function creates a bounding box of the given problem. |
*/ |
void gtopology::give_bounding_box(boundbox &bb) |
{ |
double xmin = DBL_MAX; |
double xmax = DBL_MIN; |
double ymin = DBL_MAX; |
double ymax = DBL_MIN; |
double zmin = DBL_MAX; |
double zmax = DBL_MIN; |
for (long i=0; i<nn; i++){ |
if (gnodes[i].x < xmin) xmin = gnodes[i].x; |
if (gnodes[i].x > xmax) xmax = gnodes[i].x; |
if (gnodes[i].y < ymin) ymin = gnodes[i].y; |
if (gnodes[i].y > ymax) ymax = gnodes[i].y; |
if (gnodes[i].z < zmin) zmin = gnodes[i].z; |
if (gnodes[i].z > zmax) zmax = gnodes[i].z; |
} |
bb.init(xmin, xmax, ymin, ymax, zmin, zmax); |
} |
/trunk/SIFEL/GEFEL/gtopology.h |
---|
18,7 → 18,9 |
#include "matrix.h" |
#include "dofrange.h" |
class gmatrix; |
class boundbox; |
/** |
class gtopology |
249,6 → 251,7 |
void initiate_omp_elem_order(); |
void initiate_elem_dof_ranges(); |
void give_bounding_box(boundbox &bb); |
enum Status{ |
ACTIVE = 1, |
/trunk/SIFEL/GEFEL/iotools.cpp |
---|
2034,7 → 2034,7 |
/** |
Function extracts particular conversions from the format string fmt and copies their base character to the array types. |
In addition, the function stores pointers to the beginign of each conversion in the ptypes array. |
In addition, the function stores pointers to the beginning of each conversion in the ptypes array. |
Parameters: |
@param fmt - format string |
/trunk/SIFEL/GEFEL/mathem.cpp |
---|
1,6 → 1,7 |
#include "mathem.h" |
#include "basefun.h" |
#include "gtopology.h" |
#include "vector.h" |
#include <errno.h> |
#include <math.h> |
22,7 → 23,7 |
JK, 8.12.2001 |
*/ |
double radius (vector &x,vector &natcoord) |
double radius (const vector &x, const vector &natcoord) |
{ |
long nne; |
double r; |
57,7 → 58,7 |
30.12.2001 |
*/ |
double length (vector &coorda,vector &coordb) |
double length (const vector &coorda, const vector &coordb) |
{ |
long i,m,n; |
double l; |
83,7 → 84,7 |
Cretaed by TKo 07.2020 |
*/ |
double length (vector &coorda, double xb, double yb, double zb) |
double length (const vector &coorda, double xb, double yb, double zb) |
{ |
double l; |
108,7 → 109,38 |
} |
/** |
The function computes volume of a hexahedron element with linear approximation functions. The element |
is defined by nodal coordinates given in arrays x, y and z. |
@param[in] x - array of x coordinates of hexahedron vertices (nodes), its dimension must be 8. |
@param[in] y - array of y coordinates of hexahedron vertices (nodes), its dimension must be 8. |
@param[in] z - array of z coordinates of hexahedron vertices (nodes), its dimension must be 8. |
@return The function returns the element volume. |
Created by Tomas Koudelka, 01.2024 |
*/ |
double linhex_volume(vector &x, vector &y, vector &z) |
{ |
double vol = ((z[2] + z[3] - z[4] - z[5]) * y[1] + (-z[1] + z[3]) * y[2] + (-z[1] - z[2] + z[4] + z[7]) * y[3] + (z[1] - z[3] + z[5] - z[7]) * y[4] + (z[1] - z[4]) * y[5] - y[7] * (z[3] - z[4])) * x[0]; |
vol += ((-z[2] - z[3] + z[4] + z[5]) * y[0] + (z[0] + z[3] - z[5] - z[6]) * y[2] + (z[0] - z[2]) * y[3] + (-z[0] + z[5]) * y[4] + (-z[0] + z[2] - z[4] + z[6]) * y[5] + y[6] * (z[2] - z[5])) * x[1]; |
vol += ((z[1] - z[3]) * y[0] + (-z[0] - z[3] + z[5] + z[6]) * y[1] + (z[0] + z[1] - z[6] - z[7]) * y[3] + (-z[1] + z[6]) * y[5] + (-z[1] + z[3] - z[5] + z[7]) * y[6] + y[7] * (z[3] - z[6])) * x[2]; |
vol += ((z[1] + z[2] - z[4] - z[7]) * y[0] + (-z[0] + z[2]) * y[1] + (-z[0] - z[1] + z[6] + z[7]) * y[2] + (z[0] - z[7]) * y[4] + (-z[2] + z[7]) * y[6] + y[7] * (z[0] - z[2] + z[4] - z[6])) * x[3]; |
vol += ((-z[1] + z[3] - z[5] + z[7]) * y[0] + (z[0] - z[5]) * y[1] + (-z[0] + z[7]) * y[3] + (z[0] + z[1] - z[6] - z[7]) * y[5] + (z[5] - z[7]) * y[6] - y[7] * (z[0] + z[3] - z[5] - z[6])) * x[4]; |
vol += ((-z[1] + z[4]) * y[0] + (z[0] - z[2] + z[4] - z[6]) * y[1] + (z[1] - z[6]) * y[2] + (-z[0] - z[1] + z[6] + z[7]) * y[4] + (z[1] + z[2] - z[4] - z[7]) * y[6] - y[7] * (z[4] - z[6])) * x[5]; |
vol += ((-z[2] + z[5]) * y[1] + (z[1] - z[3] + z[5] - z[7]) * y[2] + (z[2] - z[7]) * y[3] + (-z[5] + z[7]) * y[4] + (-z[1] - z[2] + z[4] + z[7]) * y[5] + y[7] * (z[2] + z[3] - z[4] - z[5])) * x[6]; |
vol -= x[7] * ((-z[3] + z[4]) * y[0] + (z[3] - z[6]) * y[2] + (z[0] - z[2] + z[4] - z[6]) * y[3] + (-z[0] - z[3] + z[5] + z[6]) * y[4] + (-z[4] + z[6]) * y[5] + y[6] * (z[2] + z[3] - z[4] - z[5])); |
vol /= 12.0; |
return vol; |
} |
/** |
function computes nodal values with help of least square problem solution |
@param val - array containing nodal values on element |
185,7 → 217,31 |
} |
/** |
The function decomposes real number arg into mantisa and exponent, i.e. |
arg = ret * 10^exp |
@param[in] arg - real number to be decomposed |
@param[out] exp - exponent in power of 10 |
@return The function returns mantisa of the required number arg. |
Created by Tomas Koudelka, 01.2024 |
*/ |
double frexp10(double arg, long &exp) |
{ |
if (arg == 0.0) |
exp = 0; |
else |
exp = 1 + (long)floor(log10(fabs(arg))); |
return arg*pow(10, -exp); |
} |
/** |
generalized Heaviside function |
for x<0, H(x)=0 |
1045,7 → 1101,10 |
nroots = solv_polynom_2 (a,b,c,ksi1,ksi2); |
if (nroots == 0) fprintf (stderr,"\n\n\n error 0 in function nc_lin_4_2d (%s, line %d)\n\n\n",__FILE__,__LINE__); |
if (nroots == 0){ |
print_err("no real roots in the solution of 2nd order polynom", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (nroots == 1) xi = ksi1; |
if (nroots == 2) |
{ |
1055,18 → 1114,24 |
{ |
if (( -1-acc <= ksi2 && ksi2 <= 1+acc ) && ( ksi1 < -1-acc || 1+acc < ksi1 )) |
xi = ksi2; |
else fprintf (stderr,"\n\n\n error 1 in function nc_lin_4_2d (%s, line %d)\n\n\n",__FILE__,__LINE__); |
else{ |
print_err("both roots of polynom are in the range [-1;1], cannot determine ksi", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
} |
if ( fabs(cx+ax*xi) < accabs ) |
{ |
if ( fabs(bx) < accabs ) |
fprintf (stderr,"\n\n\n error 2 in function nc_lin_4_2d (%s, line %d)\n\n\n",__FILE__,__LINE__); |
else |
{ |
if ( fabs(ay*xi+cy) < accabs || fabs(xi+dx/bx) > acc ) |
fprintf (stderr,"\n\n\n error 3 in function nc_lin_4_2d (%s, line %d)\n\n\n",__FILE__,__LINE__); |
if ( fabs(bx) < accabs ){ |
print_err ("zero bx and denominator in eta determination", __FILE__, __LINE__, __func__); |
abort(); |
} |
else{ |
if ( fabs(ay*xi+cy) < accabs || fabs(xi+dx/bx) > acc ){ |
print_err ("zero denominator in eta determination",__FILE__, __LINE__, __func__); |
abort(); |
} |
else |
eta = (-dy-by*xi)/(cy+ay*xi); |
} |
/trunk/SIFEL/GEFEL/mathem.h |
---|
10,11 → 10,15 |
#endif |
class gtopology; |
struct vector; |
double radius (vector &x,vector &natcoord); |
double length (vector &coorda, double xb, double yb, double zb); |
double length (vector &coorda,vector &coordb); |
double radius (const vector &x, const vector &natcoord); |
double length (const vector &coorda, double xb, double yb, double zb); |
double length (const vector &coorda, const vector &coordb); |
double sqr(double x); |
double pow3(double x); |
double linhex_volume(vector &x, vector &y, vector &z); |
void nodal_values (double **val,vector &nx,vector &ny,vector &nz, |
double *lhs,long dim,long fi,long ncomp); |
28,6 → 32,7 |
double sgn (double i); |
double heaviside (double x); |
double frexp10(double arg, int * exp); |
double genheaviside (double x,double eps); |
double polynom_4 (double x,double *a); |
/trunk/SIFEL/GEFEL/matrix.cpp |
---|
1091,6 → 1091,40 |
/** |
The function adds 2 matrices multplied by constants to the matrix C: C := C + ac*A + bc*B. |
@param[in] a - the first %matrix adder, |
@param[in] ac - a scaling factor of the first %matrix adder, |
@param[in] b - the second %matrix adder, |
@param[in] bc - a scaling factor of the second %matrix adder, |
@param[in,out] c - the resulting sum %matrix |
@retval 0 : on succes |
@retval 1 : in case incompatibility sizes of a, b and c matrices |
created 02.2024, Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
long addmultm(const matrix &a, double ac, const matrix &b, double bc, matrix &c) |
{ |
if ((a.m == b.m) && (a.n == b.n) && |
(c.m == b.m) && (c.n == b.n)) |
{ |
for (long i = 0; i < a.m; i++) |
for (long j = 0; j < a.n; j++) |
c(i,j) += ac*a(i,j) + bc*b(i,j); |
return(0); |
} |
else |
print_err("cannot add matrices due to their incompatible dimensions\n" |
" a(%ld,%ld) X b(%ld,%ld) X c(%ld,%ld)", __FILE__, __LINE__, __func__, a.m, a.n, b.m, b.n, c.m, c.n); |
return (1); |
} |
/** |
The function performs tensor product of two vectors, i.e. it performs C[m,n] = a[m] x b[n]. |
@param a is the structure of the first vector |
4209,6 → 4243,62 |
/** |
The function extracts the i-th row of the %matrix m and stores it to %vector dest. |
@param[in] m - the given %matrix whose i-th row will be extracted, |
@param[in] i - index of the extracted row, |
@aparam[out] dest - destination %vector where the extracted row will be stored to |
@return The function returns extracted row in the argument dest. |
@retval 0 - on success, |
@retval 1 - in the case of incompatible dimensions of %matrix m and %vector dest. |
Created by TKo, 02.2024 |
*/ |
long extractrow(const matrix &m, long i, vector &dest) |
{ |
if (m.n != dest.n) |
{ |
print_err("cannot extract %ld-th matrix row - incompatible dimensions of the destination vector\n" |
"m(%ld,%ld) X dest(%ld)", __FILE__, __LINE__, __func__, m.m, m.n, dest.n); |
return 1; |
} |
for (long j=0; j<m.n; j++) |
dest[j] = m(i, j); |
return 0; |
} |
/** |
The function extracts the j-th column of the %matrix m and stores it to %vector dest. |
@param[in] m - the given %matrix whose j-th column will be extracted, |
@param[in] i - index of the extracted column, |
@aparam[out] dest - destination %vector where the extracted column will be stored to |
@return The function returns extracted column in the argument dest. |
@retval 0 - on success, |
@retval 1 - in the case of incompatible dimensions of %matrix m and %vector dest. |
Created by TKo, 02.2024 |
*/ |
long extractcol(const matrix &m, long j, vector &dest) |
{ |
if (m.n != dest.n) |
{ |
print_err("cannot extract %ld-th matrix row - incompatible dimensions of the destination vector\n" |
"m(%ld,%ld) X dest(%ld)", __FILE__, __LINE__, __func__, m.m, m.n, dest.n); |
return 1; |
} |
for (long i=0; i<m.m; i++) |
dest[i] = m(i, j); |
return 0; |
} |
/** |
function diagonalizes a %matrix m |
JK, 14. 6. 2019 |
/trunk/SIFEL/GEFEL/matrix.h |
---|
360,6 → 360,9 |
/// substracts 2 matrices C := A-B |
long subm(const matrix &a, const matrix &b, matrix &c); |
/// adds 2 matrices multplied by constant to the given matrix C: C := C + ac*A + bc*B |
long addmultm(const matrix &a, double ac, const matrix &b, double bc, matrix &c); |
/// performs tensor product of two vectors c_{ij} = a_{i}. b{j} |
void tensprd (vector &a, vector &b, matrix &c); |
527,6 → 530,10 |
void extractblock (matrix &a, matrix &b, long fri,long fci); |
/// stores submatrix b in the %matrix a |
void storeblock (matrix &a, matrix &b, long fri,long fci); |
/// extracts the i-th row from the %matrix m and stores it to %vector dest |
long extractrow(const matrix &m, long i, vector &dest); |
/// extracts the j-th column from %matrix m and stores it to %vector dest |
long extractcol(const matrix &m, long j, vector &dest); |
/// function diagonalizes a %matrix mat |
void diagonalization (matrix &mat); |
/trunk/SIFEL/GEFEL/ordering.cpp |
---|
544,6 → 544,90 |
/** |
Function returns numbers of nodes on edges |
of wedge elements with six nodes (linear approximation). |
@param edgenod - array of edge node numbers |
@param edg - number of required edge |
JK, 03.2024 |
*/ |
void linwedge_edgnod(long *edgenod,long edg) |
{ |
if (edg==0){ |
edgenod[0]=0; edgenod[1]=1; |
} |
if (edg==1){ |
edgenod[0]=1; edgenod[1]=2; |
} |
if (edg==2){ |
edgenod[0]=2; edgenod[1]=0; |
} |
if (edg==3){ |
edgenod[0]=0; edgenod[1]=3; |
} |
if (edg==4){ |
edgenod[0]=1; edgenod[1]=4; |
} |
if (edg==5){ |
edgenod[0]=2; edgenod[1]=5; |
} |
if (edg==6){ |
edgenod[0]=3; edgenod[1]=4; |
} |
if (edg==7){ |
edgenod[0]=4; edgenod[1]=5; |
} |
if (edg==8){ |
edgenod[0]=5; edgenod[1]=3; |
} |
} |
/** |
function returns numbers of nodes on surfaces |
of linear wedge elements with six nodes |
@param surfnod - array of edge node numbers |
@param surf - number of required edge |
JK, 03.2024 |
*/ |
void linwedge_surfnod (long *surfnod,long surf) |
{ |
if (surf==0){ |
surfnod[0]=2; |
surfnod[1]=1; |
surfnod[2]=4; |
surfnod[3]=5; |
} |
if (surf==1){ |
surfnod[0]=0; |
surfnod[1]=2; |
surfnod[2]=5; |
surfnod[3]=3; |
} |
if (surf==2){ |
surfnod[0]=1; |
surfnod[1]=0; |
surfnod[2]=3; |
surfnod[3]=4; |
} |
if (surf==3){ |
surfnod[0]=0; |
surfnod[1]=1; |
surfnod[2]=2; |
} |
if (surf==4){ |
surfnod[0]=4; |
surfnod[1]=3; |
surfnod[2]=5; |
} |
} |
/** |
function assembles natural coordinates of nodes |
on bar or beam with 2 nodes |
756,6 → 840,24 |
} |
/** |
function assembles natural coordinates of nodes |
on linear wedge with 6 nodes |
@param xi,eta,zeta - natural coordinates of nodes |
JK, 03.2024 |
*/ |
void nodcoord_linwedge (vector &xi,vector &eta,vector &zeta) |
{ |
xi[0] = 1.0; eta[0] = 0.0; zeta[0] = 1.0; |
xi[1] = 0.0; eta[1] = 1.0; zeta[1] = 1.0; |
xi[2] = 0.0; eta[2] = 0.0; zeta[2] = 1.0; |
xi[3] = 1.0; eta[3] = 0.0; zeta[3] = -1.0; |
xi[4] = 0.0; eta[4] = 1.0; zeta[4] = -1.0; |
xi[5] = 0.0; eta[5] = 0.0; zeta[5] = -1.0; |
} |
/** |
function assembles map between nodes and the closest integration points |
on bar or beam elements, elements have two nodes |
/trunk/SIFEL/GEFEL/ordering.h |
---|
20,6 → 20,7 |
void quadhexahedral_surfnod (long *surfnod,long surf); |
void lintetrahedral_surfnod (long *surfnod,long surf); |
void quadtetrahedral_surfnod (long *surfnod,long surf); |
void linwedge_surfnod (long *surfnod,long surf); |
void nodcoord_bar (vector &xi); |
void nodcoord_barq (vector &xi); |
31,6 → 32,7 |
void nodcoord_quadtet (vector &xi,vector &eta,vector &zeta); |
void nodcoord_linhex (vector &xi,vector &eta,vector &zeta); |
void nodcoord_quadhex (vector &xi,vector &eta,vector &zeta); |
void nodcoord_linwedge (vector &xi,vector &eta,vector &zeta); |
void nodip_bar (long i,long n,ivector &ipnum); |
void nodip_barq (long i,long n,ivector &ipnum); |
/trunk/SIFEL/GEFEL/scc.cpp |
---|
850,9 → 850,9 |
// solve equation system Ax = B, i.e. type CHOLMOD_A |
fflush(stdout); |
fprintf(stdout, "\n Solution started ..."); |
//fprintf(stdout, "\n Solution started ..."); |
chmd_lhs = cholmod_l_solve(CHOLMOD_A, chmd_fact, &chmd_rhs, &chmd_com); |
fprintf(stdout, " OK\n"); |
//fprintf(stdout, " OK\n"); |
memcpy(x, chmd_lhs->x, n*sizeof(*x)); |
cholmod_l_free_dense(&chmd_lhs, &chmd_com); |
/trunk/SIFEL/GEFEL/selection.cpp |
---|
1,9 → 1,10 |
#include "selection.h" |
#include "iotools.h" |
#include <stdlib.h> |
#include <stdio.h> |
#include <string.h> |
#include <math.h> |
#include "selection.h" |
#include "iotools.h" |
1249,7 → 1250,7 |
Created by Tomas Koudelka, 09.2023 |
*/ |
long sel::conv_selprop(siftop *top, objtype ot) |
long sel::conv_selprop(const siftop *top, objtype ot) |
{ |
long i,j; |
long nlit, nrit, nold; |
/trunk/SIFEL/GEFEL/selection.h |
---|
69,7 → 69,7 |
/// converts selection type of property to selection type of list |
long conv_selprop(siftop *top, objtype ot, sel *conselent, sel *&consel, long *transent, long *&trans); |
/// converts selection type of property to selection type of list |
long conv_selprop(siftop *top, objtype ot); |
long conv_selprop(const siftop *top, objtype ot); |
/// converts list of the selected objects to the range type of selection |
void conv2range(long nit, long nobj, ivector &selobj); |
/// converts list of the selected objects to the list type of selection |
/trunk/SIFEL/GEFEL/siftop.cpp |
---|
1,13 → 1,15 |
#include "siftop.h" |
#include "galias.h" |
//#include "siftop_element_types.h" |
//#include "cmlfile.h" |
#include "mathem.h" |
#include "basefun.h" |
#include <stdlib.h> |
#include <string.h> |
#include <math.h> |
#include <float.h> |
#include "mathem.h" |
#include "basefun.h" |
#include <vector> |
#include <set> |
#include <algorithm> |
long selement::nned_isolin1d[1] = {2}; |
long selement::nned_isoquad1d[1] = {3}; |
36,7 → 38,9 |
long selement::edgenod_tetquad3d[6][selement::max_nned] = {{0, 1, 4}, {1, 2, 5}, {2, 0, 6}, {1, 3, 8}, {3, 2, 9}, {3, 0, 7}}; |
long selement::edgenod_pyramlin[8][selement::max_nned] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}; // not yet defined |
long selement::edgenod_pyramquad[8][selement::max_nned] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}; // not yet defined |
long selement::edgenod_wedgelin[9][selement::max_nned] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}; // not yet defined |
long selement::edgenod_wedgelin[9][selement::max_nned] = {{0, 1}, {1, 2}, {2, 0}, |
{0, 3}, {1, 4}, {2, 5}, |
{3, 4}, {4, 5}, {5, 3}}; |
long selement::edgenod_wedgequad[9][selement::max_nned] = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}; // not yet defined |
long selement::edgenod_isolin3d[12][selement::max_nned] = {{0, 1}, {1, 2}, {2, 3}, {3, 0}, |
{0, 4}, {1, 5}, {2, 6}, {3, 7}, |
72,7 → 76,7 |
{1, 0, 3, 4, 7, 8}, {0, 1, 2, 4, 5, 6}}; |
long selement::surfnod_pyramlin[5][selement::max_nnsurf] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfnod_pyramquad[5][selement::max_nnsurf] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfnod_wedgelin[5][selement::max_nnsurf] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfnod_wedgelin[5][selement::max_nnsurf] = {{2, 1, 4, 5}, {0, 2, 5, 3}, {1, 0, 3, 4}, {0, 1, 2}, {3, 5, 4}}; |
long selement::surfnod_wedgequad[5][selement::max_nnsurf] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfnod_isolin3d[6][selement::max_nnsurf] = {{0, 3, 7, 4}, {1, 0, 4, 5}, {2, 1, 5, 6}, |
{3, 2, 6, 7}, {0, 1, 2, 3}, {4, 5, 6, 7}}; |
80,6 → 84,28 |
{2, 1, 5, 6, 9, 13, 17, 14}, {3, 2, 6, 7, 10, 14, 18, 15}, |
{0, 1, 2, 3, 8, 9, 10, 11}, {4, 5, 6, 7, 16, 17, 18, 19}}; |
long selement::surfedg_isolin1d[1][selement::max_nsurfedg] = {{0}}; |
long selement::surfedg_isoquad1d[1][selement::max_nsurfedg] = {{0}}; |
long selement::surfedg_trlin2d[1][selement::max_nsurfedg] = {{0}}; |
long selement::surfedg_trquad2d[1][selement::max_nsurfedg] = {{0, 1, 2}}; |
long selement::surfedg_isolin2d[1][selement::max_nsurfedg] = {{0, 1, 2}}; |
long selement::surfedg_isoquad2d[1][selement::max_nsurfedg] = {{0, 1, 2, 3}}; |
long selement::surfedg_isocubic2d[1][selement::max_nsurfedg] = {{0, 1, 2, 3}}; |
long selement::surfedg_tetlin3d[4][selement::max_nsurfedg] = {{1, 3, 4}, {2, 4, 5}, {0, 5, 3}, {0, 1, 2}}; |
long selement::surfedg_tetquad3d[4][selement::max_nsurfedg] = {{1, 3, 4}, {2, 4, 5}, {0, 5, 3}, {0, 1, 2}}; |
long selement::surfedg_pyramlin[5][selement::max_nsurfedg] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfedg_pyramquad[5][selement::max_nsurfedg] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfedg_wedgelin[5][selement::max_nsurfedg] = {{2, 4, 7, 5}, {2, 5, 8, 3}, {0, 3, 6, 4}, {0, 1, 2}, {8, 7, 6}}; |
long selement::surfedg_wedgequad[5][selement::max_nsurfedg] = {{0}, {0}, {0}, {0}, {0}}; |
long selement::surfedg_isolin3d[6][selement::max_nsurfedg] = {{3, 7, 11, 4}, {0, 4, 8, 5}, {1, 5, 9, 6}, |
{2, 6, 10, 7}, {0, 1, 2, 3}, {8, 9, 10, 11}}; |
long selement::surfedg_isoquad3d[6][selement::max_nsurfedg] = {{3, 7, 11, 4}, {0, 4, 8, 5}, {1, 5, 9, 6}, |
{2, 6, 10, 7}, {0, 1, 2, 3}, {8, 9, 10, 11}}; |
gtypel operator ++(gtypel &a, int) |
{ |
gtypel old; |
190,7 → 216,11 |
void snode::alloc(long num_prop) |
{ |
nprop = num_prop; |
if (entid) |
delete [] entid; |
entid = new entityp[nprop]; |
if (prop) |
delete [] prop; |
prop = new long[nprop]; |
} |
207,29 → 237,28 |
*/ |
void snode::add_prop(entityp ent, long propid) |
{ |
entityp *auxent = entid; |
long *auxprop = prop; |
long n = nprop; |
long i; |
long n = nprop; |
long i; |
for(i=0; i<nprop; i++) |
for(i=0; i<n; i++) |
{ |
if ((entid[i] == ent) && (prop[i] == propid)) // added property has been already involved |
return; |
} |
nprop += 1; |
entid = new entityp[nprop]; |
prop = new long[nprop]; |
for(i=0; i<n; i++) |
{ |
entid[i] = auxent[i]; |
prop[i] = auxprop[i]; |
entityp *auxent = new entityp[n+1]; |
long *auxprop = new long[n+1]; |
for(i=0; i<n; i++){ |
auxent[i] = entid[i]; |
auxprop[i] = prop[i]; |
} |
entid[n] = ent; |
prop[n] = propid; |
delete [] auxent; |
delete [] auxprop; |
auxent[n] = ent; |
auxprop[n] = propid; |
delete [] entid; |
delete [] prop; |
entid = auxent; |
prop = auxprop; |
++nprop; |
} |
357,16 → 386,14 |
@return The function does not return anything but creates a copy in the argument c. |
*/ |
void snode::copyto(snode &c) |
void snode::copyto(snode &dest) |
{ |
c.x = x; |
c.y = y; |
c.z = z; |
delete [] entid; |
delete [] prop; |
c.alloc(nprop); |
memcpy(c.entid, entid, sizeof(*entid)*nprop); |
memcpy(c.prop, prop, sizeof(*prop)*nprop); |
dest.x = x; |
dest.y = y; |
dest.z = z; |
dest.alloc(nprop); |
memcpy(dest.entid, entid, sizeof(*entid)*nprop); |
memcpy(dest.prop, prop, sizeof(*prop)*nprop); |
} |
398,6 → 425,23 |
/** |
The constructor sets data members for the given element type et and allocates property arrays on edges and surfaces according to the alloc_edg flag. |
@param[in] et - the given element type |
@param[in] alloc_bp - allocation flag for allocation boundary property arrays (edge/surface), |
1 = allocation is being performed, 0 = no allocation is being performed |
Created by Tomas Koudelka 03.2024, tomas.koudelka@fsv.cvut.cz |
*/ |
selement::selement(gtypel et, long alloc_bp) |
{ |
type = et; |
alloc(alloc_bp); |
} |
/** |
Destructor deletes dynamically allocated data members |
Created by Tomas Koudelka 03.2008, tomas.koudelka@fsv.cvut.cz |
416,7 → 460,7 |
Element type is given by data member type. |
@param alloc_bp - controls allocation of boundary properties arrays on elements |
(1 = wil be allocated/ 0 = will not be allocated) |
(1 = will be allocated/ 0 = will not be allocated) |
@retval 0 : on success allocation |
@retval 1 : unknown type is required |
438,6 → 482,7 |
edgenod = edgenod_isolin1d; |
nnsurf = nnsurf_isolin1d; |
surfnod = surfnod_isolin1d; |
surfedg = surfedg_isolin1d; |
break; |
case isoquadratic1d: |
nne = 3; |
449,6 → 494,7 |
edgenod = edgenod_isoquad1d; |
nnsurf = nnsurf_isoquad1d; |
surfnod = surfnod_isoquad1d; |
surfedg = surfedg_isoquad1d; |
break; |
case trianglelinear: |
nne = 3; |
460,6 → 506,7 |
edgenod = edgenod_trlin2d; |
nnsurf = nnsurf_trlin2d; |
surfnod = surfnod_trlin2d; |
surfedg = surfedg_trlin2d; |
break; |
case trianglequadratic: |
nne = 6; |
471,6 → 518,7 |
edgenod = edgenod_trquad2d; |
nnsurf = nnsurf_trquad2d; |
surfnod = surfnod_trquad2d; |
surfedg = surfedg_trquad2d; |
break; |
case isolinear2d: |
nne = 4; |
482,6 → 530,7 |
edgenod = edgenod_isolin2d; |
nnsurf = nnsurf_isolin2d; |
surfnod = surfnod_isolin2d; |
surfedg = surfedg_isolin2d; |
break; |
case isoquadratic2d: |
nne = 8; |
493,6 → 542,7 |
edgenod = edgenod_isoquad2d; |
nnsurf = nnsurf_isoquad2d; |
surfnod = surfnod_isoquad2d; |
surfedg = surfedg_isoquad2d; |
break; |
case tetrahedronlinear: |
nne = 4; |
504,6 → 554,7 |
edgenod = edgenod_tetlin3d; |
nnsurf = nnsurf_tetlin3d; |
surfnod = surfnod_tetlin3d; |
surfedg = surfedg_tetlin3d; |
break; |
case tetrahedronquadratic: |
nne = 10; |
515,6 → 566,7 |
edgenod = edgenod_tetquad3d; |
nnsurf = nnsurf_tetquad3d; |
surfnod = surfnod_tetquad3d; |
surfedg = surfedg_tetquad3d; |
break; |
case pyramidelinear: |
nne = 5; |
526,6 → 578,7 |
edgenod = edgenod_pyramlin; |
nnsurf = nnsurf_pyramlin; |
surfnod = surfnod_pyramlin; |
surfedg = surfedg_pyramlin; |
break; |
case pyramidequadratic: |
nne = 13; |
537,6 → 590,7 |
edgenod = edgenod_pyramquad; |
nnsurf = nnsurf_pyramquad; |
surfnod = surfnod_pyramquad; |
surfedg = surfedg_pyramquad; |
break; |
case wedgelinear: |
nne = 6; |
548,6 → 602,7 |
edgenod = edgenod_wedgelin; |
nnsurf = nnsurf_wedgelin; |
surfnod = surfnod_wedgelin; |
surfedg = surfedg_wedgelin; |
break; |
case wedgequadratic: |
nne = 15; |
559,6 → 614,7 |
edgenod = edgenod_wedgequad; |
nnsurf = nnsurf_wedgequad; |
surfnod = surfnod_wedgequad; |
surfedg = surfedg_wedgequad; |
break; |
case isolinear3d: |
nne = 8; |
570,6 → 626,7 |
edgenod = edgenod_isolin3d; |
nnsurf = nnsurf_isolin3d; |
surfnod = surfnod_isolin3d; |
surfedg = surfedg_isolin3d; |
break; |
case isoquadratic3d: |
nne = 20; |
581,6 → 638,7 |
edgenod = edgenod_isoquad3d; |
nnsurf = nnsurf_isoquad3d; |
surfnod = surfnod_isoquad3d; |
surfedg = surfedg_isoquad3d; |
break; |
case isocubic2d: |
nne = 12; |
592,6 → 650,7 |
edgenod = edgenod_isocubic2d; |
nnsurf = nnsurf_isocubic2d; |
surfnod = surfnod_isocubic2d; |
surfedg = surfedg_isocubic2d; |
break; |
default: |
return 1; |
620,6 → 679,57 |
/** |
The function copies the given element to the argument instance dest. |
@param[out] dest - destination where the given element will be copied to. |
Created by Tomas Koudelka 01.2024, tomas.koudelka@fsv.cvut.cz |
*/ |
void selement::copyto(selement &dest) const |
{ |
dest.type = type; |
dest.nne = nne; |
if (nodes){ |
delete [] dest.nodes; |
dest.nodes = new long[nne]; |
memcpy(dest.nodes, nodes, sizeof(*nodes)*nne); |
} |
else |
dest.nodes = NULL; |
dest.ned = ned; |
dest.tnned = tnned; |
dest.nned = nned; |
dest.edgenod = edgenod; |
if (propedg){ |
delete [] dest.propedg; |
dest.propedg = new long[ned]; |
memcpy(dest.propedg, propedg, sizeof(*propedg)*ned); |
} |
else |
dest.propedg = NULL; |
dest.nsurf = nsurf; |
dest.tnnsurf = tnnsurf; |
dest.nnsurf = nnsurf; |
dest.surfnod = surfnod; |
if (propsurf){ |
delete [] dest.propsurf; |
dest.propsurf = new long[nsurf]; |
memcpy(dest.propsurf, propsurf, sizeof(*propsurf)*nsurf); |
} |
else |
dest.propsurf = NULL; |
dest.prop = prop; |
} |
/** |
This method searches array of properties for property aprop with given entity type ent. |
If the pointers edg and sfc are not NULL then the additional edges edg or surfaces sfc are |
also searched for the given property. |
640,7 → 750,7 |
Created by Tomas Koudelka 06.2009, tomas.koudelka@fsv.cvut.cz |
*/ |
long selement::searchprop(long aprop, gentity ent, snode *tnodes, long eid, sedges *edg, sfaces *sfc, long *&entid, long &nentid) |
long selement::searchprop(long aprop, gentity ent, snode *tnodes, long eid, sedges *edg, sfaces *sfc, long *&entid, long &nentid) const |
{ |
long i, j, ret = 0; |
entid = NULL; |
754,7 → 864,7 |
Created by Tomas Koudelka 07.2014, tomas.koudelka@fsv.cvut.cz |
*/ |
long selement::searchnodprop(long aprop, gentity ent, snode *tnodes, sedges *edg, sfaces *sfc, long *propent) |
long selement::searchnodprop(long aprop, gentity ent, snode *tnodes, sedges *edg, sfaces *sfc, long *propent) const |
{ |
long i, aux, ret = 0; |
for (i=0; i<nne; i++) |
787,7 → 897,7 |
Created by Tomas Koudelka 08.2011, tomas.koudelka@fsv.cvut.cz |
*/ |
long selement::compare_edg(long *nod, long n) |
long selement::compare_edg(const long *nod, long n) const |
{ |
long i, j, k; |
long nf; // number of found nodes from the array nod |
820,8 → 930,52 |
/** |
The method compares array of nodes nod with node numbers on particular element edges. |
If all nodes of the particular element edge were found in nod array than the edge |
id is stored in the list of found edge identifiers edgid_lst. The function return |
number of found edges. |
@param[in] nod - pointer to array of searched nodes |
@param[in] n - the number of searched nodes, i.e. dimension of the array nod |
@param[out] edgid_lst - list of identifiers of element edges whose nodes were found in nod |
@return The function returns the number of found element edges whose nodes were |
found in the nod array. |
Created by Tomas Koudelka 01.2024, tomas.koudelka@fsv.cvut.cz |
*/ |
long selement::compare_edg(const long *nod, long n, ivector &edgid_lst) const |
{ |
long i, j, k, l=0; |
long nf; // number of found nodes from the array nod |
edgid_lst.n = 0; |
for (i=0; i<ned; i++){ |
nf = 0; |
for(k=0; k<nned[i]; k++){ |
for(j=0; j<n; j++){ |
if (nodes[edgenod[i][j]] == nod[k]){ |
nf++; |
break; |
} |
} |
} |
if (nf == nned[i]){ |
edgid_lst[l] = i; |
l++; |
edgid_lst.n = l; |
} |
} |
return l; |
} |
/** |
The method compares array of nodes nod with node numbers on particular element surfaces. |
If they corresponds with some of the element surface nodes than the surface id is returned. |
If they correspond with some of the element surface nodes than the surface id is returned. |
Otherwise the -1 is returned. |
833,7 → 987,7 |
Created by Tomas Koudelka 08.2011, tomas.koudelka@fsv.cvut.cz |
*/ |
long selement::compare_surf(long *nod, long n) |
long selement::compare_surf(const long *nod, long n) const |
{ |
long i, j, k; |
long nf; // number of found nodes from the array nod |
866,6 → 1020,50 |
/** |
The method compares array of nodes nod with node numbers on particular element surfaces. |
If all nodes of the particular element surface were found in nod array than the surface |
id is stored in the list of found surface identifiers surfid_lst. The function return |
number of found surfaces. |
@param[in] nod - pointer to array of searched nodes |
@param[in] n - the number of searched nodes, i.e. dimension of the array nod |
@param[out] surfid_lst - list of identifiers of element surfaces whose nodes were found in nod |
@return The function returns the number of found element surfaces whose nodes were |
found in the nod array. |
Created by Tomas Koudelka 01.2024, tomas.koudelka@fsv.cvut.cz |
*/ |
long selement::compare_surf(const long *nod, long n, ivector &surfid_lst) const |
{ |
long i, j, k, l=0; |
long nf; // number of found nodes from the array nod |
surfid_lst.n = 0; |
for (i=0; i<nsurf; i++){ |
nf = 0; |
for(j=0; j<nnsurf[i]; j++){ |
for(k=0; k<n; k++){ |
if (nodes[surfnod[i][j]] == nod[k]){ |
nf++; |
break; |
} |
} |
} |
if (nf == nnsurf[i]){ |
surfid_lst[l] = i; |
l++; |
surfid_lst.n = l; |
} |
} |
return l; |
} |
/** |
The constructor initializes all data members to -1. |
Created by Tomas Koudelka, 08.2011 |
879,13 → 1077,17 |
/** |
The destructor specifired only for the formal purposes. |
The function copies the given instance to the argument instance dest. |
Created by Tomas Koudelka, 08.2011 |
@param[out] dest - destination instance where the data of the given instance will be copied to. |
Created by TKo, 01.2024 |
*/ |
sedge::~sedge(void) |
void sedge::copyto(sedge &dest) |
{ |
dest.n1 = n1; |
dest.n2 = n2; |
dest.prop = prop; |
} |
1029,8 → 1231,8 |
sedges::sedges(long n) |
{ |
nedg = n; |
edges = new sedge[n]; |
nprop = 0L; |
edges = new sedge[n]; |
proplist = NULL; |
prop_list_nod = NULL; |
prop_list_nod_num = NULL; |
1043,6 → 1245,95 |
/** |
The function copies the given instance to the argument instance dest. |
@param[out] dest - destination where the given instance will be copied to. |
Created by TKo, 01.2024 |
*/ |
void sedges::copyto(sedges &dest) |
{ |
dest.nedg = nedg; |
if (edges){ |
delete [] dest.edges; |
dest.edges = new sedge[nedg]; |
for (long i=0; i<nedg; i++) |
edges[i].copyto(dest.edges[i]); |
} |
else |
edges = NULL; |
for (long i=0; i<dest.nprop; i++){ |
for (long j=0; j<dest.prop_list_elem_num[i]; j++) |
delete [] dest.prop_list_elem_edgid[i][j]; |
delete [] dest.prop_list_nod[i]; |
delete [] dest.prop_list_elem[i]; |
delete [] dest.prop_list_elem_edgid[i]; |
delete [] dest.prop_list_elem_edgid_num[i]; |
} |
if (dest.nprop){ |
delete [] dest.proplist; |
delete [] dest.prop_list_nod; |
delete [] dest.prop_list_nod_num; |
delete [] dest.prop_list_elem; |
delete [] dest.prop_list_elem_num; |
delete [] dest.prop_list_elem_edgid; |
delete [] dest.prop_list_elem_edgid_num; |
} |
if (nprop){ |
dest.nprop = nprop; |
dest.proplist = new long[nprop]; |
memcpy(dest.proplist, proplist, sizeof(*proplist)*nprop); |
dest.prop_list_nod_num = new long[nprop]; |
memcpy(dest.prop_list_nod_num, prop_list_nod_num, sizeof(*prop_list_nod_num)*nprop); |
dest.prop_list_elem_num = new long[nprop]; |
memcpy(dest.prop_list_elem_num, prop_list_elem_num, sizeof(*prop_list_elem_num)*nprop); |
dest.prop_list_nod = new long*[nprop]; |
dest.prop_list_elem = new long*[nprop]; |
dest.prop_list_elem_edgid_num = new long*[nprop]; |
dest.prop_list_elem_edgid = new long**[nprop]; |
for (long i=0; i<nprop; i++){ |
dest.prop_list_nod[i] = new long[prop_list_nod_num[i]]; |
memcpy(dest.prop_list_nod[i], prop_list_nod[i], sizeof(*prop_list_nod[i])*prop_list_nod_num[i]); |
dest.prop_list_elem[i] = new long[prop_list_elem_num[i]]; |
memcpy(dest.prop_list_elem[i], prop_list_elem[i], sizeof(*prop_list_elem[i])*prop_list_elem_num[i]); |
dest.prop_list_elem_edgid_num[i] = new long[prop_list_elem_num[i]]; |
memcpy(dest.prop_list_elem_edgid_num[i], prop_list_elem_edgid_num[i], sizeof(*prop_list_elem_edgid_num[i])*prop_list_elem_num[i]); |
dest.prop_list_elem_edgid[i] = new long*[prop_list_elem_num[i]]; |
for (long j=0; j<prop_list_elem_num[i]; j++){ |
if (prop_list_elem_edgid_num[i][j]){ |
dest.prop_list_elem_edgid[i][j] = new long[prop_list_elem_edgid_num[i][j]]; |
memcpy(dest.prop_list_elem_edgid[i][j], prop_list_elem_edgid[i][j], sizeof(*dest.prop_list_elem_edgid[i][j])*dest.prop_list_elem_edgid_num[i][j]); |
} |
else |
dest.prop_list_elem_edgid[i][j] = NULL; |
} |
} |
} |
else{ |
dest.nprop = 0L; |
dest.proplist = NULL; |
dest.prop_list_nod = NULL; |
dest.prop_list_nod_num = NULL; |
dest.prop_list_elem = NULL; |
dest.prop_list_elem_num = NULL; |
dest.prop_list_elem_edgid = NULL; |
dest.prop_list_elem_edgid_num = NULL; |
} |
} |
/** |
The function reads list of additional edges from the opened text file. |
The list is placed at the end of file with topology and it is created by |
MeshEditor usually. |
1520,6 → 1811,30 |
/** |
The function copies the given instance to the argument instance dest. |
@param[out] dest - instance where the given instance data will be copied to. |
Created by Tomas Koudelka, 01.2024 |
*/ |
void sface::copyto(sface &dest) |
{ |
dest.nnod = nnod; |
if (nodes){ |
delete [] dest.nodes; |
dest.nodes = new long[nnod]; |
memcpy(dest.nodes, nodes, sizeof(*nodes)*nnod); |
} |
else |
dest.nodes = NULL; |
dest.prop = prop; |
} |
/** |
The function reads data about one face from the opened text file. |
@param in - pointer to the opened text file |
1700,7 → 2015,97 |
/** |
The function copies the given instance to the argument instance dest. |
@param[out] dest - destination where the given instance will be copied to. |
Created by TKo, 01.2024 |
*/ |
void sfaces::copyto(sfaces &dest) |
{ |
dest.nfcs = nfcs; |
if (faces){ |
delete [] dest.faces; |
dest.faces = new sface[nfcs]; |
for (long i=0; i<nfcs; i++) |
faces[i].copyto(dest.faces[i]); |
} |
else |
faces = NULL; |
for (long i=0; i<dest.nprop; i++){ |
for (long j=0; j<dest.prop_list_elem_num[i]; j++) |
delete [] dest.prop_list_elem_sfid[i][j]; |
delete [] dest.prop_list_nod[i]; |
delete [] dest.prop_list_elem[i]; |
delete [] dest.prop_list_elem_sfid[i]; |
delete [] dest.prop_list_elem_sfid_num[i]; |
} |
if (dest.nprop){ |
delete [] dest.proplist; |
delete [] dest.prop_list_nod; |
delete [] dest.prop_list_nod_num; |
delete [] dest.prop_list_elem; |
delete [] dest.prop_list_elem_num; |
delete [] dest.prop_list_elem_sfid; |
delete [] dest.prop_list_elem_sfid_num; |
} |
if (nprop){ |
dest.nprop = nprop; |
dest.proplist = new long[nprop]; |
memcpy(dest.proplist, proplist, sizeof(*proplist)*nprop); |
dest.prop_list_nod_num = new long[nprop]; |
memcpy(dest.prop_list_nod_num, prop_list_nod_num, sizeof(*prop_list_nod_num)*nprop); |
dest.prop_list_elem_num = new long[nprop]; |
memcpy(dest.prop_list_elem_num, prop_list_elem_num, sizeof(*prop_list_elem_num)*nprop); |
dest.prop_list_nod = new long*[nprop]; |
dest.prop_list_elem = new long*[nprop]; |
dest.prop_list_elem_sfid_num = new long*[nprop]; |
dest.prop_list_elem_sfid = new long**[nprop]; |
for (long i=0; i<nprop; i++){ |
dest.prop_list_nod[i] = new long[prop_list_nod_num[i]]; |
memcpy(dest.prop_list_nod[i], prop_list_nod[i], sizeof(*prop_list_nod[i])*prop_list_nod_num[i]); |
dest.prop_list_elem[i] = new long[prop_list_elem_num[i]]; |
memcpy(dest.prop_list_elem[i], prop_list_elem[i], sizeof(*prop_list_elem[i])*prop_list_elem_num[i]); |
dest.prop_list_elem_sfid_num[i] = new long[prop_list_elem_num[i]]; |
memcpy(dest.prop_list_elem_sfid_num[i], prop_list_elem_sfid_num[i], sizeof(*prop_list_elem_sfid_num[i])*prop_list_elem_num[i]); |
dest.prop_list_elem_sfid[i] = new long*[prop_list_elem_num[i]]; |
for (long j=0; j<prop_list_elem_num[i]; j++){ |
if (prop_list_elem_sfid_num[i][j]){ |
dest.prop_list_elem_sfid[i][j] = new long[prop_list_elem_sfid_num[i][j]]; |
memcpy(dest.prop_list_elem_sfid[i][j], prop_list_elem_sfid[i][j], sizeof(*dest.prop_list_elem_sfid[i][j])*dest.prop_list_elem_sfid_num[i][j]); |
} |
else |
dest.prop_list_elem_sfid[i][j] = NULL; |
} |
} |
} |
else{ |
dest.nprop = 0L; |
dest.proplist = NULL; |
dest.prop_list_nod = NULL; |
dest.prop_list_nod_num = NULL; |
dest.prop_list_elem = NULL; |
dest.prop_list_elem_num = NULL; |
dest.prop_list_elem_sfid = NULL; |
dest.prop_list_elem_sfid_num = NULL; |
} |
} |
/** |
The function reads list of additional surfaces from the opened text file. |
The list is placed at the end of file with topology and it is created by |
MeshEditor usually. |
2089,6 → 2494,7 |
nn = 0; |
ne = 0; |
memset(npet, 0, sizeof(npet)); |
nnsd = NULL; |
} |
2122,11 → 2528,91 |
nadjelnod = NULL; |
adjelnod = NULL; |
memset(npet, 0, sizeof(npet)); |
meshtype = 0; |
nsd = 0; |
nnsd = NULL; |
} |
/** |
This copy constructor initializes all data members from the argument src. |
It is defined with explicit specifier so it cannot be used for arguments passed by values |
in the function calls. |
Created by Tomas Koudelka 01/2024, tomas.koudelka@fsv.cvut.cz |
*/ |
siftop :: siftop (const siftop &src) |
{ |
nn = src.nn; |
ne = src.ne; |
if (src.nodes){ |
nodes = new snode[nn]; |
if (src.gnn){ |
gnn = new long[nn]; |
memcpy(gnn, src.gnn, sizeof(*gnn)*nn); |
} |
for (long i=0; i<nn; i++) |
src.nodes[i].copyto(nodes[i]); |
} |
else |
nodes = NULL; |
if (src.elements){ |
elements = new selement[ne]; |
for (long i=0; i<ne; i++) |
src.elements[i].copyto(elements[i]); |
} |
else |
elements = NULL; |
if (src.edges){ |
edges = new sedges; |
src.edges->copyto(*edges); |
} |
else |
edges = NULL; |
if (src.surfaces){ |
surfaces = new sfaces; |
src.surfaces->copyto(*surfaces); |
} |
else |
surfaces = NULL; |
if (src.nadjelnod){ |
nadjelnod = new long[nn]; |
memcpy(nadjelnod, src.nadjelnod, sizeof(*nadjelnod)*nn); |
} |
else |
nadjelnod = NULL; |
if (src.adjelnod){ |
adjelnod = new long*[nn]; |
for(long i=0; i<nn; i++){ |
adjelnod[i] = new long[nadjelnod[i]]; |
memcpy(adjelnod[i], src.adjelnod[i], sizeof(*adjelnod[i])*nadjelnod[i]); |
} |
} |
else |
adjelnod = NULL; |
memcpy(npet, src.npet, sizeof(npet)); |
meshtype = src.meshtype; |
nsd = src.nsd; |
if (nnsd){ |
nnsd = new long[nsd]; |
memcpy(nnsd, src.nnsd, sizeof(*nnsd)*nsd); |
} |
else |
nnsd = NULL; |
} |
/** |
This destructor deallocates memory used by data mebers |
Created by Tomas Koudelka 03.2008, tomas.koudelka@fsv.cvut.cz |
2157,10 → 2643,97 |
delete [] nadjelnod; |
delete [] adjelnod; |
} |
delete [] nnsd; |
} |
/** |
The method makes partial copy of the given siftop instance but allocates additional space for nodes, elements, |
edge and surface property objects. |
@param[out] top - destination topology where to save the partial copy |
@param[in] tndn - total number of doubled nodes |
@param[in] tnifel - total number of the generated interface elements |
@param[in] num_dnedgprop - the number of newly generated edge property objects involving doubled nodes |
@param[in] num_dnsurfprop - the number of newly generated surface property objects involving doubled nodes |
@return The function does not return anything. |
Created by TKo, 01.2024 |
*/ |
void siftop::partial_copy(siftop &top, long tndn, long tnifel, long num_dnedgprop, long num_dnsurfprop) const |
{ |
top.nn = nn+tndn; |
top.ne = ne+tnifel; |
if (top.nodes) |
delete [] top.nodes; |
if (top.gnn) |
delete [] top.gnn; |
if (nodes){ |
top.nodes = new snode[top.nn]; |
if (gnn){ |
top.gnn = new long[top.nn]; |
memcpy(top.gnn, gnn, sizeof(*gnn)*nn); |
} |
for (long i=0; i<nn; i++) |
nodes[i].copyto(top.nodes[i]); |
} |
else |
top.nodes = NULL; |
if (top.elements) |
delete [] top.elements; |
if (elements){ |
top.elements = new selement[top.ne]; |
for (long i=0; i<ne; i++) |
elements[i].copyto(top.elements[i]); |
} |
else |
top.elements = NULL; |
if (top.edges) |
delete top.edges; |
if (edges){ |
top.edges = new sedges; |
top.edges->nedg = edges->nedg+num_dnedgprop; |
top.edges->edges = new sedge[top.edges->nedg]; |
for (long i=0; i<edges->nedg; i++) |
edges->edges[i].copyto(top.edges->edges[i]); |
} |
else |
top.edges = NULL; |
if (top.surfaces) |
delete top.surfaces; |
if (surfaces){ |
top.surfaces = new sfaces; |
top.surfaces->nfcs = surfaces->nfcs+num_dnsurfprop; |
top.surfaces->faces = new sface[top.surfaces->nfcs]; |
for (long i=0; i<surfaces->nfcs; i++) |
surfaces->faces[i].copyto(top.surfaces->faces[i]); |
} |
else |
top.surfaces = NULL; |
memcpy(top.npet, npet, sizeof(npet)); |
top.meshtype = meshtype; |
top.nsd = nsd; |
if (top.nnsd) |
delete [] top.nnsd; |
if (nnsd){ |
top.nnsd = new long[nsd]; |
memcpy(top.nnsd, nnsd, sizeof(*nnsd)*nsd); |
} |
else |
top.nnsd = NULL; |
} |
/** |
This method reads topology of given domain from file, which is in the JKTK format |
2785,7 → 3358,7 |
created by Tomas Koudelka 3.2008, tomas.koudelka@fsv.cvut.cz |
*/ |
void siftop::print (FILE *out) |
void siftop::print (FILE *out) const |
{ |
long i, j; |
2841,7 → 3414,7 |
9.11.2010 JB |
*/ |
void siftop::shift_print_nodes (FILE *out,long shift) |
void siftop::shift_print_nodes (FILE *out,long shift) const |
{ |
long i,j; |
for (i = 0; i < nn; i++){ |
2865,8 → 3438,8 |
9.11.2010 JB |
*/ |
void siftop::shift_print_elements (FILE *out,long shiftnn,long shiftne){ |
void siftop::shift_print_elements (FILE *out,long shiftnn,long shiftne) const |
{ |
long i,j; |
for (i = 0; i < ne; i++){ |
fprintf (out,"%ld %d",i+1+shiftne, elements[i].type); |
2963,7 → 3536,7 |
Created 06.2009 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
Modified 08.2011 by Tomas Koudelka |
*/ |
long siftop::get_propent_nodes(long prop, gentity ent, long *setnodes) |
long siftop::get_propent_nodes(long prop, gentity ent, long *setnodes) const |
{ |
long i, j, ret=0; |
for (i=0; i<nn; i++) |
3028,7 → 3601,7 |
Created 06.2020 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
*/ |
long siftop::get_propent_nodes(long prop, gentity ent, ivector &setnodes) |
long siftop::get_propent_nodes(long prop, gentity ent, ivector &setnodes) const |
{ |
long i, j, ret=0; |
for (i=0; i<nn; i++) |
3095,7 → 3668,7 |
Created 06.2020 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
*/ |
long siftop::get_propent_nodes_compact(long prop, gentity ent, ivector &setnodes) |
long siftop::get_propent_nodes_compact(long prop, gentity ent, ivector &setnodes) const |
{ |
long i, j, ret=0; |
reallocv(nn, setnodes); |
3167,7 → 3740,7 |
Created 06.2021 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
*/ |
long siftop::get_propent_elems(long prop, gentity ent, ivector &setelems, long accum) |
long siftop::get_propent_elems(long prop, gentity ent, ivector &setelems, long accum) const |
{ |
long i, j, ret=0, k; |
long *auxp, aux; |
3241,7 → 3814,7 |
Created 06.2021 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
*/ |
long siftop::get_propent_elems_compact(long prop, gentity ent, ivector &setelems) |
long siftop::get_propent_elems_compact(long prop, gentity ent, ivector &setelems) const |
{ |
long i, j, ret=0; |
long *auxp, aux; |
3311,7 → 3884,7 |
Created 04.2008 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
*/ |
long siftop::get_ndofn(long prop, gentity ent, long *ndofn, long *setnodes) |
long siftop::get_ndofn(long prop, gentity ent, long *ndofn, long *setnodes) const |
{ |
long i, j, id; |
long ndof = -1; |
3400,7 → 3973,7 |
Created 04.2008 by Tomas Koudelka tomas.koudelka@fsv.cvut.cz |
*/ |
long siftop::get_ndofn(long prop, gentity ent, long *ndofn, ivector &setnodes) |
long siftop::get_ndofn(long prop, gentity ent, long *ndofn, ivector &setnodes) const |
{ |
long i, j, id; |
long ndof = -1; |
3483,7 → 4056,7 |
Created 2004 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
void siftop::export_gid_mesh(FILE *out, long idn1, long ide1) |
void siftop::export_gid_mesh(FILE *out, long idn1, long ide1) const |
{ |
long i, print_header, print_coord = 1; |
3720,7 → 4293,7 |
Created 2010 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
void siftop::write_gid_nodes(FILE *out, long idn1) |
void siftop::write_gid_nodes(FILE *out, long idn1) const |
{ |
long i; |
fprintf(out, "Coordinates\n"); |
3743,7 → 4316,7 |
Created 2010 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
void siftop::write_gid_element(FILE *out, long i, long idn1, long ide1) |
void siftop::write_gid_element(FILE *out, long i, long idn1, long ide1) const |
{ |
long j; |
fprintf(out, "%ld ", i+ide1); |
3898,7 → 4471,7 |
Created by TKo, 7.2020 |
*/ |
void siftop::give_node_coord3d(vector &x, vector &y, vector &z, long eid) |
void siftop::give_node_coord3d(vector &x, vector &y, vector &z, long eid) const |
{ |
long i, nne = elements[eid].nne; |
long *en = elements[eid].nodes; |
3922,7 → 4495,7 |
Created by TKo, 7.2020 |
*/ |
void siftop::give_node_coord2d(vector &x, vector &y, long eid) |
void siftop::give_node_coord2d(vector &x, vector &y, long eid) const |
{ |
long i, nne = elements[eid].nne; |
long *en = elements[eid].nodes; |
3946,7 → 4519,7 |
Created by TKo, 7.2020 |
*/ |
long siftop::give_dimension(long eid) |
long siftop::give_dimension(long eid) const |
{ |
long ret = 0; |
3994,7 → 4567,7 |
Created by Tomas Koudelka, 05.2023 |
*/ |
void siftop::give_elemnods(long eid, ivector &enod) |
void siftop::give_elemnods(long eid, ivector &enod) const |
{ |
long nne = elements[eid].nne; |
reallocv(nne, enod); |
4013,7 → 4586,7 |
Created by Tomas Koudelka, 07.2020 |
*/ |
long siftop::give_closest_node_coord(long eid, double px, double py, double pz, double &dmin) |
long siftop::give_closest_node_coord(long eid, double px, double py, double pz, double &dmin) const |
{ |
long i, nid, nne = elements[eid].nne; |
long *enodes = elements[eid].nodes; |
4050,7 → 4623,7 |
@retval 0 - on success |
@retval 1 - in the case of error |
*/ |
long siftop::centroid(long eid, vector &coord) |
long siftop::centroid(long eid, vector &coord) const |
{ |
long nne = elements[eid].nne; |
vector x(ASTCKVEC(nne)), y(ASTCKVEC(nne)), z(ASTCKVEC(nne)), bf(ASTCKVEC(nne)); |
4148,7 → 4721,7 |
Created by TKo, 07.2020 |
*/ |
double siftop::max_sqrdist_nod_pt(long eid, vector &pt) |
double siftop::max_sqrdist_nod_pt(long eid, vector &pt) const |
{ |
long i; |
long nne = elements[eid].nne; |
4185,7 → 4758,7 |
Created by Tomas Koudelka, 05.2023 |
*/ |
long siftop::give_enod_xicoord(long eid, double xi, ivector &nod) |
long siftop::give_enod_xicoord(long eid, double xi, ivector &nod) const |
{ |
long i, surfid = -1; |
gtypel et = elements[eid].type; |
4246,7 → 4819,7 |
Created by Tomas Koudelka, 05.2023 |
*/ |
long siftop::give_enod_etacoord(long eid, double eta, ivector &nod) |
long siftop::give_enod_etacoord(long eid, double eta, ivector &nod) const |
{ |
long i, surfid=-1; |
gtypel et = elements[eid].type; |
4305,7 → 4878,7 |
Created by Tomas Koudelka, 05.2023 |
*/ |
long siftop::give_enod_zetacoord(long eid, double zeta, ivector &nod) |
long siftop::give_enod_zetacoord(long eid, double zeta, ivector &nod) const |
{ |
long i, surfid=-1; |
gtypel et = elements[eid].type; |
4363,7 → 4936,7 |
Created by Tomas Koudelka, 05.2023 |
*/ |
void siftop::transform_natcoord_surf(long eid, long sid, const vector &enc, vector &lnc) |
void siftop::transform_natcoord_surf(long eid, long sid, const vector &enc, vector &lnc) const |
{ |
gtypel et = elements[eid].type; |
switch (et){ |
4402,7 → 4975,7 |
Created by Tomas Koudelka, 05.2023 |
*/ |
void siftop::transform_natcoord_edg(long eid, long edid, const vector &enc, vector &lnc) |
void siftop::transform_natcoord_edg(long eid, long edid, const vector &enc, vector &lnc) const |
{ |
gtypel et = elements[eid].type; |
switch (et){ |
4447,7 → 5020,7 |
Created by Tomas Koudelka, 05.2023. |
*/ |
gtypel siftop::give_elem_ent(long eid, long entnn, gentity &ent) |
gtypel siftop::give_elem_ent(long eid, long entnn, gentity &ent) const |
{ |
gtypel et = elements[eid].type; |
gtypel ret = gtypel(-1); |
4493,3 → 5066,90 |
return ret; |
} |
/** |
The function creates list of edges from the given element list. |
@param[out] edglst - array of particular edge definitions (arrays of edge nodes), i.e. edglst[i][j] = j-th node on i-th edge, |
where i is the global edge index. Node numbers involved in the definition of particular edges are sorted. |
@param[out] edgelem - list of adjacent elements to particular edges, i.e edgelem[i][j] = j-th element connected to i-th edge |
where i is the global edge index. Particular arrays of element numbers are sorted, i.e. edgelem[i] is |
sorted vector. |
@param[out] elemedg - list of adjacent edges to particular elements, i.e elemedg[i][j] = global edge index of j-th edge connected |
with i-th element. Particular arrays of edge indices are sorted, i.e. elemedg[i] is sorted vector. |
@param[in] elems - list of elements whose edges will be considered in the list, elems[i]=number of element under consideration |
@param[in] pelems - array of all elements in the mesh |
@param[in] pnodes - array of all nodes in the mesh |
Created by TKo, 03.2024 |
*/ |
void generate_edge_list(std::vector<std::vector<long>> &edglst, |
std::vector<std::vector<long>> &edgelem, |
std::vector<std::vector<long>> &elemedg, |
const std::vector<long> &elems, const selement *pelems, const snode *pnodes) |
{ |
std::size_t i; |
long j, k, eid, edgid; |
std::vector<long> edgn; |
std::set<std::vector<long>> edglst_set; |
// |
// create set od egdes |
// |
for (i=0; i<elems.size(); i++){ |
eid = elems[i]; |
for (j=0; j<pelems[eid].ned; j++){ |
// create array of node numbers on the j-th edge of i-th element under consideration |
edgn.clear(); |
edgn.reserve(pelems[eid].nned[j]); |
// insert edge nodes in the edgn vector |
for (k=0; k<pelems[eid].nned[j]; k++) |
edgn.push_back(pelems[eid].nodes[pelems[eid].edgenod[j][k]]); |
std::sort(edgn.begin(), edgn.end()); // sort edge node numbers |
edglst_set.insert(edgn); // insert given edge in std::set, duplicate edges are excluded automatically |
} |
} // edglst_set contains definitions of particular edges without duplicates |
// |
// convert edglst_set to std::vector of std::vectors which allows access by indices and creates global edge numbering |
// |
edglst.reserve(edglst_set.size()); |
edglst.insert(edglst.begin(), edglst_set.begin(), edglst_set.end()); |
typename decltype(edglst_set)::iterator edg1_it; |
// |
// create edge -> adjacent elements correspondence map |
// |
edgelem.reserve(edglst.size()); |
for (i=0; i<elems.size(); i++){ |
eid = elems[i]; |
// insert edge nodes in the edgn vector |
for (j=0; j<pelems[eid].ned; j++){ |
// create array of node numbers on the j-th edge of i-th element under consideration |
edgn.clear(); |
edgn.reserve(pelems[eid].nned[j]); |
// insert edge nodes in the edgn vector |
for (k=0; k<pelems[eid].nned[j]; k++) |
edgn.push_back(pelems[eid].nodes[pelems[eid].edgenod[j][k]]); |
std::sort(edgn.begin(), edgn.end()); // sort edge node numbers |
auto its = edglst_set.find(edgn); |
if (its != edglst_set.end()){ |
edgid = (long) std::distance(its, edg1_it); |
edgelem[edgid].push_back(i); |
} |
} |
} |
for(auto it=edgelem.begin(); it != edgelem.end(); ++it) |
std::sort(it->begin(), it->end()); // sort the list of elements for particular edges |
// create list of edge numbers (indices) on particular elements |
elemedg.reserve(elems.size()); |
for(auto edg_it=edgelem.begin(); edg_it != edgelem.end(); ++edg_it){ |
for (auto elem_it=edg_it->begin(); elem_it != edg_it->end(); ++elem_it){ |
elemedg[*elem_it].push_back((long)std::distance(edg_it, edgelem.begin())); |
} |
} |
for(auto it=elemedg.begin(); it != elemedg.end(); ++it) |
std::sort(it->begin(), it->end()); // sort the list of edges for particular elements |
} |
/trunk/SIFEL/GEFEL/siftop.h |
---|
58,6 → 58,7 |
{ |
static const long max_nned = 4; |
static const long max_nnsurf = 12; |
static const long max_nsurfedg = 4; |
long *nodes; ///< pointer to array with element node numbers |
long nne; ///< number of nodes on element |
73,19 → 74,26 |
long prop; ///< property number of element |
long (*edgenod)[max_nned]; ///< array with indices of nodes on particular edges - edgnod[i][j] gives j-th index of node on i-th edge |
long (*surfnod)[max_nnsurf]; ///< array with indices of nodes on particular surfaces - surfnod[i][j] gives index of j-th node on i-th surface |
long (*surfedg)[max_nsurfedg]; ///< array with indices of edges on particular surfaces - surfedg[i][j] gives index of j-th edge on i-th surface |
selement(); |
selement(gtypel et, long alloc_bp); |
~selement(); |
/// allocation of memory for nodes |
long alloc(long alloc_bp); |
/// copies the content of the given element to the argument instance |
void copyto(selement &dest) const; |
/// searches for property aprop of the given entity ent in element property arrays |
long searchprop(long aprop, gentity ent, snode *tnodes, long eid, sedges *edg, sfaces *sfc, long *&entid, long &nentid); |
long searchprop(long aprop, gentity ent, snode *tnodes, long eid, sedges *edg, sfaces *sfc, long *&entid, long &nentid) const; |
/// searches for property aprop of the given entity ent in the element nodes |
long searchnodprop(long aprop, gentity ent, snode *tnodes, sedges *edg, sfaces *sfc, long *propent); |
long compare_edg(long *nod, long n); |
long compare_surf(long *nod, long n); |
long searchnodprop(long aprop, gentity ent, snode *tnodes, sedges *edg, sfaces *sfc, long *propent) const; |
long compare_edg(const long *nod, long n) const; |
long compare_edg(const long *nod, long n, ivector &edgid_lst) const; |
long compare_surf(const long *nod, long n) const; |
long compare_surf(const long *nod, long n, ivector &surfid_lst) const; |
// initialization of the following static arrays is defined at the begining of siftop.cpp |
static long nned_isolin1d[1]; |
151,6 → 159,22 |
static long surfnod_wedgequad[5][max_nnsurf]; |
static long surfnod_isolin3d[6][max_nnsurf]; |
static long surfnod_isoquad3d[6][max_nnsurf]; |
static long surfedg_isolin1d[1][max_nsurfedg]; |
static long surfedg_isoquad1d[1][max_nsurfedg]; |
static long surfedg_trlin2d[1][max_nsurfedg]; |
static long surfedg_trquad2d[1][max_nsurfedg]; |
static long surfedg_isolin2d[1][max_nsurfedg]; |
static long surfedg_isoquad2d[1][max_nsurfedg]; |
static long surfedg_isocubic2d[1][max_nsurfedg]; |
static long surfedg_tetlin3d[4][max_nsurfedg]; |
static long surfedg_tetquad3d[4][max_nsurfedg]; |
static long surfedg_pyramlin[5][max_nsurfedg]; |
static long surfedg_pyramquad[5][max_nsurfedg]; |
static long surfedg_wedgelin[5][max_nsurfedg]; |
static long surfedg_wedgequad[5][max_nsurfedg]; |
static long surfedg_isolin3d[6][max_nsurfedg]; |
static long surfedg_isoquad3d[6][max_nsurfedg]; |
}; |
167,7 → 191,7 |
long prop; ///< property number of the given edge |
sedge(); |
~sedge(); |
void copyto(sedge &dest); ///< method copies the given instance to the argument instance dest |
long read(XFILE *in); ///< method reads the edge data from the file |
void print(FILE *out, long *lnn); ///< method prints the edge data to the file |
long cordomtest(long *lnn); ///< method tests whether the edge is contained in the given subdomain |
210,6 → 234,7 |
sedges(long ned); ///< initializes to array of edges with size ned |
~sedges(); |
void copyto(sedges &dest); ///< method copies the given instance into the argument instance dest |
void read(XFILE *in); ///< method reads the data about edges from the file |
void print(FILE *out, long *lnn); ///< method prints the data about edges to the file |
long search_list_newprop(long prop, long *propid, long n); ///< tests prop whether it is contained in the array propid |
235,6 → 260,7 |
sface(long n); ///< initializes to array of nodes with size n |
~sface(); |
void copyto(sface &dest); ///< method copies the given instance into the argument instance dest |
long read(XFILE *in); ///< method reads the edge data from the file |
void print(FILE *out, long *lnn); ///< method prints the edge data to the file |
long cordomtest(long *lnn); ///< method tests whetehr the edge is contained in the given subdomain |
274,6 → 300,7 |
sfaces(); |
sfaces(long n); ///< initializes to array of faces with size nfc |
~sfaces(); |
void copyto(sfaces &dest); ///< method copies the given instance into the argument instance dest |
void read(XFILE *in); ///< method reads the data about surfaces from the file |
void print(FILE *out, long *lnn); ///< method prints the data about surfaces to the file |
296,10 → 323,15 |
class siftop |
{ |
public: |
siftop (void); |
siftop (void); |
siftop (long inn, long ine, gtypel te); |
explicit siftop(const siftop &src); |
~siftop (void); |
/** method makes partial copy of the given siftop instance bu allocates additional space for nodes, elements, |
edge and surface property objects */ |
void partial_copy(siftop &top, long tndn, long tnifel, long num_dnedgprop, long num_dnsurfprop) const; |
/// method reads topology in JKTK format from file |
long read(XFILE *in, long rgnn, long rebp); |
319,89 → 351,89 |
void exporttop (gtopology *top); |
/// method exports topology to a text file in JKTK format |
void print (FILE *out); |
void print (FILE *out) const; |
/// prints nodes with the shift indices |
void shift_print_nodes (FILE *out,long shift); |
void shift_print_nodes (FILE *out,long shift) const; |
/// print elements with the shift indices |
void shift_print_elements (FILE *out,long shiftnn,long shiftne); |
void shift_print_elements (FILE *out,long shiftnn,long shiftne) const; |
/// method exports siftop mesh in GiD format to a text file |
void export_gid_mesh(FILE *out, long idn1=1, long ide1=1); |
void export_gid_mesh(FILE *out, long idn1=1, long ide1=1) const; |
/// method writes nodes in GiD format to a text file |
void write_gid_nodes(FILE *out, long idn1=1); |
void write_gid_nodes(FILE *out, long idn1=1) const; |
/// method writes one element in GiD format to a text file |
void write_gid_element(FILE *out, long i, long idn1=1, long ide1=1); |
void write_gid_element(FILE *out, long i, long idn1=1, long ide1=1) const; |
/// method generates lists of adjacent elements to nodes |
void gen_adjelnod(void); |
/// method gets ndof of nodes with property prop of entity ent |
long get_ndofn(long prop, gentity ent, long *ndofn, long *setnodes); |
long get_ndofn(long prop, gentity ent, long *ndofn, long *setnodes) const; |
/// method gets ndof of nodes with property prop of entity ent |
long get_ndofn(long prop, gentity ent, long *ndofn, ivector &setnodes); |
long get_ndofn(long prop, gentity ent, long *ndofn, ivector &setnodes) const; |
/// returns nodes laying on the entities ent with property prop |
long get_propent_nodes(long prop, gentity ent, long *setnodes); |
long get_propent_nodes(long prop, gentity ent, long *setnodes) const; |
/// returns nodes laying on the entity ent with property prop |
long get_propent_nodes(long prop, gentity ent, ivector &setnodes); |
long get_propent_nodes(long prop, gentity ent, ivector &setnodes) const; |
/// returns nodes laying on the entity ent with property prop, output will be in the compact form |
long get_propent_nodes_compact(long prop, gentity ent, ivector &setnodes); |
long get_propent_nodes_compact(long prop, gentity ent, ivector &setnodes) const; |
/// returns elements involving the entity ent with property prop |
long get_propent_elems(long prop, gentity ent, ivector &setelems, long accum=0); |
long get_propent_elems(long prop, gentity ent, ivector &setelems, long accum=0) const; |
/// returns elements involving the entity ent with property prop, output will be in the compact form |
long get_propent_elems_compact(long prop, gentity ent, ivector &setelems); |
long get_propent_elems_compact(long prop, gentity ent, ivector &setelems) const; |
/// function reorders mesh from t3d format into sifel format (3D) |
void t3d2sifelformat(); |
/// returns 2D nodal coordinates for the given element |
void give_node_coord3d(vector &x, vector &y, vector &z, long eid); |
void give_node_coord3d(vector &x, vector &y, vector &z, long eid) const; |
/// returns 3D nodal coordinates for the given element |
void give_node_coord2d(vector &x, vector &y, long eid); |
void give_node_coord2d(vector &x, vector &y, long eid) const; |
/// returns dimension of the given element |
long give_dimension(long eid); |
long give_dimension(long eid)const ; |
/// returns array of element nodes |
void give_elemnods(long eid, ivector &enod); |
void give_elemnods(long eid, ivector &enod) const; |
/// returns the number of closest node and the given minimum distance |
long give_closest_node_coord(long eid, double px, double py, double pz, double &dmin); |
long give_closest_node_coord(long eid, double px, double py, double pz, double &dmin) const; |
/// returns coordinates of centre of gravity of the given element |
long centroid(long eid, vector &coord); |
long centroid(long eid, vector &coord) const; |
/// returns the square of maximum distance between the given point and given element nodes |
double max_sqrdist_nod_pt(long eid, vector &pt); |
double max_sqrdist_nod_pt(long eid, vector &pt) const; |
/// returns array of element nodes with the given xi natrual coordinate and corresponding surface id |
long give_enod_xicoord(long eid, double xi, ivector &nod); |
long give_enod_xicoord(long eid, double xi, ivector &nod) const; |
/// returns array of element nodes with the given eta natrual coordinate and corresponding surface id |
long give_enod_etacoord(long eid, double eta, ivector &nod); |
long give_enod_etacoord(long eid, double eta, ivector &nod) const; |
/// returns array of element nodes with the given eta natrual coordinate and corresponding surface id |
long give_enod_zetacoord(long eid, double zeta, ivector &nod); |
long give_enod_zetacoord(long eid, double zeta, ivector &nod) const; |
/// transforms point given in element natural coordinates to the local natural coordinates of the given element surface |
void transform_natcoord_surf(long eid, long sid, const vector &enc, vector &lnc); |
void transform_natcoord_surf(long eid, long sid, const vector &enc, vector &lnc) const; |
/// transforms point given in element natural coordinates to the local natural coordinates of the given element edge |
void transform_natcoord_edg(long eid, long edid, const vector &enc, vector &lnc); |
void transform_natcoord_edg(long eid, long edid, const vector &enc, vector &lnc) const; |
/// returns entity type and general element type of entity on the given element, entity is detected according to number of nodes |
gtypel give_elem_ent(long eid, long entnn, gentity &ent); |
gtypel give_elem_ent(long eid, long entnn, gentity &ent) const; |
selement *elements; ///< pointer to array with elements |
snode *nodes; ///< pointer to array with nodes |
sedges *edges; ///< pointer to structure with additional edges |
423,4 → 455,9 |
long *nnsd; |
}; |
/// creates list of edges and elements adjacent to these edges for selected list of elemenst |
//void generate_edge_list(std::vector<std::vector<long>> &edglst, |
// std::vector<std::vector<long>> &edgelem, |
// std::vector<std::vector<long>> &elemedg, |
// const std::vector<long> &elems, const selement *pelems, const snode *pnodes); |
#endif |
/trunk/SIFEL/GEFEL/tablefunct.cpp |
---|
26,6 → 26,7 |
y=NULL; |
file1 = new char[1000]; |
memset(file1, 0, sizeof(*file1)*1000); |
dealloc = true; |
} |
45,6 → 46,7 |
y = new double [n]; |
file1 = new char[1000]; |
memset(file1, 0, sizeof(*file1)*1000); |
dealloc = true; |
} |
51,38 → 53,17 |
/** |
The constructor allocates table with n items. |
@param n - the number of table items |
@param it - type of interpolation |
@param[in] n - the number of table items |
@param[in] it - type of interpolation |
Created by JK, 11. 10. 2013 |
*/ |
tablefunct::tablefunct (long n,long it) |
{ |
switch (it){ |
case 1:{ |
itype = piecewiselin; |
break; |
if (interpoltype_kwdset.check_int(it)){ |
print_err ("unknown type of interpolation is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
case 2:{ |
itype = piecewiseconst; |
break; |
} |
case 3:{ |
itype = lagrange; |
break; |
} |
case 4:{ |
itype = piecewiselin2; |
break; |
} |
case 5:{ |
itype = dirac2; |
break; |
} |
default:{ |
print_err ("unknown type of interpolation is required",__FILE__,__LINE__,__func__); |
} |
}// end of switch (it){ |
asize = n; |
x = new double [n]; |
89,10 → 70,37 |
y = new double [n]; |
file1 = new char[1000]; |
memset(file1, 0, sizeof(*file1)*1000); |
dealloc = true; |
} |
/** |
The constructor makes table with n items. |
@param[in] xptr - pointer ot the array of x values |
@param[in] yptr - pointer ot the array of y values |
@param[in] n - the number of table items |
@param[in] it - type of interpolation, default value is piecewiselin |
Created by TKo, 02. 2024 |
*/ |
tablefunct::tablefunct (double *xptr, double *yptr, long n, interpoltype it) |
{ |
if (interpoltype_kwdset.check_int(it)){ |
print_err ("unknown type of interpolation is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
asize = n; |
x = xptr; |
y = yptr; |
file1 = new char[1000]; |
memset(file1, 0, sizeof(*file1)*1000); |
dealloc = false; |
} |
/** |
The destructor deallocates the memory where the vectors x, y are stored |
Parameters: |
100,8 → 108,10 |
*/ |
tablefunct::~tablefunct() |
{ |
delete [] x; |
delete [] y; |
if (dealloc){ |
delete [] x; |
delete [] y; |
} |
delete [] file1; |
} |
/trunk/SIFEL/GEFEL/tablefunct.h |
---|
21,7 → 21,8 |
public: |
tablefunct(); |
tablefunct(long n); |
tablefunct(long n,long it); |
tablefunct(long n, long it); |
tablefunct(double *px, double *py, long n, interpoltype it=piecewiselin); |
~tablefunct(); |
void read (XFILE *in); |
55,6 → 56,8 |
double *y; |
/// data file for reading |
char *file1; |
/// flag for x and y array deallocation |
bool dealloc; |
private: |
double piecewise_const_interpol (double temp); |
/trunk/SIFEL/GEFEL/timecontr.cpp |
---|
1,5 → 1,6 |
#include "timecontr.h" |
#include <stdlib.h> |
#include "timecontr.h" |
#include <math.h> |
timecontr::timecontr (void) |
{ |
31,6 → 32,10 |
it_step = -1.0; |
// indicator of important times |
iiit=0; |
// backup of iiit, i.e. iiit from previous time step |
biiit = 0; |
// flag for taking important times exactly |
exact_impt=true; |
// type of time controller |
tct=notct; |
81,7 → 86,10 |
// important times |
// pokus JM 29.5.2008 |
if (nit == -1){ |
if (nit < 0){ |
if (nit == -2) |
exact_impt = false; |
xfscanf (in,"%lf",&it_step); |
nit = long((end_time - start_time)/it_step); |
if (nit < 2) |
268,6 → 276,25 |
{ |
double newtime, forwarddtu; |
biiit = iiit; |
if (exact_impt == false){ |
// important times are required approximately |
if (apit<nit){ |
// time difference between attained time and actual important time |
double ptitdt = fabs(time - imptime[apit]); |
// time difference between new time and actual important time |
double atitdt = fabs(time + dt - imptime[apit]); |
// time difference between next possible new time and actual important time |
double ntitdt = fabs(time + dt + dt - imptime[apit]); |
// test if the solver enlarged the time increment comparing to previous one |
if ((atitdt < ntitdt) && (ptitdt < atitdt) && (iiit == 0)) |
// the new actual time should be the closest one -> do not enlarge time increment |
// if solver proposed so and use the original time increment |
if (dt > forwarddt) |
dt = forwarddt; |
} |
} |
// trial time step prescribed by user |
forwarddtu=timefun.getval(time); |
379,16 → 406,34 |
// indicator of important time |
iiit=0; |
if (apit<nit){ |
if (imptime[apit]<=newtime){ |
//fprintf (stdout,"\n\n jsme v important time %ld\n\n",apit); |
newtime=imptime[apit]; |
// change actual time step |
forwarddt=newtime-time; |
iiit=1; |
apit++; |
if (exact_impt){ |
if (apit<nit){ |
if (imptime[apit]<=newtime){ |
//fprintf (stdout,"\n\n jsme v important time %ld\n\n",apit); |
newtime=imptime[apit]; |
// change actual time step |
forwarddt=newtime-time; |
iiit=1; |
apit++; |
} |
} |
} |
} |
else{ |
// important times will be taken approximately, |
// the closest attained time step to the actual important time will be considered as the important one |
// no reduction of time step will be performed |
if (apit<nit){ |
// time difference between actual time and actual important time |
double atitdt = fabs(newtime - imptime[apit]); |
// time difference between next possible time and actual important time |
double ntitdt = fabs(newtime + forwarddt - imptime[apit]); |
if (atitdt <= ntitdt){ |
// the actual time is the closest one probably |
iiit=1; |
apit++; |
} |
} |
} |
// new time |
time=newtime; |
413,20 → 458,27 |
*/ |
void timecontr::oldtime () |
{ |
if (apit>0){ |
if (imptime[apit-1]==time){ |
apit--; |
if (exact_impt){ |
if (apit>0){ |
if (imptime[apit-1]==time){ |
apit--; |
} |
} |
} |
else{ |
if ((apit>0) && iiit) apit--; |
} |
// back shift in time to the previous value |
time-=backwarddt; |
if (imptime[apit]==time) |
iiit=1; |
else |
iiit=0; |
iiit = biiit; |
if (exact_impt){ |
if (imptime[apit]==time) |
iiit=1; |
else |
iiit=0; |
} |
} |
533,6 → 585,7 |
start_time = tc.start_time; |
end_time = tc.end_time; |
iiit = tc.iiit; |
exact_impt = tc.exact_impt; |
} |
583,6 → 636,7 |
timefun.initiate (tc.timefun); |
nit = tc.nit; |
exact_impt = tc.exact_impt; |
imptime = new double [nit]; |
for (i=0;i<nit;i++){ |
imptime[i]=tc.imptime[i]; |
640,6 → 694,8 |
backwarddt = tc.backwarddt; |
forwarddt = tc.forwarddt; |
bfdt = tc.bfdt; |
bsdt = tc.bsdt; |
bfdtu = tc.bfdtu; |
apit = tc.apit; |
iiit = tc.iiit; |
} |
/trunk/SIFEL/GEFEL/timecontr.h |
---|
67,7 → 67,17 |
/// iiit=0 - no |
/// iiit=1 - yes |
long iiit; |
/// backup of iiit from previous time step |
long biiit; |
/** |
flag for taking important times exactly, i.e. |
exact_impt == true (default) -> time increment may be reduced in order the given important times can be attained exactly |
exact_impt == true, time increment will not be reduced with respect to given important times and the closest attained time |
step will be considered to be important one. |
*/ |
bool exact_impt; |
double it_step; |
/** type of time controller |
/trunk/SIFEL/GEFEL/vector.cpp |
---|
786,7 → 786,7 |
/** |
The function copies array given by src to vector dest. |
The function copies array given by src to %vector dest. |
@param src is source array to copy |
@param dest is the structure of destination vector which will be copied contents of src to |
808,6 → 808,28 |
/** |
The function copies integer array given by src to %vector dest. |
@param src is source array to copy |
@param dest is the structure of destination vector which will be copied contents of src to |
@b Requests : |
dest has to be setuped dimensions and allocated memory array for required elements. |
Number of copied elements is given by the dest dimension |
@retval 0 : on succes |
created 4.10.2007 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
long copyv(const long *src, ivector &dest) |
{ |
memcpy(dest.a, src, sizeof(*dest.a)*dest.n); |
return (0); |
} |
/** |
The function copies vector given by src to array dest. |
@param src is the structure of source vector to copy |
981,7 → 1003,7 |
created 08.2011 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
long copymultv(const vector &src, vector &dest, const double c) |
long copymultv(const vector &src, vector &dest, double c) |
{ |
if (src.n != dest.n) |
{ |
1013,7 → 1035,7 |
created 08.2011 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
long copymultv(const ivector &src, ivector &dest, const long c) |
long copymultv(const ivector &src, ivector &dest, long c) |
{ |
if (src.n != dest.n) |
{ |
1041,7 → 1063,7 |
created 08.2011 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
long copymultv(const double *src, double *dest, const double c, long n) |
long copymultv(const double *src, double *dest, double c, long n) |
{ |
long i; |
for (i=0; i<n; i++) |
1864,6 → 1886,36 |
/** |
The function computes scalar product of the %vector given by a and %vector given by b, |
i.e. it returns a.b. |
@param[in] a is the structure of the %vector with left factor |
@param[in] b is the structure of the scalar multiplied %vector |
@b Requests : |
a and b have to be same dimension |
@returns The function returns the scalar product of the vectors a and b. |
created 03.2024 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
double scprd(const vector &a, const vector &b) |
{ |
if (a.n != b.n) |
{ |
print_err("cannot perform scalar product of vectors due to their incompatible dimensions\n" |
"a(%ld) X b(%ld)", __FILE__, __LINE__, __func__, a.n, b.n); |
abort(); |
} |
double scalar = 0.0; |
for (long i=0; i < a.n; i++) |
scalar += a(i) * b(i); |
return (scalar); |
} |
/** |
The function computes the scalar product of the %vector given by a and %vector given by b. |
@param a - onedimensional array of the first multiplied %vector |
1889,13 → 1941,48 |
#ifdef INC_OPENMP |
/** |
The function computes scalar product of the %vector given by a and %vector given by b on several threads. |
It returns a.b. |
@param[in] a is the structure of the %vector with left factor |
@param[in] b is the structure of the scalar multiplied %vector |
@param[in] nt - number of threads used |
@b Requests : |
a and b have to be same dimension |
@returns The function returns the scalar product of the vectors a and b. |
created 03.2024 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
double scprd_t(const vector &a, const vector &b, long nt) |
{ |
if (a.n != b.n) |
{ |
print_err("cannot perform scalar product of vectors due to their incompatible dimensions\n" |
"a(%ld) X b(%ld)", __FILE__, __LINE__, __func__, a.n, b.n); |
abort(); |
} |
double scalar = 0.0; |
#pragma omp parallel num_threads(nt) |
{ |
#pragma omp for reduction(+:scalar) |
for (long i=0; i < a.n; i++) |
scalar += a(i) * b(i); |
} |
return (scalar); |
} |
/** |
The function computes the scalar product of the %vector given by a and %vector given by b |
on several threads. |
@param a - onedimensional array of the first multiplied %vector |
@param b - onedimensional array of the second multiplied %vector |
@param n - number of components in arrays a and b. |
@param nt - number of threads used |
@param a[in] - onedimensional array of the first multiplied %vector |
@param b[in] - onedimensional array of the second multiplied %vector |
@param n[in] - number of components in arrays a and b. |
@param nt[in] - number of threads used |
@b Requests : |
a and b must have the same dimension |
1975,7 → 2062,7 |
/** |
The function multiplies %vector given by u by real constant c, |
the result is stored in the double %vector v |
the result is stored in the double %vector v, i.e. v = c.u |
@param c is the real number type double |
@param u is the structure of the %vector, which is multiplied |
2009,7 → 2096,7 |
/** |
The function multiplies %ivector given by u by real constant c, |
the result is stored in the double %ivector v |
the result is stored in the double %ivector v, i.e. v = c.u |
@param c is the real number type double |
@param u is the structure of the %ivector, which is multiplied |
2043,7 → 2130,7 |
/** |
The function multiplies %ivector given by u by integer constant c, |
the result is stored in the %vector v |
the result is stored in the %vector v, i.e. v = c.u |
@param c is the integer number type long |
@param u is the structure of the %ivector, which is multiplied |
2710,7 → 2797,7 |
@retval 1 : in case NULL pointer of the in parameter |
@retval 2 : in case error reading number from the file |
created 3.12.2006 by Jaroslav Kruis, jk@cml.fsv.cvut.cz |
created 3.12.2006 by Jaroslav Kruis, jaorslav.kruis@fsv.cvut.cz |
*/ |
long readv(XFILE *in, vector &u) |
{ |
/trunk/SIFEL/GEFEL/vector.h |
---|
390,11 → 390,14 |
long copyv(const vector &src, vector &dest); |
/// copies contents of %ivector |
long copyv(const ivector &src, ivector &dest); |
/// copies contents of array |
long copyv(const long *src,long *dest,long n); |
/// copies contents of array |
long copyv(const double *src, double *dest, long n); |
/// copies contents of array to vector |
long copyv(const double *src, vector &dest); |
/// copies contents of array to vector |
long copyv(const long *src, ivector &dest); |
/// copies contents of vector to array |
long copyv(const vector &src, double *dest); |
/// copies contents of ivector to array |
409,11 → 412,11 |
long rcopyv(const double *src, long src_fi, long src_n, double *dest, long dest_fi, long dest_n, long n); |
/// copies contents of %vector multiplied by scalar |
long copymultv(const vector &src, vector &dest, const double c); |
long copymultv(const vector &src, vector &dest, double c); |
/// copies contents of %ivector multiplied by scalar |
long copymultv(const ivector &src, ivector &dest, const long c); |
long copymultv(const ivector &src, ivector &dest, long c); |
/// copies contents of array multiplied by scalar |
long copymultv(const double *src, double *dest, const double c, long n); |
long copymultv(const double *src, double *dest, double c, long n); |
/// fills contents of %vector with value c |
long fillv(double c, vector &vec); |
446,7 → 449,7 |
/// adds 2 vectors c = a+b |
long addv(const vector &a, const vector &b, vector &c); |
/// adds vectors a = a+b |
long addv(const vector &a, const vector &b); |
long addv(vector &a, const vector &b); |
/// adds 2 double arrays, 2nd array is multplied by constant c = a + bc*b |
void addmultv(const vector &a, const vector &b, double bc, vector &c); |
/// adds 2 double arrays, 2nd array is multplied by constant a = a + bc*b |
476,7 → 479,7 |
/// subtracts 2 vectors |
long subv(const vector &a, const vector &b, vector &c); |
/// subtracts 2 vectors |
long subv(const vector &a, const vector &b); |
long subv(vector &a, const vector &b); |
/// subtracts 2 ivectors |
long subv(const ivector &a, const ivector &b, ivector &c); |
492,10 → 495,14 |
/// performs scalar product of 2 vectors |
long scprd(const vector &a, const vector &b, double &scalar); |
/// performs scalar product of 2 vectors |
double scprd(const vector &a, const vector &b); |
/// performs scalar product of 2 ivectors |
long scprd(const ivector &a, const ivector &b, long &scalar); |
/// performs scalar product of 2 arrays |
double scprd(const double *a, const double *b, long n); |
/// performs scalar product of 2 vectors |
double scprd_t(const vector &a, const vector &b, long nt); |
/// performs scalar product of two arrays on several threads |
double scprd_t(const double *a, const double *b, long n, long nt); |
/// performs scalar product of 2 arrays |
502,11 → 509,11 |
double ss (double *a,double *b,long n); |
/// multiplies %vector by constant |
long cmulv(double c, const vector &a, vector &u); |
long cmulv(double c, const vector &u, vector &v); |
/// multiplies %ivector by constant of type double |
long cmulv(double c, const ivector &a, vector &u); |
long cmulv(double c, const ivector &u, vector &v); |
/// multiplies %ivector by constant of type long |
long cmulv(long c, const ivector &a, ivector &u); |
long cmulv(long c, const ivector &u, ivector &v); |
/// multiplies %vector by constant |
long cmulv(double c, vector &a); |
/trunk/SIFEL/MEFEL/PREP/mechprep.cpp |
---|
122,6 → 122,8 |
fprintf (stdout,"\n\n *** MEFEL PREPROCESSOR ***\n"); |
fprintf (stdout," --------------------------\n"); |
initnull_glob(); |
Mp = new probdesc; |
Gtm = new gtopology; |
Top = new siftop; |
158,6 → 160,7 |
Qhex = new quadhex; |
Spltr = new soilplatetr; |
Splq = new soilplateq; |
Hexifc = new hexinterface; |
Check_unused_prop = 1; |
if (argc < 3){ |
291,45 → 294,8 |
fprintf(stdout, "\n"); |
fprintf(stderr, "\n"); |
delete_glob(); |
delete Mp; |
delete Mt; |
delete Gtm; |
delete Mm; |
delete Mc; |
delete Mb; |
delete Outdm; |
delete Bar2d; |
delete Bar3d; |
delete Beam2d; |
delete Beam3d; |
delete Spring; |
delete Pelt; |
delete Peqt; |
delete Perlt; |
delete Pelq; |
delete Peqq; |
delete Perlq; |
delete Pesqt; |
delete Pqifc; |
delete Cct; |
delete Dkt; |
delete Dst; |
delete Dkqelem; |
delete Q4pl; |
delete Asymlq; |
delete Asymqq; |
delete Asymlt; |
delete Shtr; |
delete Shq; |
delete Ltet; |
delete Lhex; |
delete Qhex; |
delete Qkirch; |
delete Spltr; |
delete Splq; |
return(0); |
} |
/trunk/SIFEL/MEFEL/SRC/aci78.cpp |
---|
131,7 → 131,7 |
//coefficient q_5 (127) |
q_5=1.0; |
if(curing!=STEAM_CURING){ |
if (t_end_curing<=1.0) q_5=1.0; |
//if (t_end_curing<=1.0) q_5=1.0; |
if (t_end_curing<=90.0){ |
tb.itype=lagrange; |
tb.asize=6; |
/trunk/SIFEL/MEFEL/SRC/adaptivity.cpp |
---|
1,31 → 1,11 |
//#include <math.h> |
//#include <stdio.h> |
//#include <string.h> |
//#include <time.h> |
// |
#include "elemhead.h" |
//#include "alias.h" |
//#include "vector.h" |
//#include "matrix.h" |
//#include "gtopology.h" |
#include "adaptivity.h" |
#include "gadaptivity.h" |
////#include "least_square.h" |
#include "element.h" |
#include "intpoints.h" |
//#include "loadcase.h" |
//#include "mechprint.h" |
//#include "j2flow.h" // docasne |
// |
//#include "mechmat.h" |
// |
// |
// |
//#include "vecttens.h" |
#include "adaptivity.h" |
#include "z2_smoothing.h" |
#include "global.h" |
#include "elemhead.h" |
#include "elemswitch.h" |
#include "probdesc.h" |
#include "mechtop.h" |
87,7 → 67,7 |
long adaptivity :: run (long of, int width, long nincr) |
{ |
long hod,min; |
double sec; |
double sec=0.0; |
if (Mespr==1){ |
fprintf (stdout,"\n\n *********************************"); |
/trunk/SIFEL/MEFEL/SRC/alias.h |
---|
29,9 → 29,9 |
//aliases for nonlinear statics solvers |
enum nonlinsolvertype {arcl=1,newton=2,arclrv1=3,newtonrv1=4,newtonrestart=5,displctrl=6,displctrlrv=7,arclrv=8,adaptram=10,arclg=20,newtong=30}; |
enum nonlinsolvertype {arcl=1,newton=2,arclrv1=3,newtonrv1=4,newtonrestart=5,displctrl=6,displctrlrv=7,arclrv=8,adaptram=10,arclg=20,newtong=30,dissip_incr=40}; |
const enumstr nonlinsolvertypestr[] = {{"arcl",1}, {"newton",2}, {"arclrv1",3}, {"newtonrv1",4}, {"newtonrestart",5}, |
{"displctrl",6}, {"displctrlrv",7}, {"arclrv",8}, {"adaptram",10}, {"arclg",20}, {"newtong", 30}}; |
{"displctrl",6}, {"displctrlrv",7}, {"arclrv",8}, {"adaptram",10}, {"arclg",20}, {"newtong", 30}, {"dissip_incr", 40}}; |
const kwdset nonlinsolvertype_kwdset(sizeof(nonlinsolvertypestr)/sizeof(*nonlinsolvertypestr), nonlinsolvertypestr); |
315,10 → 315,10 |
// aliases for type of printed unknown |
enum prunk {pr_displ=1, pr_strains=2, pr_stresses=3, pr_forces=4, pr_react=5, |
pr_stepid=6, pr_appload=7, pr_other=8, pr_time=9, pr_eigval=10, pr_macrostrain=11, pr_macrostress=12}; |
pr_stepid=6, pr_appload=7, pr_other=8, pr_time=9, pr_eigval=10, pr_macrostrain=11, pr_macrostress=12, pr_residual=13}; |
const enumstr prunkstr[] = {{"pr_displ",1}, {"pr_strains",2}, {"pr_stresses",3}, {"pr_forces",4}, |
{"pr_react",5}, {"pr_stepid",6}, {"pr_appload",7}, {"pr_other",8}, |
{"pr_time",9}, {"pr_eigval",10},{"pr_macrostrain",11},{"pr_macrostress",12}}; |
{"pr_time",9}, {"pr_eigval",10},{"pr_macrostrain",11},{"pr_macrostress",12}, {"pr_residual",13}}; |
const kwdset prunk_kwdset(sizeof(prunkstr)/sizeof(*prunkstr), prunkstr); |
/trunk/SIFEL/MEFEL/SRC/anisodam.cpp |
---|
542,7 → 542,7 |
*/ |
double anisodam::brittle_damage(long ipp, double y, double e, double f, double uf, double omegao) |
{ |
double err,omega = 0.0, dtmp, tmp, h, indam, kappa; |
double err,omega = 0.0, dtmp, tmp, h=0.0, indam, kappa; |
long i,ni, eid; |
ni=sra.give_ni (); |
583,6 → 583,7 |
} |
// it is better to start from omega=1 in order to avoid of convergention problems |
omega = 1.0; |
tmp = 0.0; |
for (i = 0; i < ni; i++) |
{ |
dtmp = -e*kappa+f/uf*h*kappa*exp(-h*omega*kappa/uf); |
/trunk/SIFEL/MEFEL/SRC/anisodamrot.cpp |
---|
476,7 → 476,7 |
*/ |
double anisodamrot::brittle_damage(long ipp, double y, double e, double f, double uf, double omegao) |
{ |
double err,omega = 0.0, dtmp, tmp, h, indam, kappa; |
double err,omega = 0.0, dtmp, tmp, h=0.0, indam, kappa; |
long i,ni, eid; |
ni=sra.give_ni (); |
517,6 → 517,7 |
} |
// it is better to start from omega=1 in order to avoid of convergention problems |
omega = 1.0; |
tmp = 0.0; |
for (i = 0; i < ni; i++) |
{ |
dtmp = -e*kappa+f/uf*h*kappa*exp(-h*omega*kappa/uf); |
/trunk/SIFEL/MEFEL/SRC/arclength.cpp |
---|
46,6 → 46,7 |
long li, double ilambda, answertype outres) |
{ |
long i,j,n,ni,ini,stop,stopj,modif; |
nonlinsolvertype nlst; // type of nonlinear solver |
double dl; // actual value of arc length increment |
double dlmin; // minimum value of arc length increment |
double dlmax; // maximum value of arc length increment |
77,9 → 78,13 |
resnormt normt; // type of residual vector norm |
matrix lsm_a(3,3); // least square matrix for the divergence detection |
vector lsm_r(3), lsm_l(3); // right hand and left hand side for the divergence detection |
double nom, denom; // auxiliary variables for the dissipation increment control |
double tau = nlman->tau_ini; // actual value of required dissipation increment |
// type of nonlinear solver |
nlst = nlman->tnlinsol; |
// number of rows of the matrix |
n = Ndofm; |
// initial value of load coefficient |
99,7 → 104,7 |
// displacement-loading driving switch |
psi = nlman->psial; |
//type of residual vector norm |
normt = nlman->rnormtnr; |
normt = nlman->rnormtnr; |
// allocation of auxiliary arrays |
r = new double[n]; |
185,13 → 190,25 |
// square of generalized norm of displacement increments |
norv = displincr(lcid, i, nlman, v, v, n); |
if ((i == 0) && (psi < 0.0) && (norfp > Mp->zero)) |
psi0 = psi = sqrt(norv/norfp/norfp); |
if (nlst == dissip_incr){ |
nom = scprd(fp, ra, n) - 2.0*nlman->tau; |
denom = scprd(fp, v, n); |
if (denom == 0.0) |
dlambda = 0.0; // proceed with alternative setup for arclength |
else |
dlambda = nom/denom; |
if (dlambda < nlman->tau_lim) // dissipated energy increment is too small => switch to arc-length method with alternative setup |
dlambda = 0.0; |
} |
if ((nlst != dissip_incr) || (dlambda == 0.0)){ |
if ((i == 0) && (psi < 0.0) && (norfp > Mp->zero)) |
psi0 = psi = sqrt(norv/norfp/norfp); |
// compute new dlambda increment |
tmp = norv+psi*psi*norfp*norfp; |
// compute new dlambda increment |
dlambda = dl/sqrt(tmp); |
// compute new dlambda increment |
tmp = norv+psi*psi*norfp*norfp; |
// compute new dlambda increment |
dlambda = dl/sqrt(tmp); |
} |
// check required value of load coefficient lambdar |
if ((check_rv_fp == on) && (dlambda+lambda > nlman->lambdar)) |
208,7 → 225,7 |
} |
// ddr[j]=dlambda*v[j]; |
copymultv(v, ddr, dlambda, n); |
cmulv(dlambda, v, ddr, n); |
// ra[j]+=ddr[j]; |
addv(ra, ddr, n); |
235,8 → 252,9 |
// computation of internal forces |
internal_forces (lcid,fi); |
Mp->lambda -= ddlambda; // restore state |
fflush(Out); |
// f[j] = fa[j]-fi[j] |
// compute residual vector f[j] = fa[j]-fi[j] |
subv(fa, fi, f, n); |
// compute norm of the residual vector |
285,7 → 303,10 |
if (Mespr==1) |
fprintf(stdout,"\n increment %ld norf=%e ierr=%e ddlambda=%e dlambda=%e",i,norf,ierr, ddlambda, dlambda); |
totl += dl; |
if (nlst == dissip_incr) |
totl += tau; |
else |
totl += dl; |
modif++; |
309,8 → 330,8 |
if (outres == yes) |
{ |
compute_req_val(lcid); |
print_step(lcid, i+1, lambda, fa); |
// print_step(lcid, (i+1)*100, lambda, fa); |
print_step(lcid, i+1, lambda, fa, f); |
// print_step(lcid, (i+1)*100, lambda, fa, f); |
print_flush(); |
} |
325,6 → 346,15 |
continue; |
} |
/* |
else{ |
if (outres == yes){ |
compute_req_val(lcid); |
print_step(lcid, (i+1)*100, lambda, fa, f); |
print_flush(); |
} |
}*/ |
// *************************************** |
// * inner iteration loop * |
// *************************************** |
442,16 → 472,17 |
Mm->updateipval(); |
compute_req_val (lcid); |
print_step(lcid, i+1, lambda, fa); |
//print_step(lcid, (i+1)*100+j+1, lambda, fa); |
//print_step(lcid, (i+1)*100+j+1, lambda, fa, f); |
print_flush(); |
totl += dl; |
stop=1; |
break; |
}/* |
} |
/* |
else{ |
print_step(lcid, (i+1)*100+j+1, lambda, fa); |
print_step(lcid, (i+1)*100+j+1, lambda, fa, f); |
print_flush(); |
}*/ |
}*/ |
// divergence detection with help of least square method |
stopj = check_divergency(nlman, lsm_a, lsm_r, lsm_l, j, norf); |
538,7 → 569,7 |
} |
compute_req_val (lcid); |
print_step_forced(lcid, i+1, lambda, fa); |
//print_step_forced(lcid, (i+1)*100+j+1, lambda, fa); |
//print_step_forced(lcid, (i+1)*100+j+1, lambda, fa, f); |
print_flush(); |
} |
1241,7 → 1272,7 |
double displincr (long lcid, long istep, nonlinman *nlman, double *dr1, double *dr2, long n) |
{ |
long i; |
double norm,u1,u2,v1,v2,w1,w2,aux; |
double norm=0.0,u1,u2,v1,v2,w1,w2,aux; |
double *mstra = NULL; |
strastre *ssa = NULL; |
1405,7 → 1436,7 |
case seldofscoord: |
case selmstr: |
case selecnodes:{ |
a0 = norddr = displincr(lcid, istep, nlman, ddr, ddr, n); |
a0 = displincr(lcid, istep, nlman, ddr, ddr, n); |
a2 = displincr(lcid, istep, nlman, v, v, n); |
norddrv = displincr(lcid, istep, nlman, ddr, v, n); |
a1 = 2.0*norddrv; |
1506,6 → 1537,8 |
a0 = displincr(lcid, istep, nlman, ddrprev, ddrprev, n); |
a0 += ddlambda*ddlambda*psi*psi*norfp*norfp - dl*dl; |
break; |
/* case dissip_incr: |
a0 = */ |
default:{ |
print_err("unknown type of detemination of lambda parameter is required",__FILE__,__LINE__,__func__); |
} |
/trunk/SIFEL/MEFEL/SRC/axisymlq-nb3.cpp |
---|
6,6 → 6,8 |
#include "node.h" |
#include "loadcase.h" |
#include "intpoints.h" |
#include "mechtop.h" |
#include "mechmat.h" |
#include <math.h> |
#include <stdlib.h> |
/trunk/SIFEL/MEFEL/SRC/axisymlq.cpp |
---|
2284,13 → 2284,13 |
ipval = approx (xi,eta,anv); |
ncompstr = Mm->ip[ipp].ncompstr; |
ncompeqother = Mm->ip[ipp].ncompeqother; |
if ((ict & inistrain) && (j < Mm->ip[ipp].ncompstr)) |
if ((ict & inistrain) && (j < ncompstr)) |
{ |
Mm->ip[ipp].strain[j] += ipval; |
ipp++; |
continue; |
} |
if ((ict & inistress) && (j < nstra + Mm->ip[ipp].ncompstr)) |
if ((ict & inistress) && (j < nstra + ncompstr)) |
{ |
Mm->ip[ipp].stress[j] += ipval; |
ipp++; |
/trunk/SIFEL/MEFEL/SRC/axisymlt.cpp |
---|
1718,7 → 1718,6 |
void axisymlt::compute_nlstress(long /*lcid*/,long eid,long ri,long ci) |
{ |
long i,ii,ipp; |
intpoints *ip=NULL; |
for (ii=0;ii<nb;ii++){ |
if (intordsm[ii][ii]==0) continue; |
1727,7 → 1726,7 |
for (i=0;i<intordsm[ii][ii];i++){ |
// computation of correct stresses |
if (Mp->strcomp==1) |
Mm->computenlstresses (ipp,ip[0]); |
Mm->computenlstresses (ipp,Mm->ip[ipp]); |
ipp++; |
} |
} |
1748,7 → 1747,6 |
void axisymlt::local_values(long /*lcid*/,long eid,long ri,long ci) |
{ |
long i,ii,ipp; |
intpoints *ip=NULL; |
for (ii=0;ii<nb;ii++){ |
if (intordsm[ii][ii]==0) continue; |
1757,7 → 1755,7 |
for (i=0;i<intordsm[ii][ii];i++){ |
// computation of correct stresses |
if (Mp->strcomp==1) |
Mm->computenlstresses (ipp,ip[0]); |
Mm->computenlstresses (ipp,Mm->ip[ipp]); |
ipp++; |
} |
} |
/trunk/SIFEL/MEFEL/SRC/axisymqq_nb3.cpp |
---|
6,6 → 6,7 |
#include "node.h" |
#include "loadcase.h" |
#include "intpoints.h" |
#include "mechtop.h" |
#include <math.h> |
#include <stdlib.h> |
/trunk/SIFEL/MEFEL/SRC/barel3d.cpp |
---|
1342,7 → 1342,7 |
ipp++; |
continue; |
} |
if ((ictn[0] & iniother) && (j < nstra+nstre+ncompeqother)) |
if ((ictn[0] & iniother) && (j < nstra+nstre+Mm->ip[ipp].ncompeqother)) |
{ |
Mm->ip[ipp].eqother[idoth] += ipval; |
ipp++; |
/trunk/SIFEL/MEFEL/SRC/beam2dspec.cpp |
---|
6,6 → 6,9 |
#include "node.h" |
#include "intpoints.h" |
#include "normmat.h" |
#include "mechtop.h" |
#include "probdesc.h" |
#include "mechcrsec.h" |
#include <math.h> |
/trunk/SIFEL/MEFEL/SRC/boermat.cpp |
---|
235,7 → 235,7 |
{ |
long i,ni,nc=Mm->ip[ipp].ncompstr; |
double gamma,err; |
vector epsn(ASTCKVEC(nc)), epsp(ASTCKVEC(nc)), q(ASTCKVEC(0)); |
vector epsn(ASTCKVEC(nc)), epsp(ASTCKVEC(nc)), q(0); |
// initial values |
for (i=0; i<nc; i++) |
280,7 → 280,7 |
{ |
long i,ni,nc=Mm->ip[ipp].ncompstr; |
double gamma,err; |
vector epsn(ASTCKVEC(nc)), epsp(ASTCKVEC(nc)), q(ASTCKVEC(0)); |
vector epsn(ASTCKVEC(nc)), epsp(ASTCKVEC(nc)), q(0); |
// initial values |
for (i=0; i<nc; i++) |
/trunk/SIFEL/MEFEL/SRC/consol.cpp |
---|
369,9 → 369,9 |
p=0.5*(1.-gama*vv/(-f)); |
if(p>=0.5) |
pp=0.0001; |
if(p>=0.4) |
else if(p>=0.4) |
pp=(0.5*0.4/(0.5-0.4)+0.5)-0.5/(0.5-0.4)*p; |
if(p>=0.24) |
else if(p>=0.24) |
pp=(0.5*0.24/(0.4-0.24)+1.)-0.5/(0.4-0.24)*p; |
else if(p>=0.06) |
pp=(0.06/(0.24-0.06)+2.)-1./(0.24-0.06)*p; |
/trunk/SIFEL/MEFEL/SRC/creep.cpp |
---|
121,6 → 121,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
262,6 → 263,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
347,6 → 349,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
457,6 → 460,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
486,6 → 490,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
543,6 → 548,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
679,6 → 685,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
863,6 → 870,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
895,6 → 903,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
949,6 → 958,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
1104,7 → 1114,6 |
{ |
long i,j; |
double nu; |
strastrestate ss; |
// number of stres components on element |
long nc=Mm->ip[ipp].ncompstr; |
1111,9 → 1120,6 |
vector eps_old(ASTCKVEC(nc)), deps(ASTCKVEC(nc)), depstot(ASTCKVEC(nc)), deps_cr(ASTCKVEC(nc)), deps_sh(ASTCKVEC(nc)), deps_ss(ASTCKVEC(nc)); |
matrix d(ASTCKMAT(nc,nc)); |
// stress/strain state; planestress=10,planestrain=11,plate=15,axisymm=20,shell=25,spacestress=30 |
ss=Mm->ip[ipp].ssst; |
// memory clearing |
fillv(0.0,eps_old); |
fillv(0.0,deps); |
1158,6 → 1164,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
1272,6 → 1279,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
1553,6 → 1561,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
1594,6 → 1603,7 |
} |
default:{ |
print_err("\n Unknown material type required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
/trunk/SIFEL/MEFEL/SRC/creep_b3.cpp |
---|
379,11 → 379,8 |
*/ |
void b3mat::updatevalues (long ipp, long ido) |
{ |
long nc; |
double beta; |
nc=Mm->ip[ipp].ncompstr; |
//updating of beta_t |
//beta_t computation |
beta = compute_beta_t(ipp); |
601,16 → 598,20 |
*/ |
double b3mat::compute_beta_t(long ipp) |
{ |
long nc,n_ret_times; |
double beta,tempr,uh_R,temprinit; |
double beta,tempr=0.0,uh_R,temprinit=0.0; |
nc=Mm->ip[ipp].ncompstr; |
n_ret_times = give_nret_time (); |
if(Mm->givestatusnmq(temperature) == 1) |
tempr = Mm->givenonmechq(temperature, ipp); |
else{ |
print_err("cannot acquire temperature", __FILE__, __LINE__, __func__); |
abort(); |
} |
if(Mm->givestatusnmq(initial_temperature) == 1) |
temprinit = Mm->givenonmechq(initial_temperature, ipp); |
else{ |
print_err("cannot acquire initial temperature", __FILE__, __LINE__, __func__); |
abort(); |
} |
//toto musime casem upravit??!! |
if (tempr < 273.15) |
1068,7 → 1069,7 |
long i; |
long n_ret_times; |
long nc; |
double eps_sh; |
double eps_sh=0.0; |
nc=Mm->ip[ipp].ncompstr; |
n_ret_times = give_nret_time (); |
1712,6 → 1713,7 |
} |
default:{ |
print_err("\n Unknown type of component is required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
return (other); |
/trunk/SIFEL/MEFEL/SRC/creep_dpl.cpp |
---|
927,6 → 927,7 |
} |
default:{ |
print_err("\n Unknown type of component is required in ", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
return (other); |
/trunk/SIFEL/MEFEL/SRC/creep_effym.cpp |
---|
762,6 → 762,7 |
break; |
default: |
print_err("unknown type of function of Young modulus evolution", __FILE__, __LINE__, __func__); |
abort(); |
} |
return e; |
} |
/trunk/SIFEL/MEFEL/SRC/creep_rspec.cpp |
---|
427,11 → 427,8 |
*/ |
void rspecmat::updatevalues (long ipp, long im,long ido) |
{ |
long nc; |
double beta; |
nc=Mm->ip[ipp].ncompstr; |
//updating of beta_t |
//beta_t computation |
beta = compute_beta_t(ipp); |
1434,7 → 1431,7 |
long i; |
long n_ret_times; |
long nc; |
double eps_sh; |
double eps_sh=0.0; |
nc=Mm->ip[ipp].ncompstr; |
n_ret_times = give_nret_time (); |
1824,6 → 1821,7 |
} |
default:{ |
print_err("\n unknown type ft_flag is required \n",__FILE__, __LINE__, __func__); |
abort(); |
} |
} |
1951,6 → 1949,7 |
} |
default:{ |
fprintf (stderr,"\n\n unknown type of component is required in function (%s, line %d).\n",__FILE__,__LINE__); |
abort(); |
} |
} |
return (other); |
/trunk/SIFEL/MEFEL/SRC/creepb-f.cpp |
---|
3,6 → 3,8 |
#include "global.h" |
#include "globmat.h" |
#include "intpoints.h" |
#include "probdesc.h" |
#include "mechmat.h" |
#include <math.h> |
#include <stdlib.h> |
/trunk/SIFEL/MEFEL/SRC/creepb.cpp |
---|
782,22 → 782,22 |
c0=q2*q+q3*log(1.0+pow((t-t0),n))+q4*log(t/t0); |
// shrink and drying |
if ( type_h ==1){ |
if ( (t0>=t_w) ){ // if ( (t0>t_w) && (t<=(t_w+600.)) ){ |
if (type_h ==1){ |
if (t0>=t_w){ // if ( (t0>t_w) && (t<=(t_w+600.)) ){ |
// shrink from huminidy=1 to h_s |
tau=k_s*k_s*k_d*k_d*85000./pow(t,0.08)/pow(fc,0.25); |
esn=a1*1.2*(0.019*pow((wc*c_s),2.1)/pow(fc,0.28)+270.); |
ht0 =tanh(sqrt((t0-t_w)/tau)); |
ht =tanh(sqrt((t -t_w)/tau)); |
if(h_s<=0.98){kh=(1.0-pow(h_s,3.0));} |
else {kh=-10.0*(1.-h_s);} |
ht0 =tanh(sqrt((t0-t_w)/tau)); |
ht =tanh(sqrt((t -t_w)/tau)); |
if(h_s<=0.98){kh=(1.0-pow(h_s,3.0));} |
else {kh=-10.0*(1.-h_s);} |
// drying from huminidy=1 to h_s |
q5 = 0.757/fc/pow(esn,0.6); |
cd = q5*sqrt( exp(-8+8.*(1.0-h_s)*ht)-exp(-8.+8.*(1.0-h_s)*ht0) ); |
} |
else { |
cd = 0.0; |
} |
} |
else { |
cd = 0.0; |
} |
} |
else { |
// shrink and drying from changeing humidity |
804,7 → 804,7 |
dh_s = h_s-h_slast; // humidity |
esn = a1*1.2*(0.019*pow((wc*c_s),2.1)/pow(fc,0.28)+270.); |
kh = 3.0*h_s*h_s; |
q5 = 0.35/fc; |
q5 = 0.35/fc; |
cd = fabs(q5*esn*kh*dh_s); |
} |
if ( type_temp ==1 ){ |
/trunk/SIFEL/MEFEL/SRC/creepbbeam.cpp |
---|
5,6 → 5,9 |
#include "global.h" |
#include "globmat.h" |
#include "intpoints.h" |
#include "probdesc.h" |
#include "mechmat.h" |
#include "vector.h" |
#include <stdlib.h> |
#include <math.h> |
/trunk/SIFEL/MEFEL/SRC/creepbs.cpp |
---|
6,6 → 6,8 |
#include "globmat.h" |
#include "intpoints.h" |
#include "elastisomat.h" |
#include "probdesc.h" |
#include "mechmat.h" |
#include <stdlib.h> |
#include <math.h> |
/trunk/SIFEL/MEFEL/SRC/creepbs.h |
---|
3,7 → 3,9 |
#include "xfile.h" |
#include "alias.h" |
struct matrix; |
#include "galias.h" |
#include "matrix.h" |
struct vector; |
/trunk/SIFEL/MEFEL/SRC/damplast.cpp |
---|
149,6 → 149,6 |
double ft; |
long ncompo; |
ncompo = Mm->givencompeqother(ipp, im+1); |
ft = Mm->give_actual_ft(ipp, im+2, ido); |
ft = Mm->give_actual_ft(ipp, im+2, ido+ncompo); |
return ft; |
} |
/trunk/SIFEL/MEFEL/SRC/damplastifacemat.cpp |
---|
20,6 → 20,7 |
{ |
ks = kn = 0.0; |
ft = wf = phideg = tanphi = c = 0.0; |
coref = no; |
} |
51,6 → 52,22 |
xfscanf(in, "%k%le %k%le %k%le %k%le", |
"ft", &ft, "wf", &wf, "phi_deg", &phideg, "cohesion", &c); |
sra.read(in); |
// read an optional treatment of corrosion effect |
xfscanf(in, "%k%m", "corrosion_effect", &answertype_kwdset, &coref); |
if (coref == yes){ |
// evolution function of the corrossion expansion factor alpha_c(t) |
xfscanf(in, "%k", "alpha_c"); |
alpha_c.read(in); |
// evolution function of the corrossion current density i_cor_func(t) |
xfscanf(in, "%k", "i_cor_func"); |
icor_func.read(in); |
// evolution function of the flux of corrosion products flux_cor_func(t) |
xfscanf(in, "%k", "flux_cor_func"); |
flux_cor_func.read(in); |
} |
tanphi = tan(phideg*M_PI/180); |
} |
71,6 → 88,13 |
fprintf(out, "%le %le ", ks, kn); |
fprintf(out, "%le %le %le %le ", ft, wf, phideg, c); |
sra.print(out); |
fprintf(out, " %d", coref); |
if (coref == yes){ |
alpha_c.print(out); |
icor_func.print(out); |
flux_cor_func.print(out); |
} |
} |
112,28 → 136,32 |
long i, nc = Mm->ip[ipp].ncompstr; |
double omega; |
switch (Mp->nlman->stmat) |
{ |
case initial_stiff: |
elmatstiff (d,ipp); |
break; |
case tangent_stiff: |
case secant_stiff: |
case incr_tangent_stiff: |
case ijth_tangent_stiff: |
elmatstiff (d,ipp); |
omega=Mm->ip[ipp].eqother[ido+1]; |
if (omega > 0.999999) |
if (Mp->nlman == NULL){ |
elmatstiff (d,ipp); |
} |
else{ |
switch (Mp->nlman->stmat){ |
case initial_stiff: |
elmatstiff (d,ipp); |
break; |
case tangent_stiff: |
case secant_stiff: |
case incr_tangent_stiff: |
case ijth_tangent_stiff: |
elmatstiff (d,ipp); |
omega=Mm->ip[ipp].eqother[ido+1]; |
if (omega > 0.999999) |
omega = 0.999999; |
d(nc-1,nc-1) *= (1-omega); |
// if plasticity has evolved (actual gamma - previous gamma > 0) then reduce shear stiffness |
if (Mm->ip[ipp].other[ido+3] - Mm->ip[ipp].eqother[ido+3] > 0.0){ |
d(nc-1,nc-1) *= (1-omega); |
// if plasticity has evolved (actual gamma - previous gamma > 0) then reduce shear stiffness |
if (Mm->ip[ipp].other[ido+3] - Mm->ip[ipp].eqother[ido+3] > 0.0){ |
for (i=0; i<nc-1; i++) |
d(i,i) *= 0.001; |
} |
break; |
default: |
print_err("unknown type of stifness matrix is required", __FILE__, __LINE__, __func__); |
} |
break; |
default: |
print_err("unknown type of stifness matrix is required", __FILE__, __LINE__, __func__); |
} |
} |
} |
156,6 → 184,7 |
long i, nc = Mm->ip[ipp].ncompstr; |
double omega, w, kappa, aft; |
double gamma, dup, epst, tau; |
double u_cor=0.0; |
vector sigma(ASTCKVEC(nc)), dd(ASTCKVEC(nc)), dds(ASTCKVEC(nc-1)); |
vector sepst(ASTCKVEC(nc-1)), sepsp(ASTCKVEC(nc-1)), dsepsp(ASTCKVEC(nc-1)), aux; |
177,23 → 206,50 |
omega = Mm->ip[ipp].eqother[ido+1]; |
w = Mm->ip[ipp].eqother[ido+2]; |
gamma = Mm->ip[ipp].eqother[ido+3]; |
if (coref == yes){ |
u_cor = Mm->ip[ipp].eqother[ido+nc-1+4]; |
} |
// actual tensile strength |
aft = Mm->give_actual_ft(ipp); |
if (coref == yes){ |
// corrosion effect is taken into account |
// numerical quadrature of the corroded thickness |
double dt = Mp->timecon.actualforwtimeincr(); |
double tn = Mp->time; |
double to = Mp->time - dt; |
const long order = 2; |
vector gp(ASTCKVEC(order)), w(ASTCKVEC(order)); |
double du_cor = 0.0; |
gauss_points (gp.a, w.a, order); |
for (i=0; i<order; i++){ |
// shift Gauss points and their weights due to integration limits \int_{to}^{tn} dtime |
gp[i] = 0.5*(tn+to)+0.5*dt*gp[i]; |
w[i] = 0.5*dt*w[i]; |
double icor = icor_func.getval(gp[i]); // current density at the shifted Gauss point |
double alpha = alpha_c.getval(gp[i]); // corrosion expansion factor at the shifted Gauss point |
double flux = flux_cor_func.getval(gp[i]); // flux contribution at the shifted Gauss point |
double dxcor = icor*0.0315*1e-6/3600.0; // increment of corroded thickness [m/s] |
// add contribution to the increment of thickness of corroded layer at the shifted Gauss point |
du_cor += w[i]*((alpha-1.0)*dxcor - flux); |
} |
// add integrated increment of the thickness of corroded layer |
u_cor += du_cor; |
// change the normal displacement difference |
dd(nc-1) -= u_cor; |
} |
// first calculate normal stress component that will be used in the yield condition for the shear stress component |
sigma(nc-1) = compute_normal_stress(dd(nc-1), aft, kappa, omega, w); |
sigma(nc-1) = compute_normal_stress(ipp, dd(nc-1), aft, kappa, omega, w); |
// calculate shear stress in the actual shear direction |
dup = 0.0; |
tau = compute_shear_stress(epst, aft, omega, kappa, sigma(nc-1), dup, gamma); |
tau = compute_shear_stress(ipp, epst, aft, omega, kappa, sigma(nc-1), dup, gamma); |
// calculate base vector of the actual shear direction -> sepst |
if (fabs(epst) > Mp->zero) |
if (fabs(epst) > 0.0) |
cmulv(1.0/epst, sepst); |
else |
nullv(sepst); |
// calculate increments of plastic shear components |
cmulv(dup, sepst, dsepsp); |
addv(sepsp, dsepsp, sepsp); |
212,6 → 268,9 |
Mm->ip[ipp].other[ido+3] = gamma; |
for(i=0; i<nc-1; i++) |
Mm->ip[ipp].other[ido+4+i] = sepsp(i); |
if (coref == yes){ |
Mm->ip[ipp].other[ido+nc-1+4] = u_cor; |
} |
} |
242,6 → 301,7 |
The function computes actual value of the normal stress component on the interface |
element according to the simple damage model. |
@param ipp - integration point pointer |
@param dv - actual value of the relative displacements in the normal direction (input) |
@param aft - actual tensile strength in normal direction (input) |
@param kappa - history variable with the maximum attained crack width (input/ouptut) |
252,7 → 312,7 |
Created by Tomas Koudelka, koudelka@cml.fsv.cvut.cz, 17.12.2015 |
*/ |
double damplastifacemat::compute_normal_stress(double dv, double aft, double &kappa, double &omega, double &w) |
double damplastifacemat::compute_normal_stress(long ipp, double dv, double aft, double &kappa, double &omega, double &w) |
{ |
long i, ni = sra.give_ni(); |
double err = sra.give_err(); |
276,6 → 336,7 |
{ |
// it is better to start from omega=1 in order to avoid of convergention problems |
omegan = 1.0; |
tmp = 0.0; |
for (i=0; i<ni; i++) |
{ |
tmp = (1.0-omegan)*kn*kappa - aft*exp(-omegan*kappa/awf); |
292,8 → 353,10 |
} |
} |
// caution - increment of omega must be positive |
if (omegan > omega) |
if (omegan > omega){ |
omega = omegan; |
fprintf(Out, "\npositive omega increment, eid=%ld, ipp=%ld", Mm->elip[ipp]+1, ipp); |
} |
// actual values of stress and crack width |
sig = (1.0-omega)*kn*dv; |
314,6 → 377,7 |
The function computes actual value of the shear stress component on the interface |
element according to the simple plasticity model with Mohr-Coulomb criterion. |
@param ipp - integration point pointer |
@param du - actual value of the relative displacements in the tangential direction (input) |
@param ks - actual elastic stiffness of the interface in tangential direction (input) |
@param aft - actual tensile strength in normal direction (input) |
327,7 → 391,7 |
Created by Tomas Koudelka, koudelka@cml.fsv.cvut.cz, 17.12.2015 |
*/ |
double damplastifacemat::compute_shear_stress(double du, double /*aft*/, double omega, double /*kappa*/, double sigma, double &dup, double &gamma) |
double damplastifacemat::compute_shear_stress(long ipp, double du, double /*aft*/, double omega, double /*kappa*/, double sigma, double &dup, double &gamma) |
{ |
long i, ni = sra.give_ni(); |
double ac, tau0; |
373,7 → 437,10 |
__FILE__, __LINE__, __func__, f, err); |
abort(); |
} |
if(gamma > 0.0) |
fprintf(Out, "\nconsitency parameter gamma > 0, eid=%ld, ipp=%ld", Mm->elip[ipp]+1, ipp); |
return tau_tr; |
} |
/trunk/SIFEL/MEFEL/SRC/damplastifacemat.h |
---|
1,8 → 1,11 |
#ifndef DAMPLAST_IFACE_MAT |
#define DAMPLAST_IFACE_MAT |
#include "strretalg.h" |
#include "gfunct.h" |
#include "galias.h" |
#include <stdio.h> |
#include "strretalg.h" |
struct XFILE; |
struct matrix; |
struct vector; |
35,8 → 38,8 |
void nlstresses(long ipp, long im, long ido); |
void updateval(long ipp, long im, long ido); |
void changeparam(atsel &atm, vector &val); |
double compute_normal_stress(double dv, double aft, double &kappa, double &omega, double &w); |
double compute_shear_stress(double du, double aft, double omega, double kappa, double sigma, double &dup, double &gamma); |
double compute_normal_stress(long ipp, double dv, double aft, double &kappa, double &omega, double &w); |
double compute_shear_stress(long ipp, double du, double aft, double omega, double kappa, double sigma, double &dup, double &gamma); |
double give_actual_ft(); |
double epsefunction(long ipp); |
double givedamage(long ipp, long ido); |
52,6 → 55,14 |
double c; /// cohesion in shear |
double tanphi; /// tangent of friction angle |
strretalg sra; /// stress algorithm settings for damage model |
answertype coref; /// flag for the treatment of the corrosion effect |
gfunct alpha_c; /// evolution function of the expansion factor for corrosion products |
gfunct icor_func; /// evolution function of the corrosion current density [uA/cm^2] |
gfunct flux_cor_func; /// evolution function of the corrosion product flux |
}; |
#endif |
/trunk/SIFEL/MEFEL/SRC/dkq.cpp |
---|
625,7 → 625,7 |
void dkq::ip_curvatures (long lcid,long eid,long ri,long ci,vector &x,vector &y,vector &r) |
{ |
long i,j,ipp; |
double xi,eta,ww1,ww2,jac; |
double xi,eta,jac; |
ivector nodes(ASTCKIVEC(nne)); |
vector l(ASTCKVEC(nne)),sx(ASTCKVEC(nne)),sy(ASTCKVEC(nne)),nx(ASTCKVEC(nne)),ny(ASTCKVEC(nne)),w,gp,t(ASTCKVEC(nne)),signs(ASTCKVEC(nne)),eps(ASTCKVEC(bncomp)); |
matrix gm(ASTCKMAT(bncomp,ndofe)); |
646,9 → 646,9 |
ipp=Mt->elements[eid].ipp[ri][ci]; |
for (i=0;i<intordsm[0][0];i++){ |
xi=gp[i]; ww1=w[i]; |
xi=gp[i]; |
for (j=0;j<intordsm[0][0];j++){ |
eta=gp[j]; ww2=w[j]; |
eta=gp[j]; |
// geometric matrix |
geom_matrix (gm,xi,eta,x,y,sx,sy,nx,ny,l,signs,jac); |
766,7 → 766,7 |
void dkq::moments (long /*lcid*/,long eid,long ri,long ci) |
{ |
long i,j,ipp; |
double xi,eta,ww1,ww2,thick; |
double xi,eta,thick; |
ivector nodes(ASTCKIVEC(nne)); |
vector w,gp,t(ASTCKVEC(nne)); |
vector eps(ASTCKVEC(bncomp)),sig(ASTCKVEC(bncomp)); |
787,9 → 787,9 |
for (i=0;i<intordsm[0][0];i++){ |
xi=gp[i]; ww1=w[i]; |
xi=gp[i]; |
for (j=0;j<intordsm[0][0];j++){ |
eta=gp[j]; ww2=w[j]; |
eta=gp[j]; |
Mm->givestrain (0,ipp,eps); |
842,7 → 842,7 |
void dkq::forces (long /*lcid*/,long eid,long ri,long ci,vector &x,vector &y,vector &r) |
{ |
long i,j,ipp; |
double xi,eta,ww1,ww2,thick,e,nu; |
double xi,eta,thick,e,nu; |
ivector nodes(ASTCKIVEC(nne)); |
vector l(ASTCKVEC(nne)),sx(ASTCKVEC(nne)),sy(ASTCKVEC(nne)),nx(ASTCKVEC(nne)),ny(ASTCKVEC(nne)),w,gp,t(ASTCKVEC(nne)),signs(ASTCKVEC(nne)); |
vector eps(ASTCKVEC(4)),sig(ASTCKVEC(2)); |
865,9 → 865,9 |
for (i=0;i<intordsm[0][0];i++){ |
xi=gp[i]; ww1=w[i]; |
xi=gp[i]; |
for (j=0;j<intordsm[0][0];j++){ |
eta=gp[j]; ww2=w[j]; |
eta=gp[j]; |
// geometric matrix |
shear_geom_matrix (gm,xi,eta,x,y,sx,sy,nx,ny,l,signs); |
/trunk/SIFEL/MEFEL/SRC/dkt.cpp |
---|
804,9 → 804,8 |
{ |
long i, j, k, ipp; |
long ii, jj, nv = nodval.n; |
double xi, eta; |
// double ipval; |
vector w, gp1, gp2, anv(ASTCKVEC(nne)); |
double ipval; |
vector w, gp1, gp2, anv(ASTCKVEC(nne)), l(ASTCKVEC(3)); |
long nstra, nstre, ncompstr, ncompeqother; |
long idstra, idstre, idoth, idic; |
inictype ict; |
847,25 → 846,26 |
gauss_points_tr (gp1.a, gp2.a, w.a, intordsm[ii][jj]); |
for (k = 0; k < intordsm[ii][jj]; k++) |
{ |
xi=gp1[k]; |
eta=gp2[k]; |
l[0]=gp1[k]; |
l[1]=gp2[k]; |
l[2]=1.0-l[0]-l[1]; |
// value in integration point |
// ipval = approx_nat(xi, eta, anv); |
ipval = approx(l, anv); |
if ((ictn[i] & inistrain) && (j < Mm->ip[ipp].ncompstr)) |
{ |
//Mm->ip[ipp].strain[j] += ipval; |
Mm->ip[ipp].strain[j] += ipval; |
ipp++; |
continue; |
} |
if ((ictn[i] & inistress) && (j < nstra + Mm->ip[ipp].ncompstr)) |
{ |
//Mm->ip[ipp].stress[j] += ipval; |
Mm->ip[ipp].stress[j] += ipval; |
ipp++; |
continue; |
} |
if ((ictn[i] & iniother) && (j < nv)) |
{ |
//Mm->ip[ipp].other[j] += ipval; |
Mm->ip[ipp].other[j] += ipval; |
ipp++; |
continue; |
} |
/trunk/SIFEL/MEFEL/SRC/doubdp.cpp |
---|
90,6 → 90,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
gamult = gtf*2/ft/h; |
/trunk/SIFEL/MEFEL/SRC/drprag2.cpp |
---|
561,7 → 561,7 |
matrix Idev(n,n); |
matrix De(n,n); |
double K_con, G_con, rho_tr, p_tr, q_value0, q_value1, delta_lambda; |
double K_con, G_con, rho_tr, p_tr, q_value0, q_value1, delta_lambda=0.0; |
double gamma, aux_con1, aux; |
vector iota(n), epsilon(n), epsilon_etr(n), epsilon_p_previous(n); |
vector epsilon_p_next(n), aux_vec(n); |
/trunk/SIFEL/MEFEL/SRC/dsm.cpp |
---|
78,7 → 78,7 |
void dsmmat::initval(long ipp, long im, long ido) |
{ |
double v_ini, v_pc0, v_lambda1; |
double i1s, j2s, s; |
double i1s=0.0, j2s, s; |
double v_kappa1, p1, bar_pc_0, pc_0; |
long i, ncompstr = Mm->ip[ipp].ncompstr; |
vector sig(ASTCKVEC(ncompstr)),sigt(ASTCKVEC(6)), q(ASTCKVEC(2)); |
/trunk/SIFEL/MEFEL/SRC/dst.cpp |
---|
985,8 → 985,8 |
{ |
long i, j, k, ipp; |
long ii, jj, nv = nodval.n; |
double xi, eta, ipval; |
vector w, gp1, gp2, anv(nne); |
double ipval; |
vector w, gp1, gp2, anv(nne), l(ASTCKVEC(3)); |
long nstra, nstre, ncompstr, ncompeqother; |
long idstra, idstre, idoth, idic; |
inictype ict; |
1027,11 → 1027,11 |
gauss_points_tr (gp1.a, gp2.a, w.a, intordsm[ii][jj]); |
for (k = 0; k < intordsm[ii][jj]; k++) |
{ |
xi=gp1[k]; |
eta=gp2[k]; |
l[0]=gp1[i]; |
l[1]=gp2[i]; |
l[2]=1.0-l[0]-l[1]; |
// value in integration point |
ipval = 0.; |
// ipval = approx_nat (xi,eta,anv); |
ipval = approx(l,anv); |
ncompstr = Mm->ip[ipp].ncompstr; |
ncompeqother = Mm->ip[ipp].ncompeqother; |
if ((ictn[0] & inistrain) && (j < ncompstr)) |
/trunk/SIFEL/MEFEL/SRC/edsolver.cpp |
---|
38,6 → 38,7 |
break; |
} default:{ |
print_err("unknown eigenvalue solver is required",__FILE__,__LINE__,__func__); |
abort(); |
} |
} |
74,7 → 75,7 |
void inverse_iteration (double *x,double *w) |
{ |
long i,ni,n; |
double nom,denom,zero,rho,prevrho,err,error; |
double nom,denom,zero,rho,prevrho,err,error=0.0; |
double *p,*z; |
// maximum number of iterations |
152,7 → 153,7 |
void subspace_iter_ortho (double *x,double *w) |
{ |
long i,j,k,l,ii,ni,n,nv,nrv; |
double err,error,maxerror,zero,nom,denom,alpha; |
double err,error,maxerror=0.0,nom,denom,alpha; |
double *z,*p,*wo; |
// problem size |
165,8 → 166,6 |
nrv=Mp->eigsol.neigv; |
// number of vectors used for iteration process |
nv=Mp->eigsol.nev; |
// computer zero |
zero=Mp->zero; |
z = new double [n]; |
p = new double [n]; |
313,9 → 312,13 |
*/ |
void subspace_iter_jac (double *x,double *w) |
{ |
long i,j,k,l,ii,ni,n,nv,nrv,nij,njacthr,stop,*ind; |
long i,j,k,l,ii,ni,n,nv,nrv,nij,njacthr,stop; |
double err,error,maxerror,zero,alpha; |
double *z,*p,*wo,*redstiff,*redmass,*redeigv,*jacthr,*aux,*invec; |
double *jacthr; |
//double *z, *p, *wo, *redstiff, *redmass, *redeigv, *aux, *invec; |
vector z, p, wo, redstiff, redmass, redeigv, aux, invec; |
// long *ind |
ivector ind; |
// problem size |
n=Ndofm; |
338,16 → 341,26 |
jacthr=Mp->eigsol.jacthr; |
//x=Lsrs->give_lhs(0); |
z = new double [n*nv]; |
p = new double [n*nv]; |
wo = new double [nv]; |
redstiff = new double [nv*nv]; |
redmass = new double [nv*nv]; |
redeigv = new double [nv*nv]; |
aux = new double [nv]; |
invec = new double [n]; |
ind = new long [n]; |
//z = new double [n*nv]; |
reallocv(n*nv, z); |
//p = new double [n*nv]; |
reallocv(n*nv, p); |
//wo = new double [nv]; |
reallocv(nv, wo); |
//redstiff = new double [nv*nv]; |
reallocv(nv*nv, redstiff); |
//redmass = new double [nv*nv]; |
reallocv(nv*nv, redmass); |
//redeigv = new double [nv*nv]; |
reallocv(nv*nv, redeigv); |
//aux = new double [nv]; |
reallocv(nv, aux); |
//invec = new double [n]; |
reallocv(n, invec); |
//ind = new long [n]; |
reallocv(n, ind); |
for (i=0;i<n;i++){ |
//invec[i]=Mm_sky->a[Mm_sky->adr[i]]/Sm_sky->a[Sm_sky->adr[i]]; |
} |
365,9 → 378,9 |
} |
// LDL decomposition of matrix A |
//Sm_sky->ldl_sky (z,z,zero,2); |
//Smat->solve_system (Gtm,z,z); |
//Mp->ssle->solve_system (Gtm,Smat,z,z,Out); |
//Sm_sky->ldl_sky (z.a,z.a,zero,2); |
//Smat->solve_system (Gtm,z.a,z.a); |
//Mp->ssle->solve_system (Gtm,Smat,z.a,z.a,Out); |
// initial value of vector x |
for (i=0;i<nv*n;i++){ |
383,7 → 396,7 |
// right hand side vector |
for (j=0;j<nv;j++){ |
//massxvect (x+j*n,z+j*n); |
Mmat->gmxv (x+j*n,z+j*n); |
Mmat->gmxv (x+j*n,z.a+j*n); |
} |
/* |
409,11 → 422,11 |
// A.x_new = z = B.x_old => x_new |
for (j=0;j<nv;j++){ |
// backup of B.x_old (will be overwritten) |
copyv (z+j*n,p+j*n,n); |
copyv (z.a+j*n,p.a+j*n,n); |
// back substitution - solution x_new |
//Sm_sky->ldl_sky (x+j*n,z+j*n,zero,3); |
//Smat->solve_system (Gtm,x+j*n,z+j*n); |
Mp->ssle->solve_system (Gtm,Smat,x+j*n,z+j*n,Out); |
//Sm_sky->ldl_sky (x+j*n,z.a+j*n,zero,3); |
//Smat->solve_system (Gtm,x+j*n,z.a+j*n); |
Mp->ssle->solve_system (Gtm,Smat,x+j*n,z.a+j*n,Out); |
} |
430,17 → 443,17 |
// reduced stiffness matrix computaion |
// K_red = x.K.x = x.z |
mtxmccr (x,p,redstiff,n,nv,nv); |
mtxmccr (x,p.a,redstiff.a,n,nv,nv); |
// new right hand side - z = B.x |
for (j=0;j<nv;j++){ |
//massxvect (x+j*n,z+j*n); |
Mmat->gmxv (x+j*n,z+j*n); |
//massxvect (x+j*n,z.a+j*n); |
Mmat->gmxv (x+j*n,z.a+j*n); |
} |
// reduced mass matrix computation |
// M_red = x.M.x = x.z |
mtxmccr (x,z,redmass,n,nv,nv); |
mtxmccr (x,z.a,redmass.a,n,nv,nv); |
/* |
fprintf (Out,"\n\n\n iterace cislo %ld",i); |
454,7 → 467,7 |
// solution of reduced system by Jacobi' method of rotations |
gen_jacobi (redstiff,redmass,redeigv,w,nv,nij,jacthr,njacthr,zero); |
gen_jacobi (redstiff.a,redmass.a,redeigv.a,w,nv,nij,jacthr,njacthr,zero); |
/* |
for (long kk=0;kk<nv;kk++){ |
481,8 → 494,8 |
// normalization process |
double norm = sqrt(ss (z,z,n*nv)); |
cmulv (1.0/norm,z,n*nv); |
double norm = sqrt(ss (z.a,z.a,n*nv)); |
cmulv (1.0/norm,z.a,n*nv); |
// convergence check |
508,8 → 521,6 |
Mp->eigsol.anies=i; |
Mp->eigsol.aerres=maxerror; |
delete [] z; |
} |
525,7 → 536,7 |
void subspace_shift_iter_ortho (double *x,double *w) |
{ |
long i,j,k,l,ii,ni,n,nv,nrv; |
double err,error,maxerror,zero,nom,denom,alpha,shift; |
double err,error,maxerror=0.0,zero,nom,denom,alpha,shift; |
double *z,*p,*wo; |
// problem size |
/trunk/SIFEL/MEFEL/SRC/elasttime.cpp |
---|
833,65 → 833,67 |
double t; |
long id; |
switch (evf) |
{ |
case b3law://b3 model for concrete - basic creep |
//pro vypocet zacinajici od casu 0.0 |
t = tb_time/86400.0 + time/86400; |
ac=sc+gc; ag=ac/gc; m=0.5; //m=0.28+1.0/fc/fc; |
n = 0.1; |
switch (evf){ |
case b3law://b3 model for concrete - basic creep |
//pro vypocet zacinajici od casu 0.0 |
t = tb_time/86400.0 + time/86400; |
ac=sc+gc; ag=ac/gc; m=0.5; //m=0.28+1.0/fc/fc; |
n = 0.1; |
if (type_e == 1) |
q1=600000.0/e28;//measured |
else |
q1=600000.0/57000.0/sqrt(fc);//empirical |
if (type_e == 1) |
q1=600000.0/e28;//measured |
else |
q1=600000.0/57000.0/sqrt(fc);//empirical |
r=1.7*pow(tl,0.12)+8.0; |
qf=1.0/(0.086*pow(tl,(2.0/9.0))+1.21*pow(tl,(4.0/9.0))); |
z = 1.0/pow(tl,m)*log(1.0 + pow((t - tl),n)); |
q = qf/pow((1.0 + pow((qf/z),r)),(1.0/r)); |
q2=451.1*sqrt(cs)/pow(fc,0.9); |
q3=0.29*pow(wc,4.0)*q2; |
q4=0.14/pow(ac,0.7); |
r=1.7*pow(tl,0.12)+8.0; |
qf=1.0/(0.086*pow(tl,(2.0/9.0))+1.21*pow(tl,(4.0/9.0))); |
z = 1.0/pow(tl,m)*log(1.0 + pow((t - tl),n)); |
q = qf/pow((1.0 + pow((qf/z),r)),(1.0/r)); |
q2=451.1*sqrt(cs)/pow(fc,0.9); |
q3=0.29*pow(wc,4.0)*q2; |
q4=0.14/pow(ac,0.7); |
c0=q2*q+q3*log(1.0+pow((t-tl),n))+q4*log(t/tl); |
j = (q1 + c0)/6.89476*1.0e-3*1.0e-6;//units 1e-6*psi^-1 -> Pa^-1 |
c0=q2*q+q3*log(1.0+pow((t-tl),n))+q4*log(t/tl); |
j = (q1 + c0)/6.89476*1.0e-3*1.0e-6;//units 1e-6*psi^-1 -> Pa^-1 |
e = 1.0/j; //effective modulus |
if (e0 == 0.0) |
e0 = e; |
break; |
case doublepwrlaw://toto neni double power law - je nutne opravit |
//pro vypocet zacinajici od casu 0.0 |
t = tb_time/86400.0 + time/86400; |
m=0.5; |
e=e0; |
tmp = 1+psi*(pow(t0,-m)+alpha)*pow(t,n); |
j = 1/e0 + qs*log(tmp); |
e = 1.0/j; |
break; |
case userfunc: |
id = itab.getval(time)-1; |
switch (id) |
{ |
case 0: |
e = udstiff[id]->getval(time); |
break; |
case 1: |
if (Mm->ip[ipp].ncompstr == 1) |
e = udstiff[id]->getderiv(Mm->ip[ipp].strain[0]); |
else |
print_err("displacement control of stiffness must be used only for 1D stress/strain state (time %le),\n" |
" i.e. ncomptr must be 1 but it is %ld", __FILE__, __LINE__, __func__, time, Mm->ip[ipp].ncompstr); |
break; |
default: |
print_err("invalid index %ld required for user defined stiffness", __FILE__, __LINE__, __func__, id); |
} |
break; |
default: |
print_err("unknown type of function of Young modulus evolution", __FILE__, __LINE__, __func__); |
e = 1.0/j; //effective modulus |
if (e0 == 0.0) |
e0 = e; |
break; |
case doublepwrlaw://toto neni double power law - je nutne opravit |
//pro vypocet zacinajici od casu 0.0 |
t = tb_time/86400.0 + time/86400; |
m=0.5; |
e=e0; |
tmp = 1+psi*(pow(t0,-m)+alpha)*pow(t,n); |
j = 1/e0 + qs*log(tmp); |
e = 1.0/j; |
break; |
case userfunc: |
id = itab.getval(time)-1; |
switch (id){ |
case 0: |
e = udstiff[id]->getval(time); |
break; |
case 1: |
if (Mm->ip[ipp].ncompstr == 1) |
e = udstiff[id]->getderiv(Mm->ip[ipp].strain[0]); |
else{ |
print_err("displacement control of stiffness must be used only for 1D stress/strain state (time %le),\n" |
" i.e. ncomptr must be 1 but it is %ld", __FILE__, __LINE__, __func__, time, Mm->ip[ipp].ncompstr); |
abort(); |
} |
break; |
default: |
print_err("invalid index %ld required for user defined stiffness", __FILE__, __LINE__, __func__, id); |
abort(); |
} |
break; |
default: |
print_err("unknown type of function of Young modulus evolution", __FILE__, __LINE__, __func__); |
abort(); |
} |
return e; |
} |
/trunk/SIFEL/MEFEL/SRC/elemswitch.cpp |
---|
2602,76 → 2602,77 |
te = Mt->give_elem_type (eid); |
switch (te){ |
case axisymmlt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Asymlt->approx (areacoord,nodval); |
break; |
case axisymmlt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Asymlt->approx (areacoord,nodval); |
break; |
} |
case axisymmqt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Asymqt->approx (areacoord,nodval); |
break; |
} |
case axisymmlq:{ |
val=Asymlq->approx (coord[0],coord[1],nodval); |
break; |
} |
case axisymmqq:{ |
val=Asymqq->approx (coord[0],coord[1],nodval); |
break; |
} |
case axisymmcq:{ |
val=Asymcq->approx (coord[0],coord[1],nodval); |
break; |
} |
case planeelementlt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Pelt->approx (areacoord,nodval); |
break; |
} |
case planeelementqt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Peqt->approx (areacoord[0],areacoord[1],nodval); |
break; |
} |
case planeelementrotlt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Perlt->approx (areacoord,nodval); |
break; |
} |
case planeelementlq:{ |
val=Pelq->approx (coord[0],coord[1],nodval); |
break; |
} |
case planeelementqq:{ |
val=Peqq->approx (coord[0],coord[1],nodval); |
break; |
} |
case planeelementrotlq:{ |
val=Perlq->approx (coord[0],coord[1],nodval); |
break; |
} |
case lineartet:{ |
volcoord[0]=coord[0]; volcoord[1]=coord[1]; volcoord[2]=coord[2]; volcoord[3]=1.0-volcoord[0]-volcoord[1]-volcoord[2]; |
val=Ltet->approx (volcoord,nodval); |
break; |
} |
case quadrtet:{ |
val=Qtet->approx (coord[0],coord[1],coord[2],nodval); |
break; |
} |
case linearhex:{ |
val=Lhex->approx (coord[0],coord[1],coord[2],nodval); |
break; |
} |
case quadrhex:{ |
val=Qhex->approx (coord[0],coord[1],coord[2],nodval); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
case axisymmqt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Asymqt->approx (areacoord,nodval); |
break; |
} |
case axisymmlq:{ |
val=Asymlq->approx (coord[0],coord[1],nodval); |
break; |
} |
case axisymmqq:{ |
val=Asymqq->approx (coord[0],coord[1],nodval); |
break; |
} |
case axisymmcq:{ |
val=Asymcq->approx (coord[0],coord[1],nodval); |
break; |
} |
case planeelementlt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Pelt->approx (areacoord,nodval); |
break; |
} |
case planeelementqt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Peqt->approx (areacoord[0],areacoord[1],nodval); |
break; |
} |
case planeelementrotlt:{ |
areacoord[0]=coord[0]; areacoord[1]=coord[1]; areacoord[2]=1.0-areacoord[0]-areacoord[1]; |
val=Perlt->approx (areacoord,nodval); |
break; |
} |
case planeelementlq:{ |
val=Pelq->approx (coord[0],coord[1],nodval); |
break; |
} |
case planeelementqq:{ |
val=Peqq->approx (coord[0],coord[1],nodval); |
break; |
} |
case planeelementrotlq:{ |
val=Perlq->approx (coord[0],coord[1],nodval); |
break; |
} |
case lineartet:{ |
volcoord[0]=coord[0]; volcoord[1]=coord[1]; volcoord[2]=coord[2]; volcoord[3]=1.0-volcoord[0]-volcoord[1]-volcoord[2]; |
val=Ltet->approx (volcoord,nodval); |
break; |
} |
case quadrtet:{ |
val=Qtet->approx (coord[0],coord[1],coord[2],nodval); |
break; |
} |
case linearhex:{ |
val=Lhex->approx (coord[0],coord[1],coord[2],nodval); |
break; |
} |
case quadrhex:{ |
val=Qhex->approx (coord[0],coord[1],coord[2],nodval); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
} |
return val; |
} |
3601,6 → 3602,7 |
} |
case planequadinterface:{ |
Pqifc->res_nonloc_internal_forces (lcid,i,ifor); |
break; |
} |
3674,6 → 3676,7 |
break; |
} |
case hexintface:{ |
Hexifc->res_nonloc_internal_forces(lcid, i, ifor); |
break; |
} |
/trunk/SIFEL/MEFEL/SRC/epsolver.cpp |
---|
101,7 → 101,7 |
void general_epressure (long lcid) |
{ |
long i, j, n, ni; |
double zero, err, norf, dl; |
double err, norf, dl; |
double *r,*f,*fi,*fb, *fc, lambda, rlam; |
109,8 → 109,6 |
n = Ndofm; |
// maximum number of increments |
ni = Mp->niep; |
// computer zero |
zero = Mp->zero; |
// required norm of unbalanced forces |
err = Mp->errep; |
// required dynamic load step |
190,7 → 188,7 |
void general_epressure_varsup (long lcid) |
{ |
long i, j, n, ni; |
double zero, err, norf; |
double err, norf; |
double *r,*rb,*f,*fi,*fb, lambda; |
double **br; |
199,8 → 197,6 |
n = Ndofm; |
// maximum number of increments |
ni = Mp->niep; |
// computer zero |
zero = Mp->zero; |
// required norm of unbalanced forces |
err = Mp->errep; |
207,12 → 203,12 |
rb = new double [n]; |
fb = new double [n]; |
fi = new double [n]; |
br = new double*[Mt->nn]; |
br = new double*[Gtm->nn]; |
memset (rb,0,n*sizeof(double)); |
memset (fb,0,n*sizeof(double)); |
memset (fi,0,n*sizeof(double)); |
memset (br,0,Mt->nn*sizeof(*br)); |
for (i = 0; i < Mt->nn; i++) |
memset (br,0,Gtm->nn*sizeof(*br)); |
for (i = 0; i < Gtm->nn; i++) |
br[i] = new double[Gtm->give_ndofn(i)]; |
// initialization phase |
287,7 → 283,7 |
print_close(); |
delete [] fi; delete [] fb; delete [] rb; |
for (i = 0; i < Gtm->nn; i++) |
delete [] br; |
delete [] br[i]; |
delete [] br; |
} |
423,6 → 419,9 |
delete [] nod; |
delete [] react; |
delete [] cnum; |
delete [] forig; |
delete [] p; |
delete [] porig; |
} |
469,12 → 468,11 |
double arclengthrv (long lcid, double rlambda, double rlerr) |
{ |
long i,j,k,n,ni,ini,stop,modif,li, numr; |
double a0,a1,a2,l1,l2,dl,dlmax,dlmin,psi,lambda,blambda,dlambda,ddlambda,norf,norfp,norv,norfa,zero,ierr; |
double lambdao,ss1,ss2,ss3,ss4,ss5; |
double a0,a1,a2,l1,l2,dl,dlmax,dlmin,psi,lambda,blambda,dlambda,ddlambda,norf,norfp,norv,norfa,ierr; |
double ss1,ss2,ss3,ss4,ss5; |
double *r,*ra,*ddr,*u,*v,*f,*fa,*fp,*fc,*fi; |
long cn, ecn[6]; |
char file[255]; |
const char *mode; |
// FILE *gr; |
FILE *grout; |
486,8 → 484,6 |
ni = Mp->nlman->nial; |
// maximum number of iterations in one increment |
ini = Mp->nlman->niilal; |
// computer zero |
zero = Mp->zero; |
// required error in inner loop |
ierr = Mp->nlman->erral; |
// length of arc |
518,15 → 514,9 |
} |
else{ |
lambda=0.0; |
lambdao=0.0; |
li=0; |
} |
if (li == 0) |
mode = "wt"; |
else |
mode = "at"; |
sprintf(file, "%s%s.epg", Mp->path, Mp->filename); |
grout = fopen (file, "wt"); |
617,7 → 607,7 |
// ****************************************** |
// no inner iteration loop is required *** |
// ****************************************** |
modif++; |
modif++; |
lambda+=dlambda; |
if (((lambda - rlambda) > 0.0) && (fabs(lambda-rlambda) > rlerr)) |
657,8 → 647,9 |
Mm->updateipval (); |
// aux_mech_nonlin_print (gr,ra,lambda); |
// print_output(lcid); |
print_step(lcid, i, lambda, fa); |
print_flush(); |
print_step(lcid, i, lambda, fa); |
print_flush(); |
stop = 0; |
} |
else{ |
// **************************** |
1202,7 → 1193,7 |
double newton_raphsonep (long lcid, double *pfp) |
{ |
long i,j,k,n,ni,ini; |
double lambda,blambda,dlambda,dlambdamin,zero,err,norf,norfa; |
double lambda,blambda,dlambda,dlambdamin,err,norf,norfa; |
double *r,*rb,*dr,*f,*fi,*fb,*fc,*fp; |
// number of rows of the matrix |
1211,8 → 1202,6 |
ni = Mp->nlman->ninr; |
// maximum number of iterations in one increment |
ini = Mp->nlman->niilnr; |
// computer zero |
zero = Mp->zero; |
// required error in inner loop |
err = Mp->nlman->errnr; |
// increment size |
1236,12 → 1225,11 |
fc = Lsrs->give_rhs (lcid*2+1); |
lambda=0.0; |
i=0; |
/* char fn[1001]; |
FILE *femcad; |
sprintf(fn,"%s%s.jk0", Mp->path, Mp->filename); |
femcad = fopen(fn, "wt"); |
export_femcad(femcad, i); |
export_femcad(femcad, 0); |
write_displ(femcad, 0, 0); |
Mm->compute_nodeothers(0); |
for (j=0; j<Mm->ip[0].ncompother; j++) |
1377,7 → 1365,7 |
} |
delete [] dr; delete [] fi; delete [] fb; delete [] f; |
delete [] dr; delete [] fi; delete [] fb; delete [] f; delete [] rb; |
// fclose (femcad); |
return lambda; |
/trunk/SIFEL/MEFEL/SRC/fdsolver.cpp |
---|
61,13 → 61,11 |
void newmark_method (long lcid) |
{ |
long i,j,n; |
double alpha,delta,zero,time,dt,end_time; |
double alpha,delta,time,dt,end_time; |
double *a,*v,*p,*dd,*vv,*lhs,*rhs,*fs; |
// number of degrees of freedom |
n = Ndofm; |
// computer zero |
zero=Mp->zero; |
// coefficient of the method |
alpha=Mp->alphafvn; |
// coefficient of the method |
208,14 → 206,11 |
void difference_method (long lcid) |
{ |
long i,j,n; |
double zero,time,dt,end_time; |
double time,dt,end_time; |
double *a,*v,*p,*da,*dp,*lhs,*rhs,*fs; |
// number of degrees of freedom |
n = Ndofm; |
// computer zero |
zero=Mp->zero; |
n = Ndofm; |
// initial time |
time=Mp->timecon.starttime (); |
// end time |
445,6 → 440,12 |
print_close (); |
delete [] dp; |
delete [] dn; |
delete [] da; |
delete [] fp; |
delete [] fi; |
delete [] m; |
} |
/** |
536,14 → 537,11 |
void explicit_difference_method (long lcid) |
{ |
long i,j,n; |
double zero,time,dt,end_time; |
double time,dt,end_time; |
double *a,*v,*p,*da,*dp,*lhs,*rhs,*fs; |
// number of degrees of freedom |
n = Ndofm; |
// computer zero |
zero=Mp->zero; |
n = Ndofm; |
// initial time |
time=Mp->timecon.starttime (); |
// end time |
701,14 → 699,11 |
void difference_method_2 (long lcid) |
{ |
long i,j,n; |
double zero,time,dt,end_time; |
double time,dt,end_time; |
double *a,*v,*p,*da,*dp,*lhs,*rhs,*fs; |
// number of degrees of freedom |
n = Ndofm; |
// computer zero |
zero=Mp->zero; |
// initial time |
time=Mp->timecon.starttime (); |
// end time |
/trunk/SIFEL/MEFEL/SRC/fixortodam.cpp |
---|
224,6 → 224,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
// It is supposed that elastic stiffness matrix is taken from the elastic orthotropic material |
250,23 → 251,8 |
void fixortodam::compute_dam(long ipp, vector &xeq, vector &xeq0, vector &omegao, vector &omega) |
{ |
long i; |
double l; |
long eid = Mm->elip[ipp]; |
switch (Mt->give_dimension(eid)){ |
case 1: |
l = Mt->give_length(eid); |
break; |
case 2: |
l = sqrt(Mt->give_area(eid)); |
break; |
case 3: |
l = pow(Mt->give_volume(eid), 1.0 / 3.0); |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
} |
for (i = 0; i < 3; i++) |
{ |
if (xeq0(i) == 2 * xeqtf(i) || fabs(xeq(i)) <= fabs(xeq0(i))) |
434,6 → 420,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (xeq0[0] == 2 * xeqtf(0)) |
/trunk/SIFEL/MEFEL/SRC/generalmod.cpp |
---|
1457,12 → 1457,12 |
} |
} |
double General_model::gscalar_dabs(double k) { |
double tmp; |
if(k>= 0) |
tmp=k; |
if(k<0) |
tmp=-1*k; |
return tmp; |
double tmp; |
if(k>= 0) |
tmp=k; |
if(k<0) |
tmp=-1*k; |
return tmp; |
} |
void General_model::garray_add( double a[], double b[], double c[], long int n ) { |
long int i=0; |
/trunk/SIFEL/MEFEL/SRC/glasgowdam.cpp |
---|
351,6 → 351,10 |
mxv(d, eps, sigma); |
cmulv(dp, sigma); |
} |
else{ |
print_err("the non-local glasgowdam model has not yet been implemented", __FILE__, __LINE__, __func__); |
abort(); |
} |
// new data storage |
for (i=0;i<ncomp;i++){ |
/trunk/SIFEL/MEFEL/SRC/glasgownew.cpp |
---|
4,6 → 4,7 |
#include "vecttens.h" |
#include "global.h" |
#include "intpoints.h" |
#include "mechmat.h" |
glasgownew::glasgownew () |
{ |
/trunk/SIFEL/MEFEL/SRC/global.cpp |
---|
89,6 → 89,7 |
Qwed = NULL; |
Pelem = NULL; |
Pqifc = NULL; |
Hexifc = NULL; |
Tlatt = NULL; |
Neval = 0.0; |
/trunk/SIFEL/MEFEL/SRC/globmat.cpp |
---|
539,7 → 539,7 |
double mstresscomp[6] = {}; // reduction array for integrated macrostress contributions from elements |
#pragma omp parallel \ |
num_threads(Numth),\ |
private(i, j, ndofe, ndofemn, eid, cn, err, ifor, aifor),\ |
private(i, j, ndofe, ndofemn, eid, cn, err, ifor, aifor), \ |
firstprivate(ncomp) |
{ |
#ifdef __linux__ |
560,7 → 560,7 |
// this number is equal to the number of DOFs without hanging nodes |
ndofe=Mt->give_ndofe (eid); |
reallocv (RSTCKVEC(ndofe,ifor)); |
elem_internal_forces (eid,lcid,ifor); |
err = check_math_errel(eid); |
725,6 → 725,8 |
ivector cn; |
vector ifor; |
vector aifor; |
matrix d; |
vector r; |
// function computes strains at integration points |
if (Mp->strcomp) |
753,7 → 755,7 |
Mp->nonlocphase=2; |
#ifdef INC_OPENMP |
#pragma omp for private(i, ndofe, ndofemn, cn, ifor, aifor) |
#pragma omp for private(i, ndofe, ndofemn, cn, ifor, aifor, d, r) |
#endif |
for (i = 0; i < ne; i++) |
{ |
764,6 → 766,14 |
ndofe=Mt->give_ndofe (i); |
reallocv (RSTCKVEC(ndofe,ifor)); |
// if (Mt->elements[i].te == hexintface){ |
// reallocm (RSTCKMAT(ndofe, ndofe, d)); |
// reallocv (RSTCKVEC(ndofe, r)); |
// stiffmat(lcid, i, d); |
// eldispl(lcid, i, r.a); |
// mxv(d, r, ifor); |
// } |
// else |
elem_nonloc_internal_forces(i, lcid, ifor); |
check_math_errel(i); |
1583,7 → 1593,7 |
*/ |
void noddispl (long lcid,double *r, long nid) |
{ |
long i,j,ndofn,ndofnm,nmn; |
long i,j,ndofn,ndofnm,nmn,maxndofnm; |
double **rr; |
vector w; |
1598,9 → 1608,12 |
rr = new double* [nmn]; |
// loop over the number of master nodes |
maxndofnm = -1; |
for (i=0;i<nmn;i++){ |
// the number of DOFs on master node |
ndofnm = Gtm->give_ndofn (Gtm->gnodes[nid].mnodes[i]); |
if (ndofnm > maxndofnm) |
maxndofnm = ndofnm; |
rr[i] = new double [ndofnm]; |
select_noddispl (lcid,rr[i],Gtm->gnodes[nid].mnodes[i]); |
} |
1611,10 → 1624,13 |
// approximation |
//r = new double [ndofnm]; |
for (i=0;i<ndofnm;i++){ |
r[i]=0.0; |
for (j=0;j<nmn;j++){ |
r[i]+=rr[j][i]*w[j]; |
for (i=0; i<maxndofnm; i++) |
r[i] = 0.0; |
for (i=0; i<nmn; i++){ |
ndofnm = Gtm->give_ndofn (Gtm->gnodes[nid].mnodes[i]); |
for (j=0; j<ndofnm; j++){ |
r[j] += rr[i][j]*w[i]; |
} |
} |
1738,7 → 1754,7 |
*/ |
void nodforce (double *f, double *nf, long nid) |
{ |
long i, j, ii, nmn, mnid, ndofn, ndofnm; |
long i, j, ii, nmn, mnid, ndofn, ndofnm, maxndofnm; |
double **ff; |
vector w; |
1752,11 → 1768,14 |
nmn=0-ndofn; |
ff = new double*[nmn]; |
// loop over the number of master nodes |
maxndofnm = -1; |
for (i=0; i<nmn; i++) |
{ |
// the number of DOFs on master node |
mnid = Gtm->gnodes[nid].mnodes[i]; |
ndofnm = Gtm->give_ndofn(mnid); |
if (ndofnm > maxndofnm) |
maxndofnm = ndofnm; |
ff[i] = new double[ndofnm]; |
for (j=0; j<Mt->give_ndofn(mnid); j++) |
{ |
1772,10 → 1791,14 |
// approximation |
//r = new double [ndofnm]; |
for (i=0;i<ndofnm;i++){ |
for (i=0; i<maxndofnm; i++) |
nf[i]=0.0; |
for (j=0;j<nmn;j++){ |
nf[i]+=ff[j][i]*w[j]; |
for (i=0; i<nmn; i++){ |
mnid = Gtm->gnodes[nid].mnodes[i]; |
ndofnm = Gtm->give_ndofn(mnid); |
for (j=0; j<ndofnm; j++){ |
nf[j] += ff[i][j]*w[i]; |
} |
} |
2095,14 → 2118,15 |
@param f - array of components for all nodal forces, it is input parameter |
@param nid - node number (node id) |
@param nf - vector of nodal force, it is output parameter |
@param react - retrieve reaction components(true) or set zero(false) in cases of nodal prescribed displacement values |
@return The function returns nodal force components at the given node in the %vector nf. |
Created by Tomas Koudelka 1.10.2013 |
*/ |
void nodforce (double *f, long nid, vector &nf) |
void nodforce (double *f, long nid, vector &nf, bool react) |
{ |
long i,j,ndofn,ndofnm,nmn; |
long i,j,ndofn,ndofnm,nmn,maxndofnm; |
vector *ff; |
vector w; |
2116,14 → 2140,17 |
nmn=0-ndofn; |
ff = new vector[nmn]; // array of force vectors of the master nodes |
maxndofnm = -1; |
// loop over the number of master nodes |
for (i=0;i<nmn;i++) |
{ |
// the number of DOFs on master node |
ndofnm = Gtm->give_ndofn(Gtm->gnodes[nid].mnodes[i]); |
if (maxndofnm < ndofnm) |
maxndofnm = ndofnm; |
reallocv(RSTCKVEC(ndofnm, ff[i])); |
select_nodforce (f, Gtm->gnodes[nid].mnodes[i], ff[i]); |
select_nodforce (f, Gtm->gnodes[nid].mnodes[i], ff[i], react); |
} |
// weights |
2131,11 → 2158,13 |
Gtm->approx_weights(Gtm->gnodes[nid].masentity, nid, w); |
// approximation |
for (i=0;i<ndofnm;i++) |
{ |
for (i=0; i<maxndofnm; i++) |
nf[i]=0.0; |
for (j=0; j<nmn; j++) |
nf[i] += ff[j][i]*w[j]; |
for (i=0; i<nmn; i++){ |
ndofnm = Gtm->give_ndofn(Gtm->gnodes[nid].mnodes[i]); |
for (j=0; j<ndofnm; j++) |
nf[j] += ff[i][j]*w[i]; |
} |
delete [] ff; |
2144,7 → 2173,7 |
else |
{ |
// this is not a hanging node |
select_nodforce (f, nid, nf); |
select_nodforce (f, nid, nf, react); |
} |
} |
2157,10 → 2186,11 |
@param f - array of components for all nodal forces, it is input parameter |
@param nid - node id |
@param nf - %vector of nodal force |
@param react - retrieve reaction components (true) or zero in cases of nodal prescribed displacement values (false) |
1. 10. 2013, TKo |
*/ |
void select_nodforce(double *f, long nid, vector &nf) |
void select_nodforce(double *f, long nid, vector &nf, bool react) |
{ |
long i,ii; |
2169,12 → 2199,12 |
ii=Mt->give_dof(nid,i); |
if (ii < 1) // there is prescribed DOF |
{ |
if (Mp->reactcomp) |
if (Mp->reactcomp && react) |
nf[i]=Mt->nodes[nid].r[i]; |
else |
nf[i]=0.0; |
} |
else // there is free DOFs |
else // there is free DOF |
{ |
if (f != NULL) |
nf[i]=f[ii-1]; |
2841,3 → 2871,66 |
} |
fprintf(Out, "\n"); |
} |
void check_hex_iface_elem() |
{ |
vector x(ASTCKVEC(8)); |
vector y(ASTCKVEC(8)); |
vector z(ASTCKVEC(8)); |
matrix tmat(ASTCKMAT(3,3)); |
long i,j, nip, nne, cerr = 0; |
double v, vt; |
for(i=0; i<Mt->ne; i++){ |
nne = Mt->give_nne(i); |
reallocv(RSTCKVEC(nne, x)); |
reallocv(RSTCKVEC(nne, y)); |
reallocv(RSTCKVEC(nne, z)); |
Gtm->give_node_coord3d(x, y, z, i); |
if (Mt->elements[i].te == hexintface){ |
Hexifc->coord_transf_matrix(tmat, x, y, z); |
for (j=0; j<nne/2; j++){ |
x(j) += tmat(0,2); |
y(j) += tmat(1,2); |
z(j) += tmat(2,2); |
} |
} |
nip = Mt->give_tnip(i); |
vector gp(ASTCKVEC(nip)), w(ASTCKVEC(nip)); |
gauss_points (gp.a, w.a, 2); |
vt = 0; |
jac_3d (v, x, y, z, gp[0], gp[0], gp[0]); |
vt += v; |
jac_3d (v, x, y, z, gp[0], gp[0], gp[1]); |
vt += v; |
jac_3d (v, x, y, z, gp[0], gp[1], gp[0]); |
vt += v; |
jac_3d (v, x, y, z, gp[0], gp[1], gp[1]); |
vt += v; |
jac_3d (v, x, y, z, gp[1], gp[0], gp[0]); |
vt += v; |
jac_3d (v, x, y, z, gp[1], gp[0], gp[1]); |
vt += v; |
jac_3d (v, x, y, z, gp[1], gp[1], gp[0]); |
vt += v; |
jac_3d (v, x, y, z, gp[1], gp[1], gp[1]); |
vt += v; |
if (vt < 0.0){ |
fprintf(Out, "\nNegative Jacobian (%le) on element %ld.", vt, i+1); |
if (Mt->elements[i].te == hexintface) |
fprintf(stdout, "\nNegative Jacobian (vt=%le, b3=[%le, %le, %le]) on hexiface element %ld.", vt, tmat(0,2), tmat(1,2), tmat(2,2), i+1); |
else |
fprintf(stdout, "\nNegative Jacobian (vt=%le) on element %ld.", vt, i+1); |
cerr++; |
} |
else |
fprintf(Out, "\nElement Jacobian vt=%le on element %ld.", vt, i+1); |
fflush(Out); |
} |
if (cerr > 0){ |
fprintf(stdout, "\nNegative Jacobian detected on %ld elements\n", cerr); |
fflush(stdout); |
abort(); |
} |
} |
/trunk/SIFEL/MEFEL/SRC/globmat.h |
---|
39,8 → 39,8 |
void macrostresses(long lcid, vector &msig); |
void nodforce (double *f, long nid, vector &nf); |
void select_nodforce(double *f, long nid, vector &nf); |
void nodforce (double *f, long nid, vector &nf, bool react=true); |
void select_nodforce(double *f, long nid, vector &nf, bool react=true); |
void constr_matrix (long nid,long cid,matrix &lcm); |
52,4 → 52,6 |
void stress_initdispl(long lcid); |
void print_nodval_vec(const double *v, const char *label, FILE *out); |
void check_hex_iface_elem(); |
#endif |
/trunk/SIFEL/MEFEL/SRC/hexiface.cpp |
---|
321,7 → 321,60 |
/** |
The function transforms node coordinates from the global coordinate system to |
the element coordinate system. |
Z coordinates have to be equal to zero for all element nodes after transformation. |
@param[in] gx, gy, gz - arrays with node coordinates in the global system |
@param[out] lx, ly - arrays with node coordinates in the element coordinate system |
@param[in] zero - computer zero |
JK, 22. 1. 2024 |
*/ |
void hexinterface::local_coordinates (vector &gx,vector &gy,vector &gz,vector &lx,vector &ly,double zero) |
{ |
vector lv(ASTCKVEC(3)),gv(ASTCKVEC(3)); |
matrix tmat (ASTCKMAT(3,3)); |
// assembling of transformation matrix |
coord_transf_matrix(tmat,gx,gy,gz); |
// transformation of coordinates of the first node |
gv[0]=gx[0]-gx[2]; gv[1]=gy[0]-gy[2]; gv[2]=gz[0]-gz[2]; |
mtxv (tmat,gv,lv); |
lx[0]=lv[0]; ly[0]=lv[1]; |
if (fabs(lv[2])>1.0e-8) |
print_err("Nonzero z coordinate of the first node in the element coordinate system.",__FILE__,__LINE__,__func__); |
// transformation of coordinates of the second node |
gv[0]=gx[1]-gx[2]; gv[1]=gy[1]-gy[2]; gv[2]=gz[1]-gz[2]; |
mtxv (tmat,gv,lv); |
lx[1]=lv[0]; ly[1]=lv[1]; |
if (fabs(lv[2])>1.0e-8) |
print_err("Nonzero z coordinate of the second node in the element coordinate system.",__FILE__,__LINE__,__func__); |
// transformation of coordinates of the third node |
// the third node will be the origin of the coordinate system |
// the transformation matrix is therefore multiplied by zero vector |
// no transformation is needed |
lx[2]=0.0; ly[2]=0.0; |
// transformation of coordinates of the fourth node |
gv[0]=gx[3]-gx[2]; gv[1]=gy[3]-gy[2]; gv[2]=gz[3]-gz[2]; |
mtxv (tmat,gv,lv); |
lx[3]=lv[0]; ly[3]=lv[1]; |
if (fabs(lv[2])>1.0e-8){ |
print_err("Nonzero z coordinate of the fourth node in the element coordinate system.", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
/** |
The function assembles strain-displacement (geometric) %matrix. |
@param[out] gm - resulting geometric %matrix (output) |
340,19 → 393,23 |
matrix transf(ASTCKMAT(3,3)); |
matrix aux(ASTCKMAT(3,3)); |
vector bf(ASTCKVEC(nne)); |
vector lx(ASTCKVEC(4)),ly(ASTCKVEC(4)); |
vector dx(ASTCKVEC(4)),dy(ASTCKVEC(4)); |
double zero = 1.0e-8; |
dx_bf_lin_4_2d (dx.a,eta); |
dy_bf_lin_4_2d (dy.a,xi); |
derivatives_2d (dx,dy,jac,gy,gz,xi,eta); |
local_coordinates (gx,gy,gz,lx,ly,zero); |
derivatives_2d (dx,dy,jac,lx,ly,xi,eta); |
fillm(0.0,gm); |
fillm(0.0,transf); |
fillm(0.0,aux); |
// transformation matrix from element coordintae system to the global system |
// transformation matrix from element coordinate system to the global system |
coord_transf_matrix (transf,gx,gy,gz); |
// basis functions on a quadrilateral element |
729,9 → 786,10 |
/** |
Function computes actual stresses at integration points on element. |
@param lcid - number of load case |
@param eid - element id |
@param ri,ci - row and column indices |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@return The function stores resulting stresses in the stress array |
of the element integration points. |
762,11 → 820,52 |
/** |
The function computes resulting internal forces due to actual stresses |
Function computes actual stresses for nonlocal material models at integration points on element. |
@param lcid - number of load case |
@param eid - element id |
@param ifor - %vector of internal forces |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@return The function stores resulting stresses in the stress array |
of the element integration points. |
Created by Tomas Koudelka, 1.2024 |
*/ |
void hexinterface::compute_nonloc_nlstress(long lcid, long eid, long ri, long ci) |
{ |
long ii, jj, i, j, ipp; |
ipp = Mt->elements[eid].ipp[ri][ci]; |
for (ii=0; ii<nb; ii++){ |
for (jj=0; jj<nb; jj++){ |
for(i=0; i<intordsm[ii][jj]; i++){ |
for (j=0; j<intordsm[ii][jj]; j++){ |
// computation of actual stresses |
if (Mp->strcomp==1) |
Mm->compnonloc_nlstresses(ipp); |
ipp++; |
} |
} |
} |
} |
} |
/** |
The function computes resulting internal forces due to actual stresses. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@param[out] ifor - %vector of internal forces |
@param[in] x - array of the x coordinates of element nodes |
@param[in] y - array of the y coordinates of element nodes |
@param[in] z - array of the z coordinates of element nodes |
@return The function returns resulting %vector of internal forces in the parameter ifor. |
788,6 → 887,37 |
/** |
The function computes resulting internal forces due to actual stresses in the case of nonlocal material models. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@param[out] ifor - %vector of internal forces |
@param[in] x - array of the x coordinates of element nodes |
@param[in] y - array of the y coordinates of element nodes |
@param[in] z - array of the z coordinates of element nodes |
@return The function returns resulting %vector of internal forces in the parameter ifor. |
Created by Tomas Koudelka, 10.2023 |
*/ |
void hexinterface::nonloc_internal_forces(long lcid, long eid, long ri, long ci, |
vector &ifor, vector &x, vector &y, vector &z) |
{ |
integratedquant iq; |
iq=locstress; |
// computation of stresses |
compute_nonloc_nlstress(lcid, eid, ri, ci); |
// integration of stresses over the element |
elem_integration(iq, lcid, eid, ri, ci, ifor, x, y, z); |
} |
/** |
The function computes resulting internal forces from actual stresses. If required, the transformation |
to the nodal coordinate system is performed. |
824,6 → 954,62 |
/** |
The function computes resulting internal forces from actual stresses in the case of nonlocal material models. |
If required, the transformation to the nodal coordinate system is performed. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[out] ifor - %vector of internal forces |
@return The function returns resulting %vector of internal forces in the parameter ifor. |
Created by Tomas Koudelka, 10.2023 |
*/ |
void hexinterface::res_nonloc_internal_forces (long lcid,long eid,vector &ifor) |
{ |
long transf; |
ivector nodes(ASTCKIVEC(nne)); |
vector v(ASTCKVEC(ndofe)), x(ASTCKVEC(nne)), y(ASTCKVEC(nne)), z(ASTCKVEC(nne)); |
Mt->give_node_coord3d(x, y, z, eid); |
nonloc_internal_forces(lcid, eid, 0, 0, ifor, x, y, z); |
// transformation of nodal forces |
// (in the case of nodal coordinate systems) |
Mt->give_elemnodes(eid, nodes); |
transf = Mt->locsystems(nodes); |
if (transf>0){ |
matrix tmat(ndofe, ndofe); |
transf_matrix(nodes, tmat); |
glvectortransf(ifor, v, tmat); |
copyv(v, ifor); |
} |
matrix sm(ASTCKMAT(ndofe, ndofe)); |
vector r(ASTCKVEC(ndofe)), cifor(ASTCKVEC(ndofe)), difor(ASTCKVEC(ndofe)); |
eldispl(lcid, eid, r.a); |
res_stiffness_matrix(eid, sm); |
mxv(sm, r, cifor); |
subv(ifor, cifor, difor); |
double nif = normv(ifor); |
double ncif = normv(cifor); |
double ndif = normv(difor); |
double iferr = ndif; |
if (nif > 1.0e-15) |
iferr /= nif; |
if (iferr > 1.0e-7){ |
//fprintf(stdout, "\ndifference in internal force computation detected on element %ld, ndif=%le, ncif=%le, nif=%le\n", eid+1, ndif, ncif, nif); |
fprintf(Out, "\ndifference in internal force computation detected on element %ld, ndif=%le, ncif=%le, nif=%le, iferr=%le", eid+1, ndif, ncif, nif, iferr); |
fflush(Out); |
} |
} |
/** |
The function integrates selected quantity on the selected finite element, i.e. \int B^T q dV. |
It results in nodal values. |
/trunk/SIFEL/MEFEL/SRC/hexiface.h |
---|
23,23 → 23,64 |
hexinterface(void); |
~hexinterface(void); |
/// function approximates function defined by the nodal values |
double approx(double xi, double eta, vector &nodval); |
/// function computes global coordinates of the given integration point on element |
void ipcoord (long eid,long ipp,long ri,long ci,vector &coord); |
/// function computes integration point values from the given nodal values of selected quantity |
void intpointval(long eid, vector &nodval, vector &ipval); |
/// function computes transformation %matrix from the element local coordinate system to the global one |
void coord_transf_matrix(matrix &tran, vector &gx, vector &gy, vector &gz); |
/// function computes transformation %matrix of the element from local coordinate systems at nodes to the global one |
void transf_matrix(ivector &nodes, matrix &tmat); |
/// function transforms node coordinates to the local element coordinate system |
void local_coordinates (vector &gx, vector &gy, vector &gz, vector &lx, vector &ly, double zero); |
/// function computes strain-displacement %matrix in the given point |
void geom_matrix(matrix &gm, vector &gx, vector &gy, vector &gz, double xi, double eta, double &jac); |
/// function computes the stiffness %matrix of the element |
void stiffness_matrix(long eid, matrix &sm); |
/// function computes the stiffness %matrix of the element with transformations to the nodal coordinate systems |
void res_stiffness_matrix(long eid, matrix &sm); |
/// function computes resulting strains in the main integration points |
void res_mainip_strains(long lcid, long eid); |
/// function computes strains in the main integration points |
void mainip_strains(long lcid, long eid, vector &r); |
/// function computes resulting stresses in the main integration points |
void res_mainip_stresses(long lcid, long eid); |
void nod_strains_ip (long lcid, long eid); |
void nod_strains_comp (long lcid,long eid,double **stra); |
void nod_stresses_ip (long lcid,long eid); |
/// function computes stresses at all integration points of the element |
void compute_nlstress(long lcid, long eid, long ri, long ci); |
/// function computes stresses for nonlocal material models at all integration points of the element |
void compute_nonloc_nlstress(long lcid, long eid, long ri, long ci); |
/// function computes stress resultants |
void internal_forces(long lcid, long eid, long ri, long ci, vector &ifor, vector &x, vector &y, vector &z); |
/// function computes stress resultants in the case of nonlocal material models |
void nonloc_internal_forces(long lcid, long eid, long ri, long ci, vector &ifor, vector &x, vector &y, vector &z); |
/// function computes stress resultants transformed to the nodal coordinate systems |
void res_internal_forces(long lcid, long eid, vector &ifor); |
/// function computes stress resultants transformed to the nodal coordinate systems in the case of nonlocal material models |
void res_nonloc_internal_forces(long lcid, long eid, vector &ifor); |
/// function integrates required quantity over the element volume, i.e. \int B^T q dV |
void elem_integration(integratedquant iq, long lcid, long eid, long ri, long ci, |
vector &nv, vector &x, vector &y, vector &z); |
/trunk/SIFEL/MEFEL/SRC/hissplas.cpp |
---|
709,8 → 709,10 |
wpf += tensor_dbldot_prod(sigt, depst, 1.0); // post-failure work of plastic strain increments |
gamma = sqrt(gamma_max*gamma_max-k*pow(wpf,3.0/2.0)); |
} |
else |
else{ |
gamma = gamma_max; |
wpf = q[3]; |
} |
// update of hardening parameters |
q[0] = alpha; |
/trunk/SIFEL/MEFEL/SRC/homogmatm.cpp |
---|
390,6 → 390,7 |
double homogmatm::give_strain_vol(long ipp, long ido) |
{ |
//return Mm->ip[ipp].eqother[ido+1]; |
return 0.0; |
} |
/trunk/SIFEL/MEFEL/SRC/homogmech.cpp |
---|
56,6 → 56,7 |
} |
default:{ |
print_err("unknown type of strain-stress state for mechanical homogeniaztion is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
}// end of the switch (strastre){ |
360,6 → 361,7 |
} |
default:{ |
print_err("unknown type of strain-stress state for mechanical homogeniaztion is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
}// end of the switch (strastre){ |
/trunk/SIFEL/MEFEL/SRC/hypoplast.cpp |
---|
1,15 → 1,18 |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include "hypoplast.h" |
#include "global.h" |
#include "intpoints.h" |
#include "vecttens.h" |
#include "mechmat.h" |
#include "probdesc.h.h" |
#include "iotools.h" |
#include "matrix.h" |
#include "vector.h" |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#ifdef FCC_DEF |
extern "C" void umatunsat_(double &, double& , double &, double &, |
double &, double &, double &, double &, |
/trunk/SIFEL/MEFEL/SRC/hypoplunsatexptherm2.cpp |
---|
1092,13 → 1092,12 |
*/ |
double hypoplast_unsat_exp_therm::give_bulk_modulus(long ipp, long ido) |
{ |
long i, ncomp = Mm->ip[ipp].ncompstr; |
long ncomp = Mm->ip[ipp].ncompstr; |
matrix d; |
makerefm(d, Mm->ip[ipp].other+ido+2*ncomp+3+nstatev+12, ngstress, ngstrain); |
double k = 0.0; |
for (i=0; i<3; i++) |
k = d(i,0) + d(i,1) + d(i,2); |
k = 1.0/9.0; |
k = d(0,0) + d(1,1) + d(2,2); |
k /= 3.0; |
return k; |
} |
/trunk/SIFEL/MEFEL/SRC/layplate.cpp |
---|
113,7 → 113,7 |
matrix pomat(3,3); |
matrix pommat(3,3); |
long eid = Mm->elip[ipp]; |
double *k; |
double *k=NULL; |
th = Mc->give_layer_thicke(eid); |
zet = Mc->give_layer_zcoord(eid); |
/trunk/SIFEL/MEFEL/SRC/lfssolver.cpp |
---|
514,7 → 514,8 |
print_step(i, 0, 0.0, NULL); |
} |
print_close(); |
delete [] condmat; |
delete [] condvect; |
} |
/trunk/SIFEL/MEFEL/SRC/lintet.cpp |
---|
1180,14 → 1180,11 |
void lintet::elem_integration(integratedquant iq,long lcid,long eid,long ri,long ci,vector &nv,vector &x,vector &y,vector &z) |
{ |
long ipp; |
double xi,eta,zeta,det,jac; |
double det,jac; |
vector ipv(ASTCKVEC(tncomp)),contr(ASTCKVEC(ndofe)); |
matrix gm(ASTCKMAT(tncomp,ndofe)); |
ipp=Mt->elements[eid].ipp[ri][ci]; |
xi=0.25; |
eta=0.25; |
zeta=0.25; |
nullv (nv); |
det = det3d (x.a,y.a,z.a); |
//det = fabs(det); |
1387,9 → 1384,11 |
{ |
for (jj = 0; jj < nb; jj++) |
{ |
ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; |
if (intordsm[ii][jj] == 0) |
continue; |
ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; |
ncompstr = Mm->ip[ipp].ncompstr; |
ncompeqother = Mm->ip[ipp].ncompeqother; |
reallocv (RSTCKVEC(intordsm[ii][jj],gp1)); |
reallocv (RSTCKVEC(intordsm[ii][jj],gp2)); |
reallocv (RSTCKVEC(intordsm[ii][jj],gp3)); |
1492,12 → 1491,10 |
*/ |
double lintet::volumeip (long eid,long ri,long ci) |
{ |
long ipp; |
double jac,det; |
vector x(ASTCKVEC(nne)),y(ASTCKVEC(nne)),z(ASTCKVEC(nne)); |
Mt->give_node_coord3d (x,y,z,eid); |
ipp=Mt->elements[eid].ipp[ri][ci]; |
det = det3d (x.a,y.a,z.a); |
//jac=fabs(det)/6.0; |
/trunk/SIFEL/MEFEL/SRC/lintetrot.cpp |
---|
1276,14 → 1276,15 |
void lintetrot::elem_integration(integratedquant iq,long lcid,long eid,long ri,long ci,vector &nv,vector &x,vector &y,vector &z) |
{ |
long ipp; |
double xi,eta,zeta,det,jac; |
double det,jac; |
vector ipv(tncomp),contr(ndofe); |
matrix gm(tncomp,ndofe); |
ipp=Mt->elements[eid].ipp[ri][ci]; |
/* |
xi=0.25; |
eta=0.25; |
zeta=0.25; |
zeta=0.25;*/ |
fillv (0.0,nv); |
det = det3d (x.a,y.a,z.a); |
det = fabs(det); |
1550,12 → 1551,10 |
*/ |
double lintetrot::volumeip (long eid,long ri,long ci) |
{ |
long ipp; |
double jac,det; |
vector x(nne),y(nne),z(nne); |
Mt->give_node_coord3d (x,y,z,eid); |
ipp=Mt->elements[eid].ipp[ri][ci]; |
det = det3d (x.a,y.a,z.a); |
jac=fabs(det)/6.0; |
/trunk/SIFEL/MEFEL/SRC/loadcase.cpp |
---|
92,7 → 92,7 |
if(tempchang == 5){ |
if (pts!=NULL){ |
for(i=0;i<ntemp_file;i++) |
for(i=0;i<Mt->nn;i++) |
delete pts[i]; |
} |
} |
203,16 → 203,17 |
if (tempchang==5){//reading temperatures from multiple files |
fprintf (stdout,"\n temperature loading - reading temperatures from extra multiple input files"); |
xfscanf(in, " %ld",&ntemp_file); |
pts = new double* [ntemp_file]; |
temp_time = new double [ntemp_file]; |
npt = Mt->nn; |
pts = new double*[npt]; |
for (i=0; i<npt; i++) |
pts[i] = new double[ntemp_file]; |
temp_time = new double[ntemp_file]; |
for (i=0;i<ntemp_file;i++){ |
xfscanf(in, " %lf",temp_time+i); |
xfscanf(in, " %a", temp_file); |
in_data = xfopen(temp_file,"r"); |
npt = Mt->nn; |
pts[i] = new double [npt]; |
for (j=0;j<npt;j++){ |
xfscanf (in_data,"%lf",&pts[i][j]); |
xfscanf (in_data,"%lf",&pts[j][i]); |
} |
xfclose(in_data); |
} |
676,7 → 677,7 |
*/ |
void loadcase::tempercontrib (long lcid,double *rhs,double scale) |
{ |
long i,j; |
long i; |
// contributions from temperature changes |
if (tempchang==1 || tempchang==4){ |
737,24 → 738,12 |
//selection of correct nodal values |
npt = Mt->nn; |
pt = new double [npt]; |
pt = new double[npt]; |
/////////////////////////////////////// |
//toto vlozit do nejake funkce??!! |
tablefunct *tabf1; |
tabf1 = new tablefunct; |
tabf1->itype = piecewiselin; |
tabf1->asize = ntemp_file; |
tabf1->x=new double[ntemp_file]; |
tabf1->y=new double[ntemp_file]; |
for(i=0;i<Mt->nn;i++){ |
for(j=0;j<ntemp_file;j++){ |
tabf1->x[j] = temp_time[j]; |
tabf1->y[j] = pts[j][i]; |
} |
pt[i] = tabf1->getval(Mp->time); |
tablefunct tabf1(temp_time, pts[i], ntemp_file); |
pt[i] = tabf1.getval(Mp->time); |
} |
/////////////////////////////////////// |
// approximation of nodal temperatures to integration points |
intpointval (pt,temperature,1.0); |
763,7 → 752,7 |
Mm->temprstrains (); |
// computation of nodal forces caused by temperature |
nodal_eigstrain_forces (lcid,rhs,Mp->time); |
nodal_eigstrain_forces (lcid,rhs,Mp->time); |
} |
} |
1072,22 → 1061,10 |
npt = Mt->nn; |
pt = new double [npt]; |
/////////////////////////////////////// |
//toto vlozit do nejake funkce??!! |
tablefunct *tabf1; |
tabf1 = new tablefunct; |
tabf1->itype = piecewiselin; |
tabf1->asize = ntemp_file; |
tabf1->x=new double[ntemp_file]; |
tabf1->y=new double[ntemp_file]; |
for(i=0;i<Mt->nn;i++){ |
for(j=0;j<ntemp_file;j++){ |
tabf1->x[j] = temp_time[j]; |
tabf1->y[j] = pts[j][i]; |
} |
pt[i] = tabf1->getval(Mp->time); |
tablefunct tabf1(temp_time, pts[i], ntemp_file); |
pt[i] = tabf1.getval(Mp->time); |
} |
/////////////////////////////////////// |
// get element number for the aux. int. point |
eid = Mm->elaip[app]; |
/trunk/SIFEL/MEFEL/SRC/loadel.cpp |
---|
392,7 → 392,6 |
nnve = 2; |
nodvale = new double[nnve]; |
memset(nodvale, 0, sizeof(*nodvale)*nnve); |
k=0; |
// read temperature change dT over the profile height (i=0) and |
// profile height h_y (i=1) |
for(i=0; i<nnve; i++){ |
413,7 → 412,6 |
nnve = 2; |
nodvale = new double[nnve]; |
memset(nodvale, 0, sizeof(*nodvale)*nnve); |
k=0; |
// read temperature change dT over the profile height (i=0) and |
// profile height h_z (i=1) |
for(i=0; i<nnve; i++){ |
/trunk/SIFEL/MEFEL/SRC/lssolver.cpp |
---|
31,7 → 31,7 |
void solve_linear_statics () |
{ |
long i,n,aux; |
double *lhs,*rhs,*fl,*fi; |
double *rhs,*fl,*fi; |
// stiffness matrix assembling |
stiffness_matrix (0); |
109,8 → 109,6 |
// indicator of computation of other array |
// it means, stresses at integration points have not been computed |
Mp->otherstate=0; |
// left hand side vector for debugging |
lhs = Lsrs->give_lhs(i); |
// rhs was rewritten by the solver call -> rebuild load vector |
aux = Mp->homog; |
Mp->homog = 0; |
/trunk/SIFEL/MEFEL/SRC/mdsolver.cpp |
---|
5,6 → 5,8 |
#include "gmatrix.h" |
#include "mechprint.h" |
#include "node.h" |
#include "lhsrhs.h" |
#include "mechmat.h" |
#include <string.h> |
/** |
/trunk/SIFEL/MEFEL/SRC/mechbclc.cpp |
---|
567,6 → 567,7 |
} |
default:{ |
print_err("unknown type of strain-stress state", __FILE__, __LINE__, __func__); |
abort(); |
} |
}// end of the switch (strastre){ |
626,6 → 627,7 |
} |
default:{ |
print_err("unknown type of strain-stress state", __FILE__, __LINE__, __func__); |
abort(); |
} |
}// end of the switch (strastre){ |
704,6 → 706,7 |
} |
default:{ |
print_err("unknown type of strain-stress state", __FILE__, __LINE__, __func__); |
abort(); |
} |
}// end of the switch (strastre){ |
762,6 → 765,7 |
} |
default:{ |
print_err("unknown type of strain-stress state", __FILE__, __LINE__, __func__); |
abort(); |
} |
}// end of the switch (strastre){ |
998,7 → 1002,7 |
*/ |
void mechbclc::aip_eigstrain_computation (long n, ipmap *ipm, double time) |
{ |
long i, k, ncomp, gfid; |
long i, k, app, ncomp, gfid; |
vector coord(4); // three spatial coordinates + time |
const char *namev[4]; |
namev[0] = "x"; |
1017,16 → 1021,17 |
coord(1) = ipm[i].y; |
coord(2) = ipm[i].z; |
coord(3) = time; |
app = ipm[i].app; |
// the true number of strain components in the integration point |
ncomp = Mm->aip[i].ncompstr; |
ncomp = Mm->aip[app].ncompstr; |
// loop over the number of eigenstrain components |
for (k=0; k<ncomp; k++){ |
// id of the general function |
gfid = Mm->aip_eigstrid[i][k]; |
gfid = Mm->aip_eigstrid[app][k]; |
if (Mp->eigstrains < 3) |
Mm->aip_eigstrains[i][k] = eigstrfun[gfid].getval(coord, namev); |
Mm->aip_eigstrains[app][k] = eigstrfun[gfid].getval(coord, namev); |
if (Mp->eigstrains > 3) |
Mm->aip_eigstresses[i][k] = eigstrfun[gfid].getval(coord, namev); |
Mm->aip_eigstresses[app][k] = eigstrfun[gfid].getval(coord, namev); |
} |
} |
} |
1709,19 → 1714,19 |
{ |
dlc[lcid].pid[ipid] = ico[i].val[0]; |
ipid++; |
Gtm->gnodes[i].save_dof(0, -(dlc[lcid].max_npd+ipid)); |
Gtm->gnodes[i].save_dof(0, -(max_npd+ipid)); |
} |
if ((ico[i].type & inidisp_y)) |
{ |
dlc[lcid].pid[ipid] = ico[i].val[1]; |
ipid++; |
Gtm->gnodes[i].save_dof(1, -(dlc[lcid].max_npd+ipid)); |
Gtm->gnodes[i].save_dof(1, -(max_npd+ipid)); |
} |
if ((ico[i].type & inidisp_z)) |
{ |
dlc[lcid].pid[ipid] = ico[i].val[2]; |
ipid++; |
Gtm->gnodes[i].save_dof(2, -(dlc[lcid].max_npd+ipid)); |
Gtm->gnodes[i].save_dof(2, -(max_npd+ipid)); |
} |
} |
else // all initial displacements specified are taken into account |
1731,7 → 1736,7 |
{ |
dlc[lcid].pid[ipid] = ico[i].val[j]; |
ipid++; |
Gtm->gnodes[i].save_dof(j, -(dlc[lcid].max_npd+ipid)); |
Gtm->gnodes[i].save_dof(j, -(max_npd+ipid)); |
} |
} |
} |
/trunk/SIFEL/MEFEL/SRC/mechcrsec.cpp |
---|
377,6 → 377,7 |
} |
default: |
print_err("unknown cross section type is required",__FILE__,__LINE__,__func__); |
abort(); |
} |
} |
424,7 → 425,7 |
*/ |
double mechcrsec::give_onethickness (crsectype crst,long idcs) |
{ |
double t; |
double t=0.0; |
switch (crst){ |
case nocrosssection:{ |
454,6 → 455,7 |
} |
default:{ |
print_err("unknown cross section type is required",__FILE__,__LINE__,__func__); |
abort(); |
} |
} |
653,7 → 655,7 |
void mechcrsec::give_densitye (long eid,double &rho) |
{ |
switch (Mt->elements[eid].crst){ |
case nocrosssection:{ |
case nocrosssection:{ |
break; |
} |
case csbar2d:{ |
678,6 → 680,7 |
} |
default:{ |
print_err("unknown cross section type is required",__FILE__,__LINE__,__func__); |
abort(); |
} |
} |
} |
698,7 → 701,7 |
void mechcrsec::give_density (long eid,ivector &nodes,vector &dens) |
{ |
long i,nne; |
double d; |
double d = 0.0; |
if (Mt->elements[eid].crst==0){ |
give_densityn (nodes,dens); |
727,7 → 730,7 |
*/ |
double mechcrsec::give_weight (crsectype cr,long idcs) |
{ |
double m; |
double m = 0.0; |
switch (cr){ |
case nocrosssection:{ |
827,7 → 830,7 |
*/ |
long mechcrsec::give_num_lay (long eid) |
{ |
long nl; |
long nl = 0.0; |
switch (Mt->elements[eid].crst){ |
case cslayer:{ |
836,6 → 839,7 |
} |
default: |
print_err("unknown type of layered cross section is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
return nl; |
} |
/trunk/SIFEL/MEFEL/SRC/mechmat.cpp |
---|
142,11 → 142,11 |
eliso=NULL; elgm2d=NULL; elgm3d=NULL; |
spl1d=NULL; j2f=NULL; mcoul=NULL; mcpar=NULL; |
boerm=NULL; drprm=NULL; ddpm=NULL; drprm2=NULL; cclay=NULL; cclayc=NULL; shpl=NULL; hisspl=NULL; |
boerm=NULL; drprm=NULL; ddpm=NULL; drprm2=NULL; cclay=NULL; cclayc=NULL; bbm=NULL; shpl=NULL; hisspl=NULL; |
glasgmat=NULL; glasgdam=NULL; crdam=NULL; tswmat=NULL; ntswmat=0L; effstr=NULL; |
mpM4=NULL; mpSIM=NULL; mpfib=NULL; nmpM4=NULL; |
svis=NULL; isovis=NULL; svipl=NULL; lmtr=NULL; |
scdam=NULL; anidam=NULL; anidamrot=NULL; ortdam=NULL; |
scdam=NULL; scdamcc=NULL; anidam=NULL; anidamrot=NULL; ortdam=NULL; |
ortdam2=NULL; ortdamrot=NULL; |
aci78mod=NULL; cebfip78mod=NULL; |
grmat=NULL; geoel=NULL; veliso=NULL; elisopd = NULL; |
241,7 → 241,7 |
delete [] svis; delete [] isovis; |
delete [] lmtr; |
delete [] scdam; delete [] anidam; delete [] anidamrot; |
delete [] scdam; delete [] scdamcc; delete [] anidam; delete [] anidamrot; |
delete [] ortdam; delete [] ortdam2; delete [] ortdamrot; |
delete [] aci78mod; delete [] cebfip78mod; |
793,7 → 793,7 |
ipp = Mt->elements[eid].ipp[0][0]; |
if (Gtm->leso[eid]==1){ |
// copy function id of all components from the first integration point of the corresponding element |
memcpy(aip_eigstrid[i], eigstrid[ipp], sizeof(*eigstrid[ipp])*aip[i].ncompstr); |
memcpy(aip_eigstrid[app], eigstrid[ipp], sizeof(*eigstrid[ipp])*aip[app].ncompstr); |
} |
} |
// compute actual values of eigenstrains/eigenstresses |
2537,17 → 2537,14 |
*/ |
void mechmat::initmaterialmodels (long lcid) |
{ |
long i,j,nip,ipp,nm; |
elemtype te; |
long i,j,nip,ipp; |
for (i=0;i<Mt->ne;i++){ |
if (Gtm->leso[i]==1){ |
te = Mt->give_elem_type (i); |
nip = Mt->give_tnip (i); |
// number of the first integration point |
ipp=Mt->elements[i].ipp[0][0]; |
for(j=0; j<nip; j++){ |
nm = ip[ipp+j].nm; |
initvalues(lcid, ipp+j, 0, 0); |
} |
} |
2795,9 → 2792,51 |
/** |
The function returns the number of the normal components in the stress/strain state defined at |
the given int. point, i.e. number of the normal componnets in int. point arrays strain/stress. |
@param[in] ipp - integration point pointer |
@return The function returns the number of the normal stress/strain components. |
Created by TKo, 02.2024 |
*/ |
long mechmat::give_num_norm_comp(long ipp) |
{ |
strastrestate ssst = ip[ipp].ssst; |
long ret = 0; |
switch(ssst){ |
case bar: |
ret = 1; |
break; |
// case plbeam: |
// case spacebeam: |
case planestress: |
case planestrain: |
ret = 2; |
break; |
case planecontact: |
ret = 1; |
break; |
// case platek: |
// case plates:, |
// case shell:, |
case axisymm: |
case spacestress: |
ret = 3; |
break; |
default: |
print_err("unknown stress/strain state(%d) is required", __FILE__, __LINE__, __func__, int(ssst)); |
} |
return ret; |
} |
// ***************************************************************************** |
// ***************************************************************************** |
// |
3936,6 → 3975,8 |
break; |
case damplifmat: |
ncompo = 4+ncompstr-1; |
if (damplifm[ip[ipp].idm[im]].coref == yes) |
ncompo += 1; |
break; |
case creeprs: |
case creepb3: |
5689,7 → 5730,7 |
double mechmat::give_preconspress(long ipp, long im, long ido) |
{ |
long i, ncompo; |
double pc; |
double pc=0.0; |
i = ip[ipp].idm[im]; |
5745,7 → 5786,7 |
double mechmat::give_virgporosity(long ipp, long im, long ido) |
{ |
long i, ncompo; |
double e_lambda1; |
double e_lambda1=0.0; |
i = ip[ipp].idm[im]; |
5962,7 → 6003,7 |
double mechmat::give_iniporosity(long ipp, long im, long ido) |
{ |
long i, ncompo; |
double n_ini; |
double n_ini=0.0; |
i = ip[ipp].idm[im]; |
6171,7 → 6212,7 |
double mechmat::give_consparam (long ipp, long im, long ido) |
{ |
long i,ncompo; |
double cp; |
double cp=0.0; |
i = ip[ipp].idm[im]; |
6411,8 → 6452,8 |
dam = give_crackwidth (ipp, im+1, ido+ncompo); |
break; |
case shrinkagemat: |
ncompo = givencompeqother(ipp,im); |
ncompo = givencompeqother(ipp,im+1); // number of components due to the shrinkage material |
ncompo = givencompeqother(ipp,im); |
ncompo -= givencompeqother(ipp,im+1); // number of components due to the shrinkage material |
dam = give_crackwidth (ipp, im+1, ido+ncompo); |
break; |
case damplifmat: |
7945,7 → 7986,8 |
void mechmat::compnonloc_nlstresses (long ipp,long im,long ido) |
{ |
long ncompo; |
switch (ip[ipp].tm[im]){ |
mattype mtype = ip[ipp].tm[im]; |
switch (mtype){ |
case elisomat:{ |
eliso[ip[ipp].idm[im]].nlstresses (ipp,im,ido); |
break; |
8007,27 → 8049,59 |
drprm[ip[ipp].idm[im]].nlstresses (ipp,im,ido); |
break; |
} |
case doubledrprager:{ |
/*if (ip[ipp].hmt & 2) |
//ddpm[ip[ipp].idm[im]].nonloc_nlstresses (ipp,im,ido); |
//ddpm[ip[ipp].idm[im]].nonloc_nlstresses (ipp,im,ido); |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
ddpm[ip[ipp].idm[im]].nlstresses (ipp,im,ido);*/ |
ddpm[ip[ipp].idm[im]].nlstresses (ipp, im, ido); |
break; |
} |
case druckerprager2:{ |
/*if (ip[ipp].hmt & 2) |
drprm[ip[ipp].idm[im]].nonloc_nlstresses (ipp,im,ido); |
// drprm[ip[ipp].idm[im]].nonloc_nlstresses (ipp,im,ido); |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
drprm[ip[ipp].idm[im]].nlstresses (ipp,im,ido);*/ |
drprm2[ip[ipp].idm[im]].nlstresses (ipp, im, ido); |
break; |
} |
case modcamclaymat:{ |
// cclay[ip[ipp].idm[im]].nonloc_nlstresses (ipp); |
// cclay[ip[ipp].idm[im]].nonloc_nlstresses (ipp); |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
cclay[ip[ipp].idm[im]].nlstresses (ipp, im, ido); |
break; |
} |
case modcamclaycoupmat:{ |
// cclay[ip[ipp].idm[im]].nonloc_nlstresses (ipp); |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
cclayc[ip[ipp].idm[im]].nlstresses (ipp, im, ido); |
break; |
} |
case hissplasmat:{ |
// cclay[ip[ipp].idm[im]].nonloc_nlstresses (ipp); |
// hisspl[ip[ipp].idm[im]].nonloc_nlstresses (ipp); |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
hisspl[ip[ipp].idm[im]].nlstresses (ipp, ido); |
break; |
} |
case effective_stress:{ |
8036,10 → 8110,18 |
compnonloc_nlstresses(ipp, im+1, ido+ncompo); |
break; |
} |
/* |
case lemaitr:{ |
// lmtr[ip[ipp].idm[im]].nlstresses (ipp); |
// lmtr[ip[ipp].idm[im]].nonloc_nlstresses (ipp); |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
lmtr[ip[ipp].idm[im]].nlstresses (ipp); |
break; |
} |
}*/ |
case scaldamage:{ |
scdam[ip[ipp].idm[im]].nlstresses (ipp,im,ido); |
break; |
8144,6 → 8226,39 |
eltimemat[ip[ipp].idm[im]].nlstresses (ipp, ido); |
break; |
} |
case contmat:{ |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
conmat[ip[ipp].idm[im]].nlstresses (ipp,im,ido); |
break; |
} |
case cebfipcontmat:{ |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
cebfipconmat[ip[ipp].idm[im]].nlstresses (ipp,im,ido); |
break; |
} |
case damplifmat:{ |
if (ip[ipp].hmt & 2){ |
print_err("non-local version of the model %s is not yet implemented (ipp=%ld, eid=%ld)", |
__FILE__, __LINE__, __func__, mattype_kwdset.get_str(mtype), ipp, elip[ipp]+1); |
abort(); |
} |
else |
damplifm[ip[ipp].idm[im]].nlstresses (ipp,im,ido); |
break; |
} |
default:{ |
print_err("unknown material type is required",__FILE__,__LINE__,__func__); |
} |
8375,7 → 8490,8 |
{ |
for (app=0; app<tnaip; app++) |
{ |
if (Gtm->leso[app]==1) |
eid = elaip[app]; |
if (Gtm->leso[eid]==1) |
{ |
nc = aip[app].ncompstr; |
for (k=0; k<nc; k++) |
8632,8 → 8748,8 |
give_aver_quantv(ipp, im+2, ido+ncompo, qv); |
break; |
case shrinkagemat: |
ncompo = givencompeqother(ipp,im); |
ncompo = givencompeqother(ipp,im+1); // number of components due to the shrinkage material |
ncompo = givencompeqother(ipp,im); |
ncompo -= givencompeqother(ipp,im+1); // number of components due to the shrinkage material |
give_aver_quantv(ipp, im+2, ido+ncompo, qv); |
break; |
default:{ |
8658,7 → 8774,7 |
*/ |
double mechmat::nonlocradius (long ipp,long im) |
{ |
double r; |
double r=0.0; |
switch (ip[ipp].tm[im]){ |
case nonlocplastmat : |
9474,7 → 9590,7 |
*/ |
double mechmat::yieldfunction (long ipp, long idpm, vector &sig,vector &q) |
{ |
double f; |
double f=0.0; |
switch (ip[ipp].tm[idpm]){ |
case simplas1d:{ |
10534,7 → 10650,7 |
*/ |
long mechmat::give_num_interparam (long ipp,long idpm) |
{ |
long np; |
long np=0; |
switch (ip[ipp].tm[idpm]){ |
case simplas1d:{ |
10735,7 → 10851,7 |
*/ |
void mechmat::cutting_plane (long ipp, long im, long ido, double &gamma, vector &epsn, vector &epsp, vector &q, long ni, double err) |
{ |
long i,j,ncomp=epsn.n,idem; |
long i,j,ncomp=epsn.n; |
double f,denom, denomh, dgamma, nordsig, norsig, rnorsig; |
vector epsa(ASTCKVEC(ncomp)),sig(ASTCKVEC(ncomp)),dfds(ASTCKVEC(ncomp)),dgds(ASTCKVEC(ncomp)); |
vector sigt(ASTCKVEC(6)), sigp(ASTCKVEC(ncomp)), dsig(ASTCKVEC(ncomp)); |
10751,7 → 10867,6 |
d[0][3] = d[0][1]; d[1][3] = d[1][0]; |
d[3][0] = d[1][0]; d[3][1] = d[1][0]; d[3][3] = d[1][1]; |
} |
idem = ip[ipp].gemid(); |
/* if (ip[ipp].ssst == planestress) |
{ |
nu = give_actual_nu(ipp); |
10874,7 → 10989,7 |
long mechmat::cutting_plane (long ipp, long im, long ido, double &gamma, vector &epsn, vector &epsp, vector &q, |
long ni, double err, long dcomp, matrix &cd) |
{ |
long i,j,ncomp=epsn.n,idem; |
long i,j,ncomp=epsn.n; |
long ncsh = ncomp + q.n; // dimension of extended vector |
double f,denom, denomh, dgamma, nordsig, norsig, rnorsig, rnorf; |
vector epsa(ASTCKVEC(ncomp)),sig(ASTCKVEC(ncomp)),dfds(ASTCKVEC(ncomp)),dgds(ASTCKVEC(ncomp)); |
10915,7 → 11030,6 |
d[0][3] = d[0][1]; d[1][3] = d[1][0]; |
d[3][0] = d[1][0]; d[3][1] = d[1][0]; d[3][3] = d[1][1]; |
} |
idem = ip[ipp].gemid(); |
/* if (ip[ipp].ssst == planestress) |
{ |
nu = give_actual_nu(ipp); |
11140,140 → 11254,6 |
/** |
Function returns stresses on sufrace of plasticity. |
Cutting plane method is used. |
gamma,epsp and q will be replaced by new values |
@param[in] ipp - integration point pointer |
@param[in] im - material index |
@param[in] ido - index of internal variables for given material in the ipp other array |
@param[in/out] gamma - consistency parameter |
@param[in] epsn - total strain components |
@param[in/out] epsp - plastic strain components |
@param[in/out] q - hardening parameters |
@param[in] ni - maximum number of iterations |
@param[in] err - required error |
@return The function returns actual plastic strain %vector in the parameter epsp, |
actual consistency parameter in the parameter gamma and actual %vector of |
hardening parameters in the parameter q. |
Created by JK, 4.8.2001 |
Modified by TKo |
Modified by J. Fiedler |
*/ |
void mechmat::cutting_plane2 (long ipp,long im,long ido,double &gamma,vector &epsn,vector &epsp,vector &q,long ni,double err) |
{ |
long i,j,b,ncomp=epsn.n,idem; |
double f,denom,denomh,dgamma,pom; |
vector epsa(ncomp),sig(ncomp),dfds(ncomp),dgds(ncomp); |
matrix d(ncomp,ncomp); |
// initialization |
dgamma=0.0; |
if (ip[ipp].ssst == planestress) |
{ |
ip[ipp].ssst = axisymm; |
b=1; |
} |
// elastic stiffness matrix |
elmatstiff (d,ipp); |
if (ip[ipp].ssst == planestrain) |
{ |
d[0][3] = d[0][1]; d[1][3] = d[1][0]; |
d[3][0] = d[1][0]; d[3][1] = d[1][0]; d[3][3] = d[1][1]; |
} |
idem = ip[ipp].gemid(); |
//fprintf (Out,"\n\n int. point %ld \n",ipp); |
// main iteration loop |
for (i=0;i<ni;i++){ |
//fprintf (Out,"\n cutting plane, iterace %ld",i); |
// elastic strain |
subv (epsn,epsp,epsa); |
// trial stress computation |
mxv (d,epsa,sig); |
// add initial stresses (eigenstresses) if defined |
if ((Mp->eigstrains == 4) || (Mp->eigstrains == 5)){ |
for (j=0; j<ncomp; j++) |
sig(j) += eigstresses[ipp][j]; |
} |
//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, elip[ipp]+1); |
// updating hardening variables from previous step |
updateq(ipp, im, ido, dgamma, epsn, epsp, sig, q); |
// checking yield function |
f = yieldfunction (ipp,im,sig,q); |
//if (f>0.0) printf ("\n plasticity at int. point %ld",ipp); |
//fprintf (Out,"\n step %ld yield function %le",i,f); |
if (f<err) break; |
if (i==ni-1 && f>err){ |
print_err("yield surface was not reached",__FILE__,__LINE__,__func__); |
fprintf (Out,"\n yield surface was not reached"); |
} |
dfdsigma (ipp, im, sig, q, dfds); |
dgdsigma (ipp, im, sig, q, dgds); |
mxv (d,dgds,epsa); |
scprd (dfds,epsa,denom); |
//fprintf (Out," denom %le",denom); |
//denom += plasmodscalar(ipp, im, ido, sigt, epsn, epsp, q,gamma); |
denomh=0; |
plasmodscalar(denomh,ipp, im, ido, sig, epsn, epsp, q,gamma); |
denom += denomh; |
//fprintf (Out," denom %le",denom); |
// new increment of consistency parameter |
dgamma = f/denom; |
// new internal variables |
gamma+=dgamma; |
// updating plastic strains |
for (j=0;j<ncomp;j++){ |
epsp[j]+=dgamma*dgds[j]; |
} |
} |
// elastic strain |
subv (epsn,epsp,epsa); |
// stress computation |
mxv (d,epsa,sig); |
if (b==1) |
{ |
pom = sig[3]; |
sig[3] = sig[2]; |
sig[2] = pom; |
} |
// add initial stresses (eigenstresses) if defined |
if ((Mp->eigstrains == 4) || (Mp->eigstrains == 5)){ |
for (j=0; j<ncomp; j++) |
sig(j) += eigstresses[ipp][j]; |
} |
// storing resulting stresses |
storestress (0,ipp,sig); |
if (b==1) |
ip[ipp].ssst = planestress; |
} |
/** |
Function returns stresses on sufrace of plasticity. |
Cutting plane method is used. |
Special approach for plane stress is implemented. |
gamma,epsp and q will be replaced by new values |
11301,7 → 11281,7 |
matrix d(n,n); |
double pom,nu; |
if ((ip[ipp].ssst == planestress)) |
if (ip[ipp].ssst == planestress) |
{ |
ip[ipp].ssst = axisymm; |
epsn[3] = epsn[2]; // switching total strain components due to change to axisym problem |
11367,12 → 11347,13 |
*/ |
void mechmat::mult_surf_cutting_plane (long ipp,vector &epsn,vector &epsp,vector &gamma,vector &q) |
{ |
long ni,i,j,k,nas,ncomp=epsn.n,nhp=q.n,nyf=gamma.n,*stat; |
long ni,i,j,k,nas,ncomp=epsn.n,nhp=q.n,nyf=gamma.n; |
double err; |
vector epsptr(ncomp),epsa(ncomp),sig(ncomp),f(nyf),qtr(nhp); |
vector epsptr(ASTCKVEC(ncomp)),epsa(ASTCKVEC(ncomp)),sig(ASTCKVEC(ncomp)),f(ASTCKVEC(nyf)),qtr(ASTCKVEC(nhp)); |
vector dq,dgamma,ff; |
matrix d(ncomp,ncomp),h(nhp,nhp); |
matrix d(ASTCKMAT(ncomp,ncomp)),h(ASTCKMAT(nhp,nhp)); |
matrix fsig,fq,cpm,amq,am,acpm; |
ivector stat(ASTCKIVEC(nyf)); |
//ni = Mp->nicp; |
//err = Mp->errcp; |
11382,9 → 11363,7 |
// initialization |
copyv (epsp,epsptr); |
copyv (q,qtr); |
stat = new long [nyf]; |
// main iteration loop |
for (i=0;i<ni;i++){ |
12829,7 → 12808,7 |
// number of components of array eqother belonging to viscous material |
ncompo = givencompother(ipp,im+1); |
double f,g,dlambda,cs; |
double f,g=0.0,dlambda,cs=0.0; |
vector epsp(ASTCKVEC(ncomp)),dq(ASTCKVEC(ncomph)),dh(ASTCKVEC(ncomph)),dfds(ASTCKVEC(ncomp)); |
matrix d(ASTCKMAT(ncomp,ncomp)),epspt(ASTCKMAT(3,3)), h(ASTCKMAT(ncomph, ncomph)); |
vector sigt(ASTCKVEC(6)); |
12939,7 → 12918,7 |
{ |
long i,ncomp=ip[ipp].ncompstr; |
double time, |
complian, |
complian=0.0, |
strength, |
shrink; |
vector eps(ncomp),sig(ncomp); |
12990,7 → 12969,7 |
*/ |
double mechmat::give_first_derivative (long ipp,double r) |
{ |
double d; |
double d=0.0; |
switch (ip[ipp].tm[0]){ |
case lenjonespot:{ |
13019,7 → 12998,7 |
*/ |
double mechmat::give_second_derivative (long ipp,double r) |
{ |
double d; |
double d=0.0; |
switch (ip[ipp].tm[0]){ |
case lenjonespot:{ |
/trunk/SIFEL/MEFEL/SRC/mechmat.h |
---|
211,7 → 211,10 |
/// initailizes material models for the given int. point |
void initvalues (long lcid, long ipp,long im,long ido); |
/// returns the number of the normal components in the stress/strain state of the given int. point |
long give_num_norm_comp(long ipp); |
// ***************************************************************************** |
// Function used for access to stress/strain/eqother/other arrays on int. points |
// ***************************************************************************** |
637,9 → 640,6 |
long cutting_plane (long ipp, long im, long ido, double &gamma, vector &epsn, vector &epsp, vector &q, long ni, double err, |
long dcomp, matrix &d); |
/// cutting plane stress return algorithm with modification for the plane stress problems |
void cutting_plane2 (long ipp, long im, long ido, double &gamma, vector &epsn, vector &epsp, vector &q,long ni,double err); |
/// cutting plane stress return algorithm with general modification for plane stress |
void cutting_plane3 (long ipp,long im,long ido,double &gamma,vector &epsn,vector &epsp,vector &q,long ni,double err); |
/trunk/SIFEL/MEFEL/SRC/mechprint.cpp |
---|
250,10 → 250,7 |
*/ |
void print_step(long lcid, long istep, double lambda, double *fi) |
{ |
//compute_req_val (lcid); |
switch(Mp->tprob) |
{ |
switch(Mp->tprob){ |
case linear_statics: |
case load_balancing: |
case layered_linear_statics: |
287,6 → 284,43 |
/** |
The function performs all prints requirements for given step. |
@param lcid - load case id |
@param istep - step id |
@param lambda - load coefficient or time (it depends on problem type and solver) |
@param fi - array of additional values at nodes which should be printed. |
It depends on problem and solver type. For example for nonlinear |
statics it contains the internal forces. |
@param fr - array of residual %vector components at nodes which should be printed. |
@return The function does not return anything. |
Created 01.2024 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
void print_step(long lcid, long istep, double lambda, double *fi, double *fr) |
{ |
switch(Mp->tprob){ |
case mat_nonlinear_statics: |
case geom_nonlinear_statics: |
case earth_pressure: |
case mech_timedependent_prob: |
case nonlin_floating_subdomain: |
case growing_mech_structure: |
Outdm->print_newstep(Outdm->outf, lcid, istep, lambda); |
Outdm->print_out(Outdm->outf, lcid, istep, lambda); |
Outdm->print_diags(lcid, lambda, istep, fi, fr); |
Outdm->print_graphics(Outdm->outgr, lcid, lambda, istep, fi, fr); |
break; |
default: |
print_err("unsupported problem type is required", __FILE__, __LINE__, __func__); |
break; |
} |
} |
/** |
The function performs all prints requirements without respect to |
to selected step/time (forced printing). |
304,10 → 338,7 |
*/ |
void print_step_forced(long lcid, long istep, double lambda, double *fi) |
{ |
//compute_req_val (lcid); |
switch(Mp->tprob) |
{ |
switch(Mp->tprob){ |
case linear_statics: |
case load_balancing: |
case layered_linear_statics: |
341,6 → 372,46 |
/** |
The function performs all prints requirements without respect to |
to selected step/time (forced printing). |
@param lcid - load case id |
@param istep - step id |
@param lambda - load coefficient or time (it depends on problem type and solver) |
@param fi - array of additional values at nodes which should be printed. |
It depends on problem and solver type. For example for nonlinear |
statics it contains the internal forces. |
@param fr - array of residual %vector components at nodes which should be printed. |
@return The function does not return anything. |
Created 01.2024 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
void print_step_forced(long lcid, long istep, double lambda, double *fi, double *fr) |
{ |
switch(Mp->tprob){ |
case mat_nonlinear_statics: |
case geom_nonlinear_statics: |
case earth_pressure: |
case forced_dynamics: |
case mech_timedependent_prob: |
case nonlin_floating_subdomain: |
case growing_mech_structure: |
Outdm->print_newstep(Outdm->outf, lcid, istep, lambda); |
Outdm->print_out_forced(Outdm->outf, lcid, istep, lambda); |
Outdm->print_diags_forced(lcid, lambda, istep, fi, fr); |
Outdm->print_graphics_forced(Outdm->outgr, lcid, lambda, istep, fi); |
break; |
default: |
print_err("unsupported problem type is required", __FILE__, __LINE__, __func__); |
break; |
} |
} |
/** |
The function performs buffer flush of all opened files managed by the outdriver. |
It is usefull for imadiate output of required values and should be called |
at solver after the function print_step is called. |
763,6 → 834,34 |
} |
if (print_header == 0) |
fprintf(out, "end Elements\n"); |
print_header = 1; |
for (i=0; i < Mt->ne; i++) |
{ |
if (Gtm->leso[i]==0) |
continue; |
switch(Mt->elements[i].te) |
{ |
case linearwed: |
if (print_header) |
{ |
fprintf(out, "MESH \"%ld-Wedge6\" dimension 3 Elemtype Prism Nnode 6\n", ide1); |
print_header = 0; |
if (print_coord) |
{ |
write_gid_nodes(out, idn1); |
print_coord = 0; |
} |
fprintf(out, "Elements\n"); |
} |
write_gid_element(out, i, idn1, ide1); |
break; |
default: |
break; |
} |
} |
if (print_header == 0) |
fprintf(out, "end Elements\n"); |
} |
781,7 → 880,7 |
void export_gid_gauss_pt(FILE *out, long ide1) |
{ |
long i, j, k, ii, jj, brk; |
vector gp1, gp2, gp3, gp, w; |
vector gp1, gp2, gp3, gp, w, wt; |
brk = 0; |
815,7 → 914,7 |
if (Mt->elements[i].te == planequadinterface) |
{ |
fprintf(out, "GaussPoints \"%d\" Elemtype Linear \"%ld-plcontact2l\"\n", Mt->elements[i].te, ide1); |
fprintf(out, "GaussPoints \"%d\" Elemtype Linear \"%ld-plcontact2l\"\n", planequadinterface, ide1); |
fprintf(out, "Number Of Gauss Points: %ld\n", Pqifc->tnip); |
fprintf(out, "Nodes included\n"); |
fprintf(out, "Natural coordinates: internal\n"); |
1420,7 → 1519,7 |
if (Mt->elements[i].te == hexintface) |
{ |
fprintf(out, "GaussPoints \"%d\" Elemtype Quadrilateral \"%ld-hexintface\"\n", Mt->elements[i].te, ide1); |
fprintf(out, "GaussPoints \"%d\" Elemtype Quadrilateral \"%ld-hexintface\"\n", hexintface, ide1); |
fprintf(out, "Number Of Gauss Points: %ld\n", Hexifc->tnip); |
fprintf(out, "Nodes not included\n"); |
fprintf(out, "Natural coordinates: internal\n"); |
1429,6 → 1528,41 |
} |
} |
for (i=0; i < Mt->ne; i++) |
{ |
if (Gtm->leso[i]==0) |
continue; |
if (Mt->elements[i].te == linearwed) |
{ |
fprintf(out, "GaussPoints \"%d\" Elemtype Quadrilateral \"%ld-Wedge6\"\n", linearwed, ide1); |
fprintf(out, "Number Of Gauss Points: %ld\n", Lwed->tnip); |
fprintf(out, "Nodes not included\n"); |
fprintf(out, "Natural coordinates: given\n"); |
fprintf(out, "end GaussPoints\n\n"); |
for (ii=0;ii<Lwed->nb;ii++){ |
for (jj=0;jj<Lwed->nb;jj++){ |
if (Lwed->intordsmt[ii][jj]==0) continue; |
reallocv (RSTCKVEC(Lwed->intordsmz[ii][jj],w)); |
reallocv (RSTCKVEC(Lwed->intordsmz[ii][jj],gp)); |
reallocv (RSTCKVEC(Lwed->intordsmt[ii][jj],wt)); |
reallocv (RSTCKVEC(Lwed->intordsmt[ii][jj],gp1)); |
reallocv (RSTCKVEC(Lwed->intordsmt[ii][jj],gp2)); |
gauss_points (gp.a,w.a,Lwed->intordsmz[ii][jj]); |
gauss_points_tr (gp1.a,gp2.a,wt.a,Lwed->intordsmt[ii][jj]); |
for (i=0;i<Lwed->intordsmt[ii][jj];i++){ |
for (k=0;k<Lwed->intordsmz[ii][jj];k++){ |
fprintf(out, "%le %le %le\n", gp2[i], gp1[(i+1)%3], 0.5*(1.0-gp[i])); |
} |
} |
} |
} |
break; |
} |
} |
} |
1682,6 → 1816,8 |
snprintf(header, hs, "MESH \"%ld-hexintface\" dimension 3 Elemtype Quadrilateral Nnode 4\n", ide1); |
write_gid_elem_set(out, {hexintface}, header, idn1, ide1); |
snprintf(header, hs, "MESH \"%ld-Wedge6\" dimension 3 Elemtype Prism Nnode 6\n", ide1); |
write_gid_elem_set(out, {linearwed}, header, idn1, ide1); |
} |
1808,7 → 1944,10 |
@param out - pointer to the opened text file where the output will be produced |
@param lcid - load case id |
@param desclcid - string with description of loadcase |
@param veclabel - string with label of printed force %vector |
@param ifor - vector of nodal forces |
@param print_react - flag for printing reactions at DOFs with the prescribed displacements (true) |
or zero value (false) |
@return The function does not return anything. |
1815,7 → 1954,7 |
created 06.2007 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
modified 04.2016 by Tomas Koudelka, tomas.koudelka@fsv.cvut.cz |
*/ |
void write_gid_nforces(FILE *out, long lcid, const char *desclcid, double *ifor) |
void write_gid_nforces(FILE *out, long lcid, const char *desclcid, const char *veclabel, double *ifor, bool print_react) |
{ |
long i, j, ndof, nc; |
vector f,g; |
1822,7 → 1961,7 |
matrix tm(3,3); |
long ndofn, transf, print_mom = 0; |
fprintf(out, "\nResult \"Forces\" \"%ld\" %s Vector OnNodes\n", lcid, desclcid); |
fprintf(out, "\nResult \"%s\" \"%ld\" %s Vector OnNodes\n", veclabel, lcid, desclcid); |
fprintf(out, "ComponentNames \"f_1\" \"f_2\" \"f_3\"\nValues\n"); |
for (i=0; i < Mt->nn; i++) |
{ |
1833,7 → 1972,7 |
ndof = Mt->give_ndofn(i); |
reallocv (ndof, f); |
nodforce (ifor, i, f); |
nodforce (ifor, i, f, print_react); |
transf = Mt->nodes[i].transf; |
if (transf>0){ |
2159,6 → 2298,7 |
Outdm->lcs[Outdm->nog.transtre[ir]-1].give_transfmat(t, p, Mp->time); |
str.n = ncompstr; |
str.a = Mt->nodes[i].stress+ncompstr*lcid; |
aux = 0.0; |
if (ncompstr == 4) |
gl_comp_engvectortransf(str, aux, dir, t, planestrain, stress); |
if (ncompstr == 6) |
2185,6 → 2325,7 |
Outdm->lcs[Outdm->nog.transtra[ir]-1].give_transfmat(t, p, Mp->time); |
str.n = ncompstr; |
str.a = Mt->nodes[i].strain+ncompstr*lcid; |
aux = 0.0; |
if (ncompstr == 4) |
gl_comp_engvectortransf(str, aux, dir, t, planestrain, strain); |
if (ncompstr == 6) |
2221,7 → 2362,6 |
// checking required scalar type and selection of the node and selection of the component |
if (Outdm->nog.selnstra.presence_id(Outdm->nog.selstra, i, dir) == 0) |
continue; |
ncompstr = Mt->nodes[i].ncompstr; |
fprintf(out, "%ld % e\n", i+Outdm->idn1, Mt->nodes[i].pstra[3*lcid+dir]); |
} |
break; |
3359,7 → 3499,6 |
} |
} |
ipp = Mt->elements[i].ipp[0][0]; |
ncompstr = Mm->ip[ipp].ncompstr; |
if (Outdm->eog.transtre[ir] > 0) |
{ |
ipcoord(Mm->elip[ipp], ipp, 0, 0, p); |
3674,7 → 3813,6 |
if (print_header) |
{ |
ipp = Mt->elements[i].ipp[0][0]; |
switch (te) |
{ |
case bar2d: |
3707,7 → 3845,6 |
if(j==2) ipp=Mt->elements[i].ipp[0][0]+12; |
if(j==3) ipp=Mt->elements[i].ipp[0][0]+15; |
} |
ncompstr = Mm->ip[ipp].ncompstr; |
if (j == 0) |
fprintf(out, "%7ld", i+Outdm->ide1); |
else |
3722,7 → 3859,6 |
for (j = 0; j < num_copy_ip; j++) |
{ |
ipp = Mt->elements[i].ipp[0][0]; |
ncompstr = Mm->ip[ipp].ncompstr; |
fprintf(out, "%7c", ' '); |
for (k = q_id1; k < q_id1+q_n; k++) |
// fprintf(out, " % e", Mm->ip[ipp].stress[ncompstr*lcid+k]); |
4087,7 → 4223,6 |
if (print_header) |
{ |
ipp = Mt->elements[i].ipp[0][0]; |
switch (te) |
{ |
case bar2d: |
4475,6 → 4610,7 |
@param out - pointer to the opened file |
@param lcid - load case id |
@param desclcid - string with load case description |
@param veclabel - string with label of the force %vector |
@param ifor - %vector of nodal force |
@return The function does not return anything. |
4481,7 → 4617,7 |
Created by Tomas Koudelka 2003 |
*/ |
void write_nforces(FILE *out, long /*lcid*/, const char *desclcid, double *ifor) |
void write_nforces(FILE *out, long /*lcid*/, const char *desclcid, const char *veclabel, double *ifor, bool print_react) |
{ |
long i, j, ii, ndof; |
vector f, g; |
4489,7 → 4625,7 |
long ndofn, transf; |
fprintf (out,"\nVALUES"); |
fprintf (out,"\nVECTOR3D NODES FORCES %s\n", desclcid); |
fprintf (out,"\nVECTOR3D NODES %s %s\n", veclabel, desclcid); |
for (i=0; i < Mt->nn; i++) |
{ |
ndof = Mt->give_ndofn(i); |
4497,7 → 4633,7 |
for (j=0;j<ndof;j++) |
{ |
ii=Mt->give_dof(i,j); |
if (ii<1) f[j]=Mt->nodes[i].r[j]; |
if ((ii<1) && print_react) f[j]=Mt->nodes[i].r[j]; |
if (ii>0) f[j]=ifor[ii-1]; |
} |
4827,7 → 4963,6 |
continue; |
ipp = Mt->elements[i].ipp[0][0]; |
ncompstr = Mm->ip[ipp].ncompstr; |
// fprintf(out, "%ld % e\n", i, Mm->ip[ipp].stress[ncompstr*lcid+dir]); |
fprintf(out, "%ld % e\n", i, Mm->ip[ipp].stress[dir]); |
} |
5063,18 → 5198,18 |
d=Mb->lc[lcid].pd; |
break; |
} |
case eigen_dynamics:{ |
break; |
} |
case forced_dynamics:{ |
d=NULL; |
break; |
} |
case growing_mech_structure: |
case mech_timedependent_prob:{ |
d=NULL; |
break; |
} |
// case eigen_dynamics:{ |
// break; |
// } |
// case forced_dynamics:{ |
// d=NULL; |
// break; |
// } |
// case growing_mech_structure: |
// case mech_timedependent_prob:{ |
// d=NULL; |
// break; |
// } |
case layered_linear_statics:{ |
d=Mb->lc[lcid].pd; |
break; |
5089,6 → 5224,7 |
} |
default:{ |
print_err("unknown problem type is required",__FILE__,__LINE__, __func__); |
abort(); |
} |
} |
6228,7 → 6364,7 |
*/ |
void print_default_dx (gtopology *gt,probdesc *mp,mechtop *mt,mechmat */*mm*/,long lcid,const char *file) |
{ |
long i,j,nn,ne,vali,capi,ndofn,ncomp,dd; |
long i,j,nn,ne,vali,capi,ndofn=0,ncomp,dd; |
double **valnod,**valel,*r; |
char **caption; |
long d[6],*dimindex; |
6250,6 → 6386,7 |
case linearhex: { ndofn = 3; d[0]= 1; d[1]= 1; d[2]= 1; d[3]= 1; d[4]= 1; d[5]= 1; break;} |
default:{ |
print_err("unknown element type is required", __FILE__,__LINE__, __func__); |
abort(); |
} |
} |
/trunk/SIFEL/MEFEL/SRC/mechprint.h |
---|
15,7 → 15,9 |
void print_init(long istep, const char *mode, long idn1=1, long ide1=1); |
void print_step(long lcid, long istep, double lambda, double *fi); |
void print_step(long lcid, long istep, double lambda, double *fi, double *fr); |
void print_step_forced(long lcid, long istep, double lambda, double *fi); |
void print_step_forced(long lcid, long istep, double lambda, double *fi, double *fr); |
void print_flush(); |
void print_close(); |
30,7 → 32,7 |
void write_gid_nodscalar(FILE *out, strastre scal, long lcid, long dir, const char *desclcid); |
void write_gid_nodvector(FILE *out, strastre q, long lcid, long sid, const char *desclcid); |
void write_gid_nodtensor(FILE *out, strastre q, long lcid, long sid, const char *desclcid); |
void write_gid_nforces(FILE *out, long lcid, const char *desclcid, double *ifor); |
void write_gid_nforces(FILE *out, long lcid, const char *desclcid, const char *veclabel, double *ifor, bool print_react); |
void write_gid_elemscalar(FILE *out, strastre scal, long lcid, long dir, const char *desclcid); |
void write_gid_elem_type_scalar(FILE *out, strastre scal, long lcid, long dir, const char *desclcid, elemtype te); |
void write_gid_elemvector(FILE *out, strastre q, long lcid, long sid, const char *desclcid); |
49,7 → 51,7 |
void write_nodscalar(FILE *out, strastre scal, long lcid, long dir, const char *desclcid); |
void write_nodscalar(FILE *out,double *val, const char *descr, const char *desclcid); |
void write_nodscalar(FILE *out, long dir, const char *desclcid); |
void write_nforces(FILE *out, long lcid, const char *desclcid, double *ifor); |
void write_nforces(FILE *out, long lcid, const char *desclcid, const char *veclabel, double *ifor, bool print_react=true); |
void write_elemscalar(FILE *out, strastre scal, long lcid, long dir, const char *desclcid); |
void write_elemscalar(FILE *out,double *val, const char *descr, const char *desclcid); |
void write_deflection (FILE *out,long lcid,long dir, const char *desclcid); |
/trunk/SIFEL/MEFEL/SRC/mechtop.cpp |
---|
26,6 → 26,7 |
#include <stdlib.h> |
#include <string.h> |
#include <limits.h> |
#include <limits> |
#include <math.h> |
56,8 → 57,9 |
nodes=NULL; |
// element array |
elements=NULL; |
dist=NULL; |
tnip = 0; |
dist=NULL; |
nadjip=NULL; |
adjip=NULL; |
nodedispl=NULL; |
81,14 → 83,13 |
delete [] nodes; |
delete [] elements; |
delete [] nadjip; |
if (adjip) |
{ |
for (i=0; i<Mm->tnip; i++) |
delete [] adjip[i]; |
if (adjip){ |
for (i=0; i<tnip; i++) |
delete [] adjip[i]; |
} |
if (dist) |
{ |
for (i=0; i<Mm->tnip; i++) |
for (i=0; i<tnip; i++) |
delete [] dist[i]; |
} |
delete [] adjip; |
1470,7 → 1471,7 |
*/ |
long mechtop::give_nsurf (long eid) |
{ |
long nsurf; |
long nsurf=0; |
elemtype te; |
te = give_elem_type (eid); |
1511,7 → 1512,7 |
*/ |
long mechtop::give_nnsurf (long eid) |
{ |
long nnsurf; |
long nnsurf=0; |
elemtype te; |
te = give_elem_type (eid); |
1909,7 → 1910,7 |
*/ |
strastrestate mechtop::give_ssst (long eid,long bi) |
{ |
strastrestate ssst; |
strastrestate ssst=strastrestate(0); |
elemtype te; |
te = give_elem_type (eid); |
2374,7 → 2375,7 |
long i, nip = give_tnip(eid); |
long ipp = elements[eid].ipp[0][0]; |
long ipc = ipp; |
double dmin; |
double dmin=std::numeric_limits<double>::max(); |
double d; |
vector ncoord(ASTCKVEC(3)); |
2381,11 → 2382,6 |
for(i=0; i<nip; ipp++, i++) |
{ |
d = sqr(px - ipm[ipp].x) + sqr(py - ipm[ipp].y) + sqr(pz - ipm[ipp].z); |
if (i == 0) |
{ |
dmin = d; |
continue; |
} |
if (d < dmin) |
{ |
dmin = d; |
2495,13 → 2491,15 |
double mechtop::give_volume (long eid) |
{ |
long nn = give_nne(eid); |
double v = 0.0,det = 0.0; |
double v = 0.0, det = 0.0; |
long nip = give_tnip(eid); |
vector gp(ASTCKVEC(nip)), w(ASTCKVEC(nip)); |
if (nn < 2) |
print_err("invalid number of nodes on element is detected", __FILE__, __LINE__, __func__); |
vector x(ASTCKVEC(nn)), y(ASTCKVEC(nn)), z(ASTCKVEC(nn)); |
Gtm->give_node_coord3d (x, y, z, eid); |
switch (Mt->give_elem_type(eid)){ |
switch (give_elem_type(eid)){ |
case lineartet: |
case quadrtet: |
jac_3d (v, x, y, z, 0.0, 0.0, 0.0); |
2511,8 → 2509,26 |
case quadrhex: |
case lineartetrot: |
case linearhexrot: |
jac_3d (v, x, y, z, 1.0, 1.0, 1.0); |
v*=8.0; // the volume of unit element |
/* |
gauss_points (gp.a, w.a, 2); |
v = 0; |
jac_3d (vip, x, y, z, gp[0], gp[0], gp[0]); |
v += vip; |
jac_3d (vip, x, y, z, gp[0], gp[0], gp[1]); |
v += vip; |
jac_3d (vip, x, y, z, gp[0], gp[1], gp[0]); |
v += vip; |
jac_3d (vip, x, y, z, gp[0], gp[1], gp[1]); |
v += vip; |
jac_3d (vip, x, y, z, gp[1], gp[0], gp[0]); |
v += vip; |
jac_3d (vip, x, y, z, gp[1], gp[0], gp[1]); |
v += vip; |
jac_3d (vip, x, y, z, gp[1], gp[1], gp[0]); |
v += vip; |
jac_3d (vip, x, y, z, gp[1], gp[1], gp[1]); |
v += vip;*/ |
v = linhex_volume(x, y, z); |
break; |
default: |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
3084,12 → 3100,12 |
*/ |
void mechtop::give_nodal_quant(long nid, mechquant mqn, long lcid, sel &selcomp, gnodvalvm &nv, vector &qv) |
{ |
long i, j, id=0; |
long i, id=0; |
gnode &nod = Gtm->gnodes[nid]; |
switch (mqn){ |
case displ_q: // displacement vector |
for(i=0, j=0; i<nod.ndofn; i++){ |
for(i=0; i<nod.ndofn; i++){ |
if(selcomp.presence_id(i)){ |
qv(id) = nv.displv[nod.cn[i]]; |
id++; |
3121,7 → 3137,7 |
} |
break; |
case resid_vect_q: // residual vector |
for(i=0, j=0; i<nod.ndofn; i++){ |
for(i=0; i<nod.ndofn; i++){ |
if(selcomp.presence_id(i)){ |
qv(id) = nv.residv[nod.cn[i]]; |
id++; |
3336,7 → 3352,7 |
case spring_4: |
{ |
ndofn = give_ndofn(nod[0]); |
if (ndofn < 1) |
if (ndofn < 4) |
{ |
print_err("spring_4 is connected to node %ld with wrong number of dofs(%ld)", __FILE__, __LINE__, __func__, nod[0], ndofn); |
abort(); |
3355,7 → 3371,7 |
case spring_5: |
{ |
ndofn = give_ndofn(nod[0]); |
if (ndofn < 1) |
if (ndofn < 5) |
{ |
print_err("spring_5 is connected to node %ld with wrong number of dofs(%ld)", __FILE__, __LINE__, __func__, nod[0], ndofn); |
abort(); |
3373,7 → 3389,8 |
} |
case spring_6: |
{ |
if (ndofn < 1) |
ndofn = give_ndofn(nod[0]); |
if (ndofn < 6) |
{ |
print_err("spring_6 is connected to node %ld with wrong number of dofs(%ld)", __FILE__, __LINE__, __func__, nod[0], ndofn); |
abort(); |
4453,12 → 4470,11 |
*/ |
void mechtop::save_nodval(long lcid) |
{ |
long i, ndofn; |
long i; |
for (i=0;i<nn;i++){ |
if (Gtm->lnso[i]) |
{ |
ndofn = give_ndofn (i); |
// nodal values must be saved also for hanging nodes due to |
// correct handling of elements with hanging nodes connected to interface |
// between old and new part of structure |
/trunk/SIFEL/MEFEL/SRC/mechtop.h |
---|
268,6 → 268,8 |
/// array of instances of the class edgem |
edgem *edges; |
/// number of integration points, i.e. dimension of arrays nadjip and adjip (it is required in the destructor) |
long tnip; |
/// array of numbers of adjacent integration points |
/// this array must be here, not in gtopology because it requires information |
/// about materials which are stored on integration points |
/trunk/SIFEL/MEFEL/SRC/mefelinit.cpp |
---|
370,12 → 370,17 |
if (Mp->matmodel == nonlocal){ |
// list of adjacent elements |
Gtm->adjacelem (Out); |
// list of adjacent elements -> it has been already assembled in the above code |
// Gtm->adjacelem (Out); |
// list of adjacent integration points was not restored |
// from file it is necessary to create it from scratch |
if (restore_adjacip() == 0) |
adjacip (); |
if (restore_adjacip() == 0){ |
adjacip2 (); |
/* |
FILE *fadjip = fopen("adjip.log", "wt"); |
print_adjacip(fadjip); |
fclose(fadjip);*/ |
} |
save_adjacip(); |
ipvolume (); |
} |
387,7 → 392,6 |
Mm->allocmacrostresses(); |
} |
// adaptivity |
//if (Mp->adaptivity) |
// Ada = new adaptivity (); |
/trunk/SIFEL/MEFEL/SRC/mohrc.cpp |
---|
89,13 → 89,13 |
*/ |
double mohrcoulomb::yieldfunction (vector &psig) |
{ |
double f,k1,k2, s1, s2, sigma, tau, maxsigt; |
double f,k1,k2, s1, s2; |
s1 = psig[0]; |
s2 = psig[2]; |
sigma = (s1 + s2) / 2.0; |
tau = -(s1 - s2) / (2.0 * cos(phi)); |
maxsigt = c / tan(phi); |
//double sigma = (s1 + s2) / 2.0; |
//double tau = -(s1 - s2) / (2.0 * cos(phi)); |
//double maxsigt = c / tan(phi); |
k1 = -1.0 + sin(phi); k2 = 1.0 + sin(phi); |
f = k1*s1 + k2*s2 - 2.0*c*cos(phi); |
439,7 → 439,6 |
abort (); |
} |
dgamma=0.0; |
e = Mm->give_actual_ym(ipp); |
nu = Mm->give_actual_nu(ipp); |
// elastic stiffness matrix computation |
/trunk/SIFEL/MEFEL/SRC/mtsolver.cpp |
---|
286,7 → 286,7 |
if (j > 10) |
{ |
if (lsm_quad(lsm_a, lsm_r, lsm_l, double(j+1), Mp->nlman->divc_step[j%10], |
Mp->nlman->divc_err[j%10], norf, Mp->zero,1) > 0.0) |
Mp->nlman->divc_err[j%10], norf, zero,1) > 0.0) |
{ |
fprintf (stdout,"\n\n Divergence of inner iteation loop is detected. Inner loop is stopped.\n\n"); |
break; |
296,7 → 296,7 |
} |
else |
{ |
lsm_quad(lsm_a, lsm_r, lsm_l, double(j+1), norf, 0.0, 0.0, Mp->zero,0); |
lsm_quad(lsm_a, lsm_r, lsm_l, double(j+1), norf, 0.0, 0.0, zero,0); |
Mp->nlman->divc_step[j%10] = double(j+1); |
Mp->nlman->divc_err[j%10] = err; |
} |
425,8 → 425,6 |
li = i = mt_gv.istep; |
// number of successful time steps (number of steps without inner iterations) |
nsts=0; |
// return status from the one_step function |
ret = 0; |
/* |
// test MuPiF |
718,7 → 716,7 |
*/ |
long one_step (long lcid,double time, double dt, double &dtr, double prev_time, long rest_calc, long istep, long li, mt_glob_vec &mt_gv) |
{ |
long j,n,ini,um, mncd, mnce, mnae; |
long j,n,um, mncd, mnce, mnae; |
double *f,*fl,*fi,*fb,*fp,*r,*dr,*lhsb, *flp; |
long *ifn; |
double norf, err; |
785,8 → 783,6 |
n = Ndofm; |
} |
// maximum number of iterations in inner loop |
ini = Mp->nlman->niilnr; |
// required norm of vector of unbalanced forces |
err = Mp->nlman->errnr; |
/trunk/SIFEL/MEFEL/SRC/ndsolver.cpp |
---|
37,7 → 37,7 |
void nonlin_newmark_method () |
{ |
long i,j,k,n,ini,lcid; |
double beta,gamma,zero,time,dt,dtc,end_time,err,norres; |
double beta,gamma,time,dt,end_time,err,norres; |
double *a,*v,*p,*dd,*vv,*lhs,*rhs,*fs,*brhs; |
// number of degrees of freedom |
50,8 → 50,6 |
// maximum number of iterations in one increment |
ini = Mp->nlman->niilnr; |
// computer zero |
zero = Mp->zero; |
// required error in inner loop |
err = Mp->nlman->errnr; |
62,8 → 60,6 |
end_time = Mp->timecon.endtime (); |
// first time increment |
dt = Mp->timecon.initialtimeincr (); |
// correction of time step |
dtc = 0.0; |
// load case id |
// this solver enables only one load case with respect to nonlinearity |
/trunk/SIFEL/MEFEL/SRC/newtonraph.cpp |
---|
57,7 → 57,6 |
double dlambda; // load coefficient increment |
double dlambdamin; // minimum value of load coefficient increment |
double dlambdamax; // maximum value of load coefficient increment |
double zero; // computer zero |
double ierr; // required error of residua |
double norf; // norm of vector of unbalanced forces |
double norfa; // norm of attained load vector (+ reaction vector eventually) |
74,8 → 73,6 |
// number of rows of the matrix |
n = Ndofm; |
// computer zero |
zero = Mp->zero; |
// initial value of load coefficient |
lambda = ilambda; |
// maximum number of increments |
93,6 → 90,8 |
//type of residual vector norm |
normt = nlman->rnormtnr; |
norf = 0.0; |
// initialization phase |
rb = new double [n]; |
fb = new double [n]; |
372,7 → 371,6 |
double dlambda; // load coefficient increment |
double dlambdamin; // minimum value of load coefficient increment |
double dlambdamax; // maximum value of load coefficient increment |
double zero; // computer zero |
double dtr; // time step size coefficient required by material models |
double ierr; // required error of residua |
double norf; // norm of vector of unbalanced forces |
388,8 → 386,6 |
// number of rows of the matrix |
n = Ndofm; |
// computer zero |
zero = Mp->zero; |
// initial value of load coefficient |
lambda = ilambda; |
// maximum number of increments |
711,8 → 707,6 |
double ierr; // required error of the residual vector |
double norf; // norm of residual vector (vector of unbalanced forces) |
double norfa; // norm of attained load vector (+ reaction vector eventually) |
double ep_fi; // potential energy of internal forces |
double ep_fe; // potential energy of external load |
resnormt normt; // type of residual vector norm |
matrix lsm_a(3,3); // least square matrix for the divergence detection |
vector lsm_r(3), lsm_l(3); // right hand and left hand side for the divergence detection |
747,8 → 741,8 |
// computation of internal forces |
internal_forces (lcid,fi); |
ep_fi = scprd(fi, ra, n); |
ep_fe = scprd(fa, ra, n); |
//double ep_fi = scprd(fi, ra, n); // potential energy of internal forces |
//double ep_fe = scprd(fa, ra, n); // potential energy of external load |
// check time step size requirements which originate in material models, |
// after check, the dtr will contain the minimum ratio of required time step size to the actual one |
802,7 → 796,7 |
// computation of internal forces |
internal_forces(lcid,fi); |
ep_fi = scprd(fi, ra, n); |
//ep_fi = scprd(fi, ra, n); |
// check time step size requirements which originate in material models, |
// after check, the dtr will contain the minimum ratio of required time step size to the actual one |
/trunk/SIFEL/MEFEL/SRC/nonlinman.cpp |
---|
1,8 → 1,8 |
#include "nonlinman.h" |
#include <string.h> |
#include "nonlinman.h" |
#include <stdlib.h> |
nonlinman::nonlinman (void) |
{ |
55,6 → 55,9 |
check_lambdar = off; |
lambdar = 0.0; |
errl = 0.0; |
// dissipation increment |
tau_ini = tau_lim = tau = 0.0; |
} |
127,114 → 130,24 |
case arclrv1: |
case arclrv: |
case arclg:{ |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by arc-length method"); |
xfscanf (in, "%k%m", "lambda_determination", &detlambda_kwdset, &dlam); |
xfscanf (in, "%k%ld%k%ld", "al_num_steps", &nial, "al_num_iter", &niilal); |
xfscanf (in, "%k%lf%k%lf", "al_error", &erral, "al_init_length", &dlal); |
xfscanf (in, "%k%lf%k%lf", "al_min_length", &dlminal, "al_max_length", &dlmaxal); |
xfscanf (in, "%k%lf", "al_psi", &psial); |
if ((tnlinsol == arclrv1) || (tnlinsol == arclrv)) |
xfscanf(in, "%k%lf", "reqval_lambda",&lambdar); |
if (tnlinsol == arclrv) |
xfscanf(in, "%k%lf", "reqerr_lambda",&errl); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
if (tnlinsol == arclg){ |
// checking of divergency of inner iteration loop |
xfscanf(in, "%k%m", "check_div", &flagsw_kwdset, &check_div); |
if (check_div == on){ |
xfscanf(in, "%k%ld", "div_min_steps", &div_min_steps); |
if (div_min_steps < 3){ |
print_warning("the minimum number of performed steps in the divergency check is < 3.\n" |
"It will be set to 3 automatically", __FILE__, __LINE__, __func__); |
div_min_steps = 3; |
} |
} |
// checking of maximum value of the total (cumulative) arc length |
xfscanf(in, "%k%m", "check_total_arcl", &flagsw_kwdset, &check_tot_al); |
if (check_tot_al == on) |
xfscanf(in, "%k%lf", "max_total_arc_length", &max_tot_al); |
// checking of required value of lambda coefficent for proportional load vector |
xfscanf(in, "%k%m", "check_req_lambda", &flagsw_kwdset, &check_lambdar); |
if (check_lambdar == on){ |
xfscanf(in, "%k%lf", "reqval_lambda",&lambdar); |
// tolerance for lambda tresholds |
xfscanf(in, "%k%lf", "reqerr_lambda",&errl); |
} |
if (mespr==1){ |
fprintf (stdout,"\n system of nonlinear equations will be solved by arc-length method (variant %s)", |
nonlinsolvertype_kwdset.get_str(tnlinsol)); |
} |
//fprintf (out,"%ld %d\n",hdbackupal,displnorm); |
// 1 - alldofs |
// 2 - seldofs |
// 3 - seldofscoord |
// 6 - selecnodes |
// 8 - nodesdistincr |
xfscanf (in,"%k%m","al_displ_contr_type",&displacementnorm_kwdset,(int*)&displnorm); |
switch (displnorm){ |
case alldofs:{ break; } |
case seldofs:{ |
xfscanf (in,"%k%ld","num_sel_dofs",&nsdofal); |
selnodal = new long [nsdofal]; |
seldofal = new long [nsdofal]; |
read_seldof (in); |
break; |
} |
case seldofscoord:{ |
xfscanf (in,"%ld",&nsdofal); |
selnodal = new long [nsdofal]; |
seldofal = new long [nsdofal]; |
selnodcoord = new double [3*nsdofal]; |
read_seldofcoord (in); |
break; |
} |
case selmstr:{ |
xfscanf(in, "%k%ld", "numcomp", &nmstrcomp); |
mstrastre = new strastre[nmstrcomp]; |
mstrid = new long[nmstrcomp]; |
read_selmstr(in); |
break; |
} |
case selecnodes:{ |
xfscanf (in,"%k%ld", "num_sel_nodes", &nsnal); |
selnodal = new long [nsnal]; |
read_selnod (in); |
break; |
} |
case nodesdistincr:{ |
nsnal=2; |
xfscanf (in,"%k%ld","probdimal",&probdimal); |
selnodal = new long [nsnal]; |
read_selnod (in); |
break; |
} |
default: |
print_err("unknown norm measurement of displacement increment", __FILE__, __LINE__, __func__); |
} |
read_arclength(in, tnlinsol, mespr); |
break; |
} |
case newton:{ |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method"); |
xfscanf (in, "%k%ld%k%ld", "nr_num_steps", &ninr, "nr_num_iter", &niilnr); |
xfscanf (in, "%k%lf%k%lf", "nr_error", &errnr, "nr_init_incr", &incrnr); |
xfscanf (in, "%k%lf%k%lf", "nr_minincr", &minincrnr, "nr_maxincr", &maxincrnr); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
case newton: |
case newtonrv1: |
case displctrl: |
case displctrlrv: |
case newtong: |
if (mespr==1){ |
fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method (variant %s)", |
nonlinsolvertype_kwdset.get_str(tnlinsol)); |
} |
read_newtonraphson(in, tnlinsol, mespr); |
break; |
} |
case newtonrv1:{ |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method"); |
xfscanf (in, "%k%ld%k%ld", "nr_num_steps", &ninr, "nr_num_iter", &niilnr); |
xfscanf (in, "%k%lf%k%lf", "nr_error", &errnr, "nr_init_incr", &incrnr); |
xfscanf (in, "%k%lf%k%lf", "nr_minincr", &minincrnr, "nr_maxincr", &maxincrnr); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
xfscanf (in, "%k%lf", "req_lambda", &lambdar); |
if (mespr==1) fprintf(stdout, "\n requried value of lambda=% e", lambdar); |
break; |
} |
/* |
case newtonrestart:{ |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method with "); |
246,52 → 159,11 |
break; |
} |
*/ |
case displctrl:{ |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method with displacement control"); |
xfscanf (in, "%k%ld%k%ld", "nr_num_steps", &ninr, "nr_num_iter", &niilnr); |
xfscanf (in, "%k%lf%k%lf", "nr_error", &errnr, "nr_init_incr", &incrnr); |
xfscanf (in, "%k%lf%k%lf", "nr_minincr", &minincrnr, "nr_maxincr", &maxincrnr); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
break; |
} |
case displctrlrv:{ |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method with displacement control"); |
xfscanf (in, "%k%ld%k%ld", "nr_num_steps", &ninr, "nr_num_iter", &niilnr); |
xfscanf (in, "%k%lf%k%lf", "nr_error", &errnr, "nr_init_incr", &incrnr); |
xfscanf (in, "%k%lf%k%lf", "nr_minincr", &minincrnr, "nr_maxincr", &maxincrnr); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
xfscanf (in, "%k%lf%k%lf", "req_lambda", &lambdar, "req_lam_err", &errl); |
if (mespr==1) fprintf(stdout, "\n requried value of lambda=% e, required error of lambda=% e", lambdar, errl); |
break; |
} |
case newtong: |
if (mespr==1) fprintf (stdout,"\n system of nonlinear equations will be solved by Newton-Raphson method"); |
xfscanf (in, "%k%ld%k%ld", "nr_num_steps", &ninr, "nr_num_iter", &niilnr); |
xfscanf (in, "%k%lf%k%lf", "nr_error", &errnr, "nr_init_incr", &incrnr); |
xfscanf (in, "%k%lf%k%lf", "nr_minincr", &minincrnr, "nr_maxincr", &maxincrnr); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
// checking of divergency of inner iteration loop |
xfscanf(in, "%k%m", "check_div", &flagsw_kwdset, &check_div); |
if (check_div == on) |
{ |
xfscanf(in, "%k%ld", "div_min_steps", &div_min_steps); |
if (div_min_steps < 3) |
{ |
print_warning("the minimum number of performed steps in the divergency check is < 3.\n" |
"It will be set to 3 automatically", __FILE__, __LINE__, __func__); |
div_min_steps = 3; |
} |
case dissip_incr: |
if (mespr==1){ |
fprintf (stdout,"\n system of nonlinear equations will be solved by dissipation increment method"); |
} |
// checking of required value of lambda coefficent for proportional load vector |
xfscanf(in, "%k%m", "check_req_lambda", &flagsw_kwdset, &check_lambdar); |
if (check_lambdar == on) |
{ |
xfscanf(in, "%k%lf", "reqval_lambda",&lambdar); |
// tolerance for lambda tresholds |
xfscanf(in, "%k%lf", "reqerr_lambda",&errl); |
} |
read_dissipincr(in, mespr); |
break; |
default: |
print_err("unknown solver of nonlinear system of equations is required", __FILE__, __LINE__, __func__); |
340,83 → 212,18 |
switch (tnlinsol){ |
case arcl: |
case arclrv1: |
case arclrv: |
case arclg: |
{ |
fprintf (out,"%d\n",(int)dlam); |
fprintf (out, "%ld %ld %e %e %e %e %e\n", nial, niilal, erral, dlal, |
dlminal, dlmaxal, psial); |
if ((tnlinsol == arclrv1) || (tnlinsol == arclrv)) |
fprintf(out, "%f\n", lambdar); |
if (tnlinsol == arclrv) |
fprintf(out, "%f\n", errl); |
fprintf (out, "%d\n", (int)rnormtnr); |
if (tnlinsol == arclg) |
{ |
// checking of divergency of inner iteration loop |
fprintf(out, "%d", check_div); |
if (check_div == on) |
fprintf(out, " %ld\n", div_min_steps+1); |
else |
fprintf(out, "\n"); |
// checking of maximum value of the total (cumulative) arc length |
fprintf(out, "%d", check_tot_al); |
if (check_tot_al == on) |
fprintf(out, " %le\n", max_tot_al); |
else |
fprintf(out, "\n"); |
// checking of required value of lambda coefficent for proportional load vector |
fprintf(out, "%d", check_lambdar); |
if (check_lambdar == on) |
fprintf(out, " %le %le\n", lambdar, errl); |
else |
fprintf(out, "\n"); |
} |
//fprintf (out,"%ld %d\n",hdbackupal,displnorm); |
fprintf (out,"%d\n",displnorm); |
switch (displnorm){ |
case alldofs:{ break; } |
case seldofs:{ |
fprintf (out,"%ld\n",nsdofal); |
print_seldof (out); |
break; |
} |
case seldofscoord:{ |
fprintf (out,"%ld\n",nsdofal); |
print_seldofcoord (out); |
break; |
} |
case selmstr: |
fprintf(out, "%ld\n", nmstrcomp); |
print_selmstr(out); |
break; |
case selecnodes:{ |
fprintf (out,"%ld\n",nsnal); |
print_selnod (out); |
break; |
} |
case nodesdistincr:{ |
nsnal=2; |
fprintf (out,"%ld\n",probdimal); |
print_selnod (out); |
break; |
} |
default: |
print_err("unknown norm measurement of displacement increment", __FILE__, __LINE__, __func__); |
} |
print_arclength(out, tnlinsol); |
break; |
} |
case newton:{ |
fprintf (out, "%ld %ld %le %le %le %le %d\n", ninr, niilnr, errnr, incrnr, minincrnr, maxincrnr, rnormtnr); |
break; |
} |
case newtonrv1:{ |
fprintf (out, "%ld %ld %le %le %le %le %d %le\n", ninr, niilnr, errnr, incrnr, minincrnr, maxincrnr, rnormtnr, lambdar); |
case newton: |
case newtonrv1: |
case displctrl: |
case displctrlrv: |
case newtong: |
print_newtonraphson(out, tnlinsol); |
break; |
} |
/* |
case newtonrestart:{ |
fprintf (out,"%ld %ld %le %le %le %d\n",ninr,niilnr,errnr,incrnr,minincrnr, rnormtnr); |
fprintf (out, "%ld %ld\n", nienr, hdbr); |
423,59 → 230,194 |
if (hdbr) |
fprintf(out, "%s\n %ld\n", backupfname, hdbid); |
break; |
}*/ |
default:{} |
} |
case displctrl:{ |
fprintf (out, "%ld %ld %le %le %le %le %d\n", ninr, niilnr, errnr, incrnr, minincrnr, maxincrnr, rnormtnr); |
break; |
} |
/** |
The function reads setup data for the arclength method. |
@param[in] in - pointer to the opened text file where the data will be read from |
@param[in] nlst - the given type of the nonlinear solver, i.e. variant of the arclength method |
@param[in] mespr - message printing flag |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::read_arclength(XFILE *in, nonlinsolvertype nlst, long mespr) |
{ |
xfscanf (in, "%k%m", "lambda_determination", &detlambda_kwdset, &dlam); |
xfscanf (in, "%k%ld%k%ld", "al_num_steps", &nial, "al_num_iter", &niilal); |
xfscanf (in, "%k%lf%k%lf", "al_error", &erral, "al_init_length", &dlal); |
xfscanf (in, "%k%lf%k%lf", "al_min_length", &dlminal, "al_max_length", &dlmaxal); |
xfscanf (in, "%k%lf", "al_psi", &psial); |
if ((nlst == arclrv1) || (nlst == arclrv)) |
xfscanf(in, "%k%lf", "reqval_lambda",&lambdar); |
if (nlst == arclrv) |
xfscanf(in, "%k%lf", "reqerr_lambda",&errl); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
if (nlst == arclg){ |
// checking of divergency of inner iteration loop |
xfscanf(in, "%k%m", "check_div", &flagsw_kwdset, &check_div); |
if (check_div == on){ |
xfscanf(in, "%k%ld", "div_min_steps", &div_min_steps); |
if (div_min_steps < 3){ |
print_warning("the minimum number of performed steps in the divergency check is < 3.\n" |
"It will be set to 3 automatically", __FILE__, __LINE__, __func__); |
div_min_steps = 3; |
} |
} |
// checking of maximum value of the total (cumulative) arc length |
xfscanf(in, "%k%m", "check_total_arcl", &flagsw_kwdset, &check_tot_al); |
if (check_tot_al == on) |
xfscanf(in, "%k%lf", "max_total_arc_length", &max_tot_al); |
// checking of required value of lambda coefficent for proportional load vector |
xfscanf(in, "%k%m", "check_req_lambda", &flagsw_kwdset, &check_lambdar); |
if (check_lambdar == on){ |
xfscanf(in, "%k%lf", "reqval_lambda",&lambdar); |
// tolerance for lambda tresholds |
xfscanf(in, "%k%lf", "reqerr_lambda",&errl); |
} |
} |
case displctrlrv:{ |
fprintf (out,"%ld %ld %le %le %le %le %d %le %le\n",ninr,niilnr,errnr,incrnr,minincrnr,maxincrnr,rnormtnr,lambdar,errl); |
break; |
//fscanff (in,"%ld %d\n",hdbackupal,displnorm); |
// 1 - alldofs |
// 2 - seldofs |
// 3 - seldofscoord |
// 6 - selecnodes |
// 8 - nodesdistincr |
xfscanf (in,"%k%m","al_displ_contr_type", &displacementnorm_kwdset, (int*)&displnorm); |
read_displnorm(in, displnorm); |
} |
/** |
The function reads setup data for the Newton-Raphson method. |
@param[in] in - pointer to the opened text file where the data will be read from |
@param[in] nlst - the given type of the nonlinear solver, i.e. variant of the Newton-Raphson method |
@param[in] mespr - message printing flag |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::read_newtonraphson(XFILE *in, nonlinsolvertype nlst, long mespr) |
{ |
xfscanf (in, "%k%ld%k%ld", "nr_num_steps", &ninr, "nr_num_iter", &niilnr); |
xfscanf (in, "%k%lf%k%lf", "nr_error", &errnr, "nr_init_incr", &incrnr); |
xfscanf (in, "%k%lf%k%lf", "nr_minincr", &minincrnr, "nr_maxincr", &maxincrnr); |
xfscanf (in, "%k%m", "resid_norm_type", &resnormt_kwdset, (int*)&rnormtnr); |
if (nlst == newtonrv1){ |
xfscanf (in, "%k%lf", "req_lambda", &lambdar); |
if (mespr==1) fprintf(stdout, "\n requried value of lambda=% e", lambdar); |
} |
case newtong: |
{ |
fprintf (out, "%ld %ld\n", ninr, niilnr); |
fprintf (out, "%le %le %le %le %d\n", errnr, incrnr, minincrnr, maxincrnr, rnormtnr); |
if (nlst == displctrlrv){ |
xfscanf (in, "%k%lf%k%lf", "req_lambda", &lambdar, "req_lam_err", &errl); |
if (mespr==1) fprintf(stdout, "\n requried value of lambda=% e, required error of lambda=% e", lambdar, errl); |
} |
if (nlst == newtong){ |
// checking of divergency of inner iteration loop |
fprintf(out, "%d", check_div); |
xfscanf(in, "%k%m", "check_div", &flagsw_kwdset, &check_div); |
if (check_div == on) |
fprintf(out, " %ld\n", div_min_steps+1); |
else |
fprintf(out, "\n"); |
{ |
xfscanf(in, "%k%ld", "div_min_steps", &div_min_steps); |
if (div_min_steps < 3) |
{ |
print_warning("the minimum number of performed steps in the divergency check is < 3.\n" |
"It will be set to 3 automatically", __FILE__, __LINE__, __func__); |
div_min_steps = 3; |
} |
} |
// checking of required value of lambda coefficent for proportional load vector |
fprintf(out, "%d", check_lambdar); |
xfscanf(in, "%k%m", "check_req_lambda", &flagsw_kwdset, &check_lambdar); |
if (check_lambdar == on) |
fprintf(out, " %le %le\n", lambdar, errl); |
else |
fprintf(out, "\n"); |
{ |
xfscanf(in, "%k%lf", "reqval_lambda",&lambdar); |
// tolerance for lambda tresholds |
xfscanf(in, "%k%lf", "reqerr_lambda",&errl); |
} |
} |
} |
break; |
/** |
The function reads setup data for the nonlinear solver with the constrained increment of dissipation. |
@param[in] in - pointer to the opened text file where the data will be read from |
@param[in] nlst - the given type of the nonlinear solver, i.e. variant of the Newton-Raphson method |
@param[in] mespr - message printing flag |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::read_dissipincr(XFILE *in, long mespr) |
{ |
xfscanf(in, "%k%le", "tau_ini", &tau_ini); |
xfscanf(in, "%k%le", "tau_max", &tau_max); |
xfscanf(in, "%k%le", "tau_lim", &tau_lim); |
xfscanf(in, "%k", "alt_arclength_setup"); |
xfscanf (in, "%k%m", "type_of_alt_nonlin_solver", &nonlinsolvertype_kwdset, (int*)&altnlst); |
if ((altnlst == arcl) || (altnlst == arclrv1) || (altnlst == arclrv) || (altnlst == arclg)) |
read_arclength(in, altnlst, mespr); |
else{ |
print_err("wrong type of alternative nonlinear solver (%d) is required", |
__FILE__, __LINE__, __func__, int(altnlst)); |
abort(); |
} |
default:{} |
} |
} |
/** |
The function reads selected nodes for arclength control. |
The function reads setup for particular types of displacement norm computation. |
@param in - pointer to the opened text file |
@param[in] in - pointer to the opened XFILE which the data will be read from |
@param[in] dn - type of required displacement norm |
@return The function does not return anything. |
Created by Jaroslav Kruis, 2008 |
Created by TKo, 03.2024 |
*/ |
void nonlinman::read_selnod (XFILE *in) |
void nonlinman::read_displnorm(XFILE *in, displacementnorm dn) |
{ |
long i; |
for (i=0;i<nsnal;i++){ |
xfscanf (in,"%ld",selnodal+i); |
selnodal[i]--; |
switch (dn){ |
case alldofs:{ break; } |
case seldofs:{ |
read_seldof (in); |
break; |
} |
case seldofscoord:{ |
read_seldofcoord (in); |
break; |
} |
case selmstr:{ |
read_selmstr(in); |
break; |
} |
case selecnodes:{ |
read_selnod (in); |
break; |
} |
case nodesdistincr:{ |
read_selnoddistincr(in); |
break; |
} |
default: |
print_err("unknown norm measurement of displacement increment", __FILE__, __LINE__, __func__); |
} |
} |
488,16 → 430,18 |
@return The function does not return anything. |
Created by Jaroslav Kruis, 2008 |
Modified by TKo, 03.2024 |
*/ |
void nonlinman::read_seldof (XFILE *in) |
{ |
long i; |
xfscanf (in,"%k%ld","num_sel_dofs",&nsdofal); |
selnodal = new long [nsdofal]; |
seldofal = new long [nsdofal]; |
for (i=0;i<nsdofal;i++){ |
xfscanf (in,"%ld %ld",selnodal+i,seldofal+i); |
selnodal[i]--; seldofal[i]--; |
} |
} |
514,8 → 458,11 |
void nonlinman::read_seldofcoord (XFILE *in) |
{ |
long i; |
for (i=0;i<nsdofal;i++){ |
xfscanf (in,"%k%ld", "num_sel_dof_coords", &nsdofal); |
selnodal = new long [nsdofal]; |
seldofal = new long [nsdofal]; |
selnodcoord = new double [3*nsdofal]; |
for (i=0; i<nsdofal; i++){ |
xfscanf (in,"%lf %lf %lf %ld",selnodcoord+3*i,selnodcoord+3*i+1,selnodcoord+3*i+2,seldofal+i); |
seldofal[i]--; |
} |
536,6 → 483,9 |
{ |
long i; |
xfscanf(in, "%k%ld", "numcomp", &nmstrcomp); |
mstrastre = new strastre[nmstrcomp]; |
mstrid = new long[nmstrcomp]; |
for (i=0;i<nmstrcomp;i++){ |
xfscanf (in,"%k%m%k%ld", "mstrcomptype", &strastre_kwdset, mstrastre+i, "mstrid", mstrid+i); |
mstrid[i]--; |
543,9 → 493,8 |
} |
/** |
The function prints selected nodes for arclength control. |
The function reads selected nodes for arclength control. |
@param in - pointer to the opened text file |
553,19 → 502,207 |
Created by Jaroslav Kruis, 2008 |
*/ |
void nonlinman::print_selnod (FILE *out) |
void nonlinman::read_selnod (XFILE *in) |
{ |
long i; |
xfscanf (in,"%k%ld", "num_sel_nodes", &nsnal); |
selnodal = new long [nsnal]; |
for (i=0; i<nsnal; i++){ |
xfscanf (in,"%ld",selnodal+i); |
selnodal[i]--; |
} |
} |
/** |
The function reads two selected nodes for arclength control by the distance increment of two nodes. |
@param in - pointer to the opened text file |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::read_selnoddistincr (XFILE *in) |
{ |
long i; |
for (i=0;i<nsnal;i++){ |
fprintf (out,"%ld\n",selnodal[i]+1); |
xfscanf (in,"%k%ld","probdimal",&probdimal); |
nsnal=2; |
selnodal = new long [nsnal]; |
for (i=0; i<nsnal; i++){ |
xfscanf (in,"%ld",selnodal+i); |
selnodal[i]--; |
} |
} |
/** |
The function prints setup data for the arclength method to the text file. |
@param[in,out] out - pointer to the opened text file where the data will be printed to |
@param[in] nlst - the given type of the nonlinear solver, i.e. variant of the arclength method |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::print_arclength(FILE *out, nonlinsolvertype nlst) |
{ |
fprintf (out,"%d\n",(int)dlam); |
fprintf (out, "%ld %ld %e %e %e %e %e\n", nial, niilal, erral, dlal, |
dlminal, dlmaxal, psial); |
if ((nlst == arclrv1) || (nlst == arclrv)) |
fprintf(out, "%f\n", lambdar); |
if (tnlinsol == arclrv) |
fprintf(out, "%f\n", errl); |
fprintf (out, "%d\n", (int)rnormtnr); |
if (nlst == arclg){ |
// checking of divergency of inner iteration loop |
fprintf(out, "%d", check_div); |
if (check_div == on) |
fprintf(out, " %ld\n", div_min_steps+1); |
else |
fprintf(out, "\n"); |
// checking of maximum value of the total (cumulative) arc length |
fprintf(out, "%d", check_tot_al); |
if (check_tot_al == on) |
fprintf(out, " %le\n", max_tot_al); |
else |
fprintf(out, "\n"); |
// checking of required value of lambda coefficent for proportional load vector |
fprintf(out, "%d", check_lambdar); |
if (check_lambdar == on) |
fprintf(out, " %le %le\n", lambdar, errl); |
else |
fprintf(out, "\n"); |
} |
//fprintf (out,"%ld %d\n",hdbackupal,displnorm); |
fprintf (out,"%d\n",displnorm); |
print_displnorm(out, displnorm); |
} |
/** |
The function reads setup data for the Newton-Raphson method. |
@param[in,out] out - pointer to the opened text file where the data will be printed to |
@param[in] nlst - the given type of the nonlinear solver, i.e. variant of the Newton-Raphson method |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::print_newtonraphson(FILE *out, nonlinsolvertype nlst) |
{ |
fprintf (out, "%ld %ld %le %le %le %le %d", ninr, niilnr, errnr, incrnr, minincrnr, maxincrnr, rnormtnr); |
if (nlst == newtonrv1){ |
fprintf (out, " %le", lambdar); |
} |
if (nlst == displctrlrv){ |
fprintf (out, " %le %le", lambdar, errl); |
} |
fprintf(out, "\n"); |
/* |
case newtonrestart:{ |
fprintf (out,"%ld %ld %le %le %le %d\n",ninr,niilnr,errnr,incrnr,minincrnr, rnormtnr); |
fprintf (out, "%ld %ld\n", nienr, hdbr); |
if (hdbr) |
fprintf(out, "%s\n %ld\n", backupfname, hdbid); |
break; |
}*/ |
if (nlst == newtong){ |
// checking of divergency of inner iteration loop |
fprintf(out, "%d", check_div); |
if (check_div == on) |
fprintf(out, " %ld\n", div_min_steps+1); |
else |
fprintf(out, "\n"); |
// checking of required value of lambda coefficent for proportional load vector |
fprintf(out, "%d", check_lambdar); |
if (check_lambdar == on) |
fprintf(out, " %le %le\n", lambdar, errl); |
else |
fprintf(out, "\n"); |
} |
} |
/** |
The function prints setup data for the nonlinear solver with the constrained increment of dissipation. |
@param[in, out] out - pointer to the opened text file where the data will be printed to |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::print_dissipincr(FILE *out) |
{ |
fprintf(out, "%le", tau_ini); |
fprintf(out, "%le", tau_max); |
fprintf(out, "%le", tau_lim); |
fprintf(out, "%d", int(altnlst)); |
if ((altnlst == arcl) || (altnlst == arclrv1) || (altnlst == arclrv) || (altnlst == arclg)) |
print_arclength(out, altnlst); |
else{ |
print_err("wrong type of alternative nonlinear solver (%d) is required", |
__FILE__, __LINE__, __func__, int(altnlst)); |
abort(); |
} |
} |
/** |
The function printss setup of the actual type of the displacement norm computation. |
@param[in,out] out - pointer to the opened FILE where the data will be printed to |
@param[in] dn - type of required displacement norm |
@return The function does not return anything. |
Created by TKo, 03.2024 |
*/ |
void nonlinman::print_displnorm(FILE *out, displacementnorm dn) |
{ |
switch (dn){ |
case alldofs:{ break; } |
case seldofs:{ |
print_seldof (out); |
break; |
} |
case seldofscoord:{ |
print_seldofcoord (out); |
break; |
} |
case selmstr:{ |
print_selmstr(out); |
break; |
} |
case selecnodes:{ |
print_selnod (out); |
break; |
} |
case nodesdistincr:{ |
print_selnoddistincr(out); |
break; |
} |
default: |
print_err("unknown norm measurement of displacement increment", __FILE__, __LINE__, __func__); |
} |
} |
/** |
The function prints selected dofs for arclength control. |
@param in - pointer to the opened text file |
578,6 → 715,7 |
{ |
long i; |
fprintf (out,"%ld\n",nsdofal); |
for (i=0;i<nsdofal;i++){ |
fprintf (out,"%ld %ld\n",selnodal[i]+1,seldofal[i]+1); |
} |
599,6 → 737,7 |
{ |
long i; |
fprintf (out,"%ld\n",nsdofal); |
for (i=0;i<nsdofal;i++){ |
fprintf (out,"%f %f %f %ld\n",selnodcoord[3*i],selnodcoord[3*i+1],selnodcoord[3*i+2],seldofal[i]+1); |
} |
620,6 → 759,7 |
{ |
long i; |
fprintf(out, "%ld\n", nmstrcomp); |
for (i=0;i<nmstrcomp;i++){ |
fprintf(out,"%d%ld", mstrastre[i], mstrid[i]+1); |
} |
628,6 → 768,45 |
/** |
The function prints selected nodes for arclength control. |
@param in - pointer to the opened text file |
@return The function does not return anything. |
Created by Jaroslav Kruis, 2008 |
*/ |
void nonlinman::print_selnod (FILE *out) |
{ |
long i; |
fprintf (out,"%ld\n",nsnal); |
for (i=0;i<nsnal;i++){ |
fprintf (out,"%ld\n",selnodal[i]+1); |
} |
} |
/** |
The function prints selected nodes for arclength control. |
@param in - pointer to the opened text file |
@return The function does not return anything. |
Created by Jaroslav Kruis, 2008 |
*/ |
void nonlinman::print_selnoddistincr (FILE *out) |
{ |
fprintf (out,"%ld\n",probdimal); |
print_selnod(out); |
} |
/** |
The function initializes data from the another nonlinman structure. |
@param nm - nonlinman structure used fro initialization |
/trunk/SIFEL/MEFEL/SRC/nonlinman.h |
---|
22,14 → 22,28 |
~nonlinman (void); |
void read (XFILE *in,long mespr); |
void print (FILE *out); |
void read_selnod (XFILE *in); |
void read_arclength(XFILE *in, nonlinsolvertype nlst, long mespr); |
void read_newtonraphson(XFILE *in, nonlinsolvertype nlst, long mespr); |
void read_dissipincr(XFILE *in, long mespr); |
void read_displnorm(XFILE *in, displacementnorm dn); |
void read_seldof (XFILE *in); |
void read_seldofcoord (XFILE *in); |
void read_selmstr (XFILE *in); |
void print_selnod (FILE *out); |
void read_selnod (XFILE *in); |
void read_selnoddistincr (XFILE *in); |
void print_arclength(FILE *out, nonlinsolvertype nlst); |
void print_newtonraphson(FILE *out, nonlinsolvertype nlst); |
void print_dissipincr(FILE *out); |
void print_displnorm(FILE *out, displacementnorm dn); |
void print_seldof (FILE *out); |
void print_seldofcoord (FILE *out); |
void print_selmstr(FILE *out); |
void print_selnod (FILE *out); |
void print_selnoddistincr (FILE *out); |
void allocavec(long n); |
void deallocavec(); |
93,7 → 107,22 |
strastre *mstrastre; |
/// array of id of selected macro-strain/stress components |
long *mstrid; |
/* |
Setup of nonliniear solver controlled by dissipation increment |
*/ |
/// initial value of dissipation increment |
double tau_ini; |
/// limit dissipation increment where the switching to the common arclength will be performed |
double tau_lim; |
/// maximum allowable dissipation increment |
double tau_max; |
/// actual value of the dissipation increment |
double tau; |
/// type of alternative solver of nonlinear algebraic equation system for solver controlled by the dissipation increment |
nonlinsolvertype altnlst; |
/* the stiffness %matrix can be modified in outer as well as in the inner loops |
for this purpose, two variables (ithstiffchange, jthstiffchange) are defined |
/trunk/SIFEL/MEFEL/SRC/nonlocmicroM4.cpp |
---|
48,9 → 48,9 |
double sigma_elast,sigma_loc,sigma_inelast; |
double S2=0; |
double rr,alfa; |
long i,j,k,aip,nad,numberOfMicroplanes; |
long i,j,k,aip,nad; |
numberOfMicroplanes = Mm->mpM4[0].numberOfMicroplanes; |
//long numberOfMicroplanes = Mm->mpM4[0].numberOfMicroplanes; |
//zero matrix and vector |
fillv(0.0,S1); |
/trunk/SIFEL/MEFEL/SRC/nssolver.cpp |
---|
406,7 → 406,7 |
// 16.8.2001 |
{ |
long i,j,k,n,ni,ini,nii; |
double lambda,blambda,dlambda,dlambdamin,zero,err,norf,norfa; |
double lambda,blambda,dlambda,dlambdamin,err,norf,norfa; |
double *r,*rb,*dr,*f,*fi,*fb,*fc,*fp; |
418,8 → 418,6 |
nii = Mp->nlman->nienr; |
// maximum number of iterations in one increment |
ini = Mp->nlman->niilnr; |
// computer zero |
zero = Mp->zero; |
// required error in inner loop |
err = Mp->nlman->errnr; |
// increment size |
578,6 → 576,11 |
fprintf(stdout, "\n Initial equilibrium could not be reached\n"); |
fprintf(stdout, " Program will be terminated\n"); |
print_close(); |
delete [] rb; |
delete [] f; |
delete [] fb; |
delete [] fi; |
delete [] dr; |
return; |
} |
else |
696,7 → 699,7 |
} |
delete [] dr; delete [] fi; delete [] fb; delete [] f; |
delete [] rb; delete [] dr; delete [] fi; delete [] fb; delete [] f; |
print_close(); |
} |
764,7 → 767,7 |
fprintf (aux,"%e\n",Mm->ip[i].eqother[j]); |
} |
} |
delete [] file; |
fclose (aux); |
} |
831,6 → 834,7 |
fscanf (aux,"%le",&Mm->ip[i].eqother[j]); |
} |
} |
delete [] file; |
fclose (aux); |
} |
/trunk/SIFEL/MEFEL/SRC/obj_funct.cpp |
---|
1,8 → 1,9 |
#include "obj_funct.h" |
#include <math.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <obj_funct.h> |
/** |
This function is here only for linking purposes. Please don't use |
/trunk/SIFEL/MEFEL/SRC/obj_funct_mefel.cpp |
---|
1,3 → 1,4 |
#include "obj_funct.h" |
#include "solverm.h" |
#include "lssolver.h" |
#include "edsolver.h" |
11,7 → 12,6 |
#include <stdlib.h> |
#include "obj_funct.h" |
/trunk/SIFEL/MEFEL/SRC/ortodam.cpp |
---|
477,6 → 477,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (cde == corr_off) |
// no correction of disipated energy only simple scalar damge |
597,6 → 598,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (cde == corr_off) |
// no correction of disipated energy only simple scalar damge |
621,6 → 623,7 |
if (kappa*omegao*h >= ul) // limit crack opening was reached => full damage, omega = 1.0 |
return 1.0; |
tmp = 0.0; |
for (i = 0; i < ni; i++) |
{ |
if (pq) |
840,6 → 843,7 |
break; |
default: |
print_err("cannot determine dimension of the element.", __FILE__, __LINE__, __func__); |
abort(); |
} |
e = Mm->give_actual_ym(ipp); |
// variable softening for tension |
1274,6 → 1278,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
// storage of cracks openings computed from tensile damage tensor |
for(i = 0; i < 3; i++){ |
/trunk/SIFEL/MEFEL/SRC/ortodam2.cpp |
---|
182,6 → 182,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (cde == corr_off) |
// no correction of disipated energy only simple scalar damge |
191,6 → 192,7 |
} |
// it is better to start from omega=1 in order to avoid of convergention problems |
omega = 1.0; |
tmp = 0.0; |
for (i = 0; i < ni; i++) |
{ |
dtmp = -e*kappa+f/uf*h*kappa*exp(-h*omega*kappa/uf); |
300,6 → 302,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (cde == corr_off) |
// no correction of disipated energy only simple scalar damge |
324,6 → 327,7 |
if (kappa*omegao*h >= ul) // limit crack opening was reached => full damage, omega = 1.0 |
return 1.0; |
tmp = 0.0; |
for (i = 0; i < ni; i++) |
{ |
if (pq) |
529,14 → 533,12 |
*/ |
void ortodam2::elmatstiff (matrix &d,long ipp) |
{ |
long idem = Mm->ip[ipp].gemid(); // index of elastic material |
long idoem=Mm->givencompeqother(ipp,0); // total number of internal variables |
long tmp=Mm->givencompeqother(ipp,idem); // number of internal variables for elastic material and thermal material |
idoem -= tmp; |
Mm->elmatstiff (d,ipp); |
// e = Mm->give_actual_ym(ipp); |
// e0 = Mm->give_actual_ym(ipp,idem,idoem); // Young modulus from elastic material |
// long idem = Mm->ip[ipp].gemid(); // index of elastic material |
// long tmp=Mm->givencompeqother(ipp,idem); // number of internal variables for elastic material and thermal material |
// long idoem=Mm->givencompeqother(ipp,0) - tmp; // total number of internal variables |
// double e = Mm->give_actual_ym(ipp); |
// double e0 = Mm->give_actual_ym(ipp,idem,idoem); // Young modulus from elastic material |
// cmulm(e/e0, d); |
} |
679,6 → 681,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
// storage of cracks openings computed from tensile damage tensor |
for (i = 0; i < 3; i++) |
/trunk/SIFEL/MEFEL/SRC/ortodamrot.cpp |
---|
331,6 → 331,7 |
break; |
default: |
print_err("unknown dimension of element is required.", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (cde == corr_off) |
// no correction of disipated energy only simple scalar damge |
340,6 → 341,7 |
} |
// it is better to start from omega=1 in order to avoid of convergention problems |
omega = 1.0; |
tmp = 0.0; |
for (i = 0; i < ni; i++) |
{ |
dtmp = -e*kappa+f/uf*h*kappa*exp(-h*omega*kappa/uf); |
449,6 → 451,7 |
break; |
default: |
print_err("unknown dimension of element is required.", __FILE__, __LINE__, __func__); |
abort(); |
} |
if (cde == corr_off) |
// no correction of disipated energy only simple scalar damge |
686,6 → 689,7 |
break; |
default: |
print_err("cannot determine dimension of element.", __FILE__, __LINE__, __func__); |
abort(); |
} |
e = Mm->give_actual_ym(ipp); |
// variable softening for tension |
1162,6 → 1166,7 |
break; |
default: |
print_err("unknown dimension of element", __FILE__, __LINE__, __func__); |
abort(); |
} |
vector_tensor(sigma, sigt, Mm->ip[ipp].ssst, stress); |
princ_val(sigt, psig, t, nijac, limit, Mp->zero, 3, 1); |
/trunk/SIFEL/MEFEL/SRC/outdiagm.cpp |
---|
428,6 → 428,104 |
/** |
The function prints one row with required values to the output file out. |
It supposes that values in the integration points and nodes are actualized and valid. |
@param out - pointer to opened output text file |
@param lcid - load case id |
@param lambda - coefficient of applied load |
@param istep - index of current step |
@param fi - pointer to array load vector |
@param fr - array of residual %vector components at nodes which should be printed. |
@retval 0 - on success |
@retval 1 - in case of wrong ip identification |
@retval 2 - in case of unknown required value type |
Created by Tomas Koudelka, |
*/ |
long outdiagm::printval(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr) |
{ |
long i; |
// check if we should print at given step |
if (dstep.presence_id(istep, lambda, Mp->timecon) == 0) |
return 0; |
for (i=0; i<npun; i++) |
{ |
if ((pid[i] < 0) && (nif[i] == atip)) |
{ |
if ((eid[i] < Mt->ne) && (ipeid[i] >= 0) && (ipeid[i] < Mt->give_tnip(eid[i]))) |
pid[i] = Mt->elements[eid[i]].ipp[0][0]+ipeid[i]; |
else |
{ |
print_err("invalid element number or element ip number is required\n" |
"(element %ld, ip %ld)", __FILE__, __LINE__, __func__, eid[i]+1, ipeid[i]+1); |
return 1; |
} |
} |
switch (pu[i]) |
{ |
case pr_displ: |
print_displacements(out, lcid, i); |
break; |
case pr_strains: |
print_strains(out, lcid, i); |
break; |
case pr_stresses: |
print_stresses(out, lcid, i); |
break; |
case pr_macrostrain: |
print_macrostrain(out, lcid, i); |
break; |
case pr_macrostress: |
print_macrostress(out, lcid, i); |
break; |
case pr_forces: |
print_forces(out, i, fi); |
break; |
case pr_residual: |
print_forces(out, i, fr); |
break; |
case pr_react: |
print_reactions(out, lcid, i); |
break; |
case pr_stepid : |
fprintf(out, "%ld ", istep); |
break; |
case pr_time: |
if(Mp->tpr == seconds) |
fprintf(out, "% .15e ", lambda); |
if(Mp->tpr == minutes) |
fprintf(out, "% .15e ", lambda/60.0); |
if(Mp->tpr == hours) |
fprintf(out, "% .15e ", lambda/3600.0); |
if(Mp->tpr == days) |
fprintf(out, "% .15e ", lambda/86400.0); |
break; |
case pr_appload: |
case pr_eigval: |
fprintf(out, "% .15e ", lambda); |
break; |
case pr_other: |
print_others(out, lcid, i); |
break; |
default: |
print_err("unknown type of value for diagram is required at node or ip number %ld", |
__FILE__, __LINE__, __func__, pid[i]+1); |
return 2; |
} |
} |
fprintf(out, "\n"); |
return 0; |
} |
/** |
The function prints one row with required values to the output file out without respect to |
to selected step/time (forced printing). It supposes that values in the integration points |
and nodes are actualized and valid. |
514,6 → 612,96 |
/** |
The function prints one row with required values to the output file out without respect to |
to selected step/time (forced printing). It supposes that values in the integration points |
and nodes are actualized and valid. |
@param out - pointer to opened output text file |
@param lcid - load case id |
@param lambda - coefficient of applied load |
@param istep - index of current step |
@param fi - pointer to array load vector |
@param fr - array of residual %vector components at nodes which should be printed. |
@retval 0 - on success |
@retval 1 - in case of wrong ip identification |
@retval 2 - in case of unknown required value type |
Created by Tomas Koudelka, |
*/ |
long outdiagm::printval_forced(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr) |
{ |
long i; |
for (i=0; i<npun; i++) |
{ |
if ((pid[i] < 0) && (nif[i] == atip)) |
{ |
if ((eid[i] < Mt->ne) && (ipeid[i] >= 0) && (ipeid[i] < Mt->give_tnip(eid[i]))) |
pid[i] = Mt->elements[eid[i]].ipp[0][0]+ipeid[i]; |
else |
{ |
print_err("invalid element number or element ip number is required\n" |
"(element %ld, ip %ld)", __FILE__, __LINE__, __func__, eid[i]+1, ipeid[i]+1); |
return 1; |
} |
} |
switch (pu[i]) |
{ |
case pr_displ: |
print_displacements(out, lcid, i); |
break; |
case pr_strains: |
print_strains(out, lcid, i); |
break; |
case pr_stresses: |
print_stresses(out, lcid, i); |
break; |
case pr_forces: |
print_forces(out, i, fi); |
break; |
case pr_residual: |
print_forces(out, i, fr); |
break; |
case pr_react: |
print_reactions(out, lcid, i); |
break; |
case pr_stepid: |
fprintf(out, "%ld ", istep); |
break; |
case pr_time: |
if(Mp->tpr == seconds) |
fprintf(out, "% .15e ", lambda); |
if(Mp->tpr == minutes) |
fprintf(out, "% .15e ", lambda/60.0); |
if(Mp->tpr == hours) |
fprintf(out, "% .15e ", lambda/3600.0); |
if(Mp->tpr == days) |
fprintf(out, "% .15e ", lambda/86400.0); |
break; |
case pr_appload: |
case pr_eigval: |
fprintf(out, "% .15e ", lambda); |
break; |
case pr_other: |
print_others(out, lcid, i); |
break; |
default: |
print_err("unknown type of value for diagram is required at node or ip number %ld", |
__FILE__, __LINE__, __func__, pid[i]+1); |
return 2; |
} |
} |
fprintf(out, "\n"); |
return 0; |
} |
/** |
The function prints displacement at required point to the output file out. |
It supposes that values in the nodes are actualized and valid. |
/trunk/SIFEL/MEFEL/SRC/outdiagm.h |
---|
31,8 → 31,12 |
long print_header(FILE *out); |
/// prints diagram to output diagram file |
long printval(FILE *out, long lcid, double lambda, long istep, double *fi); |
/// prints diagram to output diagram file |
long printval(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr); |
/// forced print of diagram to output diagram file |
long printval_forced(FILE *out, long lcid, double lambda, long istep, double *fi); |
/// forced print of diagram to output diagram file |
long printval_forced(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr); |
/// prints displacements |
long print_displacements(FILE *out, long lcid, long idp); |
/// prints strains |
/trunk/SIFEL/MEFEL/SRC/outdriverm.cpp |
---|
549,6 → 549,51 |
/** |
Function prints diagrams. |
@param lcid - required load case id |
@param lambda - actual load parameter/actual time |
@param istep - actual step id |
@param fi - array with values of load vector |
@param fr - array of residual %vector components at nodes which should be printed. |
@return The function does not return anything. |
Created by Tomas Koudelka |
*/ |
void outdriverm::print_diags(long lcid, double lambda, long istep, double *fi, double *fr) |
{ |
long i; |
for(i=0; i<ndiag; i++) |
odiag[i].printval(outdiagf[i], lcid, lambda, istep, fi, fr); |
} |
/** |
Function prints diagrams without respect to |
to selected step/time (forced printing). |
@param lcid - required load case id |
@param lambda - actual load parameter/actual time |
@param istep - actual step id |
@param fi - array with values of load vector |
@param fr - array of residual %vector components at nodes which should be printed. |
@return The function does not return anything. |
Created by Tomas Koudelka |
*/ |
void outdriverm::print_diags_forced(long lcid, double lambda, long istep, double *fi, double *fr) |
{ |
long i; |
for(i=0; i<ndiag; i++) |
odiag[i].printval_forced(outdiagf[i], lcid, lambda, istep, fi, fr); |
} |
/** |
Function prints required value to the graphics files . |
@param out - pointer to the opened text file |
1076,6 → 1121,535 |
/** |
Function prints required value to the graphics files . |
@param out - pointer to the opened text file |
@param lcid - required load case id |
@param lambda - actual load parameter/actual time |
@param istep - actual step id |
@param fi - array with values of load vector |
@param fr - array of residual %vector components at nodes which should be printed. |
@return The function does not return anything. |
Created by Tomas Koudelka |
*/ |
void outdriverm::print_graphics(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr) |
{ |
long i; |
char dlcid[50]; |
switch (gf) |
{ |
case grfmt_no: |
break;; |
case grfmt_femcad: |
break; |
case grfmt_open_dx: |
{ |
for (i=0; i<Mb->nlc; i++) |
{ |
if (gf == grfmt_open_dx) |
print_default_dx (Gtm, Mp, Mt, Mm, i, outgrfn); |
} |
break; |
} |
case grfmt_gid: |
{ |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon))) |
nog.print_graphics(out, lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1) && (eog.dstep.presence_id(istep, lambda, Mp->timecon))) |
eog.print_graphics(out, lcid, dlcid, gf, ide1); |
break; |
} |
case grfmt_gid_sep: |
{ |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon))) |
nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1) && (eog.dstep.presence_id(istep, lambda, Mp->timecon))) |
eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1); |
break; |
} |
case grfmt_vtk://not implemented for growing structure |
{ |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon)))//need to include eog separately |
{ |
char fname[FNAMELEN+70]; |
FILE *vtk_file; |
char *path; |
char *name; |
char *suffix; |
filename_decomposition (outgrfn,path,name,suffix); |
sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);//increase index in filename |
delete [] path; delete [] name; delete [] suffix; |
if((vtk_file = fopen(fname, "w"))==NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
switch (Mp->tprob) |
{ |
case mat_nonlinear_statics: |
case mech_timedependent_prob: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
print_vtk_header(vtk_file, istep, (double) atof(dlcid));//print header,points,nodes,elements |
write_vtk_unkn(vtk_file, lcid);//print datapoints in sections |
fclose(vtk_file); |
vtk_num++; |
break; |
default: |
{ |
//not implemented yet |
} |
} |
} |
break; |
} |
case grfmt_gid_vtk: |
{ |
// |
// output in GiD format |
// |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon))) |
nog.print_graphics(out, lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1) && (eog.dstep.presence_id(istep, lambda, Mp->timecon))) |
eog.print_graphics(out, lcid, dlcid, gf, ide1); |
// |
// output in VTK format |
// |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon)))//need to include eog separately |
{ |
char fname[FNAMELEN+70]; |
FILE *vtk_file; |
char *path; |
char *name; |
char *suffix; |
filename_decomposition (outgrfn,path,name,suffix); |
sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);//increase index in filename |
delete [] path; delete [] name; delete [] suffix; |
if((vtk_file = fopen(fname, "w"))==NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
switch (Mp->tprob) |
{ |
case mat_nonlinear_statics: |
case mech_timedependent_prob: |
print_vtk_header(vtk_file, istep, (double) atof(dlcid)); //print header,points,nodes,elements |
write_vtk_unkn(vtk_file, lcid); //print datapoints in sections |
fclose(vtk_file); |
vtk_num++; |
break; |
default: |
{ |
//not implemented yet |
} |
} |
} |
break; |
} |
case grfmt_gidsep_vtk: |
{ |
// |
// output in GiD format |
// |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon))) |
nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1) && (eog.dstep.presence_id(istep, lambda, Mp->timecon))) |
eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1); |
// |
// output in VTK format |
// |
if (nog.sellc.presence_id(lcid+1) && (nog.dstep.presence_id(istep, lambda, Mp->timecon)))//need to include eog separately |
{ |
char fname[FNAMELEN+70]; |
FILE *vtk_file; |
char *path; |
char *name; |
char *suffix; |
filename_decomposition (outgrfn,path,name,suffix); |
sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);//increase index in filename |
delete [] path; delete [] name; delete [] suffix; |
if((vtk_file = fopen(fname, "w"))==NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
switch (Mp->tprob) |
{ |
case mat_nonlinear_statics: |
case mech_timedependent_prob: |
print_vtk_header(vtk_file, istep, (double) atof(dlcid));//print header,points,nodes,elements |
write_vtk_unkn(vtk_file, lcid);//print datapoints in sections |
fclose(vtk_file); |
vtk_num++; |
break; |
default: |
{ |
//not implemented yet |
} |
} |
} |
break; |
} |
case grfmt_sep_files_quant: |
print_sep_files_quant(lcid, lambda, istep, Lsrs->give_lhs(lcid), NULL, fi, fr); |
break; |
default: |
print_err("unknown type of graphics format is required", __FILE__, __LINE__, __func__); |
} |
} |
/** |
Function prints required value to the graphics files without respect to |
to selected step/time (forced printing). |
@param out - pointer to the opened text file |
@param lcid - required load case id |
@param lambda - actual load parameter/actual time |
@param istep - actual step id |
@param fi - array with values of load vector |
@param fr - array of residual %vector components at nodes which should be printed. |
@return The function does not return anything. |
Created by Tomas Koudelka |
*/ |
void outdriverm::print_graphics_forced(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr) |
{ |
long i; |
char dlcid[50]; |
switch (gf) |
{ |
case grfmt_no: |
break;; |
case grfmt_femcad: |
break; |
case grfmt_open_dx: |
{ |
for (i=0; i<Mb->nlc; i++) |
{ |
if (gf == grfmt_open_dx) |
print_default_dx (Gtm, Mp, Mt, Mm, i, outgrfn); |
} |
break; |
} |
case grfmt_gid: |
{ |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1)) |
nog.print_graphics(out, lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1)) |
eog.print_graphics(out, lcid, dlcid, gf, ide1); |
break; |
} |
case grfmt_gid_sep: |
{ |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1)) |
nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1)) |
eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1); |
break; |
} |
case grfmt_vtk: |
{ |
if (nog.sellc.presence_id(lcid+1))//need to include eog separately |
{ |
char fname[FNAMELEN+70]; |
FILE *vtk_file; |
char *path; |
char *name; |
char *suffix; |
filename_decomposition (outgrfn,path,name,suffix); |
sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);//increase index in filename |
delete [] path; delete [] name; delete [] suffix; |
if((vtk_file = fopen(fname, "w"))==NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
switch (Mp->tprob) |
{ |
case mat_nonlinear_statics: |
case mech_timedependent_prob: |
print_vtk_header(vtk_file, istep, (double) atof(dlcid));//print header,points,nodes,elements |
write_vtk_unkn(vtk_file, lcid);//print datapoints in sections |
fclose(vtk_file); |
vtk_num++; |
break; |
default: |
{ |
//not implemented yet |
} |
} |
} |
break; |
} |
case grfmt_gid_vtk: |
{ |
// |
// forced output in GiD format |
// |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1)) |
nog.print_graphics(out, lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1)) |
eog.print_graphics(out, lcid, dlcid, gf, ide1); |
// |
// forced output in VTK format |
// |
if (nog.sellc.presence_id(lcid+1))//need to include eog separately |
{ |
char fname[FNAMELEN+70]; |
FILE *vtk_file; |
char *path; |
char *name; |
char *suffix; |
filename_decomposition (outgrfn,path,name,suffix); |
sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);//increase index in filename |
delete [] path; delete [] name; delete [] suffix; |
if((vtk_file = fopen(fname, "w"))==NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
switch (Mp->tprob) |
{ |
case mat_nonlinear_statics: |
case mech_timedependent_prob: |
print_vtk_header(vtk_file, istep, (double) atof(dlcid));//print header,points,nodes,elements |
write_vtk_unkn(vtk_file, lcid);//print datapoints in sections |
fclose(vtk_file); |
vtk_num++; |
break; |
default: |
{ |
//not implemented yet |
} |
} |
} |
break; |
} |
case grfmt_gidsep_vtk: |
{ |
// |
// forced output in GiD format |
// |
switch (Mp->tprob) |
{ |
case mech_timedependent_prob: |
case growing_mech_structure: |
case eigen_dynamics: |
case forced_dynamics: |
if(Mp->tpr == seconds) |
sprintf(dlcid, "%.15e", lambda); |
if(Mp->tpr == minutes) |
sprintf(dlcid, "%.15e", lambda/60.0); |
if(Mp->tpr == hours) |
sprintf(dlcid, "%.15e", lambda/3600.0); |
if(Mp->tpr == days) |
sprintf(dlcid, "%.15e", lambda/86400.0); |
break; |
default: |
sprintf(dlcid, "%ld", istep); |
} |
if (nog.sellc.presence_id(lcid+1)) |
nog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, fi, fr); |
if (eog.sellc.presence_id(lcid+1)) |
eog.print_graphics(outgrfngs, "at", lcid, dlcid, gf, ide1); |
// |
// forced output in VTK format |
// |
if (nog.sellc.presence_id(lcid+1))//need to include eog separately |
{ |
char fname[FNAMELEN+70]; |
FILE *vtk_file; |
char *path; |
char *name; |
char *suffix; |
filename_decomposition (outgrfn,path,name,suffix); |
sprintf(fname,"%s%s%04ld%s", path, name, istep, suffix);//increase index in filename |
delete [] path; delete [] name; delete [] suffix; |
if((vtk_file = fopen(fname, "w"))==NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
switch (Mp->tprob) |
{ |
case mat_nonlinear_statics: |
case mech_timedependent_prob: |
print_vtk_header(vtk_file, istep, (double) atof(dlcid));//print header,points,nodes,elements |
write_vtk_unkn(vtk_file, lcid);//print datapoints in sections |
fclose(vtk_file); |
vtk_num++; |
break; |
default: |
{ |
//not implemented yet |
} |
} |
} |
break; |
} |
default: |
print_err("unknown type of graphics format is required", __FILE__, __LINE__, __func__); |
} |
} |
/** |
Function creates output graphics files and their headers for GiD separated format (grfmt_gidsp). |
For this format (grfmt_gidsp) each required quantity is printed to the sparated file named |
in following way: filename.{elem|nodal}_{quanitity}{indexOfQuantity}.res |
2010,7 → 2584,6 |
{ |
if (Gtm->lnso[i]==0) |
continue; |
ncomp = Mt->nodes[i].ncompother; |
if (selnoth.presence_id(i)) |
{ |
fprintf(out, " Node %7ld", i+1); |
2481,9 → 3054,9 |
if (selnforce.st != sel_no) |
{ |
if ((gf == grfmt_gid) || (gf == grfmt_gid_vtk)) |
write_gid_nforces(out, lcid, desclcid, ifor); |
write_gid_nforces(out, lcid, desclcid, "Forces", ifor, true); |
else |
write_nforces(out, lcid, desclcid, ifor); |
write_nforces(out, lcid, desclcid, "Forces", ifor, true); |
} |
} |
2491,6 → 3064,60 |
/** |
Function prints required output values for selected nodes and for given load case and step |
to the output grahics file. |
@param out - pointer to the opened grahics file |
@param lcid - load case id |
@param desclcid - load case description |
@param gf - graphics format |
@param ifor - %vector of nodal forces |
@param fr - residual %vector at nodes |
@return The function does not return anything. |
Created by Tomas Koudelka |
*/ |
void nodeoutgm::print_graphics(FILE *out, long lcid, const char *desclcid, graphfmt gf, double *ifor, double *fr) |
{ |
if (gf == grfmt_open_dx) |
return; |
if (selndisp.st != sel_no) |
{ |
if ((gf == grfmt_gid) || (gf == grfmt_gid_vtk)) |
write_gid_displ(out, lcid, desclcid); |
else |
write_displ(out, lcid, desclcid); |
} |
print_gr_stra_scal(out, lcid, desclcid, gf); |
print_gr_stre_scal(out, lcid, desclcid, gf); |
print_gr_oth_scal(out, lcid, desclcid, gf); |
print_gr_stra_vec(out, lcid, desclcid, gf); |
print_gr_stre_vec(out, lcid, desclcid, gf); |
print_gr_oth_vec(out, lcid, desclcid, gf); |
print_gr_stra_mtx(out, lcid, desclcid, gf); |
print_gr_stre_mtx(out, lcid, desclcid, gf); |
print_gr_oth_mtx(out, lcid, desclcid, gf); |
if (selnforce.st != sel_no) |
{ |
if ((gf == grfmt_gid) || (gf == grfmt_gid_vtk)){ |
write_gid_nforces(out, lcid, desclcid, "Forces", ifor, true); |
write_gid_nforces(out, lcid, desclcid, "Residual", fr, false); |
} |
else{ |
write_nforces(out, lcid, desclcid, "Forces", ifor, true); |
write_nforces(out, lcid, desclcid, "Residual", fr, false); |
} |
} |
} |
/** |
Function prints required output values for selected nodes and for given load case and step |
to the several output grahics files named by printed quantity component. |
@param outfn - string with file name part |
2562,12 → 3189,104 |
fseek(out, 0, SEEK_END); // MS Visual C++ requires that |
if (ftell(out) == 0) |
fprintf(out, "GiD Post Results File 1.0\n"); |
else{ |
if (desclcid) // regular step output |
write_gid_nforces(out, lcid, desclcid, "Forces", ifor, true); |
else{ |
// do nothing because restorage from backup is just performed |
} |
} |
fclose(out); |
} |
} |
/** |
Function prints required output values for selected nodes and for given load case and step |
to the several output grahics files named by printed quantity component. |
@param outfn - string with file name part |
@param mode - opening mode for graphics files |
@param lcid - load case id |
@param desclcid - load case description |
@param gf - graphics format |
@param ifor - vector of nodal forces |
@param fr - residual %vector at nodes |
@return The function does not return anything. |
Created by Tomas Koudelka |
*/ |
void nodeoutgm::print_graphics(const char *outfn, const char *mode, long lcid, const char *desclcid, graphfmt gf, |
double *ifor, double *fr) |
{ |
char fname[FNAMELEN+70]; |
FILE *out; |
if ((gf != grfmt_gid_sep) && (gf != grfmt_gidsep_vtk)) |
{ |
print_err("invalid graphics format is required", __FILE__, __LINE__, __func__); |
return; |
} |
if (selndisp.st != sel_no) |
{ |
sprintf(fname, "%s.displ.res", outfn); |
out = fopen(fname, mode); |
if (out == NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
fseek(out, 0, SEEK_END); // MS Visual C++ requires that |
if (ftell(out) == 0) |
fprintf(out, "GiD Post Results File 1.0\n"); |
else |
{ |
if (desclcid) // regular step output |
write_gid_nforces(out, lcid, desclcid, ifor); |
write_gid_displ(out, lcid, desclcid); |
else{ |
// do nothing because restorage from backup is just performed |
} |
} |
fclose(out); |
} |
print_gr_stra_scal(outfn, mode, lcid, desclcid); |
print_gr_stre_scal(outfn, mode, lcid, desclcid); |
print_gr_oth_scal(outfn, mode, lcid, desclcid); |
print_gr_stra_vec(outfn, mode, lcid, desclcid); |
print_gr_stre_vec(outfn, mode, lcid, desclcid); |
print_gr_oth_vec(outfn, mode, lcid, desclcid); |
print_gr_stra_mtx(outfn, mode, lcid, desclcid); |
print_gr_stre_mtx(outfn, mode, lcid, desclcid); |
print_gr_oth_mtx(outfn, mode, lcid, desclcid); |
if (selnforce.st != sel_no) |
{ |
sprintf(fname, "%s.force.res", outfn); |
out = fopen(fname, mode); |
if (out == NULL) |
{ |
print_err("cannot open graphics file '%s'", __FILE__, __LINE__, __func__, fname); |
abort(); |
} |
fseek(out, 0, SEEK_END); // MS Visual C++ requires that |
if (ftell(out) == 0) |
fprintf(out, "GiD Post Results File 1.0\n"); |
else{ |
if (desclcid){ |
// regular step output |
write_gid_nforces(out, lcid, desclcid, "Forces", ifor, true); |
write_gid_nforces(out, lcid, desclcid, "Residual", fr, false); |
} |
else{ |
// do nothing because restorage from backup is just performed |
} |
} |
fclose(out); |
} |
} |
4034,8 → 4753,6 |
ipp = Mt->elements[i].ipp[0][0]; |
tnipe = Mt->give_totnip(i); |
fprintf(out, " Element %7ld, integration points %ld - %ld\n ", i+1, ipp+1, ipp+tnipe); |
ncomp = Mm->ip[ipp].ncompstr; |
id = lcid*ncomp; |
for (j=0; j<tnipe; j++) |
{ |
ncomp = Mm->ip[ipp+j].ncompstr; |
/trunk/SIFEL/MEFEL/SRC/outdriverm.h |
---|
103,6 → 103,10 |
void print_graphics(FILE *out, long lcid, const char *desclcid, graphfmt gf, double *ifor); |
/// prints values for selected items to several grahics files |
void print_graphics(const char *outfn, const char *mode, long lcid, const char *desclcid, graphfmt gf, double *ifor); |
/// prints values for selected items to grahics file |
void print_graphics(FILE *out, long lcid, const char *desclcid, graphfmt gf, double *ifor, double *fr); |
/// prints values for selected items to several grahics files |
void print_graphics(const char *outfn, const char *mode, long lcid, const char *desclcid, graphfmt gf, double *ifor, double *fr); |
/// prints values of selected strains as scalars to graphics file |
void print_gr_stra_scal(FILE *out, long lcid, const char *desclcid, graphfmt gf); |
414,10 → 418,18 |
void print_diags(long lcid, double lambda, long istep, double *fi); |
/// forced print of diagrams |
void print_diags_forced(long lcid, double lambda, long istep, double *fi); |
/// prints diagrams |
void print_diags(long lcid, double lambda, long istep, double *fi, double *fr); |
/// forced print of diagrams |
void print_diags_forced(long lcid, double lambda, long istep, double *fi, double *fr); |
/// prints graphics |
void print_graphics(FILE *out, long lcid, double lambda, long istep, double *fi); |
/// forced print of graphics |
void print_graphics_forced(FILE *out, long lcid, double lambda, long istep, double *fi); |
/// prints graphics |
void print_graphics(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr); |
/// forced print of graphics |
void print_graphics_forced(FILE *out, long lcid, double lambda, long istep, double *fi, double *fr); |
/// creates output graphics files and their headers for GiD separated format (grfmt_gidsp) |
void create_files_gidsp(const char *mode); |
/// creates output graphics files and their headers for general quantity output (grfmt_quant) |
/trunk/SIFEL/MEFEL/SRC/outquantm.cpp |
---|
596,15 → 596,16 |
long ret = 1; |
matrix tv, pvect(ASTCKMAT(3,3)); |
vector auxv, pval(ASTCKVEC(3)); |
strastrestate ssst = give_pnt_ssst(i); |
strastrestate ssst; |
ivector id(ASTCKIVEC(3)); |
for(i=0; i<tnpnt; i++){ |
ssst = give_pnt_ssst(i); |
switch (tsn){ |
case voigtred: |
makerefv(auxv, qvv[i], ncmpr); |
reallocm(RSTCKMAT(3, 3, tv)); |
vector_tensor(auxv, tv, give_pnt_ssst(i), tti); |
vector_tensor(auxv, tv, ssst, tti); |
break; |
default: |
break; |
612,7 → 613,7 |
if (ncmpr <= 6){ |
makerefv(auxv, qvv[i], ncmpr); |
reallocm(RSTCKMAT(3, 3, tv)); |
vector_tensor(auxv, tv, give_pnt_ssst(i), tti); |
vector_tensor(auxv, tv, ssst, tti); |
ret = 0; |
} |
if (ncmpr == 9){ |
721,7 → 722,7 |
*/ |
strastrestate outquantm::give_pnt_ssst(long pid) |
{ |
strastrestate ssst; |
strastrestate ssst=strastrestate(0); |
if (tpnt == atnode) ssst = guess_ssst(Mt->nodes[pid].ncompstr); |
if (tpnt == atip) ssst = Mm->ip[pid].ssst; |
934,10 → 935,8 |
void outquantm::give_quant_comp_deflabel(mechquant mq, mechquant rmq, strastrestate ssst, long compid, long maxll, char *label) |
{ |
long l; |
label[0] = '\0'; |
give_quant_deflabel(mq, rmq, maxll, label); |
l = strlen(label); |
switch(mq){ |
case displ_q: // displacements vector (r) |
snprintf(label, maxll, "r_%s", vector_cnamem::displ_cmpstr(ssst, compid)); |
/trunk/SIFEL/MEFEL/SRC/outresfilem.cpp |
---|
175,7 → 175,7 |
case resfmt_diag_dat: |
fprintf(outf, "#"); |
for (i=0; i<nqnt; i++){ |
if (qnt[i].defqlabel == true) |
if ((qnt[i].defqlabel == true) && (label == NULL)) |
label = new char[outquantm::maxl_qlabel]; |
ssst = qnt[i].give_pnt_ssst(qnt[i].selid.id1[0]); |
for(j=0; j<qnt[i].ncmp; j++){ |
228,7 → 228,7 |
void outresfilem::get_modified_fname(long stochid, long stepid) |
{ |
char *path, *name, *ext; |
long pathl, namel, extl; |
long pathl, namel; |
long pc; |
// decompose base file name into path, name and extension |
240,11 → 240,11 |
if (ext){ |
namel = ext - name; |
extl = strlen(ext); |
//extl = strlen(ext); |
} |
else{ |
namel = outfbnl; |
extl = 0; |
//extl = 0; |
} |
// take path and file name |
/trunk/SIFEL/MEFEL/SRC/plelemlq.cpp |
---|
635,7 → 635,6 |
gauss_points (gp.a,w.a,intordsm[ii][jj]); |
ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; |
for (i=0;i<intordsm[ii][jj];i++){ |
xi=gp[i]; |
for (j=0;j<intordsm[ii][jj];j++){ |
646,7 → 645,7 |
geom_matrix (gmr,x,y,xi,eta,jac); |
geom_matrix (gmc,x,y,xi,eta,jac); |
} |
if (nb==2){ |
else{ |
geom_matrix_block (gmr,ii,x,y,xi,eta,jac); |
geom_matrix_block (gmc,jj,x,y,xi,eta,jac); |
} |
1403,7 → 1402,7 |
*/ |
void planeelemlq::nod_strains (long lcid,long eid) |
{ |
long i, j, k, m, ipp; |
long i, j, k, m; |
double jac; |
vector x(ASTCKVEC(nne)), y(ASTCKVEC(nne)); |
vector nxi(ASTCKVEC(nne)), neta(ASTCKVEC(nne)), r(ASTCKVEC(ndofe)); |
1428,7 → 1427,6 |
lgvectortransf (aux,r,tmat); |
copyv (aux,r); |
} |
ipp=Mt->elements[eid].ipp[0][0]; |
// natural coordinates of element nodes |
// (function is from the file GEFEL/ordering.cpp) |
1629,9 → 1627,10 |
{ |
long i,naep,ncp,sid; |
vector coord,sig; |
double **stra,**stre; |
if (Mp->stressaver==0){ |
/* |
double **stra,**stre; |
stra = new double* [nne]; |
stre = new double* [nne]; |
for (i=0;i<nne;i++){ |
1638,8 → 1637,9 |
stra[i] = new double [tncomp]; |
stre[i] = new double [tncomp]; |
} |
// elem_strains (stra,lcid,eid,ri,ci); |
// elem_stresses (stra,stre,lcid,eid,ri,ci); |
elem_strains (stra,lcid,eid,ri,ci); |
elem_stresses (stra,stre,lcid,eid,ri,ci); |
*/ |
} |
// computation of blocks of stresses at integration points |
res_ip_stresses (lcid,eid); |
1678,6 → 1678,7 |
} |
default:{ |
print_err("unknown stress point is required", __FILE__, __LINE__, __func__); |
abort(); |
} |
} |
} |
2338,7 → 2339,7 |
// strain-displacement (geometric) matrix |
geom_matrix (gm,x,y,xi,eta,jac); |
} |
if (nb==2){ |
else{ |
// strain-displacement (geometric) matrix |
geom_matrix_block (gm,ii,x,y,xi,eta,jac); |
} |
2411,7 → 2412,7 |
// strain-displacement (geometric) matrix |
geom_matrix (gm,x,y,xi,eta,jac); |
} |
if (nb==2){ |
else{ |
// strain-displacement (geometric) matrix |
geom_matrix_block (gm,ii,x,y,xi,eta,jac); |
} |
/trunk/SIFEL/MEFEL/SRC/plelemqq.cpp |
---|
783,10 → 783,8 |
*/ |
void planeelemqq::nodipnum (long eid,long ri,long ci,ivector &ipnum) |
{ |
long i,j; |
j=intordsm[0][0]; |
i=Mt->elements[eid].ipp[ri][ci]; |
// long j=intordsm[0][0]; |
long i=Mt->elements[eid].ipp[ri][ci]; |
ipnum[0]=i+8; |
ipnum[1]=i+2; |
/trunk/SIFEL/MEFEL/SRC/plelemqt.cpp |
---|
789,7 → 789,7 |
} |
} |
if (Mp->strainaver==0){ |
if (stra){ |
for (i=0;i<nne;i++){ |
delete [] stra[i]; |
} |
1198,12 → 1198,16 |
} |
} |
if (Mp->stressaver==0){ |
if (stra){ |
for (i=0;i<nne;i++){ |
delete [] stra[i]; |
} |
delete [] stra; |
} |
if (stre){ |
for (i=0;i<nne;i++){ |
delete [] stre[i]; |
} |
delete [] stra; |
delete [] stre; |
} |
/trunk/SIFEL/MEFEL/SRC/plquadiface.cpp |
---|
475,13 → 475,45 |
/** |
The function computes actual stresses for the nonlocal material models at integration points on element. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@return The function stores resulting stresses in the stress array |
of the element integration points. |
Created by Tomas Koudelka, 1.2024 |
*/ |
void plquadinterface::compute_nonloc_nlstress (long /*lcid*/, long eid, long ri, long ci) |
{ |
long i,ipp; |
ipp=Mt->elements[eid].ipp[ri][ci]; |
for(i=0; i<intordsm[0][0]; i++) |
{ |
// computation of correct stresses |
if (Mp->strcomp==1) |
Mm->compnonloc_nlstresses(ipp); |
ipp++; |
} |
} |
/** |
The function computes internal forces due to actual stresses in the global coordinate system. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri,ci - row and column indices |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@param[out] ifor - %vector of internal forces |
@param[in] x,y - %vectors of nodal coordinates |
@param[in] x - %vector of x nodal coordinates |
@param[in] y - %vector of y nodal coordinates |
@return The function returns %vector of internal forces in the parameter ifor. |
502,6 → 534,36 |
/** |
The function computes internal forces due to actual stresses in the global coordinate system. |
Nonlocal material models are considered in the stress computation. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[in] ri - row index of the required integration point block on the given element |
@param[in] ci - column index of the required integration point block on the given element |
@param[out] ifor - %vector of internal forces |
@param[in] x - %vector of x nodal coordinates |
@param[in] y - %vector of y nodal coordinates |
@return The function returns %vector of internal forces in the parameter ifor. |
Created by Tomas Koudelka, 1.2024 |
*/ |
void plquadinterface::nonloc_internal_forces (long lcid, long eid, long ri, long ci, vector &ifor, vector &x, vector &y) |
{ |
integratedquant iq; |
iq=locstress; |
// computation of stresses |
compute_nonloc_nlstress (lcid,eid,ri,ci); |
// integration of stresses over the element |
elem_integration (iq,lcid,eid,ri,ci,ifor,x,y); |
} |
/** |
The function computes resulting internal forces from actual stresses. If required, the transformation |
to the nodal coordinate system is performed. |
539,6 → 601,43 |
/** |
The function computes resulting internal forces from actual stresses in the case of nonlocal material models. |
If required, the transformation to the nodal coordinate system is performed. |
@param[in] lcid - number of load case |
@param[in] eid - element id |
@param[out] ifor - %vector of internal forces |
@return The function returns resulting %vector of internal forces in the parameter ifor. |
Created by Tomas Koudelka, 11.2008 |
*/ |
void plquadinterface::res_nonloc_internal_forces (long lcid, long eid, vector &ifor) |
{ |
long transf; |
ivector nodes(ASTCKIVEC(nne)); |
vector v(ASTCKVEC(ndofe)), x(ASTCKVEC(nne)), y(ASTCKVEC(nne)); |
Mt->give_node_coord2d(x, y, eid); |
nonloc_internal_forces(lcid, eid, 0, 0, ifor, x, y); |
// transformation of nodal forces |
// (in the case of nodal coordinate systems) |
Mt->give_elemnodes (eid,nodes); |
transf = Mt->locsystems (nodes); |
if (transf>0){ |
matrix tmat (ndofe,ndofe); |
transf_matrix (nodes,tmat); |
//globloctransf (ifor,v,tmat); |
glvectortransf (ifor,v,tmat); |
copyv (v,ifor); |
} |
} |
/** |
The function integrates selected quantity on the selected finite element. |
It results in nodal values. |
/trunk/SIFEL/MEFEL/SRC/plquadiface.h |
---|
55,12 → 55,21 |
/// function computes stresses at all integration points of the element |
void compute_nlstress (long lcid,long eid,long ri,long ci); |
/// function computes stresses for nonlocal material models at all integration points of the element |
void compute_nonloc_nlstress(long lcid, long eid, long ri, long ci); |
/// function computes stress resultants |
void internal_forces (long lcid,long eid,long ri,long ci,vector &ifor,vector &x, vector &y); |
/// function computes stress resultants in the case of nonlocal material models |
void nonloc_internal_forces(long lcid, long eid, long ri, long ci, vector &ifor, vector &x, vector &y); |
/// function computes stress resultants transformed to the nodal coordinate systems |
void res_internal_forces (long lcid,long eid,vector &ifor); |
/// function computes stress resultants transformed to the nodal coordinate systems in the case of nonlocal material models |
void res_nonloc_internal_forces(long lcid, long eid, vector &ifor); |
/// function integrates required quantity over the element volume, i.e. \int B^T q dV |
void elem_integration (integratedquant iq,long lcid,long eid,long ri,long ci,vector &nv,vector &x,vector &y); |
/trunk/SIFEL/MEFEL/SRC/scaldam.cpp |
---|
24,7 → 24,7 |
*/ |
scaldam::scaldam (void) |
{ |
ft=0.0; uf = 0.0; c = 0.0; k = 0.0; cde = corr_on; |
ft=0.0; uf = 0.0; k = 0.0; cde = corr_on; |
min_exp_arg = log(DBL_MIN); |
} |
65,8 → 65,6 |
// vonmises= 8 |
xfscanf (in,"%k%lf %k%lf %k%m %k%m","ft",&ft,"uf",&uf,"norm_type",¶mf_type_kwdset,(int *)(&ftype), |
"cor_dis_energy", &corr_disip_en_kwdset, (int *)(&cde)); |
if ((ftype == norenergy) || (ftype == norposenergy)) |
xfscanf(in, "%k%lf", "c", &c); |
if (ftype == vonmises) |
xfscanf(in, "%k%lf", "k", &k); |
94,8 → 92,6 |
void scaldam::print (FILE *out) |
{ |
fprintf (out,"%le %le %d %d ",ft,uf,ftype,cde); |
if ((ftype == norenergy) || (ftype == norposenergy)) |
fprintf(out, " %e ",c); |
if (ftype == vonmises) |
fprintf(out, " %e ",k); |
123,15 → 119,15 |
{ |
double epseq; |
vector poseps; |
vector princsig; |
vector princeps; |
vector posprincsig; |
vector psig; |
vector peps; |
vector pospsig; |
vector tmp; |
vector sig; |
matrix pvect; |
matrix sigt; |
matrix epst; |
vector epstt; |
vector epsf; |
matrix dev; |
matrix d; |
double i1e, j2e, a, b, e, nu, temp; |
141,24 → 137,24 |
{ |
case norstrain: |
// strain norm = |eps| = \sqrt{eps_{ij} eps_{ij}} |
scprd(eps, eps, epseq); |
kappa[0] = sqrt(epseq); |
kappa[0] = tensor_strain_norm(eps); |
break; |
case norenergy: |
// energy norm c\sqrt{eps : D_e : eps} where c should be E^{-1/2} |
ncomp=Mm->ip[ipp].ncompstr; |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
reallocv(RSTCKVEC(ncomp, tmp)); |
elmatstiff (d,ipp); |
vxm(eps, d, tmp); |
mxv(d, eps, tmp); |
scprd(tmp, eps, epseq); |
kappa[0] = sqrt(epseq)*c; |
e = Mm->give_actual_ym(ipp); |
kappa[0] = sqrt(epseq/e); |
break; |
case norposstrain: |
// positive strain norm = \sqrt{<eps_{ij}><eps_{ij}>} |
reallocv(RSTCKVEC(eps.n,poseps)); |
extractposv (eps, poseps); |
scprd(poseps, poseps, epseq); |
kappa[0] = sqrt(epseq); |
kappa[0] = tensor_strain_norm(poseps); |
break; |
case norposenergy: |
// positive energy norm c\sqrt{<eps> : D_e : <eps>} where c should be E_oed^{-1/2} |
168,9 → 164,9 |
elmatstiff (d,ipp); |
reallocv(RSTCKVEC(eps.n,poseps)); |
extractposv (eps, poseps); |
vxm(poseps, d, tmp); |
mxv(d, poseps, tmp); |
scprd(tmp, poseps, epseq); |
kappa[0] = sqrt(epseq)*c; |
kappa[0] = sqrt(epseq/d(0,0)); |
break; |
case norrankine: |
// Rankine norm = max(\bar{sig}_1, \bar{sig}_2, \bar{sig}_3)/E |
183,15 → 179,15 |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
reallocm(RSTCKMAT(3, 3, sigt)); |
reallocm(RSTCKMAT(3, 3, pvect)); |
reallocv(RSTCKVEC(3, princsig)); |
reallocv(RSTCKVEC(3, psig)); |
elmatstiff (d,ipp); |
mxv(d, eps, sig); |
vector_tensor(sig, sigt, Mm->ip[ipp].ssst, stress); |
princ_val (sigt,princsig,pvect,nijac,limit,Mp->zero,3,1); |
princ_val (sigt,psig,pvect,nijac,limit,Mp->zero,3,1); |
// principal values are sorted -> maximum value of principal stresses is at the last |
// position of vector princsig |
if (princsig[2] > 0.0) |
kappa[0] = princsig[2] / e; |
if (psig[2] > 0.0) |
kappa[0] = psig[2] / e; |
else |
kappa[0] = 0.0; |
break; |
207,14 → 203,14 |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
reallocm(RSTCKMAT(3, 3, sigt)); |
reallocm(RSTCKMAT(3, 3, pvect)); |
reallocv(RSTCKVEC(3, princsig)); |
reallocv(RSTCKVEC(3, posprincsig)); |
reallocv(RSTCKVEC(3, psig)); |
reallocv(RSTCKVEC(3, pospsig)); |
elmatstiff (d,ipp); |
mxv(d, eps, sig); |
vector_tensor(sig, sigt, Mm->ip[ipp].ssst, stress); |
princ_val (sigt,princsig,pvect,nijac,limit,Mp->zero,3,1); |
extractposv (princsig, posprincsig); |
scprd(posprincsig, posprincsig, epseq); |
princ_val (sigt,psig,pvect,nijac,limit,Mp->zero,3,1); |
extractposv (psig, pospsig); |
scprd(pospsig, pospsig, epseq); |
kappa[0] = sqrt(epseq) / e; |
break; |
} |
224,12 → 220,12 |
{ |
reallocm(RSTCKMAT(3, 3, epst)); |
reallocm(RSTCKMAT(3, 3, pvect)); |
reallocv(RSTCKVEC(3, princeps)); |
reallocv(RSTCKVEC(3, peps)); |
reallocv(RSTCKVEC(3,poseps)); |
nullv(princeps); |
nullv(peps); |
vector_tensor(eps, epst, Mm->ip[ipp].ssst, strain); |
princ_val (epst,princeps,pvect,nijac,limit,Mp->zero,3,1); |
extractposv (princeps, poseps); |
princ_val (epst,peps,pvect,nijac,limit,Mp->zero,3,1); |
extractposv (peps, poseps); |
scprd(poseps, poseps, epseq); |
kappa[0] = sqrt(epseq); |
break; |
238,14 → 234,11 |
// glasgow modified von Mises norm |
ncomp=Mm->ip[ipp].ncompstr; |
//allocm(3, 3, epst); |
reallocv(RSTCKVEC(6, epstt)); |
reallocv(RSTCKVEC(6, epsf)); |
reallocm(RSTCKMAT(3, 3, dev)); |
//vector_tensor(eps, epst, Mm->ip[ipp].ssst, strain); |
give_full_vector (epstt,eps,Mm->ip[ipp].ssst); |
i1e = first_invar(epstt); |
//deviator (epst,dev); |
//j2e = second_invar (dev); |
j2e = j2_strain_invar (epstt); |
give_full_vector (epsf,eps,Mm->ip[ipp].ssst); |
i1e = first_invar(epsf); |
j2e = j2_strain_invar (epsf); |
e = Mm->give_actual_ym(ipp); |
nu = Mm->give_actual_nu(ipp); |
a = (k-1.0)/(2.0*k)/(1.0-2.0*nu); |
253,7 → 246,7 |
temp = a*a*i1e*i1e + b*j2e; |
kappa[0] = a*i1e+sqrt(temp); |
/* |
// original von Mises norm |
// original von Mises norm, it is the same as the above one |
kappa[0] = (k-1.0)/(2.0*k)/(1.0-2.0*nu)*i1e; |
tmp = (k-1.0)*(k-1.0)/(1.0-2.0*nu)/(1.0-2.0*nu)*i1e*i1e -12.0*k/(1.0+nu)/(1.0+nu)*j2e; |
kappa[0] += 1.0/(2.0*k)*sqrt(tmp);*/ |
280,61 → 273,76 |
Created by Tomas Koudelka, |
*/ |
void scaldam::derdamfuncpar(long /*ipp*/, vector &eps, vector &dkappa) |
void scaldam::derdamfuncpar(long ipp, vector &eps, vector &dkappa) |
{ |
long i; |
double epseq; |
vector poseps; |
vector princsig; |
vector princeps; |
vector posprincsig; |
vector psig; |
vector peps; |
vector pospsig; |
vector tmp; |
vector sig; |
matrix pvect; |
matrix sigt; |
matrix epst; |
vector epstt; |
matrix dev; |
vector epsf; |
vector dev; |
matrix d; |
//double i1e, j2e, a, b, e, nu; |
double temp; |
// long ncomp; |
matrix dkappat, tmpm; |
matrix em[3]; |
double i1e, j2e, a, b, e, nu, temp; |
long ncomp, nncomp; |
switch (ftype) |
{ |
case norstrain: |
// strain norm = |eps| = \sqrt{eps_{ij} eps_{ij}} |
scprd(eps, eps, epseq); |
temp = sqrt(epseq); |
temp = tensor_strain_norm(eps); |
copyv(eps, dkappa); |
cmulv(2.0/temp, dkappa); |
cmulv(1.0/temp, dkappa); |
ncomp=Mm->ip[ipp].ncompstr; |
nncomp = Mm->give_num_norm_comp(ipp); |
for(i=nncomp; i<ncomp; i++) |
dkappa[i] *= 0.5; |
break; |
/* case norenergy: |
case norenergy: |
// energy norm c\sqrt{eps : D_e : eps} where c should be E^{-1/2} |
ncomp=Mm->ip[ipp].ncompstr; |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
makerefv(sig, dkappa); |
elmatstiff (d,ipp); |
vxm(eps, d, tmp); |
scprd(tmp, eps, epseq); |
dkappa[0] = sqrt(epseq)*c; |
mxv(d, eps, sig); |
scprd(sig, eps, epseq); |
epseq = sqrt(epseq); |
e = Mm->give_actual_ym(ipp); |
cmulv(e*epseq, dkappa); |
break; |
case norposstrain: |
// positive strain norm = \sqrt{<eps_{ij}><eps_{ij}>} |
reallocv(RSTCKVEC(eps.n,poseps)); |
extractposv (eps, poseps); |
scprd(poseps, poseps, epseq); |
kappa[0] = sqrt(epseq); |
makerefv(poseps, dkappa); |
extractposv (eps, poseps); |
epseq = tensor_strain_norm(poseps); |
cmulv(1.0/epseq, dkappa); |
ncomp=Mm->ip[ipp].ncompstr; |
nncomp = Mm->give_num_norm_comp(ipp); |
for(i=nncomp; i<ncomp; i++) |
dkappa[i] *= 0.5; |
break; |
case norposenergy: |
// positive energy norm c\sqrt{<eps> : D_e : <eps>} where c should be E_oed^{-1/2} |
ncomp=Mm->ip[ipp].ncompstr; |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
reallocv(RSTCKVEC(ncomp, tmp)); |
makerefv(sig, dkappa); |
elmatstiff (d,ipp); |
reallocv(RSTCKVEC(eps.n,poseps)); |
extractposv (eps, poseps); |
vxm(poseps, d, tmp); |
scprd(tmp, poseps, epseq); |
kappa[0] = sqrt(epseq)*c; |
mxv(d, poseps, sig); |
scprd(sig, poseps, epseq); |
epseq = sqrt(epseq); |
temp = d(0,0)*epseq; |
temp = 1.0/temp; |
cmulv(temp, dkappa); |
extractposv (dkappa, dkappa); |
break; |
case norrankine: |
// Rankine norm = max(\bar{sig}_1, \bar{sig}_2, \bar{sig}_3)/E |
347,17 → 355,31 |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
reallocm(RSTCKMAT(3, 3, sigt)); |
reallocm(RSTCKMAT(3, 3, pvect)); |
reallocv(RSTCKVEC(3, princsig)); |
reallocv(RSTCKVEC(3, psig)); |
elmatstiff (d,ipp); |
mxv(d, eps, sig); |
vector_tensor(sig, sigt, Mm->ip[ipp].ssst, stress); |
princ_val (sigt,princsig,pvect,nijac,limit,Mp->zero,3,1); |
princ_val (sigt, psig, pvect, nijac, limit, Mp->zero, 3, 1); |
// principal values are sorted -> maximum value of principal stresses is at the last |
// position of vector princsig |
if (princsig[2] > 0.0) |
kappa[0] = princsig[2] / e; |
else |
kappa[0] = 0.0; |
// position of vector psig |
nullv(dkappa); |
if (psig[2] > 0.0){ |
e = Mm->give_actual_ym(ipp); |
nu = Mm->give_actual_nu(ipp); |
reallocv(RSTCKVEC(3, tmp)); |
for (i=0; i<3; i++){ |
reallocm(RSTCKMAT(3, 3, em[i])); |
extractcol(pvect, i, tmp); |
vxv(tmp, tmp, em[i]); |
} |
reallocm(RSTCKMAT(3,3,tmpm)); |
addm(em[0], em[1], tmpm); |
temp = (1+nu)*(1-2.0*nu); |
cmulm(nu/temp, tmpm); |
cmulm((1.0-nu)/temp, em[2]); |
addm(em[2], tmpm, tmpm); |
tensor_vector(dkappa, tmpm, Mm->ip[ipp].ssst, stress); // strain option must be reconsidered in the last argument |
} |
break; |
} |
case norrankinesmooth: |
371,15 → 393,35 |
reallocm(RSTCKMAT(ncomp, ncomp, d)); |
reallocm(RSTCKMAT(3, 3, sigt)); |
reallocm(RSTCKMAT(3, 3, pvect)); |
reallocv(RSTCKVEC(3, princsig)); |
reallocv(RSTCKVEC(3, posprincsig)); |
reallocv(RSTCKVEC(3, psig)); |
elmatstiff (d,ipp); |
mxv(d, eps, sig); |
vector_tensor(sig, sigt, Mm->ip[ipp].ssst, stress); |
princ_val (sigt,princsig,pvect,nijac,limit,Mp->zero,3,1); |
extractposv (princsig, posprincsig); |
scprd(posprincsig, posprincsig, epseq); |
kappa[0] = sqrt(epseq) / e; |
princ_val(sigt, psig, pvect, nijac, limit, Mp->zero, 3, 0); |
extractposv (psig, pospsig); |
nullv(dkappa); |
epseq = normv(pospsig); |
if (epseq > 0.0){ |
reallocv(RSTCKVEC(3, tmp)); |
reallocm(RSTCKMAT(3, 3, dkappat)); |
for (i=0; i<3; i++){ |
reallocm(RSTCKMAT(3, 3, em[i])); |
extractcol(pvect, i, tmp); |
vxv(tmp, tmp, em[i]); |
} |
e = Mm->give_actual_ym(ipp); |
nu = Mm->give_actual_nu(ipp); |
temp = (1+nu)*(1-2.0*nu); |
reallocm(RSTCKMAT(3,3,tmpm)); |
for (i=0; i<3; i++){ |
if (pospsig[i] > 0){ |
addm(em[(i+1)%3], em[(i+2)%3], tmpm); |
addmultm(em[i], (1.0-nu)/temp, tmpm, nu/temp, dkappat); |
} |
} |
cmulm(1.0/epseq, dkappat); |
tensor_vector(dkappa, dkappat, Mm->ip[ipp].ssst, stress); // strain option must be reconsidered in the last argument |
} |
break; |
} |
case normazar: |
388,40 → 430,69 |
{ |
reallocm(RSTCKMAT(3, 3, epst)); |
reallocm(RSTCKMAT(3, 3, pvect)); |
reallocv(RSTCKVEC(3, princeps)); |
reallocv(RSTCKVEC(3, peps)); |
reallocv(RSTCKVEC(3,poseps)); |
nullv(princeps); |
nullv(peps); |
vector_tensor(eps, epst, Mm->ip[ipp].ssst, strain); |
princ_val (epst,princeps,pvect,nijac,limit,Mp->zero,3,1); |
extractposv (princeps, poseps); |
scprd(poseps, poseps, epseq); |
kappa[0] = sqrt(epseq); |
princ_val (epst, peps, pvect, nijac, limit, Mp->zero, 3, 0); |
extractposv (peps, poseps); |
epseq = normv(poseps); |
nullv(dkappa); |
if (epseq > 0.0){ |
reallocv(RSTCKVEC(3, tmp)); |
reallocm(RSTCKMAT(3, 3, dkappat)); |
for (i=0; i<3; i++){ |
if (poseps[i] > 0.0){ |
reallocm(RSTCKMAT(3, 3, em[i])); |
extractcol(pvect, i, tmp); |
vxv(tmp, tmp, em[i]); |
addm(em[i], dkappat, dkappat); |
} |
} |
cmulm(1.0/epseq, dkappat); |
tensor_vector(dkappa, dkappat, Mm->ip[ipp].ssst, stress); // strain option must be reconsidered in the last argument |
} |
break; |
} |
case vonmises: |
// glasgow modified von Mises norm |
// glasgow modified von Mises norm: \kappa = a.I_{1\eps} + sqrt(a^2.I^2_{1\eps} + b.J_{2\eps}) |
// dkappa/deps = a.delta_{ij} + \frac{1}{2.sqrt(a^2.I^2_{1\eps} + |
// b.J_{2\eps})}[2a^2\delta_{ij} + b.s_e_{ij}:(I_{ijkl} - 1/3\delta_{ij}\delta{kl})] |
ncomp=Mm->ip[ipp].ncompstr; |
//allocm(3, 3, epst); |
reallocv(RSTCKVEC(6, epstt)); |
reallocm(RSTCKMAT(3, 3, dev)); |
//vector_tensor(eps, epst, Mm->ip[ipp].ssst, strain); |
give_full_vector (epstt,eps,Mm->ip[ipp].ssst); |
i1e = first_invar(epstt); |
//deviator (epst,dev); |
//j2e = second_invar (dev); |
j2e = j2_strain_invar (epstt); |
reallocv(RSTCKVEC(6, epsf)); |
reallocv(RSTCKVEC(6, dev)); |
give_full_vector (epsf, eps, Mm->ip[ipp].ssst); |
i1e = first_invar(epsf); |
deviator (epsf, dev); |
j2e = j2_strain_invar (epsf); |
e = Mm->give_actual_ym(ipp); |
nu = Mm->give_actual_nu(ipp); |
a = (k-1.0)/(2.0*k)/(1.0-2.0*nu); |
b = 3.0/k/(1+nu)/(1.0+nu); |
temp = a*a*i1e*i1e + b*j2e; |
kappa[0] = a*i1e+sqrt(temp); |
// original von Mises norm |
// kappa[0] = (k-1.0)/(2.0*k)/(1.0-2.0*nu)*i1e; |
// tmp = (k-1.0)*(k-1.0)/(1.0-2.0*nu)/(1.0-2.0*nu)*i1e*i1e -12.0*k/(1.0+nu)/(1.0+nu)*j2e; |
// kappa[0] += 1.0/(2.0*k)*sqrt(tmp); |
break;*/ |
temp = sqrt(temp); |
// compute I - 1/3(\delta*\delta) = \delta_{ik}\delta_{jl} - 1/3\delta_{ij}\delta_{kl} |
reallocm(RSTCKMAT(6, 6, d)); |
d(0,0) = d(1,1) = d(2,2) = 2.0/3.0; |
d(3,3) = d(4,4) = d(5,5) = 1.0; |
d(0,1) = d(0,2) = d(1,0) = d(1,2) = d(2,0) = d(2,1) = -1.0/3.0; |
// compute b.s_e:(I-1/3(\delta*\delta)) |
reallocv(RSTCKVEC(6, tmp)); |
mxv(d, dev, tmp); |
cmulv(b, tmp); |
// add 2a^2\delta |
tmp(0) += 2.0*a*a; |
tmp(1) += 2.0*a*a; |
tmp(2) += 2.0*a*a; |
// scale by 1/(2.sqrt(a^2I^2_{1\eps} + bJ_{2\eps})) |
cmulv(1.0/(2.0*temp), tmp); |
// add a\delta |
tmp(0) += a; |
tmp(1) += a; |
tmp(2) += a; |
// convert from the full vector length to the reduced vector format |
give_red_vector(tmp, dkappa, Mm->ip[ipp].ssst); |
break; |
default: |
print_err("unknown damage parameter function type", __FILE__, __LINE__, __func__); |
} |
616,8 → 687,14 |
case initial_stiff: |
elmatstiff (d,ipp); |
break; |
case secant_stiff: |
elmatstiff (d,ipp); |
dp=Mm->ip[ipp].eqother[ido+1]; |
if (dp > 0.999) |
dp = 0.999; |
cmulm (1.0-dp,d); |
break; |
case tangent_stiff: |
case secant_stiff: |
case incr_tangent_stiff: |
case ijth_tangent_stiff: |
elmatstiff (d,ipp); |
/trunk/SIFEL/MEFEL/SRC/scaldam.h |
---|
44,8 → 44,6 |
double ft; |
/// determines the softening -> corresponds to crack opening (not strain) when tension stress vanishes |
double uf; |
/// parameter for energy norm |
double c; |
/// parameter for von Mises norm - ratio of compression and tensile strength |
double k; |
/// type of function for evaluation damage funtion parameter |
/trunk/SIFEL/MEFEL/SRC/sequent.cpp |
---|
14,6 → 14,7 |
#include <stdlib.h> |
#include <limits.h> |
#include <float.h> |
#include <vector> |
#ifndef M_PI |
#define M_PI 3.14159265358979323846 |
53,12 → 54,13 |
long max_nadjip = 0; |
long nipp = 0; |
adjelel = NULL; |
adjelelback = NULL; |
treatedel = NULL; |
change = NULL; |
// total number of integration points |
totnip=Mm->tnip; |
totnip=Mt->tnip=Mm->tnip; |
Mt->nadjip = new long [totnip]; |
Mt->adjip = new long* [totnip]; |
Mt->dist = new double* [totnip]; |
87,6 → 89,17 |
fprintf(stdout, "\n Adjacent integration points\n"); |
// max_nadjip = give_max_adjacip(); |
// fprintf(stdout, " guess of maximum number of integration point is %ld\n", max_nadjip); |
/* |
struct cmpfunc{ |
static int compare (const void * a, const void * b) { |
return ( *(int*)a - *(int*)b ); |
} |
}; |
FILE *ftrel = fopen("treatedel.log", "wt"); |
fprintf(ftrel, "\n\nList of treated elements of adjac. int. points:\n"); |
*/ |
for (i=0;i<Gtm->ne;i++){ |
nb = Mt->give_nb (i); |
if(i%100 == 0) |
168,6 → 181,16 |
else{} |
} |
while (nnae!=0); |
/* |
qsort(treatedel, nte, sizeof(*treatedel), cmpfunc::compare); |
fprintf(ftrel, "ipp=%ld, nte=%ld:", ipp, nte); |
for(long kk=0; kk<nte; kk++){ |
fprintf(ftrel, " %ld", treatedel[kk]); |
} |
fprintf(ftrel, "\n"); |
*/ |
// computes the number of integration points in a circle (ball) with the radies rlim |
// these integration points will be used in nonlocal models |
// the number of integration points are stored in the array Mt->nadjip[ipp] |
221,18 → 244,18 |
} |
} |
while (nnae!=0); |
ipp++; |
} |
} |
} |
} |
delete [] adjelelback; |
delete [] adjelel; |
delete [] treatedel; |
delete [] change; |
delete [] ipc; |
//fclose(ftrel); |
// compression of arrays with adjacent integration points and distances |
/* for (ipp=0; ipp<totnip; ipp++) |
247,9 → 270,17 |
delete [] tmp_adjip; |
} |
*/ |
/* |
for (ipp=0; ipp<Mm->tnip; ipp++){ |
long nadjip = Mt->nadjip[ipp]; |
qsort(Mt->adjip[ipp], nadjip, sizeof(*Mt->adjip[ipp]), cmpfunc::compare); |
}*/ |
et = time (NULL); |
fprintf (Out,"\n\n time of adajcip %ld", long(et-bt)); |
fprintf (stdout,"\n\n time of adajcip %ld", long(et-bt)); |
fflush(Out); |
} |
650,7 → 681,7 |
Created by JK, |
*/ |
void newadjelel (long *adjelelback,long *adjelel,long &nae,long &nnae,long *treatedel,long &nte) |
void newadjelel (long *adjelelback,long *adjelel, long &nae, long &nnae, long *treatedel, long &nte) |
{ |
long i,j,k,l,prev,min; |
811,3 → 842,329 |
if (ii==0) adjelel[i]=-1-adjelel[i]; |
} |
} |
/** |
The function creates list of adjacent integration points and their distances. |
Results are stored in arrays of object Mt (class mechtop): |
- Mt->nadjip[i] - number of adjacent integration points to the i-th integration point |
- Mt->adjip[i] - array of numbers of adjacent integration points to the i-th integration point |
- Mt->dist[i] - array of distances of adjacent integration points |
to the i-th integration point |
@return The function does not return anything, but allocates and changes arrays of Mt object. |
Created by TKo, 12.2023 |
*/ |
void adjacip2 (void) |
{ |
time_t bt,et; |
bt = time (NULL); |
long i, j, ii, jj, nb, ipp, nip, totnip, nae, nnae, nlmid, nadjip; |
ivector adjelel; // list of adjacent elements used in the actual lookup pass for adjacent int. points |
ivector adjelelback; // backup of the adjacent element list from the passed lookup |
// list of adjacent int. points, std::vector allows for automatic growing while pushing back new elements |
std::vector<long> ipl; |
// list of distances of adjacent int. points, std::vector allows for automatic growing while pushing back new elements |
std::vector<double> ipd; |
// list of already treated elements in one adjacent int. point lookup, |
// std::set allows for automatic duplicate element removal |
std::set<long> treatedel; |
double rlim; // limit radius of the adjacent int. point search |
vector coord; // coordinates of the actual int. point whose neighbours are looked for |
vector ipc(3*Mm->tnip); // array of int. point coordinates, ipc+3*i = pointer to the array of 3 coordinates of the i-th int. point |
// maximum reached sizes of often reallocated arrays |
long max_nadjip = 0; |
// total number of integration points involved in the neighbour search, i.e. number of int. points with a nonlocal material model |
long nipp = 0; |
// total number of integration points |
totnip = Mt->tnip = Mm->tnip; |
Mt->nadjip = new long [totnip]; |
Mt->adjip = new long* [totnip]; |
Mt->dist = new double* [totnip]; |
memset(Mt->nadjip, 0, sizeof(*Mt->nadjip)*totnip); |
memset(Mt->adjip, 0, sizeof(*Mt->adjip)*totnip); |
memset(Mt->dist, 0, sizeof(*Mt->dist)*totnip); |
// calculate coordinates of integration points |
for(i=0; i<Gtm->ne; i++){ |
nb = Mt->give_nb (i); |
for (ii=0;ii<nb;ii++){ |
for (jj=0;jj<nb;jj++){ |
ipp=Mt->elements[i].ipp[ii][jj]; |
nip = Mt->give_nip (i,ii,jj); |
for (j=0;j<nip;j++){ |
makerefv(coord, &ipc[3*ipp], 3); |
ipcoord(i, ipp, ii, jj, coord); |
ipp++; |
} |
} |
} |
} |
fprintf(stdout, "\n Adjacent integration points\n"); |
// struct cmpfunc{ |
// static int compare (const void * a, const void * b) { |
// return ( *(int*)a - *(int*)b ); |
// } |
// }; |
// FILE *ftrel = fopen("treatedel.log", "wt"); |
// fprintf(ftrel, "\n\nList of treated elements of adjac. int. points:\n"); |
for (i=0;i<Gtm->ne;i++){ |
if(i%100 == 0) |
fprintf(stdout, "\n Adjacent integration points on element %ld, max_nadjip=%ld", i+1,max_nadjip); |
ipp=Mt->elements[i].ipp[0][0]; |
if (!(Mm->ip[ipp].hmt & 2)){ |
// integration point number ipp does not contain nonlocal material model |
Mt->nadjip[ipp]=0; |
continue; |
} |
nip = Mt->give_tnip(i); |
for (j=0;j<nip;j++){ |
nipp++; |
// index of the nonlocal material model |
nlmid = Mm->givenonlocid(ipp); |
// radius of nonlocal volume |
rlim = Mm->nonlocradius (ipp,nlmid); |
// reference to coordinates of the actual integration point |
makerefv(coord, &ipc[3*ipp], 3); |
// number of adjacent integration points determination |
Mt->nadjip[ipp]=0; |
// number of adjacent elements to required element |
nae=Gtm->nadjelel[i]; |
// create initial list of adjacent elements to required element including the given element |
reallocv(nae, adjelel); |
copyv(Gtm->adjelel[i], adjelel.a, nae); |
// initialize list of treated elements |
treatedel.clear(); // erase all elements |
treatedel.insert(adjelel.a, adjelel.a + adjelel.n); // copy actual list of adjacent elements |
// empty list of adjacent int. points |
ipl.clear(); |
// empty list of distances of adjacent int. point |
ipd.clear(); |
// computes the number of integration points in a circle (ball) with the radius rlim |
// these integration points will be used in nonlocal models |
// the number of adjacent integration points are stored in the array Mt->nadjip[ipp] |
do{ |
in_dist2(ipp, coord, ipc, rlim, adjelel, ipl, ipd); |
ipl.capacity(); |
ipd.capacity(); |
reallocv(nae, adjelelback); |
newnadjelel2(adjelel, adjelelback, nnae); |
if (nnae>0){ |
newadjelel2(adjelelback, treatedel, adjelel, nnae); |
nae=nnae; |
} |
} |
while (nnae!=0); |
// storage of found adjacent integration points and their distances in mechtop arrays |
nadjip = Mt->nadjip[ipp]; |
if (max_nadjip < nadjip) |
max_nadjip = nadjip; |
if (Mt->adjip[ipp] == NULL) |
Mt->adjip[ipp] = new long[nadjip]; |
else{ |
print_err("multiple allocation of adjip[%ld], eid=%ld", __FILE__, __LINE__, __func__, ipp, i+1); |
abort(); |
} |
Mt->dist[ipp] = new double[nadjip]; |
copyv(ipl.data(), Mt->adjip[ipp], nadjip); // ipl.data() returns the pointer to the array of std::vector elements |
copyv(ipd.data(), Mt->dist[ipp], nadjip); |
// fprintf(ftrel, "ipp=%ld, nte=%ld:", ipp, treatedel.size()); |
// for (std::set<long>::iterator it = treatedel.begin(); it != treatedel.end(); it++){ |
// fprintf(ftrel, " %ld", *it); |
// } |
// fprintf(ftrel, "\n"); |
ipp++; |
} |
} |
/* |
for (ipp=0; ipp<Mm->tnip; ipp++){ |
long nadjip = Mt->nadjip[ipp]; |
qsort(Mt->adjip[ipp], nadjip, sizeof(*Mt->adjip[ipp]), cmpfunc::compare); |
}*/ |
et = time (NULL); |
fprintf (Out,"\n\n time of adajcip %ld", long(et-bt)); |
fprintf (stdout,"\n\n time of adajcip %ld", long(et-bt)); |
fflush(Out); |
// fclose(ftrel); |
} |
/** |
The function calculates a number of non-eliminated adjacent elements. |
It is used in function adjacip. |
@param[in] adjelel - array of identfiers of adjacent elements |
@param[out] adjelelback - auxiliary array of identfiers of adjacent elements, it will contain backup of adjelel array |
@param[out] nnae - new number of adjacent elements |
@return The function does not return anything. |
Created by TKo 12.2023, according to the original JK algorithm |
*/ |
void newnadjelel2(const ivector &adjelel, ivector &adjelelback, long &nnae) |
{ |
long i, nee, nae = adjelel.n; |
// number of eliminated elements, i.e. no adjacent int. points were found on these elements |
nee=0; |
for(i=0; i<nae; i++){ |
if (adjelel[i] < 0) nee++; |
} |
nnae = 0; |
if (nae!=nee){ |
for (i=0; i<adjelel.n; i++){ |
adjelelback[i] = adjelel[i]; |
if (adjelel[i] > -1){ |
nnae += Gtm->nadjelel[adjelel[i]]; |
} |
} |
} |
} |
/** |
Function creates list of adjacent elements to required element. |
Function is used in function adjacip. |
@param[in] adjelelback - auxiliary array of adjacent elements from the previous lookup pass |
@param[in,out] treatedel - array of already treated elements, it may be actualized by new set of adjacent elements |
@param[out] adjelel - array of new adjacent elements for the neighbour lookup |
@param[out] nnae - new number of adjacent elements |
@return The function does not return anything. |
Created by TKo 10.2023, according to original JK algorithm |
*/ |
void newadjelel2(const ivector &adjelelback, std::set<long> &treatedel, ivector &adjelel, long &nnae) |
{ |
long i, j, eid, nadjel, aeid; |
std::set<long> new_adjelel; |
// create list of new adjacent elements to already passed (adjacent) elements |
for (i=0; i<adjelelback.n; i++){ |
eid = adjelelback[i]; |
if (eid > -1){ |
nadjel = Gtm->nadjelel[eid]; |
// insert all adjacent elements of eid-th element, duplicates are removed automatically in std::set |
for (j=0; j<nadjel; j++){ |
aeid = Gtm->adjelel[eid][j]; |
if (treatedel.count(aeid) == 0){ // std::set.count returns a number of its elements matching aeid, i.e. 0 or 1 |
new_adjelel.insert(aeid); // insert just non-treated elements |
treatedel.insert(aeid); // add new element for the treatment |
} |
} |
} |
} |
nnae = new_adjelel.size(); |
reallocv(nnae, adjelel); |
// copy new adjacent elements to array adjelel |
decltype(new_adjelel)::iterator it = new_adjelel.begin(); // get iterator (pointer) to the first element of new_adjelel |
for(i=0; i<nnae; it++, i++) |
adjelel[i] = *it; |
} |
/** |
Function computes number of integration points which are closer |
to required integration point (ipp) than rlim. |
Function is used in adjacip2. |
@param[in] ipp - integration point pointer |
@param[in] coord - coordinates of one of integration points |
@param[in] ipc - array of coordinates of all integration points, |
ipc+3*i = pointer to array of 3 coordinates of i-th integration point |
@param[in] rlim - limit distance |
@param[in,out] adjelel - array of adjacent elements |
@param[in,out] - list of adjacent integration points. |
@param[in,out] - list of distances of adjacent integration points. |
@return The function does not return anything. |
Created by JK, |
Modified by TKo, 04.2018 |
*/ |
void in_dist2 (long ipp, const vector &coord, const vector &ipc, double rlim, ivector &adjelel, std::vector<long> &ipl, std::vector<double> &ipd) |
{ |
long i, j, lj, uj, eid, nip, count; |
double r; |
vector auxcoord; |
for (i=0;i<adjelel.n;i++){ |
eid = adjelel[i]; |
count = 0; |
nip = Mt->give_tnip(eid); |
lj = Mt->elements[eid].ipp[0][0]; |
uj = lj+nip; |
for (j=lj; j<uj; j++){ |
if (Mm->ip[j].hmt & 2){// integration point number j has a nonlocal material model |
// make reference to coordinates of the j-th int. point |
makerefv(auxcoord, &ipc[j*3], 3); |
r = length(coord, auxcoord); // calculate distance of the j-th int. point |
if (r<rlim){ // j-th int. point is closer than the limit distance |
Mt->nadjip[ipp]++; // increase the number of adjacent int. points |
ipl.push_back(j); // store the adjacent int. point number |
ipd.push_back(r); // store the adjacent int. point distance |
count++; // increase number of found adjacent int. point |
} |
} |
} |
if (count==0) // if no adjacent int. points were found on the actual element, mark it by negative value |
adjelel[i]=-1-adjelel[i]; |
} |
} |
void print_adjacip(FILE *out) |
{ |
fprintf(out, "\nADJACENT IP ACCORDING TO NONLOCAL MODELS\n\n"); |
long eid = -1; |
for(long i=0; i<Mm->tnip; i++){ |
long nadjip = Mt->nadjip[i]; |
if (Mm->elip[i] != eid){ |
eid = Mm->elip[i]; |
fprintf(out, "Element %ld, ipp[0][0]=%ld: ----------------------------------\n", eid+1, Mt->elements[eid].ipp[0][0]); |
} |
fprintf(out, "IPP %7ld, nadjip %4ld:", i, nadjip); |
for(long j=0; j<nadjip; j++){ |
fprintf(out, " %ld", Mt->adjip[i][j]); |
} |
fprintf(out, "\n"); |
} |
} |
/trunk/SIFEL/MEFEL/SRC/sequent.h |
---|
1,11 → 1,16 |
#ifndef SEQUENT_H |
#define SEQUENT_H |
#include "alias.h" |
#include <stdio.h> |
#include "alias.h" |
#include <vector> |
#include <set> |
struct vector; |
struct ivector; |
/// creates list of adjacent integration points |
void adjacip (void); |
35,4 → 40,15 |
/// computes distances of adjacent integration points closer than given limit |
void dist (long ipp,long max_nadjip,vector &coord,double *ipc,long *adjelel,long nae,double rlim); |
/// creates list of adjacent integration points |
void adjacip2 (void); |
/// computes number of non-eliminated adjacent elements |
void newnadjelel2 (const ivector &adjelel, ivector &adjelelback, long &nnae); |
/// creates list of adjacent elements |
void newadjelel2 (const ivector &adjelelback, std::set<long> &treatedel, ivector &adjelel, long &nnae); |
/// computes number of adjacent integration points closer than given limit |
void in_dist2 (long ipp, const vector &coord, const vector &ipc, double rlim, ivector &adjelel, std::vector<long> &ipl, std::vector<double> &ipd); |
/// prints adjacent int. points to file |
void print_adjacip(FILE *out); |
#endif |
/trunk/SIFEL/METR/SRC/globmatc.cpp |
---|
1930,7 → 1930,7 |
// at this point arrays of regular int. points are swapped with the auxiliary one |
// and therefore all functions of mechmat work with aux. int. points |
memset(anmq, 0, sizeof(*anmq)*tnknmq); |
for (j=0; j<Mm->ip[i].nm; j++) |
for (j=0; j<Mm->ip[app].nm; j++) |
Mm->give_reqnmq(app, j, anmq); |
for (j=0; j<nnmq; j++) |
2105,7 → 2105,6 |
for (i=0; i< tnipm; i++) |
{ |
MTipmap[i].cerr = sqrt(MTipmap[i].cerr); |
if (MTipmap[i].cerr > err) |
{ |
print_err("natural coordinates are out of tolerance on MEFEL element %ld, ip=%ld\n" |
2120,7 → 2119,6 |
for (i=0; i< tnipt; i++) |
{ |
TMipmap[i].cerr = sqrt(TMipmap[i].cerr); |
if (TMipmap[i].cerr > err) |
{ |
print_err("natural coordinates are out of tolerance on TRFEL element %ld, ip=%ld\n" |
2330,6 → 2328,7 |
reallocv(RSTCKVEC(nne, x)); |
reallocv(RSTCKVEC(nne, y)); |
reallocv(RSTCKVEC(nne, z)); |
MTipmap[j].ipp = Tt->give_closest_ip_ncoord(i, MTipmap[j].x, MTipmap[j].y, MTipmap[j].z, TMipmap, err, xi, eta, zeta); |
if (MTipmap[j].ipp >= 0) // the closest integration point on element matches th global coordinates of TMipmap[j] exactly |
{ // => no further investigation is needed |
/trunk/SIFEL/METR/SRC/probdescc.cpp |
---|
46,7 → 46,7 |
// the maximum number of itartions in the computation of auxiliary int. point coordinates |
aip_ni = 100; |
// the maximum distance of two points at which they may be assumed to be identical in the computation of auxiliary int. point coordinates |
aip_err = 5.0e-6; |
aip_err = 1.0e-6; |
incr_step=0; |
inner_step=0; |
/trunk/SIFEL/PREP/LSHAPEGEN/cprof_geom.cpp |
---|
1,11 → 1,10 |
#include "cprof_geom.h" |
#include "iotools.h" |
#include <stdio.h> |
#include <stdlib.h> |
#include <math.h> |
#include "cprof_geom.h" |
cprof_geom::cprof_geom() |
{ |
wp = hp = 0.0; |
22,23 → 21,23 |
int cprof_geom::read(FILE *in) |
int cprof_geom::read(XFILE *in) |
{ |
int nri = 0; |
nri += fscanf(in, " prof-width %le", &wp); |
nri += fscanf(in, " prof-height %le", &hp); |
nri += xfscanf(in, " prof-width %le", &wp); |
nri += xfscanf(in, " prof-height %le", &hp); |
nri += fscanf(in, " thick-flange %le", &tf); |
nri += fscanf(in, " thick-web %le", &tw); |
nri += xfscanf(in, " thick-flange %le", &tf); |
nri += xfscanf(in, " thick-web %le", &tw); |
nri += fscanf(in, " mesh-dens-flange %d", &mshdf); |
nri += fscanf(in, " mesh-dens-web %d", &mshdw); |
nri += xfscanf(in, " mesh-dens-flange %d", &mshdf); |
nri += xfscanf(in, " mesh-dens-web %d", &mshdw); |
nri += fscanf(in, " mesh-dens-thick-flange %d", &mshdtf); |
nri += fscanf(in, " mesh-dens-thick-web %d", &mshdtw); |
nri += xfscanf(in, " mesh-dens-thick-flange %d", &mshdtf); |
nri += xfscanf(in, " mesh-dens-thick-web %d", &mshdtw); |
nri += fscanf(in, " mat-id %d", &matid); |
nri += xfscanf(in, " mat-id %d", &matid); |
if (nri == 9) |
return 0; |
/trunk/SIFEL/PREP/LSHAPEGEN/cprof_geom.h |
---|
7,12 → 7,14 |
#define M_PI 3.14159265358979323846 |
#endif |
struct XFILE; |
class cprof_geom |
{ |
public: |
cprof_geom(); |
~cprof_geom(); |
int read(FILE *in); |
int read(XFILE *in); |
int get_nn(); |
int get_ne(); |
void gen_nodes(FILE *out, double tx, double ty, double alpha, int inid); |
/trunk/SIFEL/PREP/LSHAPEGEN/lshape_geom.cpp |
---|
1,9 → 1,7 |
#include <stdlib.h> |
#include <stdio.h> |
#include <string.h> |
#include <math.h> |
// generator header files |
#include "lshape_geom.h" |
#include "cprof_geom.h" |
// GEFEL header files |
#include "gtopology.h" |
#include "siftop.h" |
12,13 → 10,17 |
#include "difcalc.h" |
#include "mathem.h" |
// generator header files |
#include "lshape_geom.h" |
#include "cprof_geom.h" |
#include <stdlib.h> |
#include <stdio.h> |
#include <string.h> |
#include <math.h> |
lshape_geom::lshape_geom() |
{ |
lh = lv = 0.0; |
72,7 → 74,7 |
Created by Tomas Koudelka, 11.7.2018 |
*/ |
int lshape_geom::read(FILE *in) |
int lshape_geom::read(XFILE *in) |
{ |
int nri=0; |
int i; |
79,15 → 81,15 |
fprintf(stdout, "Reading of basic geometry parameters ..."); |
nri += fscanf(in, " lh %le", &lh); |
nri += fscanf(in, " lv %le", &lv); |
nri += xfscanf(in, " lh %le", &lh); |
nri += xfscanf(in, " lv %le", &lv); |
nri += fscanf(in, " mesh-dens-h %d", &mshdh); |
nri += fscanf(in, " mesh-dens-v %d", &mshdv); |
nri += xfscanf(in, " mesh-dens-h %d", &mshdh); |
nri += xfscanf(in, " mesh-dens-v %d", &mshdv); |
nri += fscanf(in, " numlh %d", &numlh); |
nri += fscanf(in, " numlv %d", &numlv); |
nri += xfscanf(in, " numlh %d", &numlh); |
nri += xfscanf(in, " numlv %d", &numlv); |
if (nri == 6) |
fprintf(stdout, " OK.\n"); |
122,11 → 124,11 |
th = 0.0; |
for (i=0; i<numlh; i++) |
{ |
nri += fscanf(in, " thick %le", tlh+i); |
nri += xfscanf(in, " thick %le", tlh+i); |
th += tlh[i]; |
nri += fscanf(in, " mesh-dens %d", mshdhl+i); |
nri += fscanf(in, " type-mat %d", (int *)(tmath+i)); |
nri += fscanf(in, " mat-id %d", matidh+i); |
nri += xfscanf(in, " mesh-dens %d", mshdhl+i); |
nri += xfscanf(in, " type-mat %d", (int *)(tmath+i)); |
nri += xfscanf(in, " mat-id %d", matidh+i); |
} |
if (nri == 4*numlh) |
fprintf(stdout, " OK.\n"); |
141,11 → 143,11 |
tv = 0.0; |
for (i=0; i<numlv; i++) |
{ |
nri += fscanf(in, " thick %le", tlv+i); |
nri += xfscanf(in, " thick %le", tlv+i); |
tv += tlv[i]; |
nri += fscanf(in, " mesh-dens %d", mshdvl+i); |
nri += fscanf(in, " type-mat %d", (int *)(tmatv+i)); |
nri += fscanf(in, " mat-id %d", matidv+i); |
nri += xfscanf(in, " mesh-dens %d", mshdvl+i); |
nri += xfscanf(in, " type-mat %d", (int *)(tmatv+i)); |
nri += xfscanf(in, " mat-id %d", matidv+i); |
} |
if (nri == 4*numlv) |
fprintf(stdout, " OK.\n"); |
156,7 → 158,7 |
} |
fprintf(stdout, "Reading of profiles ..."); |
nri = fscanf(in, " num-prof %d", &numprof); |
nri = xfscanf(in, " num-prof %d", &numprof); |
if (nri == 1) |
fprintf(stdout, " OK.\n"); |
else |
175,9 → 177,9 |
for(i=0; i<numprof; i++) |
{ |
nri = 0; |
nri += fscanf(in, " px %le", px+i); |
nri += fscanf(in, " py %le", py+i); |
nri += fscanf(in, " alpha %le", alpha+i); |
nri += xfscanf(in, " px %le", px+i); |
nri += xfscanf(in, " py %le", py+i); |
nri += xfscanf(in, " alpha %le", alpha+i); |
alpha[i] *= M_PI/180.0; // conversion to radians |
nri += cprof[i].read(in); |
if (nri != 3) |
/trunk/SIFEL/PREP/LSHAPEGEN/lshape_geom.h |
---|
8,6 → 8,7 |
class cprof_geom; |
class gtopology; |
class nodmap; |
struct XFILE; |
class lshape_geom |
{ |
14,7 → 15,7 |
public: |
lshape_geom(); |
~lshape_geom(); |
int read(FILE *in); |
int read(XFILE *in); |
int gen_nodes(FILE *out); |
int gen_elements(FILE *out); |
int cprof_hang_nodes_natcoords(gtopology *gt, long wne, long nnmap, nodmap *cpnmap, long ni, double err); |
/trunk/SIFEL/PREP/LSHAPEGEN/lshapegen.cpp |
---|
13,7 → 13,7 |
int main(int argc, char *argv[]) |
{ |
FILE *in = NULL; |
XFILE *in = NULL; |
FILE *out = NULL; |
XFILE *intf = NULL; |
const char *infn; |
42,7 → 42,7 |
fprintf(stdout, "\nError: Invalid number of generator arguments (argc=%d)\n", argc); |
return 1; |
} |
in = fopen(infn, "rt"); |
in = xfopen(infn, "rt"); |
out = fopen(outfn, "wt"); |
if (in == NULL) |
{ |
60,7 → 60,7 |
if (cg.read(in)) |
{ |
fclose(in); |
xfclose(in); |
fclose(out); |
return 4; |
} |
87,7 → 87,7 |
fprintf(stdout, " - number of nodes in the topology: %d\n", cg.tnn); |
fprintf(stdout, " - number of elements in the topology: %d\n\n", cg.tne); |
fclose(in); |
xfclose(in); |
fclose(out); |
intf = xfopen(outfn, "rt"); |
96,7 → 96,7 |
fprintf(stdout, "Reading of output FE topology ..."); |
if (top.read(intf, 0, 1)) |
{ |
fclose(in); |
xfclose(in); |
fprintf(stdout, " FAILURE.\n"); |
return 7; |
} |
/trunk/SIFEL/PREP/MESHTOOLS/Makefile |
---|
31,7 → 31,7 |
#################################################################### |
# List of source files |
# |
SRCS = ansys2sif.cpp connectmeshes.cpp convertor.cpp flsubmesh.cpp gen2d3d.cpp genbridge.cpp meshcomp.cpp mshed-nodren.cpp negjac-nodren.cpp ohybak.cpp t3dtosiffor.cpp |
SRCS = ansys2sif.cpp connectmeshes.cpp convertor.cpp flsubmesh.cpp gen2d3d.cpp gen3dext.cpp genbridge.cpp meshcomp.cpp mshed-nodren.cpp negjac-nodren.cpp ohybak.cpp t3dtosiffor.cpp |
/trunk/SIFEL/PREP/MESHTOOLS/connectmeshes.cpp |
---|
68,6 → 68,7 |
Log = fopen(logname, "w"); |
delete [] logname; |
in->warning = 1; |
in->kwdmode = sect_mode_seq; |
//in->kwdmode = sequent_mode; |
in->ignorecase = 1; |
87,6 → 88,8 |
// reading of line with edge number indicator |
// reading of line with output file name |
xfscanf(in,"%k%s","output_file_name",&outputfname); |
// reading of tolerance for coordinate difference under which the nodes are considered to be identical |
xfscanf(in, "%k%le", "tolerance", &coordtol); |
// this is the sequential version |
d.paral=0; |
516,9 → 519,9 |
delete []surfnodes; |
} |
// for(j = 0; j < auxninterfnodes; j++){ |
// fprintf(Log,"int nodes %ld\n",auxinterfnodes[j]); |
// } |
for(j = 0; j < auxninterfnodes; j++){ |
fprintf(Log,"int nodes %ld\n",auxinterfnodes[j]); |
} |
duplnodes = new long [auxninterfnodes]; |
for(j = 0; j < auxninterfnodes; j++){ |
duplnodes[j] = 0; |
534,12 → 537,13 |
} |
} |
tee = clock(); |
//printf("hledani duplicitnich uzlu %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
printf("hledani duplicitnich uzlu %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
//kontrolni tisk |
// for(j = 0; j < auxninterfnodes; j++){ |
// fprintf(Log,"%ld duplnodes %ld\n",j,duplnodes[j]); |
// } |
for(j = 0; j < auxninterfnodes; j++){ |
fprintf(Log,"%ld duplnodes %ld\n",j,duplnodes[j]); |
} |
tss = clock(); |
ninterfnodes[i] = 0; |
for(j = 0; j < auxninterfnodes; j++){ |
559,15 → 563,15 |
delete []auxinterfnodes; |
} |
tee = clock(); |
//printf("pocet hranicnich %ld\n",m); |
//printf("seznam hranicnich %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
//printf("seznam hranicnich %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
// for(i = 0 ; i < nfiles; i++){ |
// fprintf(Log,"# interface nodes %ld\n",ninterfnodes[i]); |
// for(j = 0 ; j < ninterfnodes[i]; j++){ |
// fprintf(Log,"%ld\n",interfnodes[i][j]); |
// } |
// } |
printf("pocet hranicnich %ld\n",m); |
printf("seznam hranicnich %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
// printf("seznam hranicnich %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
for(i = 0 ; i < nfiles; i++){ |
fprintf(Log,"# interface nodes %ld\n",ninterfnodes[i]); |
for(j = 0 ; j < ninterfnodes[i]; j++){ |
fprintf(Log,"%ld\n",interfnodes[i][j]); |
} |
} |
tss = clock(); |
m = -1; |
578,9 → 582,9 |
u = p+Gtop[i].nn; |
for(j = i+1; j < nfiles; j++){ |
for(l = 0; l < ninterfnodes[j]; l++){ |
if(Gtop[i].gnodes[interfnodes[i][k]].x == Gtop[j].gnodes[interfnodes[j][l]].x){ |
if(Gtop[i].gnodes[interfnodes[i][k]].y == Gtop[j].gnodes[interfnodes[j][l]].y){ |
if(Gtop[i].gnodes[interfnodes[i][k]].z == Gtop[j].gnodes[interfnodes[j][l]].z){ |
if(fabs(Gtop[i].gnodes[interfnodes[i][k]].x - Gtop[j].gnodes[interfnodes[j][l]].x) <= coordtol){ |
if(fabs(Gtop[i].gnodes[interfnodes[i][k]].y - Gtop[j].gnodes[interfnodes[j][l]].y) <= coordtol){ |
if(fabs(Gtop[i].gnodes[interfnodes[i][k]].z - Gtop[j].gnodes[interfnodes[j][l]].z) <= coordtol){ |
n=p+interfnodes[i][k]; |
v=u+interfnodes[j][l]; |
if(ltg[n]== 0){ |
590,7 → 594,7 |
if(ltg[v]== 0){ |
ltg[v]= n; |
} |
//printf("shoda %ld %ld %ld %ld\n",interfnodes[i][k],interfnodes[j][l],n,v); |
printf("shoda %ld %ld %ld %ld\n",interfnodes[i][k],interfnodes[j][l],n,v); |
break; |
} |
} |
604,14 → 608,14 |
} |
//printf("m %ld\n",m); |
// kontrolni tisk |
// n = 0; |
// for(i = 0; i < nfiles; i++){ |
// fprintf(Log,"domena %ld\n",i); |
// for(j = 0; j < SifTop[i].nn; j++){ |
// fprintf(Log,"ltg[%ld] = %ld\n",n,ltg[n]); |
// n++; |
// } |
// } |
n = 0; |
for(i = 0; i < nfiles; i++){ |
fprintf(Log,"domena %ld\n",i); |
for(j = 0; j < SifTop[i].nn; j++){ |
fprintf(Log,"ltg[%ld] = %ld\n",n,ltg[n]); |
n++; |
} |
} |
tee = clock(); |
//printf("ltg %le s\n",(tee-tss)/(double)CLOCKS_PER_SEC); |
n = 0; |
761,8 → 765,7 |
Gtop[i].adjacelem (Log); |
} |
establish_ltg(); |
print(); |
print(); |
} |
/trunk/SIFEL/PREP/MESHTOOLS/connectmeshes.h |
---|
40,6 → 40,7 |
char outputfname[1025]; |
char topfile[1025]; |
long nfiles; |
double coordtol; |
connectmeshes(int argc,char *argv[]); |
~connectmeshes(); |
/trunk/SIFEL/PREP/MESHTOOLS/gen2d3d.cpp |
---|
113,7 → 113,7 |
dz = 0.0; |
switch(dir) |
{ |
case 'x': |
case 'x': |
d = &dx; |
break; |
case 'y': |
169,11 → 169,11 |
{ |
if (top.elements[k].type == isolinear2d) |
{ |
fprintf(out, "%ld %d ", k+1+eid, isolinear3d); |
fprintf(out, "%ld %d ", k+1+eid, int(isolinear3d)); |
for (l=0; l<top.elements[k].nne; l++) |
fprintf(out, "%ld ", top.elements[k].nodes[l]+(i+1)+nid2); |
fprintf(out, "%ld ", top.elements[k].nodes[l]+1+nid2); |
for (l=0; l<top.elements[k].nne; l++) |
fprintf(out, "%ld ", top.elements[k].nodes[l]+i+1+nid1); |
fprintf(out, "%ld ", top.elements[k].nodes[l]+1+nid1); |
fprintf(out, "%ld", top.elements[k].prop); |
if (edg) |
{ |
209,7 → 209,7 |
} |
if (top.elements[k].type == trianglelinear) |
{ |
fprintf(out, "%ld %d ", k+1+eid, isolinear3d); |
fprintf(out, "%ld %d ", k+1+eid, int(isolinear3d)); |
for (l=0; l<top.elements[k].nne; l++) |
fprintf(out, "%ld ", top.elements[k].nodes[l]+1+nid2); |
fprintf(out, "%ld ", top.elements[k].nodes[top.elements[k].nne-1]+1+nid2); |
/trunk/SIFEL/PREP/MESHTOOLS/gen3dext.cpp |
---|
0,0 → 1,711 |
#include "siftop.h" |
#include "kwdset.h" |
#include <stdio.h> |
#include <string.h> |
#include <vector> |
#include <stdlib.h> |
#include <math.h> |
enum dir_id {x_plus=0, y_plus, z_plus, x_minus, y_minus, z_minus}; |
const enumstr dir_idstr[] {{"x+",0}, {"y+",1}, {"z+",2}, {"x-",3}, {"y-",4}, {"z-",5}}; |
const kwdset dir_id_kwdset(sizeof(dir_idstr)/sizeof(*dir_idstr), dir_idstr); |
enum gen_elem_type{et_auto=0, et_brick, et_wedge, et_tetra}; |
const enumstr gen_elem_typestr[] {{"et_auto",0}, {"et_brick", 1}, {"et_wedge", 2}, {"et_tetra", 3}}; |
const kwdset gen_elem_type_kwdset(sizeof(gen_elem_typestr)/sizeof(*gen_elem_typestr), gen_elem_typestr); |
enum extgentype{egt_no=0, egt_glob_coord, egt_relative_sections}; |
const enumstr extgentypestr[] {{"egt_no", 0}, {"egt_glob_coord", 1}, {"egt_relative_sections", 2}}; |
const kwdset extgentype_kwdset(sizeof(extgentypestr)/sizeof(*extgentypestr), extgentypestr); |
void gen_brick(FILE *out, const siftop &top, const ivector &sfcnods, const ivector &sfcnodid, long sfcid, long &eid, |
gtypel et, long ifceid, long nid1, long nid2, long volp, answertype edg, long frontp, long layid, long nlay); |
void gen_wedge(FILE *out, const siftop &top, const ivector &sfcnods, const ivector &sfcnodid, long sfcid, long &eid, |
gtypel et, long ifceid, long nid1, long nid2, long volp, answertype edg, long frontp, long layid, long nlay); |
void gen_tetra(FILE *out, const siftop &top, const ivector &sfcnods, const ivector &sfcnodid, long sfcid, long &eid, |
gtypel et, long ifceid, long nid1, long nid2, long volp, answertype edg, long frontp, long layid, long nlay); |
/* |
Generator for extension of 3D mesh segment in the given direction |
Created by Tomas Koudelka, 5.10.2018 |
*/ |
int main (int argc,char *argv[]) |
{ |
long i, j, k, l; |
meshform fmt; |
long nsec; |
answertype edg, paral; |
double clev, ctol, cgcoord, auxcoord; |
dir_id dir; |
XFILE *in; |
FILE *out; |
long ret; |
char topname[1001]; |
siftop top; |
vector secl, dl, gcoord; |
ivector md; |
long ngcoord; |
long frontp; |
long nid, nid1, nid2, eid; |
long volp; |
long errc; |
extgentype extgt; |
gen_elem_type gen_et; |
fprintf(stdout, "\n\n\n--- GENERATION OF MESH EXTENSION OF 3D DOMAIN ---\n\n"); |
if (argc < 3){ |
fprintf (stderr,"\n Wrong number of command line parameters."); |
fprintf (stderr,"\n Use : %s input_file_name output_file_name\n\n", argv[0]); |
return(1); |
} |
in = xfopen(argv[1], "rt"); |
if (in==NULL){ |
fprintf (stderr,"\n Input file has not been specified."); |
fprintf (stderr,"\n Try it again!\n\n"); |
return(2); |
} |
out = fopen(argv[2], "wt"); |
if (out==NULL){ |
fprintf (stderr,"\n Output file has not been specified."); |
fprintf (stderr,"\n Try it again!\n\n"); |
return(2); |
} |
in->kwdmode = sequent_mode; |
xfscanf(in, "%k%m", "mesh_format", &meshform_kwdset, &fmt); |
xfscanf(in, "%k %1000a", "mesh_file_name", topname); |
xfscanf(in, "%k%m", "read_edge_property", &answertype_kwdset, &edg); |
xfscanf(in, "%k%m", "read_paral", &answertype_kwdset, ¶l); |
xfscanf(in, "%k %m", "gen_dir", &dir_id_kwdset, &dir); |
xfscanf(in, "%k%le", "coord_level", &clev); |
xfscanf(in, "%k%le", "coord_tolerance", &ctol); |
xfscanf(in, "%k%m", "gen_elem_type", &gen_elem_type_kwdset, &gen_et); |
xfscanf(in, "%k%ld", "front_prop", &frontp); |
xfscanf(in, "%k%ld", "vol_prop", &volp); |
xfscanf(in, "%k%m", "extension_gen_type", &extgentype_kwdset, &extgt); |
switch (extgt){ |
case egt_glob_coord: |
xfscanf(in, "%k%ld", "num_coord", &ngcoord); |
reallocv(ngcoord, gcoord); |
errc = readv(in, gcoord); |
if (errc){ |
if (errc == 2) |
print_err("cannot read global coordinate", __FILE__, __LINE__, __func__); |
return 3; |
} |
break; |
case egt_relative_sections: |
xfscanf(in, "%k%ld", "num_sec", &nsec); |
reallocv(nsec, dl); |
reallocv(nsec, md); |
reallocv(nsec, secl); |
ngcoord = 0; // total number of 3D sections generated in starting with the 3D domain segment |
for (i=0; i<nsec; i++){ |
xfscanf(in, "%k%le %k%ld", "secblock_lenght", secl.a+i, "mesh_dens", md.a+i); |
dl[i] = secl[i]/md[i]; |
if (dir > z_plus) dl[i] = -dl[i]; |
ngcoord += md[i]; |
} |
reallocv(ngcoord, gcoord); |
k = 0; |
cgcoord = 0.0; |
for (i=0; i<nsec; i++){ |
for(j=0; j<md[i]; j++){ |
cgcoord += dl[i]; |
gcoord[k] = cgcoord; |
k++; |
} |
} |
break; |
default: |
print_err("uknown type (%d) of extension generation", __FILE__, __LINE__, __func__, extgt); |
return 3; |
} |
xfclose(in); |
// open and read file with topology of 3D section |
fprintf(stdout, "Reading of topology file %s with 3D segment ...", topname); |
in = xfopen(topname, "rt"); |
if (in == NULL) |
return(3); |
switch (fmt){ |
case sifel: |
ret = top.read(in, paral, edg); |
break; |
case t3d: |
ret = top.import_t3d(in, paral); |
break; |
default: |
print_err("unknown mesh format %d is required", __FILE__, __LINE__, __func__, fmt); |
return 3; |
} |
xfclose(in); |
if (ret) |
return 3; |
// find interface nodes where the generation of nodes will start from |
std::vector<long> ifcnod; // array of found interface nodes |
long c_id = dir%3; // index of coordinate in the extension direction |
ivector sfcnodid(top.nn); |
long newid = top.nn; |
vector coord(ASTCKVEC(3)); |
for(i=0; i< top.nn; i++){ |
top.nodes[i].getcoord(coord); |
if (fabs(coord[c_id] - clev) <= ctol){ |
ifcnod.push_back(i); |
sfcnodid[i] = newid; |
++newid; |
} |
} |
long nifcn = ifcnod.size(); |
// find elements connected to the interface nodes where the generation of nodes will start from |
std::vector<std::pair<long,long>> ifcelem; // array of pairs containing found element id and corresponding surface id |
ivector surfid_lst; |
long nelemlay = 0, nnsurf; |
for(i=0; i<top.ne; i++){ |
reallocv(RSTCKIVEC(top.elements[i].nsurf, surfid_lst)); |
long ns = top.elements[i].compare_surf(ifcnod.data(), ifcnod.size(), surfid_lst); |
for (j=0; j<ns; j++){ |
ifcelem.push_back(std::make_pair(i, surfid_lst[j])); |
nnsurf = top.elements[i].nnsurf[surfid_lst[j]]; |
switch(nnsurf){ |
case 3: |
case 6: |
if (gen_et == et_tetra) |
nelemlay += 3; |
else |
nelemlay += 1; |
break; |
case 4: |
case 8: |
nelemlay += 1; |
break; |
default: |
print_err("interface entities has wrong number of nodes, nnsurf must be either 3, 4, 6 or 8", __FILE__, __LINE__,__func__); |
abort(); |
} |
} |
} |
long nifce = ifcelem.size(); |
fprintf(stdout, "OK\n"); |
fprintf(stdout, "\nNumber of nodes in 3D starter segement : %ld\n", top.nn); |
fprintf(stdout, "Number of elements in 3D starter segment: %ld\n", top.ne); |
fprintf(stdout, "Number of interface nodes found on 3D starter segment: %ld\n", nifcn); |
fprintf(stdout, "Number of interface element enitites found on 3D starter segment: %ld\n", nifce); |
fprintf(stdout, "\nGeneration of 3D domain ..."); |
// |
// printing of nodes |
// |
long inod; |
// add volume property numbers at interface nodes |
for(i=0; i<nifcn; i++){ |
inod = ifcnod[i]; |
top.nodes[inod].add_prop(eregion, volp); |
} |
// add surface property numbers generated from edge ones at interface nodes |
for(i=0; i<nifcn; i++){ |
inod = ifcnod[i]; |
for (j=0; j<top.nodes[inod].nprop; j++){ |
if (top.nodes[inod].entid[j] == ecurve) |
top.nodes[inod].add_prop(esurface, top.nodes[inod].prop[j]); |
} |
} |
// print nodes of intial (first) 3D segment |
fprintf(out, "%ld\n", top.nn+ngcoord*nifcn); |
top.shift_print_nodes(out, 0); |
double snode::* coordptr; // pointer to the data member of class snode |
switch(dir) |
{ |
case x_plus: |
case x_minus: |
coordptr = &snode::x; // coordptr referes to the x coordinate in class snode |
break; |
case y_plus: |
case y_minus: |
coordptr = &snode::y; // coordptr referes to the y coordinate in class snode |
break; |
case z_plus: |
case z_minus: |
coordptr = &snode::z; // coordptr referes to the z coordinate in class snode |
break; |
default: |
print_err("invalid direction indicator %d, it must be in the range <0;5>", __FILE__, __LINE__, __func__, int(dir)); |
return 4; |
} |
nid = top.nn; |
std::vector<entityp> nodent; |
std::vector<long> nodprop; |
long np; |
bool addvolp = true; |
entityp ent; |
for (i=0; i<ngcoord; i++){ |
for (k=0; k<nifcn; k++){ |
inod = ifcnod[k]; |
auxcoord = top.nodes[inod].*coordptr; // save actual coordinate value of the interface node either x,y or z according to coordptr |
top.nodes[inod].*coordptr = gcoord[i]; // change the coordinate value value |
fprintf (out,"%ld %15.10le %15.10le %15.10le",nid+1, top.nodes[inod].x, top.nodes[inod].y, top.nodes[inod].z); |
top.nodes[inod].*coordptr = auxcoord; // restore the coordinate value |
// create arrays with nodal properties |
nodent.clear(); |
nodprop.clear(); |
np = top.nodes[inod].nprop; |
nodent.reserve(np); |
nodprop.reserve(np); |
nodent.insert(nodent.begin(), top.nodes[inod].entid, top.nodes[inod].entid+np); |
nodprop.insert(nodprop.begin(), top.nodes[inod].prop, top.nodes[inod].prop+np); |
addvolp = true; |
for(l=0; l<np; l++){ |
ent = nodent[l]; |
if (ent == ecurve) nodent[l] = esurface; // edge properties are changed to surface ones |
if (ent == esurface) nodprop[l] = 0; // surface properties are dropped |
if (ent == eregion){ // volume properties are dropped or changed to volp |
if (addvolp){ // new nodes should have just one volume property equal to volp |
nodprop[l] = volp; |
addvolp = false; |
} |
else |
nodprop[l] = 0; |
} |
} |
if (addvolp){ // no volume properties were found in the interface nodes |
nodent.push_back(eregion); |
nodprop.push_back(volp); |
} |
if (i == ngcoord - 1){ |
nodent.push_back(esurface); |
nodprop.push_back(frontp); |
} |
fprintf (out," %ld", long(nodent.size())); |
for (l=0; l<long(nodent.size()); l++) |
fprintf(out, " %d %ld", int(nodent[l]), nodprop[l]); |
fprintf(out, "\n"); |
nid++; |
} |
} |
fprintf(out, "%ld\n", top.ne+nelemlay*ngcoord); |
// |
// printing of elements |
// |
eid = top.ne; |
nid1 = 0; |
nid2 = 0; |
// print elements of starter 3D segment |
top.shift_print_elements(out, 0, 0); |
ivector sfcnods; |
long eidifc, sfid, nnsfc; |
selement *elem; |
gtypel et; |
for (i=0; i<ngcoord; i++){ |
for (k=0; k<nifce; k++){ |
eidifc = ifcelem[k].first; |
sfid = ifcelem[k].second; |
nnsfc = top.elements[eidifc].nnsurf[sfid]; |
reallocv(RSTCKIVEC(nnsfc, sfcnods)); |
elem = top.elements+eidifc; |
et = top.elements[eidifc].type; |
for (l=0; l<nnsfc; l++) |
sfcnods[l] = elem->nodes[elem->surfnod[sfid][l]]; |
switch(gen_et){ |
case et_auto: |
if (nnsfc == 4) |
gen_brick(out, top, sfcnods, sfcnodid, sfid, eid, et, eidifc, nid1, nid2, volp, edg, frontp, i, ngcoord); |
else |
gen_wedge(out, top, sfcnods, sfcnodid, sfid, eid, et, eidifc, nid1, nid2, volp, edg, frontp, i, ngcoord); |
break; |
case et_brick: |
gen_brick(out, top, sfcnods, sfcnodid, sfid, eid, et, eidifc, nid1, nid2, volp, edg, frontp, i, ngcoord); |
break; |
case et_tetra: |
gen_tetra(out, top, sfcnods, sfcnodid, sfid, eid, et, eidifc, nid1, nid2, volp, edg, frontp, i, ngcoord); |
break; |
case et_wedge: |
gen_wedge(out, top, sfcnods, sfcnodid, sfid, eid, et, eidifc, nid1, nid2, volp, edg, frontp, i, ngcoord); |
break; |
default: |
print_err("unknown type of generated elements (%d) is required", __FILE__, __LINE__, __func__, int(gen_et)); |
abort(); |
} |
} |
nid1 = nid2; // increase start index of nodes on the front base surface |
nid2 += nifcn; // increase start index of nodes on the rear base surface |
} |
fclose(out); |
fprintf(stdout, "OK\n\n"); |
fprintf(stdout, "The total number of nodes in 3D domain : %ld\n", top.nn + nifcn*ngcoord); |
fprintf(stdout, "The total number of elements in 3D domain: %ld\n", top.ne + nifce*ngcoord); |
fprintf(stdout, "3D topology has been written in file %s\n", argv[2]); |
return 0; |
} |
/** |
The function generates one new element of the linear brick type over the given surface of the |
interface element of the base 3D mesh segment. |
@param[in, out] out - pointer to the opened text file, where the given element is written to |
@param[in] sfcnods - array of nodes defining the element surface of the base 3D mesh segment interface |
which the new element should be generated over |
@param[in] sfcid - index of surface defined by sfcnods on the interface element of the base 3D mesh segment |
@param[in, out] eid - element id of the new generated element |
@param[in] et - element type of the interface element of the base 3D mesh segment |
@param[in] ifceid - element id of the interface element of the base 3D mesh segment connected with the |
surface nodes sfcnods |
@param[in] sfcnodid - nodal indices of the first layer of new generated nodes |
@param[in] nid1 - index offset of the bottom nodes of the new generated element, the offset is related to sfcnodid |
@param[in] nid2 - index offset of the top nodes of the new generated element, the offset is related to sfcnodid |
@param[in] volp - volume property ov the new generated element |
@param[in] edg - flag for generation of edge/surface property numbers (edg == yes -> property numbers will be generated) |
@param[in] frontp - surface property of the final front surface of the new generated mesh segment |
@param[in] layid - actual id of the element layer generated |
@param[in] nlay - the total number of element layers generated |
Created by Tomas Koudelka, 03.2024, tomas.koudelka@fsv.cvut.cz |
*/ |
void gen_brick(FILE *out, const siftop &top, const ivector &sfcnods, const ivector &sfcnodid, long sfcid, long &eid, |
gtypel et, long ifceid, long nid1, long nid2, long volp, answertype edg, long frontp, |
long layid, long nlay) |
{ |
long nnsfc = sfcnods.n; |
long k, l, m, aux; |
ivector sfcnodsord(ASTCKIVEC(nnsfc)); |
ivector sfcedgord(ASTCKIVEC(nnsfc)); |
static selement isolin3d(isolinear3d, 0); |
if ((et != isolinear3d) && (et != tetrahedronlinear)){ |
print_err("unknown type (%d) of interface element %ld is required", __FILE__, __LINE__, __func__, int(et), ifceid+1); |
abort(); |
} |
if ((nnsfc < 3) || (nnsfc > 4)){ |
print_err("invalid number of surface nodes (%ld) is required for a new brick element %ld", |
__FILE__, __LINE__, __func__, nnsfc, eid+1); |
abort(); |
} |
// create anti-clockwise ordering of surface nodes with respect to its outter normal direction |
if (et == isolinear3d){ |
if ((sfcid < 2) || (sfcid == 4)){ |
copyv(sfcnods, sfcnodsord); |
for(l=0; l<nnsfc; l++) |
sfcedgord[l] = l; |
} |
else{ |
for(l=nnsfc-1, m=0; l>=0; --l, ++m) |
sfcnodsord[m] = sfcnods[l]; |
sfcedgord[0] = 2; sfcedgord[1] = 1; |
sfcedgord[2] = 0; sfcedgord[3] = 3; |
} |
} |
if (et == tetrahedronlinear){ |
for(l=nnsfc-1, m=0; l>=0; --l, ++m) |
sfcnodsord[m] = sfcnods[l]; |
sfcedgord[0] = 1; sfcedgord[1] = 0; |
sfcedgord[2] = 2; |
} |
if (nnsfc == 4){ |
fprintf(out, "%ld %d ", eid+1, int(isolinear3d)); |
for (l=0; l<nnsfc; l++) |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[l]]+1+nid2); |
for (l=0; l<nnsfc; l++){ |
if (layid == 0) |
fprintf(out, "%ld ", sfcnodsord[l]+1); |
else |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[l]]+1+nid1); |
} |
fprintf(out, " %ld", volp); |
if (edg == yes){ |
// edge property id of brick element are not preserved, |
// they will be changed to surface property id |
fprintf(out, " "); |
for (l=0; l<isolin3d.ned; l++) |
fprintf(out, " %d", 0); |
fprintf(out, " "); |
// property id of side surfaces on the brick element |
k = nnsfc-1; |
for (l=0; l<nnsfc; l++, k++){ |
// indeces of brick side surfaces are shifted by 3 with respect |
// to edge indeces on quadrilateral |
m = top.elements[ifceid].surfedg[sfcid][sfcedgord[k%nnsfc]]; |
fprintf(out, " %ld", top.elements[ifceid].propedg[m]); |
} |
// property id of top surface of the last layer of new generated elements |
aux = 0; |
if (layid == nlay-1) |
aux = frontp; |
fprintf(out, " %ld 0", aux); |
} |
fprintf(out, "\n"); |
} |
if (nnsfc == 3){ |
fprintf(out, "%ld %d ", eid+1, int(isolinear3d)); |
for (l=0; l<nnsfc; l++) |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[l]]+1+nid2); |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[nnsfc-1]]+1+nid2); |
for (l=0; l<nnsfc; l++){ |
if (layid == 0) |
fprintf(out, "%ld ", sfcnodsord[l]+1); |
else |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[l]]+1+nid1); |
} |
if (layid == 0) |
fprintf(out, "%ld ", sfcnodsord[nnsfc-1]+1); |
else |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[nnsfc-1]]+1+nid1); |
fprintf(out, "%ld", volp); |
if (edg == yes){ |
// edge property id of brick element are not preserved, |
// they will be changed to surface property id |
fprintf(out, " "); |
for (l=0; l<isolin3d.ned; l++) |
fprintf(out, " %d", 0); |
fprintf(out, " "); |
fprintf(out, " 0"); // surface with zero area due to degenerated brick element |
// property id of side surfaces on the brick element |
k = nnsfc-1; |
for (l=0; l<nnsfc; l++, k++){ // nnsfc corresponds to number of edges of the given surface |
// index of the corresponding adjacent edge to the given surface of interface element |
m = top.elements[ifceid].surfedg[sfcid][sfcedgord[k%nnsfc]]; |
fprintf(out, " %ld", top.elements[ifceid].propedg[m]); |
} |
// property id of top surface of the last layer of new generated elements |
aux = 0; |
if (layid == nlay-1) |
aux = frontp; |
fprintf(out, "0 %ld 0", aux); |
} |
fprintf(out, "\n"); |
} |
++eid; |
} |
/** |
The function generates one new element of the linear wedge type over the given surface of the |
interface element of the base 3D mesh segment. |
@param[in, out] out - pointer to the opened text file, where the given element is written to |
@param[in] sfcnods - array of nodes defining the element surface of the base 3D mesh segment interface |
which the new element should be generated over |
@param[in] sfcid - index of surface defined by sfcnods on the interface element of the base 3D mesh segment |
@param[in, out] eid - element id of the new generated element |
@param[in] et - element type of the interface element of the base 3D mesh segment |
@param[in] ifceid - element id of the interface element of the base 3D mesh segment connected with the |
surface nodes sfcnods |
@param[in] sfcnodid - nodal indices of the first layer of new generated nodes |
@param[in] nid1 - index offset of the bottom nodes of the new generated element, the offset is related to sfcnodid |
@param[in] nid2 - index offset of the top nodes of the new generated element, the offset is related to sfcnodid |
@param[in] volp - volume property ov the new generated element |
@param[in] edg - flag for generation of edge/surface property numbers (edg == yes -> property numbers will be generated) |
@param[in] frontp - surface property of the final front surface of the new generated mesh segment |
@param[in] layid - actual id of the element layer generated |
@param[in] nlay - the total number of element layers generated |
Created by Tomas Koudelka, 03.2024, tomas.koudelka@fsv.cvut.cz |
*/ |
void gen_wedge(FILE *out, const siftop &top, const ivector &sfcnods, const ivector &sfcnodid, long sfcid, long &eid, |
gtypel et, long ifceid, long nid1, long nid2, long volp, answertype edg, long frontp, |
long layid, long nlay) |
{ |
long nnsfc = sfcnods.n; |
long k, l, m, aux; |
ivector sfcnodsord(ASTCKIVEC(nnsfc)); |
ivector sfcedgord(ASTCKIVEC(nnsfc)); |
static selement wedgelin(wedgelinear, 0); |
if (et != tetrahedronlinear){ |
print_err("unknown type (%d) of interface element %ld is required", __FILE__, __LINE__, __func__, int(et), ifceid+1); |
abort(); |
} |
if ((nnsfc < 3) || (nnsfc > 4)){ |
print_err("invalid number of surface nodes (%ld) is required for a new brick element %ld", |
__FILE__, __LINE__, __func__, nnsfc, eid+1); |
abort(); |
} |
// create anti-clockwise ordering of surface nodes with respect to its outter normal direction |
for(l=nnsfc-1, m=0; l>=0; --l, ++m) |
sfcnodsord[m] = sfcnods[l]; |
sfcedgord[0] = 1; sfcedgord[1] = 0; |
sfcedgord[2] = 2; |
fprintf(out, "%ld %d ", eid+1, int(wedgelinear)); |
for (l=0; l<nnsfc; l++) |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[l]]+1+nid2); |
for (l=0; l<nnsfc; l++){ |
if (layid == 0) |
fprintf(out, "%ld ", sfcnodsord[l]+1); |
else |
fprintf(out, "%ld ", sfcnodid[sfcnodsord[l]]+1+nid1); |
} |
fprintf(out, " %ld", volp); |
if (edg == yes){ |
// edge property id of brick element are not preserved, |
// they will be changed to surface property id |
fprintf(out, " "); |
for (l=0; l<wedgelin.ned; l++) |
fprintf(out, " %d", 0); |
fprintf(out, " "); |
// property id of side surfaces on the brick element |
k = nnsfc-1; |
for (l=0; l<nnsfc; l++,k++){ // nnsfc corresponds to number of edges of the given surface |
// index of the corresponding adjacent edge to the given surface of interface element |
m = top.elements[ifceid].surfedg[sfcid][sfcedgord[k%nnsfc]]; |
fprintf(out, " %ld", top.elements[ifceid].propedg[m]); |
} |
// property id of top surface of the last layer of new generated elements |
aux = 0; |
if (layid == nlay-1) |
aux = frontp; |
fprintf(out, " %ld 0", aux); |
} |
fprintf(out, "\n"); |
++eid; |
} |
/** |
The function generates one new element of the linear brick type over the given surface of the |
interface element of the base 3D mesh segment. |
@param[in, out] out - pointer to the opened text file, where the given element is written to |
@param[in] sfcnods - array of nodes defining the element surface of the base 3D mesh segment interface |
which the new element should be generated over |
@param[in,out] eid - element id of the new generated element |
@param[in] ifceid - element id of the interface element of the base 3D mesh segment connected with the |
surface nodes sfcnods |
@param[in] sfcnodid - nodal indices of the first layer of new generated nodes |
@param[in] nid1 - index offset of the bottom nodes of the new generated element, the offset is related to sfcnodid |
@param[in] nid2 - index offset of the top nodes of the new generated element, the offset is related to sfcnodid |
@param[in] volp - volume property ov the new generated element |
@param[in] edg - flag for generation of edge/surface property numbers (edg == yes -> property numbers will be generated) |
@param[in] frontp - surface property of the final front surface of the new generated mesh segment |
@param[in] layid - actual id of the element layer generated |
@param[in] nlay - the total number of element layers generated |
*/ |
void gen_tetra(FILE *out, const siftop &top, const ivector &sfcnods, const ivector &sfcnodid, long sfcid, long &eid, |
gtypel et, long ifceid, long nid1, long nid2, long volp, answertype edg, long frontp, long layid, long nlay) |
{ |
long nnsfc = sfcnods.n; |
long l, m; |
ivector sfcnodsord(ASTCKIVEC(nnsfc)); |
ivector sfcedgord(ASTCKIVEC(nnsfc)); |
static selement tetrahedlin(tetrahedronlinear, 0); |
if (nnsfc != 3){ |
print_err("invalid number of surface nodes (%ld) is required for a tetrahedron element", |
__FILE__, __LINE__, __func__, nnsfc); |
abort(); |
} |
if (et == tetrahedronlinear){ |
for(l=nnsfc-1, m=0; l>=0; --l, ++m) |
sfcnodsord[m] = sfcnods[l]; |
sfcedgord[0] = 1; sfcedgord[1] = 0; |
sfcedgord[2] = 2; |
} |
fprintf(out, "%ld %d ", eid+1, int(tetrahedronlinear)); |
if (layid == 0){ |
fprintf(out, "%ld %ld %ld %ld ", sfcnodsord[0]+1, sfcnodsord[1]+1, sfcnodsord[2]+1, sfcnodid[sfcnodsord[0]]+1+nid2); |
} |
else |
fprintf(out, "%ld %ld %ld %ld ", sfcnodid[sfcnodsord[0]]+nid1+1, sfcnodid[sfcnodsord[1]]+nid1+1, |
sfcnodid[sfcnodsord[2]]+nid1+1, sfcnodid[sfcnodsord[0]]+nid2+1); |
fprintf(out, "%ld", volp); |
if (edg == yes){ |
// edge property id of tetrahedron element are not preserved, |
// they will be changed to surface property id |
fprintf(out, " "); |
for (l=0; l<tetrahedlin.ned; l++) |
fprintf(out, " %d", 0); |
fprintf(out, " "); |
// surface property numbers of the first tetrahedron |
fprintf(out, " 0 %ld %ld 0", top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[2]]], |
top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[0]]]); |
} |
fprintf(out, "\n"); |
++eid; |
fprintf(out, "%ld %d ", eid+1, int(tetrahedronlinear)); |
if (layid == 0){ |
fprintf(out, "%ld %ld %ld %ld ", sfcnodsord[2]+1, sfcnodsord[1]+1, sfcnodid[sfcnodsord[1]]+nid2+1, sfcnodid[sfcnodsord[0]]+nid2+1); |
} |
else |
fprintf(out, "%ld %ld %ld %ld ", sfcnodid[sfcnodsord[2]]+nid1+1, sfcnodid[sfcnodsord[1]]+nid1+1, |
sfcnodid[sfcnodsord[1]]+nid2+1, sfcnodid[sfcnodsord[0]]+nid2+1); |
fprintf(out, "%ld", volp); |
if (edg == yes){ |
// edge property id of tetrahedron element are not preserved, |
// they will be changed to surface property id |
fprintf(out, " "); |
for (l=0; l<tetrahedlin.ned; l++) |
fprintf(out, " %d", 0); |
fprintf(out, " "); |
// surface property numbers of the second tetrahedron |
fprintf(out, " %ld 0 0 %ld", top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[0]]], |
top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[1]]]); |
} |
fprintf(out, "\n"); |
++eid; |
fprintf(out, "%ld %d ", eid+1, int(tetrahedronlinear)); |
if (layid == 0){ |
fprintf(out, "%ld %ld %ld %ld ", sfcnodid[sfcnodsord[0]]+nid2+1, sfcnodid[sfcnodsord[1]]+nid2+1, |
sfcnodid[sfcnodsord[2]]+nid2+1, sfcnodsord[2]+1); |
} |
else |
fprintf(out, "%ld %ld %ld %ld ", sfcnodid[sfcnodsord[0]]+nid2+1, sfcnodid[sfcnodsord[1]]+nid2+1, |
sfcnodid[sfcnodsord[2]]+nid2+1, sfcnodid[sfcnodsord[2]]+nid1+1); |
fprintf(out, "%ld", volp); |
if (edg == yes){ |
// edge property id of tetrahedron element are not preserved, |
// they will be changed to surface property id |
fprintf(out, " "); |
for (l=0; l<tetrahedlin.ned; l++) |
fprintf(out, " %d", 0); |
fprintf(out, " "); |
// surface property numbers of the second tetrahedron |
if (layid < nlay-1) |
fprintf(out, " 0 %ld %ld 0", top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[1]]], |
top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[1]]]); |
else |
fprintf(out, " 0 %ld %ld %ld", top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[1]]], |
top.elements[ifceid].propedg[top.elements[ifceid].surfedg[sfcid][sfcedgord[1]]], frontp); |
} |
fprintf(out, "\n"); |
++eid; |
} |
/trunk/SIFEL/PREP/MESHTOOLS/negjac-nodren.cpp |
---|
9,7 → 9,6 |
FILE *out; |
siftop top; |
long i, aux; |
double jac; |
fprintf (stdout,"\n\n *** NODE RENUMBERING FOR ELEMENTS WITH NEGATIVE JACOBIAN ***\n"); |
/trunk/SIFEL/PREP/MESHTOOLS/ohybak.cpp |
---|
63,7 → 63,8 |
double xk,xp,r; |
double alpha,alphac,ys,xl,yl,x,y,xn; |
descrip d; |
FILE *out,*gid; |
FILE *out; |
//FILE *gid; |
XFILE *in,*itop; |
Top = new siftop; |
/trunk/SIFEL/PREP/SEQMESHGEN/Makefile |
---|
32,7 → 32,7 |
# List of source files |
# |
#SRCS = gensifhex.cpp gensifhexq.cpp gensifquad.cpp gensifquadq.cpp gensifquadq-gid.cpp gensifquadq-new.cpp gensifquadc.cpp gensiftetras.cpp gensiftria.cpp soilplate.cpp gen1d.cpp |
SRCS = gensifhex.cpp gensifhexq.cpp gensifquad.cpp gensifquadq.cpp gensifquadq-new.cpp gensifquadc.cpp gensiftetras.cpp gensiftria.cpp soilplate.cpp gen1d.cpp |
SRCS = gensifhex.cpp gensifhexq.cpp gensifquad.cpp gensifquadq.cpp gensifquadq-new.cpp gensifquadc.cpp gensiftetras.cpp gensiftria.cpp soilplate.cpp gen1d.cpp geniface.cpp |
/trunk/SIFEL/PREP/SEQMESHGEN/geniface.cpp |
---|
0,0 → 1,826 |
#include "geniface.h" |
#include "galias.h" |
#include "iotools.h" |
#include "vector.h" |
#include "siftop.h" |
#include "selection.h" |
#include <vector> |
int main(int argc, char *argv[]) |
{ |
if (argc < 3){ |
fprintf(stderr, "\nError - missing command line argument.\n" |
"\n\nUse: '%s input_file_name output_file_name'\n", argv[0]); |
return 1; |
} |
if (argc > 3){ |
fprintf(stderr, "\nError - too many command line arguments.\n" |
"\n\nUse: '%s input_file_name output_file_name'\n", argv[0]); |
return 1; |
} |
XFILE *in=xfopen(argv[1], "rt"); |
if (in == NULL){ |
fprintf(stderr, "\nError - cannot open input file '%s'.\n", argv[1]); |
return 1; |
} |
in->kwdmode = sequent_mode; |
siftop top_orig; // original topology |
genopt options; |
long ncmd = 0; |
long i, mn; |
char *aptr = NULL; |
long gdnn = 0; |
bool ok; |
// read options for the given problem and load original topology |
// parse the input file and save locations of the generator commands |
long ret = process_input_file(in, options, top_orig, ncmd); |
if (ret) return 2; |
// copy original topology to the new one |
siftop top_new; |
// generate lists of adjacent elements to nodes |
top_orig.gen_adjelnod(); |
ivector gdn_lst(top_orig.nn); // global list of nodes to be doubled gdn_lst[i] > 0 -> i-th node should be doubled |
std::vector<long> dn_lst; // list of node numbers to be doubled in the actual command |
std::vector<ifcel_descript> ifcdel(ncmd); // list of descriptions of generated interface elements |
std::set<boundary_ent_ifc> face_lst; // list of identifiers {elem_id, edg/surf_id, ifceld_ptr} where the interface element will be connected |
xf_setsec(in, bsec_ifc_str[0]); |
xf_resetsec(in); |
// set initial index value for new doubled nodes |
gdnn = top_orig.nn; |
fprintf(stdout, "Reading of %ld command(s) for generation of interface nodes/elements:\n", ncmd); |
for (i=0; i< ncmd; i++){ |
in->kwdmode = sect_mode_fwd; |
getkwd_sect(in, NULL, aptr, "gen_ifc", 0); |
in->kwdmode = sect_mode_seq; |
fprintf(stdout, " - command at line %ld ...", in->line); |
ok = true; |
// search for node numbers to be doubled |
ret = doubled_nodes(in, top_orig, dn_lst, gdnn, gdn_lst, mn); |
if (ret) return 3; |
if (mn){ |
fprintf(stdout, "\n * there were %ld nodes that has already been doubled.\n", mn); |
ok = false; |
} |
// reads command record dealing with element set to be searched for boundary entities connected |
// with the interface nodes |
ret = search_elem_connect2ifc(in, top_orig, dn_lst, face_lst, ifcdel[i]); |
if (ret) return 4; |
if (ok) |
fprintf(stdout, " O.K.\n"); |
else |
fprintf(stdout, "... O.K.\n"); |
} |
xfclose(in); |
// generate interface elements if required and store them in the new topology |
gen_iface_elems(top_orig, gdn_lst, face_lst, options, top_new); |
fprintf(stdout, "Writing of the output topology file ..."); |
FILE *out = fopen(argv[2], "wt"); |
if (out == NULL){ |
fprintf(stderr, "\nError - cannot open output file '%s'.\n", argv[2]); |
return 5; |
} |
// export the new topology to the output file |
top_new.print(out); |
fprintf(stdout, "O.K.\n"); |
fclose(out); |
return 0; |
} |
/** |
The function reads the original topology file where some of nodes should be doubled |
and interface elements may be generated optiionally. Additionally, the options |
of the interface elements are read and number of commands for node doubling and |
interface element generation are detected. |
@param[in, out] in - pointer to the opened input text file |
@param[out] options - |
@param[out] top - structure for storage of the original topology |
@param[out] ncmd - number of commmands detected |
@retval 0 - on sucess |
@retval 1 - reading of topology failed |
@retval 2 - error in the reading of section with generation commands |
@retval 3 - no commands found |
Created by TKo, 01.2024 |
*/ |
long process_input_file(XFILE *in, genopt &options, siftop &top, long &ncmd) |
{ |
char fname[1025]; |
xfscanf(in, "%1024a", fname); |
xfscanf(in, "%k%m", "mesh_format", &meshform_kwdset, &options.meshfmt); |
xfscanf(in, "%k%m", "edge_numbering", &answertype_kwdset, &options.edgnum); |
// reading of the file with original topology |
fprintf(stdout, "\n\nReading of mesh topology . . ."); |
XFILE *intop = xfopen(fname, "rt"); |
if (intop == NULL){ |
print_err("cannot open topology file '%s'.", __FILE__, __LINE__, __func__, fname); |
return 1; |
} |
long ret; |
switch (options.meshfmt) |
{ |
case t3d: |
top.import_t3d(intop, 0); |
break; |
case sifel: |
ret = top.read(intop, 0, options.edgnum); |
if (ret) return 1; |
break; |
default: |
print_err("unknown mesh format is required.", __FILE__, __LINE__, __func__); |
return 1; |
} |
fprintf(stdout, " O.K.\n"); |
xfclose(intop); |
if (top.nadjelnod == NULL) |
top.gen_adjelnod(); |
in->kwdmode = sect_mode_seq; |
// detect section with commands for generation of interface nodes/elements |
xfdetect_sect(in, bsec_ifc_kwdset, esec_ifc_kwdset); |
// index of sections must be created |
if (in->index_created != 1){ |
print_err("index of sections has not beeen created.", __FILE__, __LINE__, __func__); |
return 2; |
} |
// section with commands for interface node/element generation must be detected |
ret = xf_setsec(in, bsec_ifc_str[begsec_ifc_cmd]); |
if (ret){ |
print_err("section with commands for generation of interface elements has not been detected.", |
__FILE__, __LINE__, __func__); |
return 2; |
} |
char *aptr = NULL; |
ncmd = getkwd_sect(in, NULL, aptr, "gen_ifc", 1); |
if (ncmd == 0){ |
print_err("no commands for interface element generation were found.", __FILE__, __LINE__, __func__); |
return 3; |
} |
return 0; |
} |
/** |
The function searchs for nodes to be doubled in the actual generation command of the input file in. |
@param[in, out] in - pointer to the opened input text file, the file position must be set to the beginning |
of the actual command for generation of interface nodes/elements. |
@param[in] top - structure with the original topology from which the doubled nodes should be generated. |
@param[out] dn_lst - list of node numbers to be doubled by the actual command |
@param[in,out] gdnn - attained global node number for numbering of doubled nodes, at the beginning the number should be top_orig.nn, |
C-style node numbering is used (starting from 0), the number of nodes in the original topology top_orig |
must be nonzero |
@param[in, out] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@param[out] mn - number of multiply defined doubled nodes detected in the function |
@return - list of interface nodes to be doubled is returned in the argument dn_lst |
@retval 0 - on success |
@retval 1 - in the case of an error |
*/ |
long doubled_nodes(XFILE *in, const siftop &top, std::vector<long> &dn_lst, long &gdnn, ivector &gdn_lst, long &mn) |
{ |
long i, j, k; |
sel selnod; |
long line = in->line; |
long col = in->col; |
dn_lst.clear(); |
xfscanf(in, "%k %k", "gen_ifc", "node_selection"); |
selnod.read(in); |
// conversion of property selection to list of nodes or renges of nodes |
if (selnod.st == sel_prop) |
selnod.conv_selprop(&top, gnod); |
switch (selnod.st){ |
case sel_range: |
for (i=0; i<selnod.n; i++){ |
for(j=0, k=selnod.id1[i]; j<selnod.ncomp[i]; j++, k++) |
dn_lst.push_back(k); |
} |
break; |
case sel_list: |
for (i=0; i<selnod.n; i++){ |
j = selnod.id1[i]; |
dn_lst.push_back(j); |
} |
break; |
default: |
print_err("unknown type of interface node selection is required (%s)\n" |
"Only 'sel_range', 'sel_list' or 'sel_prop' selection types are allowed.", |
__FILE__, __LINE__, __func__, seltype_kwdset.get_str(selnod.st)); |
return 1; |
} |
if (dn_lst.size() == 0){ |
print_warning("no interface node were selected by the gen_ifc command (line=%ld, col=%ld)", |
__FILE__, __LINE__, __func__, line, col); |
} |
mn = 0; |
// generate identifiers of new doubled interface nodes |
for (auto j : dn_lst){ |
if (gdn_lst[j] == 0){ |
gdn_lst[j] = gdnn; |
gdnn++; |
} |
else{ |
//fprintf(stdout, "original interface node %ld has been already doubled (new node id=%ld)\n", j+1, gdn_lst[j]+1); |
mn++; |
} |
} |
return 0; |
} |
/** |
The function reads part of the command for an interface generation dealing with the element set and interface |
element generation setup. Additionally, it searches for elements connected to the interface nodes in the selected set of elements |
and saves the result in argument face_lst. |
@param[in, out] in - pointer to the opened input text file, the file position indicator must correspond the |
position inside the interface generation command at the beginning of the element set |
definition to be considered in the interface searching. |
@param[in] top - structure with the original topology from which the doubled nodes should be generated. |
@param[in] dn_lst - list of node numbers to be doubled by the actual command |
@param[out] face_lst - list of strutures containing: |
* identifier of found element on interface, |
* index of its boundary entity (edge or surface) which is defined by the interface nodes, |
i.e. the entity, which is fully connected to the interface nodes; |
* pointer to the description of the generated interface elements |
@param[out] ifc_desc - description of generated interface elements |
@retval 0 - on success |
@retval 1 - in the case of wrong selection of interface nodes |
Created by TKo, 01.2024 |
*/ |
long search_elem_connect2ifc(XFILE *in, const siftop &top, const std::vector<long> &dn_lst, |
std::set<boundary_ent_ifc> &face_lst, ifcel_descript &ifcdel) |
{ |
long i, j, k; |
sel selelem; |
long line = in->line, col = in->col; |
// read selection of element set where the interface nodes will be searched for |
xfscanf(in, "%k", "elem_selection"); |
selelem.read(in); |
// read setup of generated interface elements |
ifcdel.read(in); |
ivector e_lst(top.ne); |
// conversion of property selection to list of nodes or renges of nodes |
if (selelem.st == sel_prop) |
selelem.conv_selprop(&top, gelem); |
switch (selelem.st){ |
case sel_range: |
for (i=0; i<selelem.n; i++){ |
for(j=0, k=selelem.id1[i]; j<selelem.ncomp[i]; j++, k++) |
e_lst[k] = 1; |
} |
break; |
case sel_list: |
for (i=0; i<selelem.n; i++){ |
j = selelem.id1[i]; |
e_lst[j] = 1; |
} |
break; |
default: |
print_err("unknown type of interface node selection is required (%s)\n" |
"Only 'sel_range', 'sel_list' or 'sel_prop' selection types are allowed.", |
__FILE__, __LINE__, __func__, seltype_kwdset.get_str(selelem.st)); |
return 1; |
} |
if (dn_lst.size() == 0){ |
print_warning("no interface node were selected by the gen_ifc command (line=%ld, col=%ld)", |
__FILE__, __LINE__, __func__, line, col); |
} |
// create list of elements connected to interface nodes |
std::set<long> adjelnodifc_lst; |
for (i=0; i<(long)dn_lst.size(); i++){ |
for(j=0; j<top.nadjelnod[i]; j++){ |
adjelnodifc_lst.insert(top.adjelnod[dn_lst[i]][j]); |
} |
} |
// reconnect of found elements on interface to new doubled nodes |
long nent; |
ivector entid_lst; |
for (long eid : adjelnodifc_lst){ |
if (e_lst[eid]){ |
if (top.give_dimension(eid) <= 2){ |
reallocv(RSTCKIVEC(top.elements[eid].ned, entid_lst)); |
nent = top.elements[eid].compare_edg(&dn_lst.front(), dn_lst.size(), entid_lst); |
} |
else{ |
reallocv(RSTCKIVEC(top.elements[eid].nsurf, entid_lst)); |
nent = top.elements[eid].compare_surf(&dn_lst.front(), dn_lst.size(), entid_lst); |
} |
if (nent){ |
// element edges or surfaces were found to be defined by interface nodes |
for(i=0; i<entid_lst.n; i++){ |
long eid2 = search_adj_ifc_elem(eid, entid_lst[i], e_lst, top); |
if (eid2 >= 0) |
face_lst.insert({eid, entid_lst[i], eid2, &ifcdel}); // store the found element id and interface entity id |
} |
} |
} |
} |
return 0; |
} |
/** |
The function searches for adjacent element to the given eid-th element such that both |
are connected to the entid-th element boundary entity (edge or surface) of the eid-the element. |
@param[in] eid - the given element identifier, |
@param[in] entid - identfier of the eid-th element boundary entity (edge or surface) |
@param[in] e_lst - list of elements where adjacent element is NOT searched, |
dimension of the list is top.ne, e_lst[i] > 0 -> i-th element is not |
considered for the searching |
@param[in] top - original topology with initialize arrays adjelnod and nadjelnod |
@return The function returns an identifier of the adjacent element if found or -1 if not. |
Created by TKo, 01.2024 |
*/ |
long search_adj_ifc_elem(long eid, long entid, const ivector &e_lst, const siftop &top) |
{ |
long nnent, i, j, nadj, adjeid, ret = -1; |
ivector rentnod; |
long dim = top.give_dimension(eid); |
if (dim <= 2){ |
nnent = top.elements[eid].nned[entid]; |
makerefv(rentnod, top.elements[eid].edgenod[entid], nnent); |
} |
else{ |
nnent = top.elements[eid].nnsurf[entid]; |
makerefv(rentnod, top.elements[eid].surfnod[entid], nnent); |
} |
ivector entnod(ASTCKIVEC(nnent)); |
std::set<long> adjel; |
for(i=0; i<nnent; i++){ |
entnod[i] = top.elements[eid].nodes[rentnod[i]]; |
nadj = top.nadjelnod[entnod[i]]; |
for(j=0; j<nadj; j++){ |
adjeid = top.adjelnod[entnod[i]][j]; |
if (e_lst[adjeid] == 0) |
adjel.insert(adjeid); |
} |
} |
for(long eid2 : adjel){ |
if (dim <= 2) |
i = top.elements[eid2].compare_edg(entnod.a, nnent); |
else |
i = top.elements[eid2].compare_surf(entnod.a, nnent); |
if (i >= 0){ |
ret = eid2; |
break; |
} |
} |
return ret; |
} |
/** |
The function generates new doubled nodes and interface elements if the new interface elements are required. |
@param[in] top_orig - structure with the original topology from which the doubled nodes should be generated. |
@param[in, out] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@param[in] face_lst - list of strutures containing: |
* identifier of found element on interface, |
* index of its boundary entity (edge or surface) which is defined by the interface nodes, |
i.e. the entity, which is fully connected to the interface nodes; |
* pointer to the description of the generated interface elements |
@param[in] gopt - structure with the options for mesh format used |
@param[out] top_new - structure with the new topology where reconnection of elements on interface to doubled nodes will be performed |
@return The function does not return anything. |
Created by TKo, 01.2024 |
*/ |
void gen_iface_elems(const siftop &top_orig, const ivector &gdn_lst, const std::set<boundary_ent_ifc> &face_lst, const genopt &gopt, |
siftop &top_new) |
{ |
// reconnect of found elements on interface to new doubled nodes |
long i, eid, entid, nnent, dim; |
ivector rentnod; |
ivector entnod; |
// count the total number of doubled nodes |
long tndn = 0; |
for(i=0; i<top_orig.nn; i++){ |
if (gdn_lst[i] > 0) tndn++; |
} |
long tnifel = 0; |
for (auto eld : face_lst){ |
if (eld.ifceld_ptr->et != ifc_noel) |
tnifel++; |
} |
long num_dnedgprop = 0; |
if (top_orig.edges) |
num_dnedgprop = num_doubled_nodes_edg_prop(top_orig, gdn_lst); |
long num_dnsurfprop = 0; |
if (top_orig.surfaces) |
num_dnsurfprop = num_doubled_nodes_surf_prop(top_orig, gdn_lst); |
// make copy of topology with extended arrays of nodes and elements and actualize extended list of properties |
// on edges and surfaces if they are defined |
top_orig.partial_copy(top_new, tndn, tnifel, num_dnedgprop, num_dnsurfprop); |
if (num_dnedgprop) |
doubled_nodes_add_edg_prop(top_new, num_dnedgprop, gdn_lst); |
if (num_dnsurfprop) |
doubled_nodes_add_surf_prop(top_new, num_dnsurfprop, gdn_lst); |
/* |
if (top_new.edges || top_new.surfaces) |
top_new.gen_adjelnod(); |
if (top_new.edges) |
top_new.edges->gen_list_edg(top_new.nn, top_new.ne, top_new.elements, top_new.nadjelnod, top_new.adjelnod); |
if (top_new.surfaces) |
top_new.surfaces->gen_list_surf(top_new.nn, top_new.ne, top_new.elements, top_new.nadjelnod, top_new.adjelnod); |
*/ |
// generate new doubled nodes |
for(i=0; i<top_orig.nn; i++){ |
if (gdn_lst[i] > 0) |
top_orig.nodes[i].copyto(top_new.nodes[gdn_lst[i]]); |
} |
// reconnect original elements connected to the interface nodes to new doubled nodes |
for (auto eld : face_lst){ |
eid = eld.eid; |
entid = eld.entid; |
if (top_orig.give_dimension(eid) <= 2){ |
nnent = top_orig.elements[eid].nned[entid]; |
makerefv(rentnod, top_orig.elements[eid].edgenod[entid], nnent); |
} |
else{ |
nnent = top_orig.elements[eid].nnsurf[entid]; |
makerefv(rentnod, top_orig.elements[eid].surfnod[entid], nnent); |
} |
// renumber interface nodes of found element in the new topology |
for (i=0; i<nnent; i++){ |
long *enodes = top_orig.elements[eid].nodes; |
top_new.elements[eid].nodes[rentnod[i]] = gdn_lst[enodes[rentnod[i]]]; |
} |
} |
// generate interface elements if required |
long k=top_orig.ne; |
for (auto eld : face_lst){ |
if (eld.ifceld_ptr->et == ifc_noel) |
continue; |
eid = eld.eid; |
entid = eld.entid; |
dim = top_orig.give_dimension(eid); |
if (dim <= 2){ |
nnent = top_orig.elements[eid].nned[entid]; |
makerefv(rentnod, top_orig.elements[eid].edgenod[entid], nnent); |
} |
if (dim == 3){ |
nnent = top_orig.elements[eid].nnsurf[entid]; |
makerefv(rentnod, top_orig.elements[eid].surfnod[entid], nnent); |
} |
reallocv(RSTCKIVEC(rentnod.n, entnod)); |
for(i=0; i<rentnod.n; i++) |
entnod[i] = top_orig.elements[eid].nodes[rentnod[i]]; |
make_ifc_elem(top_new, eid, entnod, gdn_lst, gopt, *eld.ifceld_ptr, k); |
k++; |
} |
} |
/** |
The function searches for the doubled nodes given in the gdn_lst in the edge property objects at the given topology. |
@param[in] top - given topology whose edge property objects will be searched for doubled nodes |
@param[in] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@return The function returns the number of edge property objects that contain doubled nodes. |
Created by TKo, 01.2024 |
*/ |
long num_doubled_nodes_edg_prop(const siftop &top, const ivector &gdn_lst) |
{ |
long ret = 0; |
sedge *edg = NULL; |
if (top.edges){ |
for (long i=0; i<top.edges->nedg; i++){ |
edg = top.edges->edges + i; |
if ((gdn_lst[edg->n1] > 0) || (gdn_lst[edg->n2] > 0)) |
++ret; |
} |
} |
return ret; |
} |
/** |
The function searches for the doubled nodes given in the gdn_lst in the surface property objects at the given topology. |
@param[in] top - given topology whose surface property objects will be searched for doubled nodes |
@param[in] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@return The function returns the number of surface property objects that contain doubled nodes. |
Created by TKo, 01.2024 |
*/ |
long num_doubled_nodes_surf_prop(const siftop &top, const ivector &gdn_lst) |
{ |
long ret = 0; |
sface *sfc = NULL; |
if (top.surfaces){ |
for (long i=0; i<top.surfaces->nfcs; i++){ |
sfc = top.surfaces->faces + i; |
for (long j=0; j<sfc->nnod; j++){ |
if (gdn_lst[sfc->nodes[j]] > 0){ |
++ret; |
break; |
} |
} |
} |
} |
return ret; |
} |
/** |
The function adds new edge property objects to the given topology. These objects are derived from the |
current one that contains nodes to be doubled. |
@param[in] top - given topology where the new edge property objects will be stored, |
array of the edge property objects must be allocated to hold the newly generated ones |
@param[in] num_dnedgprop - number of new edge property objects that will be added to the topology |
@param[in] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@return The function does not return anything. |
Created by TKo, 01.2024 |
*/ |
void doubled_nodes_add_edg_prop(siftop &top, long num_dnedgprop, const ivector &gdn_lst) |
{ |
sedge *edg = NULL; |
if (top.edges){ |
long k = top.edges->nedg - num_dnedgprop; |
long n = k; |
for (long i=0; i<n; i++){ |
edg = top.edges->edges + i; |
if ((gdn_lst[edg->n1] > 0) || (gdn_lst[edg->n2] > 0)){ |
edg->copyto(top.edges->edges[k]); |
if (gdn_lst[edg->n1] > 0) |
top.edges->edges[k].n1 = edg->n1; |
if (gdn_lst[edg->n2] > 0) |
top.edges->edges[k].n2 = edg->n2; |
k++; |
} |
} |
} |
} |
/** |
The function adds new surface property objects to the given topology. These objects are derived from the |
current one that contains nodes to be doubled. |
@param[in] top - given topology where the new surface property objects will be stored, |
array of the surface property objects must be allocated to hold the newly generated ones |
@param[in] num_dnsurfprop - number of new surface property objects that will be added to the topology |
@param[in] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@return The function does not return anything. |
Created by TKo, 01.2024 |
*/ |
void doubled_nodes_add_surf_prop(siftop &top, long num_dnsurfprop, const ivector &gdn_lst) |
{ |
sface *sfc = NULL; |
if (top.surfaces){ |
long k = top.surfaces->nfcs - num_dnsurfprop; |
long n = k; |
for (long i=0; i<n; i++){ |
sfc = top.surfaces->faces + i; |
bool create = false; |
for (long j=0; j<sfc->nnod; j++){ |
if (gdn_lst[sfc->nodes[j]] > 0){ |
create = true; |
break; |
} |
} |
if (create){ |
sface *sfcn = top.surfaces->faces + k; |
sfc->copyto(*sfcn); |
for (long j=0; j<sfc->nnod; j++){ |
if (gdn_lst[sfc->nodes[j]] > 0) |
sfcn->nodes[j] = gdn_lst[sfc->nodes[j]]; |
} |
k++; |
} |
} |
} |
} |
/** |
The function makes new interface element with identifier k in the topology top. The new interface element |
nodes will be defined by with the help of nodes entnod such that the half of nodes will be associated with |
with etnodes directly and the secnod half will be associated to nodes entnodes renumbered with the help of |
gdn_lst. If the ifceld.orient == ifc_elor_low then the first half of nodes will be entnodes directly while |
the renumbered nodes will be used for the second half. If the ifceld.orient == ifc_elor_high then the |
oposite node assigment is used. On the given half of nodes, the node assignment start with the ifceld.nodid-th |
node from the array entnodes. The type of generated element is either prescribed by ifceld.et or detected |
automatically according to neighbour element eid if ifceld.et == ifc_automatic. |
@param[in, out] top - the topology where the new interface element will be stored as the k-th element, |
the array top.elements must be allocated sufficiently to hold the new element |
@param[in] eid - element identifier which the new interface element will be connected to. |
@param[in] entnod - array of nodes on the boundary entity (edge or surface) of the eid-th element which |
the new interface element will be connected to. |
@param[in] gdn_lst - global list of node numbers to be doubled for the whole problem, gdn_lst[i] > 0 if the node is |
on the interface (to be doubled) |
@param[in] gopt - structure with the options for mesh format used |
@param[in] ifceld - the generation setup of the new interface element |
@return The function does not return anything. |
Created by TKo, 01.2024 |
*/ |
void make_ifc_elem(siftop &top, long eid, const ivector &entnod, const ivector &gdn_lst, const genopt &gopt, const ifcel_descript &ifceld, long k) |
{ |
ifctypel ifcet = ifceld.et; |
if (ifcet == ifc_automatic){ |
gtypel et = top.elements[eid].type; |
switch (et){ |
case isolinear1d: |
case trianglelinear: |
case isolinear2d: |
ifcet = ifc_linquad; |
break; |
case isoquadratic1d: |
case trianglequadratic: |
case isoquadratic2d: |
ifcet = ifc_quadquad; |
break; |
case isolinear3d: |
ifcet = ifc_linhexa; |
break; |
case isoquadratic3d: |
ifcet = ifc_quadhexa; |
break; |
case tetrahedronlinear: |
ifcet = ifc_linwedge; |
break; |
case tetrahedronquadratic: |
ifcet = ifc_quadwedge; |
break; |
case wedgelinear: |
if (entnod.n == 4) |
ifcet = ifc_linhexa; |
else |
ifcet = ifc_linwedge; |
break; |
case wedgequadratic: |
if (entnod.n == 8) |
ifcet = ifc_quadhexa; |
else |
ifcet = ifc_quadwedge; |
break; |
default: |
print_err("unknown/unimplemented element type '%s' is required for interface element generation.", |
__FILE__, __LINE__,__func__, gtypel_kwdset.get_str(et)); |
abort(); |
} |
} |
selement &ifcel = top.elements[k]; |
ifcel.type = noel; |
switch(ifcet){ |
case ifc_linquad: |
ifcel.type = isolinear2d; |
break; |
case ifc_linhexa: |
ifcel.type = isolinear3d; |
break; |
case ifc_linwedge: |
ifcel.type = wedgelinear; |
break; |
default: |
print_err("unknown type of interface element '%s' is required", __FILE__, __LINE__, __func__, ifctypel_kwdset.get_str(ifcet)); |
abort(); |
} |
ifcel.alloc(gopt.edgnum); |
ifcel.prop = ifceld.prop; |
long n = entnod.n; |
if (ifceld.orient == ifc_elor_low){ |
for (long i=0, j=ifceld.nodid+n-1; i<n; i++, j--){ |
ifcel.nodes[i] = entnod[j%n]; |
} |
for (long i=n, j=ifceld.nodid+n-1; i<ifcel.nne; i++, j--){ |
ifcel.nodes[i] = gdn_lst[entnod[j%n]]; |
} |
} |
if (ifceld.orient == ifc_elor_high){ |
for (long i=0, j=ifceld.nodid; i<n; i++, j++){ |
ifcel.nodes[i] = entnod[j%n]; |
} |
for (long i=n, j=ifceld.nodid; i<ifcel.nne; i++, j++){ |
ifcel.nodes[i] = gdn_lst[entnod[j%n]]; |
} |
} |
} |
/** |
The operator compares two objects of boundary_ent_ifc class. The operator is required by the container |
std::set<boundary_ent_ifc>. The comparison also checks for faulty input of interface elements defined |
with different setup for the same boundary entity (edge or surface) of the same element connected to |
the interface nodes. |
@param[in] lhs - left hand side of the operator |
@param[in] rhs - right hand side of the operator |
@retval true if lhs < rhs |
@retval false otherwise |
Created by TKo, 01.2024 |
*/ |
bool operator < (const boundary_ent_ifc &lhs, const boundary_ent_ifc &rhs) |
{ |
if (lhs.eid < rhs.eid) |
return true; |
else{ |
if (lhs.eid == rhs.eid){ |
if (lhs.entid < rhs.entid) |
return true; |
else{ |
if (lhs.entid == rhs.entid){ |
if (lhs.eid2 < rhs.eid2) |
return true; |
else{ |
if ((lhs.eid2 == rhs.eid2) && !(*lhs.ifceld_ptr == *lhs.ifceld_ptr)){ |
// lhs and rhs are the same elements where the interface element is required to be connected to the same boundary entity(edge or surface) and |
// there is different setup of the generated interface element => failure |
// different interface element setup must not appear on the same entity, apparently, there are wrong data in the input file |
print_err("failure of interface element definition on element %ld:\n" |
" there are two different setup of interface generation on %ld-th element boundary entity.\n" |
" setup 1: ifceld_ptr=%p{et=%s, orient=%s, nodid=%ld}\n" |
" setup 2: ifceld_ptr=%p{et=%s, orient=%s, nodid=%ld}\n", |
__FILE__, __LINE__, __func__, lhs.eid+1, lhs.entid+1, lhs.ifceld_ptr, ifctypel_kwdset.get_str(lhs.ifceld_ptr->et), |
ifc_elor_kwdset.get_str(lhs.ifceld_ptr->orient), lhs.ifceld_ptr->nodid, rhs.ifceld_ptr, ifctypel_kwdset.get_str(rhs.ifceld_ptr->et), |
ifc_elor_kwdset.get_str(rhs.ifceld_ptr->orient), lhs.ifceld_ptr->nodid); |
abort(); |
} |
} |
} |
} |
} |
} |
return false; |
} |
/trunk/SIFEL/PREP/SEQMESHGEN/geniface.h |
---|
0,0 → 1,118 |
#ifndef GENIFACE_H |
#define GENIFACE_H |
#include "kwdset.h" |
#include "galias.h" |
#include "iotools.h" |
#include <vector> |
#include <set> |
struct XFILE; |
class siftop; |
struct ivector; |
enum bsec_ifc {begsec_ifc_cmd=0}; |
const enumstr bsec_ifc_str[] = {{"begsec_ifc_cmd",0}}; |
const kwdset bsec_ifc_kwdset(sizeof(bsec_ifc_str)/sizeof(*bsec_ifc_str), bsec_ifc_str); |
enum esec_ifc {endsec_ifc_cmd=0}; |
const enumstr esec_ifc_str[] = {{"endsec_ifc_cmd",0}}; |
const kwdset esec_ifc_kwdset(sizeof(esec_ifc_str)/sizeof(*esec_ifc_str), esec_ifc_str); |
enum ifctypel {ifc_noel=0, ifc_automatic=1, ifc_linquad=2, ifc_quadquad=3, ifc_linhexa=4, ifc_quadhexa=5, ifc_linwedge=6, |
ifc_quadwedge=7}; |
const enumstr ifctypel_str[] = {{"ifc_noel",0}, {"ifc_automatic",1}, {"ifc_linquad",2}, {"ifc_quadquad",3}, {"ifc_linhexa",4}, |
{"ifc_quadhexa",5}, {"ifc_linwedge",6}, {"ifc_quadwedge",7}}; |
const kwdset ifctypel_kwdset(sizeof(ifctypel_str)/sizeof(*ifctypel_str), ifctypel_str); |
enum ifc_elor {ifc_elor_low=0, ifc_elor_high=1}; |
const enumstr ifc_elor_str[] = {{"ifc_elor_low",0}, {"ifc_elor_high",1}}; |
const kwdset ifc_elor_kwdset(sizeof(ifc_elor_str)/sizeof(*ifc_elor_str), ifc_elor_str); |
struct genopt |
{ |
meshform meshfmt; |
answertype edgnum; |
}; |
class ifcel_descript |
{ |
public: |
ifcel_descript() { |
et = ifc_noel; orient = ifc_elor_low; nodid = prop = 0; |
}; |
long read(XFILE *in) { |
xfscanf(in, "%k%m", "ifc_elem_type", &ifctypel_kwdset, &et); |
if (et != ifc_noel){ |
xfscanf(in, "%k%m", "ifc_elem_orientation", &ifc_elor_kwdset, &orient); |
xfscanf(in, "%k%ld", "ifc_start_node_id", &nodid); |
--nodid; |
xfscanf(in, "%k%ld", "ifc_vol_prop", &prop); |
} |
return 0; |
}; |
bool operator == (const ifcel_descript &rhs) |
{ return (et == rhs.et) && (orient == rhs.orient) && (nodid == rhs.nodid) && (prop == rhs.prop);}; |
ifctypel et; /// type of generated interface elements |
ifc_elor orient; /// orientation of generated interface elements between elements connected to interface |
long nodid; /// node index of the boundary entity of elements on interface from which the the definition of intefrace elements starts |
long prop; /// region property number of the generated interface elements |
}; |
struct boundary_ent_ifc |
{ |
long eid; // the first element identifier to be connected to an interface |
long entid; // boundary entity identifier (edge or surface id) on the eid-the element where the interface was detected |
long eid2; // the second element identifier to be connected to an interface |
ifcel_descript *ifceld_ptr; |
}; |
/// read options for the given problem, load original topology and detect number of commands for the interface generation |
long process_input_file(XFILE *in, genopt &options, siftop &top_orig, long &ncmd); |
/// search for nodes to be doubled given by the actual command |
long doubled_nodes(XFILE *in, const siftop &top, std::vector<long> &dn_lst, long &gdnn, ivector &gdn_lst, long &mn); |
/// search for elements connected to the doubled nodes given in the actual command and search for surfaces connected with doubled nodes on these elements |
long search_elem_connect2ifc(XFILE *in, const siftop &top, const std::vector<long> &dn_lst, |
std::set<boundary_ent_ifc> &face_lst, ifcel_descript &ifcdel); |
/// search adjacent element to the given one which is connected to the eid-th element boundary entity |
long search_adj_ifc_elem(long eid, long entid, const ivector &e_lst, const siftop &top); |
/// generate doubled interface nodes, reconnect elements in touch with interface and generate interface elements if required |
void gen_iface_elems(const siftop &top_orig, const ivector &gdn_lst, const std::set<boundary_ent_ifc> &face_lst, |
const genopt &gopt, siftop &top_new); |
/// returns number edge property objects involving the interface nodes in the edge property definition |
long num_doubled_nodes_edg_prop(const siftop &top, const ivector &gdn_lst); |
/// returns number surface property objects involving the interface nodes in the surface property definition |
long num_doubled_nodes_surf_prop(const siftop &top, const ivector &gdn_lst); |
/// adds new instances of edge property objects defined with new doubled nodes |
void doubled_nodes_add_edg_prop(siftop &top, long num_dnedgprop, const ivector &gdn_lst); |
/// adds new instances of surface property objects defined with new doubled nodes to the given topology |
void doubled_nodes_add_surf_prop(siftop &top, long num_dnsurfprop, const ivector &gdn_lst); |
/// makes new interface element with id k |
void make_ifc_elem(siftop &top, long eid, const ivector &entnod, const ivector &gdn_lst, const genopt &gopt, const ifcel_descript &ifceld, long k); |
/// comparison operator allowing the use std::set with boundary_ent_ifc class |
bool operator < (const boundary_ent_ifc &lhs, const boundary_ent_ifc &rhs); |
#endif |
/trunk/SIFEL/TRFEL/SRC/Makefile |
---|
38,7 → 38,7 |
SRCS += dnnpsolvert.cpp dnpsolvert.cpp edget.cpp elementt.cpp elemswitcht.cpp endnodet.cpp febex_granit_reten.cpp fourmedia.cpp gardner.cpp gen2delem.cpp |
SRCS += glasgowmat.cpp globalt.cpp globmatt.cpp gmultiphase.cpp grunewaldmat.cpp homogt.cpp homogmat.cpp homogtrans.cpp hydrationheat.cpp |
SRCS += interfacematt.cpp interfacequadrilat.cpp intpointst.cpp isotherm.cpp isotrmat.cpp |
SRCS += kunzel.cpp kunzel2.cpp lhsrhst.cpp lewis_schrefler.cpp linbart.cpp linbart3d.cpp linbartax.cpp lincoupmat.cpp linhext.cpp lintett.cpp |
SRCS += kunzel.cpp kunzel2.cpp lhsrhst.cpp lewis_schrefler.cpp linbart.cpp linbart3d.cpp linbartax.cpp lincoupmat.cpp linhext.cpp lintett.cpp linwedget.cpp |
SRCS += loadcaset.cpp loadelt.cpp masin_reten.cpp millymat.cpp moistheat.cpp multiphase.cpp nlisotrmat.cpp npglvec.cpp nnpsolvert.cpp nodet.cpp nonlinmant.cpp |
SRCS += npsolvert.cpp nspsolvert.cpp onemedium.cpp outdiagt.cpp outdrivert.cpp o30bazant.cpp pedersen.cpp |
SRCS += probdesct.cpp pvalt.cpp potts.cpp quadbart.cpp quadbartax.cpp quadhext.cpp quadlinaxisym.cpp quadlineart.cpp |
/trunk/SIFEL/TRFEL/SRC/aliast.h |
---|
71,12 → 71,12 |
// aliases for elements |
enum elemtypet {barlint=200,barlintax=201,barlint3d=202,barquadt=205,barquadtax=206,trlint=210,trlaxisym=211, |
quadlint=215,quadquadt=216,quadlaxisym=217,quadquadtax=218, |
lineartett=220,linearhext=225,quadratichext=226, |
lineartett=220,linearhext=225,quadratichext=226,linearwedget=228, |
gen2del=300,ifacequadel=351,trquadt=500,trqaxisym=501};//trquadt and trqaxisym not used |
const enumstr elemtypetstr[] = {{"barlint",200},{"barlintax",201},{"barlint3d",202},{"barquadt",205},{"barquadtax",206}, |
{"trlint",210},{"trlaxisym",211},{"trquadt",500},{"trqaxisym",501}, |
{"quadlint",215},{"quadquadt",216},{"quadlaxisym",217},{"quadquadtax",218}, |
{"lineartett",220},{"linearhext",225},{"quadratichext",226},{"gen2del",300}, |
{"lineartett",220},{"linearhext",225},{"quadratichext",226},{"linearwedget",228},{"gen2del",300}, |
{"ifacequadel",351}}; |
const kwdset elemtypet_kwdset(sizeof(elemtypetstr)/sizeof(*elemtypetstr), elemtypetstr); |
/trunk/SIFEL/TRFEL/SRC/elementt.cpp |
---|
78,139 → 78,149 |
xfscanf (in,"%d",(int*)&te); |
switch (te){ |
case barlint:{ |
get=linbar; |
if (Lbt==NULL) |
Lbt = new linbart; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barlint3d:{ |
get=linbar; |
if (Lbt3d==NULL) |
Lbt3d = new linbart3d; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barlintax:{ |
get=linbar; |
if (Lbt==NULL) |
Lbat = new linbartax; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barquadt:{ |
get=quadbar; |
if (Qbt==NULL) |
Qbt = new quadbart; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barquadtax:{ |
get=quadbar; |
if (Qbat==NULL) |
Qbat = new quadbartax; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case trlint:{ |
get=lintriag; |
if (Ltt==NULL) |
Ltt = new trlineart; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case trlaxisym:{ |
get=lintriag; |
if (Ltat==NULL) |
Ltat = new trlinaxisym; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadlint:{ |
get=linquad; |
if (Lqt==NULL) |
Lqt = new quadlineart; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadquadt:{ |
get=quadquad; |
if (Qqt==NULL) |
Qqt = new quadquadrilatt; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadquadtax:{ |
get=quadquad; |
if (Qqat==NULL) |
Qqat = new quadquadrilattax; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadlaxisym:{ |
get=linquad; |
if (Lqat==NULL) |
Lqat = new quadlinaxisym; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case ifacequadel:{ |
get=linquad; |
if (Ifcquadt==NULL) |
Ifcquadt = new interfacequadrilat; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case lineartett:{ |
get=lintetra; |
if (Ltett==NULL) |
Ltett = new lintett; |
if (Tp->gdim < 3) |
case barlint:{ |
get=linbar; |
if (Lbt==NULL) |
Lbt = new linbart; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barlint3d:{ |
get=linbar; |
if (Lbt3d==NULL) |
Lbt3d = new linbart3d; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barlintax:{ |
get=linbar; |
if (Lbt==NULL) |
Lbat = new linbartax; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barquadt:{ |
get=quadbar; |
if (Qbt==NULL) |
Qbt = new quadbart; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case barquadtax:{ |
get=quadbar; |
if (Qbat==NULL) |
Qbat = new quadbartax; |
if (Tp->gdim < 1) |
Tp->gdim=1; |
break; |
} |
case trlint:{ |
get=lintriag; |
if (Ltt==NULL) |
Ltt = new trlineart; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case trlaxisym:{ |
get=lintriag; |
if (Ltat==NULL) |
Ltat = new trlinaxisym; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadlint:{ |
get=linquad; |
if (Lqt==NULL) |
Lqt = new quadlineart; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadquadt:{ |
get=quadquad; |
if (Qqt==NULL) |
Qqt = new quadquadrilatt; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadquadtax:{ |
get=quadquad; |
if (Qqat==NULL) |
Qqat = new quadquadrilattax; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case quadlaxisym:{ |
get=linquad; |
if (Lqat==NULL) |
Lqat = new quadlinaxisym; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case ifacequadel:{ |
get=linquad; |
if (Ifcquadt==NULL) |
Ifcquadt = new interfacequadrilat; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case lineartett:{ |
get=lintetra; |
if (Ltett==NULL) |
Ltett = new lintett; |
if (Tp->gdim < 3) |
Tp->gdim=3; |
break; |
} |
case linearhext:{ |
get=linhexa; |
if (Lht==NULL) |
Lht = new linhext; |
if (Tp->gdim < 3) |
Tp->gdim=3; |
break; |
} |
case quadratichext:{ |
get=quadhexa; |
if (Qht==NULL) |
Qht = new quadhext; |
if (Tp->gdim < 3) |
Tp->gdim=3; |
break; |
} |
case linearhext:{ |
get=linhexa; |
if (Lht==NULL) |
Lht = new linhext; |
if (Tp->gdim < 3) |
Tp->gdim=3; |
break; |
} |
case quadratichext:{ |
get=quadhexa; |
if (Qht==NULL) |
Qht = new quadhext; |
if (Tp->gdim < 3) |
Tp->gdim=3; |
break; |
} |
case gen2del:{ |
get=gen2d; |
break; |
} |
case gen2del:{ |
get=gen2d; |
if (G2d==NULL) |
G2d = new gen2delem; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
if (G2d==NULL) |
G2d = new gen2delem; |
if (Tp->gdim < 2) |
Tp->gdim=2; |
break; |
} |
case linearwedget:{ |
get=linwedge; |
if (Lwt==NULL) |
Lwt = new linwedget; |
if (Tp->gdim < 3) |
Tp->gdim=3; |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
} |
// number of DOFs on element |
ndofe=Tt->give_ndofe (eid); |
/trunk/SIFEL/TRFEL/SRC/elemswitcht.cpp |
---|
78,6 → 78,10 |
Qht->res_conductivity_matrix (eid,lcid,km); |
break; |
} |
case linearwedget:{ |
Lwt->res_conductivity_matrix (eid,lcid,km); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
159,6 → 163,10 |
Qht->res_capacity_matrix (eid,cm); |
break; |
} |
case linearwedget:{ |
Lwt->res_capacity_matrix (eid,cm); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
355,6 → 363,10 |
Qht->grad_matrix(gm, x, y, z, xi, eta, zeta, jac); |
break; |
} |
case linearwedget:{ |
Lwt->grad_matrix(gm, x, y, z, xi, eta, zeta, jac); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
475,6 → 487,10 |
Qht->intpointval (eid); |
break; |
} |
case linearwedget:{ |
Lwt->intpointval (eid); |
break; |
} |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
573,6 → 589,10 |
Lht->initintpointval (eid); |
break; |
} |
case linearwedget:{ |
Lwt->initintpointval (eid); |
break; |
} |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
655,6 → 675,10 |
Qht->intpointgrad (eid); |
break; |
} |
case linearwedget:{ |
Lwt->intpointgrad (eid); |
break; |
} |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
1061,6 → 1085,10 |
Qht->res_quantity_source_vector (lv,nodval,lcid,eid); |
break; |
} |
case linearwedget:{ |
Lwt->res_quantity_source_vector (lv,nodval,lcid,eid); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
1206,6 → 1234,10 |
ret = Qht->approx(xi, eta, zeta, nv); |
break; |
} |
case linearwedget:{ |
ret = Lwt->approx(xi, eta, zeta, nv); |
break; |
} |
default:{ |
print_err("unknown element type is required", __FILE__, __LINE__, __func__); |
} |
2061,6 → 2093,10 |
Qht->res_convection_vector (lv,lcid,eid,i); |
break; |
} |
case linearwedget:{ |
Lwt->res_convection_vector (lv,lcid,eid,i); |
break; |
} |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
2145,6 → 2181,10 |
Qht->res_transmission_vector (lv,lcid,eid,i); |
break; |
} |
case linearwedget:{ |
Lwt->res_transmission_vector (lv,lcid,eid,i); |
break; |
} |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
2318,6 → 2358,10 |
break; |
} |
*/ |
case linearwedget:{ |
Lwt->res_volume_rhs_vector (lv,eid,lcid); |
break; |
} |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
/trunk/SIFEL/TRFEL/SRC/globalt.cpp |
---|
32,6 → 32,7 |
Ltett = NULL; |
Lht = NULL; |
Qht = NULL; |
Lwt = NULL; |
G2d = NULL; |
Outdt = NULL; |
78,6 → 79,7 |
delete Ltett; Ltett = NULL; |
delete Lht; Lht = NULL; |
delete Qht; Qht = NULL; |
delete Lwt; Lwt = NULL; |
delete G2d; G2d = NULL; |
delete Stt; Stt = NULL; |
/trunk/SIFEL/TRFEL/SRC/globalt.h |
---|
23,6 → 23,7 |
#include "lintett.h" |
#include "linhext.h" |
#include "quadhext.h" |
#include "linwedget.h" |
#include "gen2delem.h" |
#include "outdrivert.h" |
#include "stochdrivert.h" |
142,6 → 143,9 |
// 3D hexahedral element with quadratic approximation functions |
EXTERN quadhext *Qht; |
// 3D wedge element with linear approximation functions |
EXTERN linwedget *Lwt; |
// general 2D element used in HERMES |
EXTERN gen2delem *G2d; |
/trunk/SIFEL/TRFEL/SRC/transprint.cpp |
---|
625,6 → 625,34 |
if (print_header == 0) |
fprintf(out, "end Elements\n"); |
print_header = 1; |
for (i=0; i < Tt->ne; i++) |
{ |
if (Gtt->leso[i]==0) |
continue; |
switch(Tt->elements[i].te) |
{ |
case linearwedget: |
if (print_header) |
{ |
fprintf(out, "MESH \"Wedge6\" dimension 3 Elemtype Prism Nnode 6\n"); |
print_header = 0; |
if (print_coord) |
{ |
write_gid_nodest(out, idn1); |
print_coord = 0; |
} |
fprintf(out, "Elements\n"); |
} |
write_gid_elementt(out, i, idn1, ide1); |
break; |
default: |
break; |
} |
} |
if (print_header == 0) |
fprintf(out, "end Elements\n"); |
if (Adat) |
fprintf(out, "End Group\n\n\n"); |
} |
700,7 → 728,7 |
void export_gid_gauss_ptt(FILE *out) |
{ |
long i, j, k, ii, jj, brk,ngp; |
vector gp1, gp2, gp3, gp, w; |
vector gp1, gp2, gp3, gp, w, wt; |
ii = 0;//only for the first block |
jj = 0;//only for the first block |
771,13 → 799,12 |
fprintf(out, "Natural coordinates: given\n"); |
if (Ltt->intordkm[ii][jj]!=0){//only for the first block |
allocv (Ltt->intordkm[ii][jj],w); |
allocv (Ltt->intordkm[ii][jj],gp1); |
allocv (Ltt->intordkm[ii][jj],gp2); |
reallocv(RSTCKVEC(Ltt->intordkm[ii][jj],w)); |
reallocv(RSTCKVEC(Ltt->intordkm[ii][jj],gp1)); |
reallocv(RSTCKVEC(Ltt->intordkm[ii][jj],gp2)); |
gauss_points_tr (gp1.a,gp2.a,w.a,Ltt->intordkm[ii][jj]); |
for (i=0;i<Ltt->intordkm[ii][jj];i++) |
fprintf(out, "%le %le\n", gp1[i], gp2[i]); |
destrv(gp1); destrv(gp2); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
800,13 → 827,12 |
fprintf(out, "Natural coordinates: given\n"); |
if (Ltat->intordkm[ii][jj]!=0){//only for the first block |
allocv (Ltat->intordkm[ii][jj],w); |
allocv (Ltat->intordkm[ii][jj],gp1); |
allocv (Ltat->intordkm[ii][jj],gp2); |
reallocv(RSTCKVEC(Ltat->intordkm[ii][jj],w)); |
reallocv(RSTCKVEC(Ltat->intordkm[ii][jj],gp1)); |
reallocv(RSTCKVEC(Ltat->intordkm[ii][jj],gp2)); |
gauss_points_tr (gp1.a,gp2.a,w.a,Ltat->intordkm[ii][jj]); |
for (i=0;i<Ltat->intordkm[ii][jj];i++) |
fprintf(out, "%le %le\n", gp1[i], gp2[i]); |
destrv(gp1); destrv(gp2); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
829,13 → 855,12 |
fprintf(out, "Natural coordinates: given\n"); |
if (Lqt->intordkm[ii][jj]!=0) {//only for the first block |
allocv (Lqt->intordkm[ii][jj],w); |
allocv (Lqt->intordkm[ii][jj],gp); |
reallocv(RSTCKVEC(Lqt->intordkm[ii][jj],w)); |
reallocv(RSTCKVEC(Lqt->intordkm[ii][jj],gp)); |
gauss_points (gp.a,w.a,Lqt->intordkm[ii][jj]); |
for (i=0;i<Lqt->intordkm[ii][jj];i++) |
for (j=0; j<Lqt->intordkm[ii][jj]; j++) |
fprintf(out, "%le %le\n", -gp[i], -gp[j]); |
destrv(gp); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
858,13 → 883,12 |
fprintf(out, "Natural coordinates: given\n"); |
if (Qqt->intordkm[ii][jj]!=0){//only for the first block |
allocv (Qqt->intordkm[ii][jj],w); |
allocv (Qqt->intordkm[ii][jj],gp); |
reallocv(RSTCKVEC(Qqt->intordkm[ii][jj],w)); |
reallocv(RSTCKVEC(Qqt->intordkm[ii][jj],gp)); |
gauss_points (gp.a,w.a,Qqt->intordkm[ii][jj]); |
for (i=0;i<Qqt->intordkm[ii][jj];i++) |
for (j=0; j<Qqt->intordkm[ii][jj]; j++) |
fprintf(out, "%le %le\n", -gp[i], -gp[j]); |
destrv(gp); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
887,13 → 911,12 |
fprintf(out, "Natural coordinates: given\n"); |
if (Lqat->intordkm[ii][jj]!=0){//only for the first block |
allocv (Lqat->intordkm[ii][jj],w); |
allocv (Lqat->intordkm[ii][jj],gp); |
reallocv(RSTCKVEC(Lqat->intordkm[ii][jj],w)); |
reallocv(RSTCKVEC(Lqat->intordkm[ii][jj],gp)); |
gauss_points (gp.a,w.a,Lqat->intordkm[ii][jj]); |
for (i=0;i<Lqat->intordkm[ii][jj];i++) |
for (j=0; j<Lqat->intordkm[ii][jj]; j++) |
fprintf(out, "%le %le\n", -gp[i], -gp[j]); |
destrv(gp); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
916,13 → 939,12 |
fprintf(out, "Natural coordinates: given\n"); |
if (Qqat->intordkm[ii][jj]!=0) {//only for the first block |
allocv (Qqat->intordkm[ii][jj],w); |
allocv (Qqat->intordkm[ii][jj],gp); |
reallocv(RSTCKVEC(Qqat->intordkm[ii][jj],w)); |
reallocv(RSTCKVEC(Qqat->intordkm[ii][jj],gp)); |
gauss_points (gp.a,w.a,Qqat->intordkm[ii][jj]); |
for (i=0;i<Qqat->intordkm[ii][jj];i++) |
for (j=0; j<Qqat->intordkm[ii][jj]; j++) |
fprintf(out, "%le %le\n", -gp[i], -gp[j]); |
destrv(gp); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
944,14 → 966,13 |
fprintf(out, "Natural coordinates: given\n"); |
if (Ltett->intordkm[ii][jj]!=0) {//only for the first block |
allocv (Ltett->intordkm[ii][jj],w); |
allocv (Ltett->intordkm[ii][jj],gp1); |
allocv (Ltett->intordkm[ii][jj],gp2); |
allocv (Ltett->intordkm[ii][jj],gp3); |
reallocv (RSTCKVEC(Ltett->intordkm[ii][jj],w)); |
reallocv (RSTCKVEC(Ltett->intordkm[ii][jj],gp1)); |
reallocv (RSTCKVEC(Ltett->intordkm[ii][jj],gp2)); |
reallocv (RSTCKVEC(Ltett->intordkm[ii][jj],gp3)); |
gauss_points_tet (gp1.a,gp2.a,gp3.a,w.a,Ltett->intordkm[ii][jj]); |
for (i=0;i<Ltett->intordkm[ii][jj];i++) |
fprintf(out, "%le %le %le\n", gp1[i], gp2[i], gp3[i]); |
destrv(gp1); destrv(gp2); destrv(gp3); destrv(w); |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
973,18 → 994,15 |
fprintf(out, "Natural coordinates: given\n"); |
if (Lht->intordkm[ii][jj]!=0) {//only for the first block |
allocv (Lht->intordkm[ii][jj],w); |
allocv (Lht->intordkm[ii][jj],gp); |
reallocv (RSTCKVEC(Lht->intordkm[ii][jj],w)); |
reallocv (RSTCKVEC(Lht->intordkm[ii][jj],gp)); |
gauss_points(gp.a,w.a,Lht->intordkm[ii][jj]); |
for (i=0;i<Lht->intordkm[ii][jj];i++) |
{ |
for (j=0;j<Lht->intordkm[ii][jj];j++) |
{ |
for (k=0;k<Lht->intordkm[ii][jj];k++) |
fprintf(out, "%le %le %le\n", -gp[i], -gp[j], -gp[k]); |
} |
} |
destrv(gp); destrv(w); |
for (i=0;i<Lht->intordkm[ii][jj];i++){ |
for (j=0;j<Lht->intordkm[ii][jj];j++){ |
for (k=0;k<Lht->intordkm[ii][jj];k++) |
fprintf(out, "%le %le %le\n", -gp[i], -gp[j], -gp[k]); |
} |
} |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
1006,24 → 1024,55 |
fprintf(out, "Natural coordinates: given\n"); |
if (Qht->intordkm[0][0]!=0){ //only for the first block |
allocv (Qht->intordkm[0][0],w); |
allocv (Qht->intordkm[0][0],gp); |
reallocv (RSTCKVEC(Qht->intordkm[0][0],w)); |
reallocv (RSTCKVEC(Qht->intordkm[0][0],gp)); |
gauss_points(gp.a,w.a,Qht->intordkm[0][0]); |
for (i=0;i<Qht->intordkm[0][0];i++) |
{ |
for (j=0;j<Qht->intordkm[0][0];j++) |
{ |
for (k=0;k<Qht->intordkm[0][0];k++) |
fprintf(out, "%le %le %le\n", -gp[i], -gp[j], -gp[k]); |
} |
} |
destrv(gp); destrv(w); |
for (i=0;i<Qht->intordkm[0][0];i++){ |
for (j=0;j<Qht->intordkm[0][0];j++){ |
for (k=0;k<Qht->intordkm[0][0];k++) |
fprintf(out, "%le %le %le\n", -gp[i], -gp[j], -gp[k]); |
} |
} |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
} |
} |
// linear wedge element // |
for (i=0; i < Tt->ne; i++) |
{ |
if (Gtt->leso[i]==0) |
continue; |
if (Tt->elements[i].te == linearwedget) |
{ |
fprintf(out, "GaussPoints \"%d\" Elemtype Prism\n", linearwedget); |
ngp=6; |
fprintf(out, "Number Of Gauss Points: %ld\n",ngp); |
fprintf(out, "Nodes not included\n"); |
fprintf(out, "Natural coordinates: given\n"); |
if (Lwt->intordkmt[ii][jj]!=0) {//only for the first block |
reallocv (RSTCKVEC(Lwt->intordkmz[ii][jj],w)); |
reallocv (RSTCKVEC(Lwt->intordkmz[ii][jj],gp)); |
reallocv (RSTCKVEC(Lwt->intordkmt[ii][jj],wt)); |
reallocv (RSTCKVEC(Lwt->intordkmt[ii][jj],gp1)); |
reallocv (RSTCKVEC(Lwt->intordkmt[ii][jj],gp2)); |
gauss_points (gp.a,w.a,Lwt->intordkmz[ii][jj]); |
gauss_points_tr (gp1.a,gp2.a,wt.a,Lwt->intordkmt[ii][jj]); |
for (i=0;i<Lwt->intordkmt[ii][jj];i++){ |
for (k=0;k<Lwt->intordkmz[ii][jj];k++){ |
fprintf(out, "%le %le %le\n", gp2[i], gp1[(i+1)%3], 0.5*(1.0-gp[k])); |
} |
} |
} |
fprintf(out, "end GaussPoints\n\n"); |
break; |
} |
} |
} |
1978,7 → 2027,7 |
for (i=0; i < Tt->nn; i++) |
{ |
ndof = Tt->give_ndofn(i); |
allocv(ndof, f); |
reallocv(RSTCKVEC(ndof, f)); |
for (j=0;j<ndof;j++) |
{ |
ii=Tt->give_dof(i,j); |
1997,7 → 2046,6 |
for (j=ndof; j < 3; j++) |
fprintf(out, " 0.0"); |
fprintf(out, "\n"); |
destrv(f); |
} |
} |
/trunk/SIFEL/TRFEL/SRC/transtop.cpp |
---|
510,6 → 510,7 |
case lineartett:{ ndofe=Ltett->ndofe; break; } |
case linearhext:{ ndofe=Lht->ndofe; break; } |
case quadratichext:{ ndofe=Qht->ndofe; break; } |
case linearwedget:{ ndofe=Lwt->ndofe; break; } |
case gen2del:{ ndofe=G2d->ndofe; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
536,25 → 537,26 |
te = give_elem_type (eid); |
switch (te){ |
case barlint:{ dofe=Lbt->dofe; break; } |
case barlint3d:{ dofe=Lbt3d->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__); |
} |
case barlint:{ dofe=Lbt->dofe; break; } |
case barlint3d:{ dofe=Lbt3d->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; } |
case linearwedget:{ dofe=Lwt->dofe; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
} |
return dofe; |
} |
576,25 → 578,26 |
te = give_elem_type (eid); |
switch (te){ |
case barlint:{ ordering=Lbt->ordering; break; } |
case barlint3d:{ ordering=Lbt3d->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__); |
} |
case barlint:{ ordering=Lbt->ordering; break; } |
case barlint3d:{ ordering=Lbt3d->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; } |
case linearwedget:{ ordering=Lwt->ordering; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
} |
return ordering; |
} |
664,6 → 667,7 |
case lineartett:{ ncomp=Ltett->ncomp; break; } |
case linearhext:{ ncomp=Lht->ncomp; break; } |
case quadratichext:{ ncomp=Qht->ncomp; break; } |
case linearwedget:{ ncomp=Lwt->ncomp; break; } |
case gen2del:{ ncomp=G2d->ncomp; break; } |
default:{ |
688,21 → 692,22 |
te = give_elem_type (eid); |
switch (te){ |
case barlint:{ ned=Lbt->ned; break; } |
case barlint3d:{ ned=Lbt3d->ned; break; } |
case barlintax:{ ned=Lbat->ned; break; } |
case barquadt:{ ned=Qbt->ned; break; } |
case barquadtax:{ ned=Qbat->ned; break; } |
case trlint:{ ned=Ltt->ned; break; } |
case trlaxisym:{ ned=Ltat->ned; break; } |
case quadlint:{ ned=Lqt->ned; break; } |
case quadlaxisym:{ ned=Lqat->ned; break; } |
case quadquadt:{ ned=Qqt->ned; break; } |
case quadquadtax:{ ned=Qqat->ned; break; } |
case lineartett:{ ned=Ltett->ned; break; } |
case linearhext:{ ned=Lht->ned; break; } |
case quadratichext:{ned=Qht->ned; break; } |
case gen2del:{ ned=0; break; } |
case barlint:{ ned=Lbt->ned; break; } |
case barlint3d:{ ned=Lbt3d->ned; break; } |
case barlintax:{ ned=Lbat->ned; break; } |
case barquadt:{ ned=Qbt->ned; break; } |
case barquadtax:{ ned=Qbat->ned; break; } |
case trlint:{ ned=Ltt->ned; break; } |
case trlaxisym:{ ned=Ltat->ned; break; } |
case quadlint:{ ned=Lqt->ned; break; } |
case quadlaxisym:{ ned=Lqat->ned; break; } |
case quadquadt:{ ned=Qqt->ned; break; } |
case quadquadtax:{ ned=Qqat->ned; break; } |
case lineartett:{ ned=Ltett->ned; break; } |
case linearhext:{ ned=Lht->ned; break; } |
case quadratichext:{ ned=Qht->ned; break; } |
case linearwedget:{ ned=Lwt->ned; break; } |
case gen2del:{ ned=0; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
728,7 → 733,7 |
switch (te){ |
case barlint:{ nned=Lbt->nned; break; } |
case barlint3d:{ nned=Lbt3d->nned; break; } |
case barlint3d:{ nned=Lbt3d->nned; break; } |
case barlintax:{ nned=Lbat->nned; break; } |
case barquadt:{ nned=Qbt->nned; break; } |
case barquadtax:{ nned=Qbat->nned; break; } |
741,6 → 746,7 |
case lineartett:{ nned=Ltett->nned; break; } |
case linearhext:{ nned=Lht->nned; break; } |
case quadratichext:{ nned=Qht->nned; break; } |
case linearwedget:{ nned=Lwt->nned; break; } |
case gen2del:{ nned=0; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
780,6 → 786,7 |
case lineartett:{ nsurf=Ltett->nsurf; break; } |
case linearhext:{ nsurf=Lht->nsurf; break; } |
case quadratichext:{ nsurf=Qht->nsurf; break; } |
case linearwedget:{ nsurf=Lwt->nsurf; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
806,6 → 813,7 |
case lineartett:{ nnsurf=Ltett->nnsurf; break; } |
case linearhext:{ nnsurf=Lht->nnsurf; break; } |
case quadratichext:{ nnsurf=Qht->nnsurf; break; } |
case linearwedget:{ nnsurf=Lwt->nnsurf; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
844,6 → 852,7 |
case lineartett:{ nne=Ltett->nne; break; } |
case linearhext:{ nne=Lht->nne; break; } |
case quadratichext:{ nne=Qht->nne; break; } |
case linearwedget:{ nne=Lwt->nne; break; } |
case gen2del:{ nne=G2d->nne; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
871,7 → 880,7 |
switch (te){ |
case barlint:{ nip=Lbt->nip[ri][ci]; break; } |
case barlint3d:{ nip=Lbt3d->nip[ri][ci]; break; } |
case barlint3d:{ nip=Lbt3d->nip[ri][ci]; break; } |
case barlintax:{ nip=Lbat->nip[ri][ci]; break; } |
case barquadt:{ nip=Qbt->nip[ri][ci]; break; } |
case barquadtax:{ nip=Qbat->nip[ri][ci]; break; } |
885,6 → 894,7 |
case lineartett:{ nip=Ltett->nip[ri][ci]; break; } |
case linearhext:{ nip=Lht->nip[ri][ci]; break; } |
case quadratichext:{ nip=Qht->nip[ri][ci]; break; } |
case linearwedget:{ nip=Lwt->nip[ri][ci]; break; } |
case gen2del:{ nip=G2d->nip[ri][ci]; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
1094,6 → 1104,7 |
case lineartett:{ deg=1; break; } |
case linearhext:{ deg=1; break; } |
case quadratichext:{ deg=2; break; } |
case linearwedget:{ deg=1; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
} |
1132,6 → 1143,7 |
case lineartett:{ dim=3; break; } |
case linearhext:{ dim=3; break; } |
case quadratichext:{ dim=3; break; } |
case linearwedget:{ dim=3; break; } |
case gen2del:{ dim=2; break; } |
default:{ |
print_err("unknown element type is required",__FILE__,__LINE__,__func__); |
1212,6 → 1224,9 |
case quadratichext:{ |
break; |
} |
case linearwedget:{ |
break; |
} |
case gen2del:{ |
break; |
} |
1487,6 → 1502,11 |
ncompbco=Qht->nnsurf; |
break; |
} |
case linearwedget:{ |
bco=Lwt->nsurf; |
ncompbco=Lwt->nnsurf; |
break; |
} |
case gen2del:{ |
bco=0; |
ncompbco=0; |
/trunk/SIFEL/TRFEL/SRC/van_genuchten.cpp |
---|
188,9 → 188,9 |
else |
sigt = 0.0019106*exp(0.05*(633.15-t)); |
p0 = p0*sigt/sig0; |
expm = 1.0/(1.0-lambda0); |
fd = pow((1.0-(-pw)/pd),lambdap); |
p0 = p0*sigt/sig0; |
expm = 1.0/(1.0-lambda0); |
fd = pow((1.0-(-pw)/pd),lambdap); |
ft = 1.0;//temp |
theta = pow(1+(pow((-pw/p0),expm)),-lambda0)*fd*ft; |
sw = sirr + (ssat - sirr)*theta; |
/trunk/SIFEL/zipsif |
---|
8,6 → 8,6 |
echo Creating backup file prg$FNAME.zip with following files $FILETYPES |
zip -R prg$FNAME $FILETYPES -x 691/\* EXAM/\* GEFEL/PETSC/\* GEFEL/CHOLMOD/\* ARCHIVES/\* EXAMPLES/\* WORK/\* |
zip -R prg$FNAME $FILETYPES -x 691/\* EXAM/\* GEFEL/PERMON/\* GEFEL/PETSC/\* GEFEL/CHOLMOD/\* ARCHIVES/\* EXAMPLES/\* WORK/\* |
echo Backup file prg$FNAME.zip was created |