Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Micropp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ggiuntol
Micropp
Commits
3632d327
Commit
3632d327
authored
Aug 05, 2019
by
Guido Giuntoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding MIC3D_FIBS_20_DISORDER microstructure
Modifying MIC3D_SPHERES
parent
2591d8be
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
164 additions
and
34 deletions
+164
-34
include/micro.hpp
include/micro.hpp
+8
-3
include/util.hpp
include/util.hpp
+20
-2
src/homogenize.cpp
src/homogenize.cpp
+1
-1
src/micro_common.cpp
src/micro_common.cpp
+121
-26
test/benchmark-mic-2.cpp
test/benchmark-mic-2.cpp
+7
-1
test/benchmark-mic-3.cpp
test/benchmark-mic-3.cpp
+7
-1
No files found.
include/micro.hpp
View file @
3632d327
...
...
@@ -138,20 +138,25 @@ enum {
MIC_QUAD_FIB_XYZ
,
MIC_QUAD_FIB_XZ
,
MIC_QUAD_FIB_XZ_BROKEN_X
,
MIC_SPHERES
,
MIC3D_8
MIC3D_SPHERES
,
MIC3D_8
,
MIC3D_FIBS_20_DISORDER
};
/*
* MIC_HOMOGENEOUS : Only one material (mat[0])
*
* MIC3D_SPHERES : (2 materials) Random spheres.
*
* MIC3D_8 : (3 materiales) 2 cilinders at 90 deg with a layer around the
* perimeter and a flat layer between the fibers.
*
* MIC3D_FIBS_20_DISORDER: (2 materiales) 20 fibers in random directions.
*
*/
enum
{
NO_COUPLING
,
LINEAR
,
ONE_WAY
,
FULL
};
...
...
include/util.hpp
View file @
3632d327
...
...
@@ -124,8 +124,25 @@ inline T dot_prod(const T v1[n], const T v2[n])
}
inline
bool
point_inf_cilinder
(
const
double
dir
[
3
],
const
double
center
[
3
],
const
double
radius
,
const
double
point
[
3
])
inline
bool
point_inside_sphere
(
const
double
center
[
3
],
const
double
radius
,
const
double
point
[
3
])
{
/*
* Returns <true> if <point> is inside the sphere with <center> and
* <radius>. Returns <false> otherwise.
*/
const
double
v
[
3
]
=
{
point
[
0
]
-
center
[
0
],
point
[
1
]
-
center
[
1
],
point
[
2
]
-
center
[
2
]};
return
(
norm
<
double
,
3
>
(
v
)
<
radius
)
?
true
:
false
;
}
inline
bool
point_inside_cilinder_inf
(
const
double
dir
[
3
],
const
double
center
[
3
],
const
double
radius
,
const
double
point
[
3
])
{
/*
* Returns <true> if <point> is inside the infinite cilinder with
...
...
@@ -143,6 +160,7 @@ inline bool point_inf_cilinder(const double dir[3], const double center[3],
const
double
cos_tetha
=
dir_dot_v
/
(
norm_dir
*
norm_v
);
const
double
sin_tetha
=
sqrt
(
1
-
cos_tetha
*
cos_tetha
);
const
double
d_1
=
norm_v
*
sin_tetha
;
return
(
d_1
<=
radius
)
?
true
:
false
;
}
...
...
src/homogenize.cpp
View file @
3632d327
...
...
@@ -66,7 +66,7 @@ void micropp<tdim>::homogenize(const int homog_type)
gp_t
<
tdim
>
*
gp_ptr
=
&
gp_list
[
igp
];
if
((
homog_type
==
HOMOG_LINEAR
&&
gp_ptr
->
coupling
==
ONE_WAY
)
||
gp_ptr
->
coupling
==
NO_COUPLING
)
{
||
gp_ptr
->
coupling
==
LINEAR
)
{
/*
* Computational cheap calculation
...
...
src/micro_common.cpp
View file @
3632d327
...
...
@@ -80,7 +80,7 @@ micropp<tdim>::micropp(const micropp_params_t ¶ms):
if
(
params
.
coupling
!=
nullptr
)
{
gp_list
[
gp
].
coupling
=
params
.
coupling
[
gp
];
switch
(
params
.
coupling
[
gp
])
{
case
NO_COUPLING
:
case
LINEAR
:
num_no_coupling
++
;
break
;
case
ONE_WAY
:
...
...
@@ -489,35 +489,64 @@ int micropp<tdim>::get_elem_type(int ex, int ey, int ez) const
return
0
;
}
else
if
(
micro_type
==
MIC_SPHERES
)
{
}
else
if
(
micro_type
==
MIC
3D
_SPHERES
)
{
/* Distribution of Several Spheres of diferent sizes */
const
double
factor
=
geo_params
[
0
];
const
int
num
=
9
;
const
double
centers
[
num
][
3
]
=
{
{
0.50
*
lx
,
0.50
*
ly
,
0.50
*
lz
},
{
0.22
*
lx
,
0.65
*
ly
,
0.10
*
lz
},
{
0.21
*
lx
,
0.80
*
ly
,
0.90
*
lz
},
{
0.10
*
lx
,
0.19
*
ly
,
0.35
*
lz
},
{
0.20
*
lx
,
0.17
*
ly
,
0.85
*
lz
},
{
0.65
*
lx
,
0.81
*
ly
,
0.15
*
lz
},
{
0.81
*
lx
,
0.78
*
ly
,
0.60
*
lz
},
{
0.77
*
lx
,
0.35
*
ly
,
0.25
*
lz
},
{
0.70
*
lx
,
0.15
*
ly
,
0.80
*
lz
}
const
int
num_spheres
=
20
;
const
double
centers
[
num_spheres
][
3
]
=
{
{
.8663
,
.0689
,
.1568
},
{
.2305
,
.4008
,
.2093
},
{
.1987
,
.8423
,
.2126
},
{
.6465
,
.7095
,
.4446
},
{
.6151
,
.9673
,
.2257
},
{
.1311
,
.9739
,
.4129
},
{
.8433
,
.0738
,
.2233
},
{
.5124
,
.2111
,
.0369
},
{
.4094
,
.7030
,
.6241
},
{
.1215
,
.8289
,
.3812
},
{
.1125
,
.9266
,
.6872
},
{
.7422
,
.4030
,
.6000
},
{
.0791
,
.3819
,
.9297
},
{
.1201
,
.7712
,
.0069
},
{
.9339
,
.2177
,
.1976
},
{
.3880
,
.1331
,
.9032
},
{
.7319
,
.7146
,
.8150
},
{
.8796
,
.2858
,
.6701
},
{
.1427
,
.9309
,
.9830
},
{
.1388
,
.3126
,
.8054
}
};
const
double
rads
[
num_spheres
]
=
{
0.1
*
.5741
,
0.1
*
.1735
,
0.1
*
.5065
,
0.1
*
.8565
,
0.1
*
.9735
,
0.1
*
.7087
,
0.1
*
.9585
,
0.1
*
.2843
,
0.1
*
.4029
,
0.1
*
.2574
,
0.1
*
.1575
,
0.1
*
.3316
,
0.1
*
.1874
,
0.1
*
.6300
,
0.1
*
.7049
,
0.1
*
.7258
,
0.1
*
.8002
,
0.1
*
.8176
,
0.1
*
.9970
,
0.1
*
.4736
};
double
rads
[
num
]
=
{
0.3
,
0.22
,
0.13
,
0.08
,
0.20
,
0.17
,
0.19
,
0.21
,
0.15
};
for
(
int
i
=
0
;
i
<
num
;
++
i
)
rads
[
i
]
*=
factor
;
for
(
int
i
=
0
;
i
<
num
;
++
i
)
{
double
tmp
=
0.
;
for
(
int
d
=
0
;
d
<
dim
;
++
d
)
tmp
+=
(
centers
[
i
][
d
]
-
coor
[
d
])
*
(
centers
[
i
][
d
]
-
coor
[
d
]);
if
(
tmp
<
rads
[
i
]
*
rads
[
i
])
for
(
int
i
=
0
;
i
<
num_spheres
;
++
i
)
{
if
(
point_inside_sphere
(
centers
[
i
],
rads
[
i
],
coor
))
{
return
1
;
}
}
return
0
;
...
...
@@ -595,6 +624,69 @@ int micropp<tdim>::get_elem_type(int ex, int ey, int ez) const
return
2
;
}
}
else
if
(
micro_type
==
MIC3D_FIBS_20_DISORDER
)
{
const
int
num_fibs
=
20
;
const
double
radius
=
0.05
;
const
double
dirs
[
num_fibs
][
3
]
=
{
{
1
,
.5741
,
.8515
},
{
1
,
.1735
,
.1103
},
{
1
,
.5065
,
.4600
},
{
1
,
.8565
,
.9045
},
{
1
,
.9735
,
.6313
},
{
1
,
.7087
,
.1547
},
{
1
,
.9585
,
.0220
},
{
1
,
.2843
,
.4062
},
{
1
,
.4029
,
.8095
},
{
1
,
.2574
,
.4742
},
{
1
,
.1575
,
.0768
},
{
1
,
.3316
,
.0320
},
{
1
,
.1874
,
.6364
},
{
1
,
.6300
,
.2688
},
{
1
,
.7049
,
.5137
},
{
1
,
.7258
,
.2799
},
{
1
,
.8002
,
.4794
},
{
1
,
.8176
,
.4142
},
{
1
,
.9970
,
.2189
},
{
1
,
.4736
,
.6202
}
};
const
double
centers
[
num_fibs
][
3
]
=
{
{
.8663
,
.0689
,
.1568
},
{
.2305
,
.4008
,
.2093
},
{
.1987
,
.8423
,
.2126
},
{
.6465
,
.7095
,
.4446
},
{
.6151
,
.9673
,
.2257
},
{
.1311
,
.9739
,
.4129
},
{
.8433
,
.0738
,
.2233
},
{
.5124
,
.2111
,
.0369
},
{
.4094
,
.7030
,
.6241
},
{
.1215
,
.8289
,
.3812
},
{
.1125
,
.9266
,
.6872
},
{
.7422
,
.4030
,
.6000
},
{
.0791
,
.3819
,
.9297
},
{
.1201
,
.7712
,
.0069
},
{
.9339
,
.2177
,
.1976
},
{
.3880
,
.1331
,
.9032
},
{
.7319
,
.7146
,
.8150
},
{
.8796
,
.2858
,
.6701
},
{
.1427
,
.9309
,
.9830
},
{
.1388
,
.3126
,
.8054
}
};
for
(
int
i
=
0
;
i
<
num_fibs
;
++
i
)
{
if
(
point_inside_cilinder_inf
(
dirs
[
i
],
centers
[
i
],
radius
,
coor
))
{
// Is in a Fiber
return
1
;
}
}
// Is in the Matrix
return
0
;
}
cerr
<<
"Invalid micro_type = "
<<
micro_type
<<
endl
;
...
...
@@ -667,18 +759,21 @@ void micropp<tdim>::print_info() const
case
(
MIC_QUAD_FIB_XZ_BROKEN_X
):
cout
<<
"MIC_QUAD_FIB_XZ_BROKEN_X"
<<
endl
;
break
;
case
(
MIC_SPHERES
):
cout
<<
"MIC_SPHERES"
<<
endl
;
case
(
MIC
3D
_SPHERES
):
cout
<<
"MIC
3D
_SPHERES"
<<
endl
;
break
;
case
(
MIC3D_8
):
cout
<<
"MIC3D_8"
<<
endl
;
break
;
case
(
MIC3D_FIBS_20_DISORDER
):
cout
<<
"MIC3D_FIBS_20_DISORDER"
<<
endl
;
break
;
default:
cout
<<
"NO TYPE"
<<
endl
;
break
;
}
cout
<<
"
NO_COUPLING
: "
<<
num_no_coupling
<<
" GPs"
<<
endl
;
cout
<<
"
LINEAR
: "
<<
num_no_coupling
<<
" GPs"
<<
endl
;
cout
<<
"ONE_WAY : "
<<
num_one_way
<<
" GPs"
<<
endl
;
cout
<<
"FULL : "
<<
num_full
<<
" GPs"
<<
endl
;
cout
<<
"USE A0 : "
<<
use_A0
<<
endl
;
...
...
test/benchmark-mic-2.cpp
View file @
3632d327
...
...
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
mic_params
.
size
[
0
]
=
n
;
mic_params
.
size
[
1
]
=
n
;
mic_params
.
size
[
2
]
=
n
;
mic_params
.
type
=
MIC3D_
8
;
mic_params
.
type
=
MIC3D_
SPHERES
;
mic_params
.
geo_params
[
0
]
=
0.1
;
mic_params
.
geo_params
[
1
]
=
0.02
;
mic_params
.
geo_params
[
2
]
=
0.01
;
...
...
@@ -89,6 +89,12 @@ int main(int argc, char **argv)
micropp
<
3
>
micro
(
mic_params
);
//micro.print_info();
if
(
print
)
{
char
filename
[
128
];
snprintf
(
filename
,
128
,
"micropp_%d"
,
0
);
micro
.
output
(
0
,
filename
);
}
ofstream
file
;
file
.
open
(
"result.dat"
);
...
...
test/benchmark-mic-3.cpp
View file @
3632d327
...
...
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
mic_params
.
size
[
0
]
=
n
;
mic_params
.
size
[
1
]
=
n
;
mic_params
.
size
[
2
]
=
n
;
mic_params
.
type
=
MIC3D_
8
;
mic_params
.
type
=
MIC3D_
FIBS_20_DISORDER
;
mic_params
.
geo_params
[
0
]
=
0.1
;
mic_params
.
geo_params
[
1
]
=
0.02
;
mic_params
.
geo_params
[
2
]
=
0.01
;
...
...
@@ -89,6 +89,12 @@ int main(int argc, char **argv)
micropp
<
3
>
micro
(
mic_params
);
//micro.print_info();
if
(
print
)
{
char
filename
[
128
];
snprintf
(
filename
,
128
,
"micropp_%d"
,
0
);
micro
.
output
(
0
,
filename
);
}
ofstream
file
;
file
.
open
(
"result.dat"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment