CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions > OpenFOAM CC Toolkits for Fluid-Structure Interaction

solids4Foam + sixDoFRigidBodyDisplacement

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2020, 21:39
Default
  #21
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
Sorry for the careless. I did not notice my text editor folded the code in
void Foam::fluidSolidInterface::moveFluidMesh().
It is where the fluid mesh is moved.
Michael@UW is offline   Reply With Quote

Old   March 27, 2020, 11:57
Default
  #22
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Michael@UW View Post
1. Can the solid mesh be moved by the solver? It seems staticFvMesh is used in all the tutorials for the solid part.
You are correct that all the solid solvers are using staticFvMesh, however, this is because the solid mesh motion (if any) is implemented in the solid model classes themselves. I do agree that it would be nicer to follow the standard OpenFOAM-style of defining dynamic meshes and this might be something that will be done in the future but for now it is within each solid model class.

Also, it is worth mentioning that all solid models calculate the deformation but deepening on the formulation they might not move the mesh.

Quote:
Originally Posted by Michael@UW View Post
2. In all the fsi solvers inherited from fluidSolidInterface, I find the function moveFluidMesh seems to do nothing. Did I miss some codes?

My finding is that moveFluidMesh is a virtual function in fluidSolidInterface, and is not overridden in the derived classes.

For example, here is the code for
Code:
bool AitkenCouplingInterface::evolve()
{
  ... 
   do
    {
        outerCorr()++;

        // Transfer the displacement from the solid to the fluid
        updateDisplacement();

        // Move the fluid mesh
        moveFluidMesh(); // does nothing?

        // Solve fluid
        fluid().evolve(); 

        // Transfer the force from the fluid to the solid
    //    updateForce();

        // Solve solid
        solid().evolve();

        // Calculate the FSI residual
        residualNorm = updateResidual();
    }
    while (residualNorm > outerCorrTolerance() && outerCorr() < nOuterCorr());

    solid().updateTotalFields();

....
}
You can find the implementation of fluidSolidInterface::moveFluidMesh() in the base class itself; see line 686 in fluidSolidInterface.C:
Code:
void Foam::fluidSolidInterface::moveFluidMesh()
{
    // Get fluid patch displacement from fluid zone displacement                                                                                                                                                                       
    // Take care: these are local patch fields not global patch fields                                                                                                                                                                 

    List<vectorField> fluidPatchesPointsDispls
    (
        nGlobalPatches_, vectorField()
    );

    List<vectorField> fluidPatchesPointsDisplsPrev
    (
     	nGlobalPatches_, vectorField()
    );

    ...

}
Philip
bigphil is offline   Reply With Quote

Old   March 27, 2020, 15:08
Default
  #23
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
1. Though a solid solver uses staticFvMesh, the mesh moves according to the displacement field. The solid mesh is moved when calling updateTotalFields() in the coupling, for instance in AitkenCouplingInterface::evolve().

Code:
void nonLinGeomUpdatedLagSolid::updateTotalFields()
{
    // Density
    rho_ = rho_.oldTime()/relJ_;

    // Move the mesh to the deformed configuration
#ifdef OPENFOAMESIORFOUNDATION
    const vectorField oldPoints = mesh().points();
#else
    const vectorField oldPoints = mesh().allPoints();
#endif
    moveMesh(oldPoints, DD(), pointDD());

    solidModel::updateTotalFields();
}

2. If I want to manually add some displacement to the solid, is the following procedure correct?

The purpose is to give the boundary of the interface a rigid body motion.
(I do not want to model the whole solid domain but need to consider the gravity force)

The procedure I use is as follows:

First, move the solid mesh due to force. (But do not solve the solid, because it only adds a same constant displacement to all the points)

Next, move the interface boundary of fluid, using dynamic solver update the mesh.

Then, solve the fluid domain to update the force.

Finally, enter into the ordinary fulid-solid coupling loop with modified meshes.

The nonLinGeomUpdatedLagSolid solver is used which solves the Displacement Increment, so I modify the incremental displacement manually.

Code:
bool AitkenCouplingInterface::evolve()
{
    initializeFields();

    updateInterpolatorAndGlobalPatches();

    scalar residualNorm = 0;

    
   {
 
    // Total force at the solid side of the interface
    scalar mass=33.4/2; 
    static vector v=vector(0,0,0);
    scalar ds=0.0;
    //prepare rigid body motion

    vector totalForceOnFluid=vector::zero;
    {
        for (label interfaceI = 0; interfaceI < nGlobalPatches(); interfaceI++)
        {
            // Take references to zones
            const standAlonePatch& fluidZone = fluid().globalPatches()[interfaceI].globalPatch();
            const standAlonePatch& solidZone = solid().globalPatches()[interfaceI].globalPatch();

            // Calculate total traction of fluid zone
            vectorField fluidZoneTotalTraction = fluid().faceZoneViscousForce(interfaceI)
                                                - fluid().faceZonePressureForce(interfaceI)*fluidZone.faceNormals();

            // Initialise the solid zone traction field that is to be interpolated from the fluid zone
            vectorField solidZoneTotalTraction(solidZone.size(), vector::zero);

            // Transfer the field frm the fluid interface to the solid interface
            interfaceToInterfaceList()[interfaceI].transferFacesZoneToZone
            (
                fluidZone,                 // from zone
                solidZone,                 // to zone
                fluidZoneTotalTraction,    // from field
                solidZoneTotalTraction     // to field
            );

            // Flip traction sign after transferring from fluid to solid
            solidZoneTotalTraction = -solidZoneTotalTraction;
            
            totalForceOnSolid+=totalForceOnInterface(solidZone, solidZoneTotalTraction);
            
        }

        vector a=totalForceOnSolid/mass+vector(0,0,-9.81);
        scalar dt=runTime().deltaT().value();
        v=v+a*dt;

        ds=v.z()*dt;  // only consider z direction

        Info << "Acceleration = " << a << endl;
        Info << "Rigid displacement = " << ds <<endl;  
    }

    
    // modify solid mesh
    {
        volVectorField vdd
        ( 
            IOobject
                (
                    "vdd",
                    runTime().timeName(),
                    solid().mesh(),
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                ),
            solid().mesh(),
            dimensionedVector("vdd", dimensionSet(0,1,0,0,0,0,0), vector(0,0,ds))
        );

      solid().DD()==vdd;    // manually add the rigid body motion to the whole solid.
      solid().updateTotalFields();     // solid mesh is moved according to PointDD which is interpelated from DD.
    }
   
   //modify fluid mesh
    {
        Info<< "#-------------modifying pointMotionU ---------------# " << endl;
    
        //Find the reference to the location of pointMotionU field
        pointVectorField& pointMotionU = const_cast<pointVectorField&>
        (
            fluid().mesh().objectRegistry::lookupObject<pointVectorField>
            (
            "pointMotionU"
            )
        );

        //Get the vector field of the patch
        forAll(fluidPatchIndices(), patchi)
        {
            vectorField &pMotionU=refCast<vectorField>(pointMotionU.boundaryField()[fluidPatchIndices()[patchi]]);
            
            //Find the relevant size of the vector and declare a vectorField.
            int Psize= pMotionU.size();
            vectorField pointMotionUVals(Psize);
            
            // loop over points to move the nodes
            forAll(pointMotionUVals, index)
            {
                pointMotionUVals[index].x() = 0;
                pointMotionUVals[index].y() = 0;
                pointMotionUVals[index].z() = v.z();
            }
        
            
            //Once the values have been assigned to pointMotionUVals, assign them to pointMotionU boundaryField
            pointMotionU.boundaryField()[fluidPatchIndices()[patchi]] == pointMotionUVals;
            
            fluid().mesh().update(); // mesh is updated due to the updated pointMotionU using velocityLaplacian(dynamicMotionSolverFvMesh) solver.
            fluid().mesh().moving(false); // Avoid affect the dynamic mesh in the fsi coupling loop. Not sure if it is necesary.
        }
    
        // after rigid body motion, Solve fluid
        fluid().evolve();              

    }
    
     // end of modification
    
     }
      
    
    

//original coupling loop
    do
    {
        //break;
        outerCorr()++;

        // Transfer the displacement from the solid to the fluid
        updateDisplacement();

        // Move the fluid mesh
        moveFluidMesh();

        // Solve fluid
        fluid().evolve();

        // Transfer the force from the fluid to the solid
        updateForce();

        // Solve solid
        solid().evolve();

        // Calculate the FSI residual
        residualNorm = updateResidual();

        // Optional: write residuals to file
        if (writeResidualsToFile() && Pstream::master())
        {
            residualFile()
                << runTime().value() << " "
                << outerCorr() << " "
                << residualNorm << endl;
        }
    }
    while (residualNorm > outerCorrTolerance() && outerCorr() < nOuterCorr());

    solid().updateTotalFields();
    return 0;
}
Michael@UW is offline   Reply With Quote

Old   March 27, 2020, 15:30
Default
  #24
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
From the picture, the mesh moving and deformation can be seen, though the fluid boundary (interface) is not conformal with the solid interface (something is wrong with the solution).

The final solid shape is the actual position but not the warped one.

Michael@UW is offline   Reply With Quote

Old   March 30, 2020, 06:27
Default
  #25
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Michael@UW View Post
2. If I want to manually add some displacement to the solid, is the following procedure correct?

The purpose is to give the boundary of the interface a rigid body motion.
(I do not want to model the whole solid domain but need to consider the gravity force)
Hi Michael@UW,

I am struggling a bit to understand what you are trying to do, however, the following points may help to clarify some things:
  • For Lagrangian approaches, the solid mesh and solid deformation field are not independent. It is not correct to manipulate the mesh without taking it into account in the displacement field itself. Maybe you can do what you intend through appropriate use of solid boundary conditions.
  • The FSI interface (for both solid and fluid) is an interior face and the solution at the FSI interface is part of solution i.e. it is not like a boundary condition where you can specify what you like. Like internal faces within the solid and fluid, the FSI interface is enforcing conservation of mass and momentum.

Hope it helps,
Philip
Daniel_Khazaei likes this.
bigphil is offline   Reply With Quote

Old   March 31, 2020, 19:26
Default
  #26
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
Hi Philip,

Thank you for your reply. I know it is not practical, but I intend to have solid4Foam solve the coupling problem without considering the gravity of solid first (g=0 in solid region), then I manually add the rigid body motion to the solution. Because I need to take the counterweight into account, i.e., the mass cannot be calculated by the solid solver, but should be specified manually.

By the way, is the solid mass calculated by density*volume, where the volume is the total solid mesh volume and density is specified in 'mechanicalProperties'?

Can I just increase the density to count for the counterweight?

As for my wedge model, I am struggling with setting appropriate boundary conditions on them. I want the two ends to have no deformation but the whole wedge is free to fall. I have tried fixDisplacment, symmetryPlane, solidTractionFree and solidSymmetry; they are all not appropriate.

The results look more reasonable by the ad hoc way I aformentioned, i.e.
1) before the fsi coupling, the rigid body motion (considering the gravity of solid) is calculated and superimposed to the solid, which just change the initial state (a constant value is added to the mesh, D, and DD)

2) accordingly, move the interface boundary of the fluid domain and solve the fluid problem and update the force(the initial one to be transferred to solid in the coupling loop).

3) then solving the fsi problem (without considering the gravity of solid) by fixing the two ends (fixedDisplacement).

In my opinion, the additional rigid body motion only does not affect the coupling algorithm because it only changes the initial conditions before entering the coupling loop. Of course, it may cause more coupling iterations.

Hopefully, my problem and intention are a little bit clearer.

I appreciate any of your comments or suggestions.

Michael
Michael@UW is offline   Reply With Quote

Old   August 24, 2020, 05:41
Default
  #27
zqz
New Member
 
QianZe ZHUANG
Join Date: Oct 2019
Location: DA LIAN
Posts: 3
Rep Power: 7
zqz is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Good question.

I had presumed it was for some other boundary e.g. 6DoF for one solid and FSI for the other, however, this may not be the case.
Hi Phillip,
I'm trying to simulate a case just like you said, there are two solids, 6DoF for one solid, and FSI for the other.

I remember you said that the displacementLaplacian can not be applied in solid4Foam, but as I know the sixDoRigidBodyDisplacement can only be uesd when I choose the displacementLaplacian, so does that mean I can not use 6DoF in the situation?

Thanks,
zqz
zqz is offline   Reply With Quote

Old   August 24, 2020, 05:52
Default
  #28
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by zqz View Post
Hi Phillip,
I'm trying to simulate a case just like you said, there are two solids, 6DoF for one solid, and FSI for the other.

I remember you said that the displacementLaplacian can not be applied in solid4Foam, but as I know the sixDoRigidBodyDisplacement can only be uesd when I choose the displacementLaplacian, so does that mean I can not use 6DoF in the situation?

Thanks,
zqz
In theory you can use the displacement laplacian mesh motion solver with solids4foam. I know Danial made a branch on the git to make a fix for this but I think we still had issues with symmetry planes. You can have a look at that if you are comfortable with code and git; if not then you may have to wait until it is fixed.

Philip
zqz likes this.
bigphil is offline   Reply With Quote

Old   August 24, 2020, 06:46
Default
  #29
zqz
New Member
 
QianZe ZHUANG
Join Date: Oct 2019
Location: DA LIAN
Posts: 3
Rep Power: 7
zqz is on a distinguished road
Quote:
Originally Posted by bigphil View Post
In theory you can use the displacement laplacian mesh motion solver with solids4foam. I know Danial made a branch on the git to make a fix for this but I think we still had issues with symmetry planes. You can have a look at that if you are comfortable with code and git; if not then you may have to wait until it is fixed.

Philip
Thanks for your suggestion! By the way, do you have the URL of Danial's work, I try to search but get nothing until now.
zqz is offline   Reply With Quote

Old   August 24, 2020, 06:50
Default
  #30
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
It is the "feature-displacementLaplacian" branch here: https://bitbucket.org/philip_cardiff...ease/branches/
bigphil is offline   Reply With Quote

Old   January 17, 2024, 10:00
Default
  #31
New Member
 
Runxin Luo
Join Date: Mar 2022
Posts: 6
Rep Power: 4
Naive is on a distinguished road
Quote:
Originally Posted by zqz View Post
Hi Phillip,
I'm trying to simulate a case just like you said, there are two solids, 6DoF for one solid, and FSI for the other.

I remember you said that the displacementLaplacian can not be applied in solid4Foam, but as I know the sixDoRigidBodyDisplacement can only be uesd when I choose the displacementLaplacian, so does that mean I can not use 6DoF in the situation?

Thanks,
zqz
I would like to ask you if you have solved this problem, I have been working on it recently and I found that after using sixDoFRigidBodyDisplacement the deformed body is moving as a rigid body, so the deformation is very small!
Naive is offline   Reply With Quote

Old   April 28, 2024, 12:55
Default
  #32
zqz
New Member
 
QianZe ZHUANG
Join Date: Oct 2019
Location: DA LIAN
Posts: 3
Rep Power: 7
zqz is on a distinguished road
Quote:
Originally Posted by Naive View Post
I would like to ask you if you have solved this problem, I have been working on it recently and I found that after using sixDoFRigidBodyDisplacement the deformed body is moving as a rigid body, so the deformation is very small!
Hello, I think we can get in touch about the question more deeply, 0580zqz@gmail.com, it is my email
zqz is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pimpleFoam is right, how about solids4Foam pimpleFluid? amuzeshi OpenFOAM Running, Solving & CFD 6 December 9, 2019 11:55
[solids4Foam] How to calculate drag coeff when using solids4Foam amuzeshi OpenFOAM CC Toolkits for Fluid-Structure Interaction 15 November 7, 2019 13:50
Fatal error in solids4Foam brunomramoa OpenFOAM CC Toolkits for Fluid-Structure Interaction 1 October 16, 2019 13:26
Overset FSI - pimpleOversetFluid is unknown to solids4Foam amuzeshi OpenFOAM CC Toolkits for Fluid-Structure Interaction 2 September 29, 2019 15:31
[FSI] solids4Foam vs icoFsiElasticNonLinULSolidFoam on HPC server amuzeshi OpenFOAM CC Toolkits for Fluid-Structure Interaction 7 August 31, 2019 06:26


All times are GMT -4. The time now is 12:03.