-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[L-IE] supporting fracture intersections in mechanics #2235
Conversation
8b582ba
to
bb1a621
Compare
i can't find out why Jenkins is failing. anyone can help me? |
I think it's a temporary internet access error: |
@endJunction can you please restart the Jenkins again? |
The jenkins run also fine, but has new warnings; Github cannot display the "unstable" build, so it is displaying a failure. The warnings are: The builds automatically starts, if there is a change in commit hash, e.g. by changing the last commit's date. |
@endJunction thanks! |
i think now this PR is ready for reviewing |
// unit vector normal to the master fracture in a direction to the slave | ||
Eigen::Vector3d normal_vector_branch; | ||
|
||
virtual ~BranchProperty() = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Since nothing is derived from this class, I'd drop the dtor and mark the class
final
. - Reorder the members as {coords, normal, node_id, further ints} s.t. to reduce the holes in the memory because of alignment.
- Not sure, but might be necessary to have aligned new operator http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
MeshLib::Node const& branchNode, | ||
FractureProperty const& master_frac, | ||
FractureProperty const& slave_frac, | ||
BranchProperty& branch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consideration: I'd rather return a new Branch object, or maybe create a constructor to the Branch class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
namespace | ||
{ | ||
// Heaviside step function | ||
inline double Heaviside(double v) | ||
{ | ||
return (v < 0.0) ? 0.0 : 1.0; | ||
return (v < 0.0) ? 0.0 : 1.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems, that the clang-format is not using the .clang-format
from the source root...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will check it
} | ||
|
||
template <class T_VEC, class T_V> | ||
inline bool inList(T_VEC const& vec, T_V const& v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would suggest to move it to BaseLib/Algorithm.h, and rename to contains
or similar, because it is not acting on lists only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
std::unordered_map<int,int> const& fracID_to_local, | ||
Eigen::Vector3d const& x) | ||
{ | ||
auto this_frac_local_index = fracID_to_local.at(this_frac_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if bound checked access is intended; if not use operator[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: i remember it now. i had to use at()
because fracID_to_local
is const. operator[]
cannot be used because it is non-const.
ProcessLib/LIE/Common/MeshUtils.cpp
Outdated
frac_nodeID_to_matIDs[node->getID()].push_back(vec_fracture_mat_IDs[i]); | ||
|
||
auto opt_material_ids( | ||
mesh.getProperties().getPropertyVector<int>("MaterialIDs")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is MeshLib::materialIDs(mesh)
function returning a pointer with additional checks of the property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ProcessLib/LIE/Common/PostUtils.cpp
Outdated
return (itr2 != vec_nodes.end()); | ||
} | ||
|
||
std::vector<int> const& getmatids( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
longer names are preferred and use camelCase for function names, e.g. getMaterialIdsForNode(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
master_frac.branches_master.emplace_back(branch); | ||
|
||
BranchProperty* branch2 = new BranchProperty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new code new
is not welcome (unless you have to as in copying the MeshLib's nodes). I also didn't see the reason to store pointers in the *.branches_master/slave
vectors instead of the branch objects.
In any case this is a memory leak.
I was wrong, no memory leak, because the branches_master/slave
are vectors of unique_ptr's.
Still the question remains, why store pointers instead of values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the number of branches varies depending on problem, i store them as a vector of its pointers. i am not sure if I understand your question.
{ | ||
struct BranchProperty | ||
{ | ||
int node_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These members can be set as const by introducing a constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it can be const but i don't see a definitive reason for it.
computeNormalVector(e, dim, frac_prop.normal_vector); | ||
frac_prop.R.resize(dim, dim); | ||
computeRotationMatrix(e, frac_prop.normal_vector, dim, frac_prop.R); | ||
} | ||
|
||
|
||
inline void setBranchProperty( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be converted to a constructor of BranchProperty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here i intentionally separate data and functions (to let myself focus on the data structure during coding).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
5e27400
to
f8cf098
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue my previous review
computeNormalVector(e, dim, frac_prop.normal_vector); | ||
frac_prop.R.resize(dim, dim); | ||
computeRotationMatrix(e, frac_prop.normal_vector, dim, frac_prop.R); | ||
} | ||
|
||
inline BranchProperty* createBranchProperty(MeshLib::Node const& branchNode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this function is called to fill _process_data._vec_junction_property
which is a vector of unique_ptr. I think that you can return std::unique_ptr<BranchProperty>
in this function. Then use std::move in line 139 of file
ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don’t like to use unique ptr too much. current implementation is already readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is just related to the operator of new
. If a new
is used, one may try to find a delete
. If you prefer to use it, it is OK. All other stuffs are OK for me too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
benchmarks failed.
FractureProperty const& master_frac, | ||
FractureProperty const& slave_frac) | ||
{ | ||
BranchProperty* branch = new BranchProperty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new can be replace with make_unique if the return type is change to unique_ptr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
return branch; | ||
} | ||
|
||
inline JunctionProperty* createJunctionProperty( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the same.
for (std::size_t i = 0; i < junction_props.size(); i++) | ||
{ | ||
auto const* junction = junction_props[i]; | ||
auto fid1 = fracID_to_local.at(junction->fracture_IDs[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good to add const to these three definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don’t see reason for it, though fid1 is already const
fracID_to_local.end()) | ||
continue; | ||
|
||
double singned = boost::math::sign( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not important as the scope is limited
if (!BaseLib::contains(junction->fracture_IDs, this_frac.fracture_id)) | ||
continue; | ||
|
||
auto another_frac_id = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not important as the scope is limited
@@ -72,6 +76,11 @@ class HydroMechanicsLocalAssemblerMatrixNearFracture | |||
|
|||
static const int displacement_jump_index = | |||
displacement_index + displacement_size; | |||
|
|||
std::vector<FractureProperty*> _fracture_props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to use std::vector<std::reference_wrapper<const unique_ptr> > because the vector is pushed with process_data.fracture_property.get().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the suggestion. however that way is too complicated for me
@@ -75,9 +79,9 @@ void HydroMechanicsLocalAssemblerMatrixNearFracture< | |||
|
|||
// levelset value of the element | |||
// remark: this assumes the levelset function is uniform within an element | |||
auto const& fracture_props = *_process_data.fracture_property; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fracture_props
was set as member of the class as _fracture_props
. However I could not found where _fracture_props
is initialized. May be I am wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fracture_property
is initialized in CreateSmallDeformationProcess.cpp and moved to the process data. see https://github.com/ufz/ogs/blob/master/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp#L143
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that is initialized after creating its owner.
7e27f44
to
e3d6fa9
Compare
4904a1b
to
46cc9d2
Compare
OpenGeoSys development has been moved to GitLab. |
supporting branch/junction intersections of fractures in 2D M problems