Skip to content

Commit a6630fd

Browse files
committed
Modified fluid surface force log output to use vector output
1 parent ce0412b commit a6630fd

3 files changed

Lines changed: 7 additions & 231 deletions

File tree

FEBioFluid/FEBioFluid.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,6 @@ REGISTER_FECORE_CLASS(FELogFluidRateOfDefZZ , "fdzz");
294294
REGISTER_FECORE_CLASS(FELogFluidRateOfDefXY , "fdxy");
295295
REGISTER_FECORE_CLASS(FELogFluidRateOfDefYZ , "fdyz");
296296
REGISTER_FECORE_CLASS(FELogFluidRateOfDefXZ , "fdxz");
297-
REGISTER_FECORE_CLASS(FELogFluidSurfaceForceX , "fsfx");
298-
REGISTER_FECORE_CLASS(FELogFluidSurfaceForceY , "fsfy");
299-
REGISTER_FECORE_CLASS(FELogFluidSurfaceForceZ , "fsfz");
300297
REGISTER_FECORE_CLASS(FELogFluidSurfaceForce , "fsf" );
301298

302299
//-----------------------------------------------------------------------------

FEBioFluid/FEBioFluidData.cpp

Lines changed: 4 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

FEBioFluid/FEBioFluidData.h

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -324,50 +324,12 @@ class FELogFluidRateOfDefXZ : public FELogElemData
324324
//=============================================================================
325325

326326
//-----------------------------------------------------------------------------
327-
//! Fluid surface force along X
328-
//!
329-
class FELogFluidSurfaceForceX : public FELogSurfaceData
327+
class FELogFluidSurfaceForce : public FELogSurfaceVec3dData
330328
{
331329
private:
332330
vector<vec3d> m_area;
333331

334332
public:
335-
FELogFluidSurfaceForceX(FEModel* pfem) : FELogSurfaceData(pfem) {}
336-
double value(FESurface& surface) override;
337-
};
338-
339-
//! Fluid surface force along Y
340-
//!
341-
class FELogFluidSurfaceForceY : public FELogSurfaceData
342-
{
343-
private:
344-
vector<vec3d> m_area;
345-
346-
public:
347-
FELogFluidSurfaceForceY(FEModel* pfem) : FELogSurfaceData(pfem) {}
348-
double value(FESurface& surface) override;
349-
};
350-
351-
//! Fluid surface force along Z
352-
//!
353-
class FELogFluidSurfaceForceZ : public FELogSurfaceData
354-
{
355-
private:
356-
vector<vec3d> m_area;
357-
358-
public:
359-
FELogFluidSurfaceForceZ(FEModel* pfem) : FELogSurfaceData(pfem) {}
360-
double value(FESurface& surface) override;
361-
};
362-
363-
//! Fluid surface force magnitude
364-
//!
365-
class FELogFluidSurfaceForce : public FELogSurfaceData
366-
{
367-
private:
368-
vector<vec3d> m_area;
369-
370-
public:
371-
FELogFluidSurfaceForce(FEModel* pfem) : FELogSurfaceData(pfem) {}
372-
double value(FESurface& surface) override;
333+
FELogFluidSurfaceForce(FEModel* fem) : FELogSurfaceVec3dData(fem) {}
334+
vec3d typedValue(FESurface& surf) override;
373335
};

0 commit comments

Comments
 (0)