Closed ermore closed 3 years ago
for(auto nodes : elem->node_index_range()){
This is a range-based for loop syntax, so the variable "nodes" in this case is poorly named. Within the body of the loop it is a pointer to a single Node node index.
~~Furthermore
elem->node_ptr(nodes)
doesn't make sense, since the Elem::node_ptr()
function takes a single index for its argument. I can't quite understand exactly what you are trying to do, but maybe you are trying to explicitly set values in element rhs vectors, which should be straightforward once you fix the errors I mentioned above...~~
For the whole model, I know the load on some nodes, these nodes may come from different elements, how should I set it up?
I edited my original comment, sorry, it must have been too early in the morning. It looks like what you are doing is actually pretty close. If you want to avoid applying the load multiple times as you encounter the same node from multiple elements, you could keep track of nodes you have already encountered in a separate container (e.g. std::set) and then skip them the next time you come across them?
I have a question about how to use libmesh .I'm not familiar with it at present.
How to apply load on edge in 3D problems?
Is there an example of how to apply boundary conditions and loads (from user specified set nodes or edge or face) in the example or test folder?