Example #1
0
void beam_PK1_stress_function(TensorValue<double>& PP,
                              const TensorValue<double>& FF,
                              const libMesh::Point& /*X*/,
                              const libMesh::Point& s,
                              Elem* const /*elem*/,
                              const vector<NumericVector<double>*>& /*system_data*/,
                              double /*time*/,
                              void* /*ctx*/)
{      const double dist2root = sqrt((s(0) - 0) * (s(0) - 0));
    if (dist2root <= fixed_L) // we use penalty method to fix the root
    {
        PP = 0.0 * FF; // so we no longer compute stress here
	return ;
    }

 
    // 1)  compute the radius r(x) : r_x
    double arc_s = get_arc_length(s(0));
    const double r_x = slope * arc_s + r0;
    // 2) compute ratio_moduli;
    const double ratio_radius = r_x /r0; 
    const double ratio_moduli = ratio_radius *  ratio_radius*  ratio_radius*  ratio_radius;

   
        
        const TensorValue<double> CC = FF.transpose() * FF;
        const TensorValue<double> EE = 0.5 * (CC - II);
        const TensorValue<double> SS = lambda_s * EE.tr() * II + 2.0 * mu_s * EE;
        PP = ratio_moduli * FF * SS;
 
    return;
} // beam_PK1_stress_function
Example #2
0
double RefEdge::fraction_from_arc_length(RefVertex *root_vertex,
                                         double     length)
{
  if (root_vertex != start_vertex() && root_vertex != end_vertex())
    return -1.0;
 
  if (geometry_type() == POINT_CURVE_TYPE || get_arc_length() < GEOMETRY_RESABS)
    return 0.0;
 
  if (length >= get_arc_length())
    return 1.0;

  if (root_vertex == start_vertex())
    return length/get_arc_length();

  else
    return 1-length/get_arc_length();
}
Example #3
0
//-------------------------------------------------------------------------
// Purpose       : Initializes the member data of the RefEdge
//
// Special Notes :
//
// Creator       : Malcolm J. Panthaki
//
// Creation Date : 10/07/96
//-------------------------------------------------------------------------
void RefEdge::initialize()
{
    // Initialize some member data
  refEdgeClone = 0;
  markedFlag = CUBIT_FALSE;

    // Make sure the arc length is not zero if there are start and end 
    // RefVertex'es already assigned to this RefEdge
  if ( get_arc_length() < CUBIT_DBL_MIN )  
  {
    if ( start_vertex() && end_vertex() )
    {
      CubitVector start_pt = start_vertex()->coordinates();
      CubitVector end_pt   = end_vertex()->coordinates();
      PRINT_WARNING ( "(RefEdge::initialize): Edge has zero arclength.\n"
                      "  Start vertex location is (%9.2f, %9.2f, %9.2f ).\n"
                      "  End   vertex location is (%9.2f, %9.2f, %9.2f ).\n",
          start_pt.x(), start_pt.y(), start_pt.z(),
          end_pt.x(), end_pt.y(), end_pt.z() );
    }
    else if (!mSuppressEdgeLengthWarning)
    {
      PRINT_WARNING( "Edge found with zero arclength\n"
                     "  For cones, this may be normal.\n");
    }
    
  }
  
    // Set the Entity ID for this new RefEdge
   GeometryEntity* geom_ptr = get_geometry_entity_ptr();
   int saved_id = geom_ptr->get_saved_id();
   if ( !saved_id || RefEntityFactory::instance()->get_ref_edge(saved_id) )
   {
     saved_id =  RefEntityFactory::instance()->next_ref_edge_id();
     geom_ptr->set_saved_id(saved_id);
   }
   entityId = saved_id;
  
     // read and initialize attributes
   auto_read_cubit_attrib();
   auto_actuate_cubit_attrib();

     // Assign a default entity name
   assign_default_name();
}
Example #4
0
deque<int> Graph::critical_path(int source, int sink)
{
	/*
		Retourne le chemin critique de la source vers la fin de valeur de maximale
	*/
	vector<int> d = max_distances(source);

	deque<int> path;						// PILE = []
	path.push_front(sink);					// PILE <- t
	int v = sink;							// v := t
	bool excess = false;
	while (v != source)						// while v != s do
	{										// begin
		int u;
		for (int i=0; i<incoming_arcs[v].size(); i++)
			if (d[v] == d[incoming_arcs[v][i].vertex_id] + get_arc_length(incoming_arcs[v][i].vertex_id, v)) // incoming_arcs[v][i] - "Candidat" pour u
				{
					u = incoming_arcs[v][i].vertex_id;	// u := sommet pour lequel D(v) = D(u) + A(u, v)
					break;
				}
		path.push_front(u);					// PILE <- u
		v = u;								// v := u
		if (path.size() > 1000 && !excess) { debug("Excessive path size!\n"); excess = true; }
	}										// end

	//printf("path.size() = %d\n", path.size());

	debug("critical path from %d to %d: ", source, sink);
	for (int i=0; i<path.size(); i++)
		debug("%d ", path[i]);
	debug("\n");




	return path;
}
Example #5
0
double RefEdge::measure()
{
  return get_arc_length();
}