Hi Andrew,
the reaction forces are the forces in the FE nodes, that are fixed by the Dirichlet boundary conditions - is that what you want?
If yes, such forces can be easily computed by assembling, after the problem has been solved, the residual vector of your equation without the Dirichlet BCs [1], e.g. by:
[1] https://scicomp.stackexchange.com/a/29350
# state is the State containing your variables with the problem solution. state.apply_ebc() nls = problem.get_nls() residual = nls.fun(state())
then the reaction forces in the nodes of a given region can be obtained by:
reg = problem.domain.regions[region_name] dofs = field.get_dofs_in_region(reg, merge=True)
res = residual.reshape((-1, dim)) # dim = space dimension = DOFs per node. reactions = res[dofs]
Some more answers below...
On 1/16/19 5:44 PM, andrew.glusiec@gmail.com wrote:
Not sure if I should open a new thread, but I'm having a very similar problem where I can't figure out how to calculate the reaction forces and torques through a face of a 3D model. I have the model working to the point where I have the following commands execute successfully:
svar = FieldVariable('sigma', 'parameter', field, primary_var_name='sigma') stress = ev('ev_cauchy_stress.3.Omega(m.D, u)', mode='qp', copy_materials=False) svar.set_from_qp(stress, integral) supportstresses = ev('ev_surface_integrate.3.Gamma1(sigma)', var_dict={'sigma':svar}, mode='qp') geo, _ = field.get_mapping(region, integral, 'surface')
I now have what I believe are variables that represent: Cauchy Stress throughout the model (stress)
Yes, in the quadrature points in the volume of the domain. Not surface.
Normal vectors/Jacobians for the face (geo)
Yes.
I am confused as to what supportstresses represents, if it is even a useful quantity, I thought it would be the reaction forces, but the results don't seem to correlate well with the forces I should be seeing
If the field of svar is a surface field, then supportstresses should be the stress interpolated to the surface quadrature points from the surface field nodes of svar. Also, another averaging/interpolation occurred to get the stress from the volume QP to the svar field nodes in svar.set_from_qp(stress, integral).
So I am now lost on how to pick out the stresses that correspond to the face where the support is located and then convert that information to a simple np array for use in this equation:
np.sum(np.dot(stress, geo.normal) * geo.det)
Maybe you are just missing using the region, where you have the support defined? Is it Gamma1?
Also note, that ev_cauchy_strain_s term can be used to directly evaluate the strain on a surface region. The same term for the stress is not implemented, but it would be an easy addition. Or you can just take the strain, and multiply it by the material tensor D_ijkl.
My goal once the reaction forces are working is to also calculate reaction torques if possible based on the distances of each force to some normal axis, but I don't know how I would go about getting the position information needed for this.
I can post my full code if that would be helpful. Does anyone have suggestions that could help determine the reaction forces and moments?
Yes, if the above does not help you, post a minimalistic (small mesh etc.) running example that demonstrates what you want to achieve.
Cheers, r.