@@ -525,12 +525,12 @@ double FELogFluidRateOfDefXZ::value(FEElement& el)
525525// =============================================================================
526526
527527// -----------------------------------------------------------------------------
528- // ! Fluid surface force along X
528+ // ! Fluid surface force
529529// -----------------------------------------------------------------------------
530- double FELogFluidSurfaceForceX::value (FESurface& surface)
530+ vec3d FELogFluidSurfaceForce::typedValue (FESurface& surface)
531531{
532532 FESurface* pcs = &surface;
533- if (pcs == 0 ) return false ;
533+ if (pcs == 0 ) return vec3d ( 0 , 0 , 0 ) ;
534534
535535 int NF = pcs->Elements ();
536536 vec3d fn (0 ,0 ,0 ); // initialize
@@ -582,188 +582,5 @@ double FELogFluidSurfaceForceX::value(FESurface& surface)
582582 }
583583 }
584584
585- return fn.x ;
586- }
587-
588- // -----------------------------------------------------------------------------
589- // ! Fluid surface force along Y
590- // -----------------------------------------------------------------------------
591- double FELogFluidSurfaceForceY::value (FESurface& surface)
592- {
593- FESurface* pcs = &surface;
594- if (pcs == 0 ) return false ;
595-
596- int NF = pcs->Elements ();
597- vec3d fn (0 ,0 ,0 ); // initialize
598-
599- // calculate the vectorial area of each surface element and to identify solid element associated with this surface element
600- m_area.resize (NF );
601- for (int j=0 ; j<NF ; ++j)
602- {
603- FESurfaceElement& el = pcs->Element (j);
604- m_area[j] = pcs->SurfaceNormal (el,0 ,0 )*pcs->FaceArea (el);
605- }
606-
607- // calculate net fluid force
608- for (int j=0 ; j<NF ; ++j)
609- {
610- FESurfaceElement& el = pcs->Element (j);
611-
612- // get the element this surface element belongs to
613- FEElement* pe = el.m_elem [0 ].pe ;
614- if (pe)
615- {
616- // get the material
617- FEMaterial* pm = GetFEModel ()->GetMaterial (pe->GetMatID ());
618- FEFluidMaterial* pfluid = pm->ExtractProperty <FEFluidMaterial>();
619-
620- if (!pfluid) {
621- pe = el.m_elem [1 ].pe ;
622- if (pe) pfluid = GetFEModel ()->GetMaterial (pe->GetMatID ())->ExtractProperty <FEFluidMaterial>();
623- }
624-
625- // see if this is a fluid element
626- if (pfluid) {
627- // evaluate the average stress in this element
628- int nint = pe->GaussPoints ();
629- mat3d s (mat3dd (0 ));
630- for (int n=0 ; n<nint; ++n)
631- {
632- FEMaterialPoint& mp = *pe->GetMaterialPoint (n);
633- FEFluidMaterialPoint& pt = *(mp.ExtractData <FEFluidMaterialPoint>());
634- s += pt.m_sf ;
635- }
636- s /= nint;
637-
638- // Evaluate contribution to net force on surface.
639- // Negate the fluid traction since we want the traction on the surface,
640- // which is the opposite of the traction on the fluid.
641- fn -= s*m_area[j];
642- }
643- }
644- }
645-
646- return fn.y ;
647- }
648-
649- // -----------------------------------------------------------------------------
650- // ! Fluid surface force along Z
651- // -----------------------------------------------------------------------------
652- double FELogFluidSurfaceForceZ::value (FESurface& surface)
653- {
654- FESurface* pcs = &surface;
655- if (pcs == 0 ) return false ;
656-
657- int NF = pcs->Elements ();
658- vec3d fn (0 ,0 ,0 ); // initialize
659-
660- // calculate the vectorial area of each surface element and to identify solid element associated with this surface element
661- m_area.resize (NF );
662- for (int j=0 ; j<NF ; ++j)
663- {
664- FESurfaceElement& el = pcs->Element (j);
665- m_area[j] = pcs->SurfaceNormal (el,0 ,0 )*pcs->FaceArea (el);
666- }
667-
668- // calculate net fluid force
669- for (int j=0 ; j<NF ; ++j)
670- {
671- FESurfaceElement& el = pcs->Element (j);
672-
673- // get the element this surface element belongs to
674- FEElement* pe = el.m_elem [0 ].pe ;
675- if (pe)
676- {
677- // get the material
678- FEMaterial* pm = GetFEModel ()->GetMaterial (pe->GetMatID ());
679- FEFluidMaterial* pfluid = pm->ExtractProperty <FEFluidMaterial>();
680-
681- if (!pfluid) {
682- pe = el.m_elem [1 ].pe ;
683- if (pe) pfluid = GetFEModel ()->GetMaterial (pe->GetMatID ())->ExtractProperty <FEFluidMaterial>();
684- }
685-
686- // see if this is a fluid element
687- if (pfluid) {
688- // evaluate the average stress in this element
689- int nint = pe->GaussPoints ();
690- mat3d s (mat3dd (0 ));
691- for (int n=0 ; n<nint; ++n)
692- {
693- FEMaterialPoint& mp = *pe->GetMaterialPoint (n);
694- FEFluidMaterialPoint& pt = *(mp.ExtractData <FEFluidMaterialPoint>());
695- s += pt.m_sf ;
696- }
697- s /= nint;
698-
699- // Evaluate contribution to net force on surface.
700- // Negate the fluid traction since we want the traction on the surface,
701- // which is the opposite of the traction on the fluid.
702- fn -= s*m_area[j];
703- }
704- }
705- }
706-
707- return fn.z ;
708- }
709-
710- // -----------------------------------------------------------------------------
711- // ! Fluid surface force magnitude
712- // -----------------------------------------------------------------------------
713- double FELogFluidSurfaceForce::value (FESurface& surface)
714- {
715- FESurface* pcs = &surface;
716- if (pcs == 0 ) return false ;
717-
718- int NF = pcs->Elements ();
719- vec3d fn (0 ,0 ,0 ); // initialize
720-
721- // calculate the vectorial area of each surface element and to identify solid element associated with this surface element
722- m_area.resize (NF );
723- for (int j=0 ; j<NF ; ++j)
724- {
725- FESurfaceElement& el = pcs->Element (j);
726- m_area[j] = pcs->SurfaceNormal (el,0 ,0 )*pcs->FaceArea (el);
727- }
728-
729- // calculate net fluid force
730- for (int j=0 ; j<NF ; ++j)
731- {
732- FESurfaceElement& el = pcs->Element (j);
733-
734- // get the element this surface element belongs to
735- FEElement* pe = el.m_elem [0 ].pe ;
736- if (pe)
737- {
738- // get the material
739- FEMaterial* pm = GetFEModel ()->GetMaterial (pe->GetMatID ());
740- FEFluidMaterial* pfluid = pm->ExtractProperty <FEFluidMaterial>();
741-
742- if (!pfluid) {
743- pe = el.m_elem [1 ].pe ;
744- if (pe) pfluid = GetFEModel ()->GetMaterial (pe->GetMatID ())->ExtractProperty <FEFluidMaterial>();
745- }
746-
747- // see if this is a fluid element
748- if (pfluid) {
749- // evaluate the average stress in this element
750- int nint = pe->GaussPoints ();
751- mat3d s (mat3dd (0 ));
752- for (int n=0 ; n<nint; ++n)
753- {
754- FEMaterialPoint& mp = *pe->GetMaterialPoint (n);
755- FEFluidMaterialPoint& pt = *(mp.ExtractData <FEFluidMaterialPoint>());
756- s += pt.m_sf ;
757- }
758- s /= nint;
759-
760- // Evaluate contribution to net force on surface.
761- // Negate the fluid traction since we want the traction on the surface,
762- // which is the opposite of the traction on the fluid.
763- fn -= s*m_area[j];
764- }
765- }
766- }
767-
768- return fn.norm ();
585+ return fn;
769586}
0 commit comments