MASTmultiphysics / mast-multiphysics

Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST) - Sensitivity-enabled multiphysics FEA for design
https://www.mast-multiphysics.com
GNU Lesser General Public License v2.1
44 stars 25 forks source link

Applying point loads to a discipline #29

Open anupzope opened 5 years ago

anupzope commented 5 years ago

Similar to the code here, does following code correctly setup the discipline for accepting point loads from the FSI module?

MAST::PointLoadCondition fluid_load(MAST::POINT_LOAD);
libMesh::MeshBase::node_iterator niter   = mesh.nodes_begin();
libMesh::MeshBase::node_iterator niterend  = mesh.nodes_end();
for ( ; niter != niterend; ++niter) {
  fluid_load.add_node(**niter);
}
discipline.add_volume_load(0, fluid_load);

Further, how do I pass the actual load values to the solver in the time stepping loop?

manavbhatia commented 5 years ago

This code is used when MAST computes the values that are placed in the force vector. Since you will be computing nodal pressure load contribution externally, we will need to add a separate route to add that contribution to our Newton-Raphson solver.

At this point, you should try to add a code block similar to the following (this is conceptually correct, but will need to be massaged slightly for bugs and working in an MPI environment):

libMesh::NumericVector<Real>& loads = system.add_vector("loads");
unsigned int 
sys_num=0, 
u_displ = 0,
v_displ = 1, 
w_displ = 2;
libMesh::MeshBase::node_iterator niter   = mesh.nodes_begin();
libMesh::MeshBase::node_iterator niterend  = mesh.nodes_end();
for ( ; niter != niterend; ++niter) {
const libMesh::Node& n = **niter;
loads.set(n.dof_number(sys_num, u_displ, 0), f_x);
loads.set(n.dof_number(sys_num, v_displ, 0), f_y);
loads.set(n.dof_number(sys_num, w_displ, 0), f_z);
}

f_x, f_y, f_z are the forces values for this node computed from your FSI module.

anupzope commented 5 years ago

Question: When using MPI parallelism, does the node iteration loop results in iterations over local nodes on each process?

manavbhatia commented 5 years ago

This depends on the kind of iterator you instantiate.

There also also other types of iterators (see the documentation of MeshBase), but this should suffice for now.