CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Prescribing the Loading Condition in solids4Foam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2021, 06:43
Default Prescribing the Loading Condition in solids4Foam
  #1
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
HI All,
I am presently working on a structural analysis problem. But, I have a problem, which I think can be addressed but I am not very familiar with it.



Assume that we have a boundary, a patch that represents one surface of a structure, such as the wing of an airplane, or bottom of a ship section, that is exposed to fluid loads. We have already simulated the fluid motion problem by using some mathematical models, which is performed in a unsteady framework. It means that we have the p(x,y,z,t) value. Here p is the pressure. At the current stage, we want to compute the deformation of the structure, of course over time, as it is exposed to this unsteady pressure. I am wondering how we can implement this condition. I have seen that we can do it for displacement. But, can we do it for pressure distribution over the a surface, which itself varies over the time. Just to make it clearer, we can have a .txt or .dat output for pressure distribution, that gives five column, including time, x, y, z and pressure. We have also rows, each of which refers to a specific time-step. In general, we can get the output in the way we want.


Thank you in advance,
Sasan
ttsasan is offline   Reply With Quote

Old   February 17, 2021, 07:54
Default
  #2
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Sasan,

It will not be too difficult to make a custom version of the solidTraction boundary condition which reads in csv/txt files of the pressure distribution. The challenge will be how we can interpolate/map this data to the OpenFOAM patch, as I am guessing the number of points are not the same. Do you have thoughts on conceptually how to do this?

Philip
bigphil is offline   Reply With Quote

Old   February 17, 2021, 19:05
Default
  #3
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
Hi Philip
Thank you for your reply. It's a bit flexible. I have a grid on the surface. You are right. Number of points on my own code, are different from the one I generate in solids4foam.
I can go through three different approaches:
1) I can get the force distribution on the surface. i.e, I can divide the surface into a bunch of patches, like 20, 30 or whatever, and then give the time history of the force vector for each of these patches as a txt file. Each txt file then include four columns. The first one is time, the next ones are the force in x, y and z directions.
2) I can use only one force file. In this case, I don't divide the surface into sub-surfaces. I assume all surface is a single patch and prescribe the time history of the force on this patch. But, the problem is that we need to also prescribe the center of forces as it varies over the time. I can save the center of forces in x, y and z direction. But, i don't know whether it helps or not.

3) I can get a pressure distribution file. In this case, I can save a text file with a large number of columns. Each column represents one point on the surface. We will then have the time history of the pressure at each point. We can have different rows, and each row corresponds to a special time-step.


I think the first one can be a good option. We just need to have some txt file, each corresponding to one patch.
ttsasan is offline   Reply With Quote

Old   March 11, 2021, 13:07
Default
  #4
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Sasan,

Hmnn the challenge here is to map/interpolate from your point cloud to the patch. There are definitely many ways to do this so I guess it is about funding the easiest way to do it that is still sufficiently accurate.

If there are not too many points in the point cloud, the radial basis functions (RBF) may be a straight-forward approach e.g. as can be used for mapping data at the FSI interface. We could re-use the code from the FSI class (rbfInterfaceToInterfaceMapping.[HC]); basically the code there allows mapping from one point cloud to another. This would allow you to read in your "X Y Z pressure" data and then map this point cloud to the patch faces at every time-step.

However, this will require some coding (how do you feel about that?).

You can see the code at:
Code:
solids4foam-release/src/solids4FoamModels/fluidSolidInterfaces/fluidSolidInterface/interfaceToInterfaceMapping/rbfInterfaceToInterfaceMapping/rbfInterfaceToInterfaceMapping.C
For example, to make the RBF interpolator, look at rbfInterfaceToInterfaceMapping.C, from line 41:
Code:
void rbfInterfaceToInterfaceMapping::makeZoneAToZoneBInterpolator() const
{
...
   std::shared_ptr<RBFFunctionInterface> rbfFunction;
    rbfFunction = std::shared_ptr<RBFFunctionInterface>(new TPSFunction());

    zoneAToZoneBInterpolatorPtr_ =
        std::shared_ptr<RBFInterpolation>
        (
            new RBFInterpolation(rbfFunction)
        );

    const vectorField zoneBFaceCentres = zoneB().faceCentres();
    const vectorField zoneAFaceCentres = zoneA().faceCentres();

    matrix zoneAX(zoneAFaceCentres.size(), 3);
    matrix zoneBX(zoneBFaceCentres.size(), 3);

    forAll(zoneAFaceCentres, faceI)
    {
        zoneAX(faceI, 0) = zoneAFaceCentres[faceI].x();
        zoneAX(faceI, 1) = zoneAFaceCentres[faceI].y();
        zoneAX(faceI, 2) = zoneAFaceCentres[faceI].z();
    }

    forAll(zoneBFaceCentres, faceI)
    {
        zoneBX(faceI, 0) = zoneBFaceCentres[faceI].x();
        zoneBX(faceI, 1) = zoneBFaceCentres[faceI].y();
        zoneBX(faceI, 2) = zoneBFaceCentres[faceI].z();
    }

    zoneAToZoneBInterpolatorPtr_->compute(zoneAX, zoneBX);
...
}
where the two zones here represent the two point clouds (they don't need to be face-centres; they are just coordinates).

Then an example mapping/interpolation is performed just after this:
Code:
    matrix zoneAXatZoneB(zoneBFaceCentres.size(), 3);

    zoneAToZoneBInterpolatorPtr_->interpolate(zoneAX, zoneAXatZoneB);

    vectorField zoneAFaceCentresAtZoneB(zoneBFaceCentres.size(), vector::zero);

    forAll(zoneAFaceCentresAtZoneB, faceI)
    {
        zoneAFaceCentresAtZoneB[faceI].x() = zoneAXatZoneB(faceI, 0);
        zoneAFaceCentresAtZoneB[faceI].y() = zoneAXatZoneB(faceI, 1);
        zoneAFaceCentresAtZoneB[faceI].z() = zoneAXatZoneB(faceI, 2);
    }

    const scalar maxDist = gMax
    (
        mag(zoneAFaceCentresAtZoneB - zoneBFaceCentres)
    );
where here we are just checking the interpolation error by interpolating the coordinates themselves to see how much error is introduced.

If you are able to add this code into a new custom boundary condition (derived from solidTraction) then I can help advise on coding issues.

Philip
bigphil is offline   Reply With Quote

Old   September 29, 2021, 02:49
Default
  #5
New Member
 
Philipp Conen
Join Date: Jul 2021
Location: Germany, NRW
Posts: 22
Rep Power: 4
philippconen is on a distinguished road
Dear Sasan,

I would like to know if you managed to handle this problem and if you have some tips towards this approach.

Greetings!
philippconen is offline   Reply With Quote

Old   September 29, 2021, 04:16
Default
  #6
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
Quote:
Originally Posted by philippconen View Post
Dear Sasan,

I would like to know if you managed to handle this problem and if you have some tips towards this approach.

Greetings!

Hi George.
Thank you for your message. I liked to do it. But, I have been busy, so I didn't go deep through in it. Are you aiming to do so?
ttsasan is offline   Reply With Quote

Old   September 29, 2021, 04:33
Default
  #7
New Member
 
Philipp Conen
Join Date: Jul 2021
Location: Germany, NRW
Posts: 22
Rep Power: 4
philippconen is on a distinguished road
Dear Sasan,

I am working on a digital twin approach for an aircraft wing for my thesis. For this, I would like to have a One-Way-FSI and a Two-Way-FSI where both are coupled with a dynamic mesh (time depending rotation of the wing).

I have existing models in ANSYS, but because of software and license problems and because of the code sharing approach I would like to switch to OpenFOAM.

Sad to hear that you don't have the time to finish the project. But do you have any other information on this topic which are not already mentioned in this thread?

Greetings!
philippconen is offline   Reply With Quote

Old   September 29, 2021, 04:39
Default
  #8
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
Quote:
Originally Posted by philippconen View Post
Dear Sasan,

I am working on a digital twin approach for an aircraft wing for my thesis. For this, I would like to have a One-Way-FSI and a Two-Way-FSI where both are coupled with a dynamic mesh (time depending rotation of the wing).

I have existing models in ANSYS, but because of software and license problems and because of the code sharing approach I would like to switch to OpenFOAM.

Sad to hear that you don't have the time to finish the project. But do you have any other information on this topic which are not already mentioned in this thread?

Greetings!

That's an interesting topic. I do not have any update about it. But, Philip can help you. I am pretty sure. If you managed to do so, please let me know.
ttsasan is offline   Reply With Quote

Old   September 29, 2021, 04:43
Default
  #9
New Member
 
Philipp Conen
Join Date: Jul 2021
Location: Germany, NRW
Posts: 22
Rep Power: 4
philippconen is on a distinguished road
Anyway, many thanks for your reply!

Maybe he sees the replies..

I would like to share the full content if I could manage to get everything started!
philippconen is offline   Reply With Quote

Old   September 29, 2021, 04:44
Default
  #10
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
Quote:
Originally Posted by philippconen View Post
Anyway, many thanks for your reply!

Maybe he sees the replies..

I would like to share the full content if I could manage to get everything started!

He will. If he doesn't, we can tell him to check. No worries.
ttsasan is offline   Reply With Quote

Old   September 30, 2021, 05:44
Default
  #11
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
One solution to this is to make a traction boundary condition using the functionality from the timeVaryingMappedFixedValue boundary condition. Tian Tang actually did this in her minigeotechfoam e.g. see here: https://bitbucket.org/tiantang/minig...TotalTraction/.
In that case, she creates a temporary "sigma_s" field which uses timeVaryingMappedFixedValue to look up point cloud data of pressures from the case (see here: https://bitbucket.org/tiantang/minig.../boundaryData/). Then in the timeVaryMappedTotalTraction condition, she looks up this sigma_s field and uses the values of pressure on its boundary as the traction to be applied. This approach is nice as it does not require too much additional coding, although I am sure it is possible to remove the need for an additional field.

Philip
bigphil is offline   Reply With Quote

Old   September 30, 2021, 05:49
Default
  #12
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
Quote:
Originally Posted by bigphil View Post
One solution to this is to make a traction boundary condition using the functionality from the timeVaryingMappedFixedValue boundary condition. Tian Tang actually did this in her minigeotechfoam e.g. see here: https://bitbucket.org/tiantang/minig...TotalTraction/.
In that case, she creates a temporary "sigma_s" field which uses timeVaryingMappedFixedValue to look up point cloud data of pressures from the case (see here: https://bitbucket.org/tiantang/minig.../boundaryData/). Then in the timeVaryMappedTotalTraction condition, she looks up this sigma_s field and uses the values of pressure on its boundary as the traction to be applied. This approach is nice as it does not require too much additional coding, although I am sure it is possible to remove the need for an additional field.

Philip

Thank you very much Philip. That's so useful.
ttsasan is offline   Reply With Quote

Old   October 5, 2021, 12:16
Default
  #13
New Member
 
Philipp Conen
Join Date: Jul 2021
Location: Germany, NRW
Posts: 22
Rep Power: 4
philippconen is on a distinguished road
Dear Foamers,

thanks for your fast reply and sorry for my late ones. I am "fighting on many fronts" at the moment.

Sadly, I didn't get running what you (Philip) told us to try. I understand the idea of calculating a temporary field, but I don't know how to realize that. Only from studying the code, I couldn't figure it out until now. Would it be enough to copy the boundary condition and compile it under the other boundaries? I also tried to run the minigeotechfoam but it does not work. Can anyone give me some more hinds to push this idea forward?

As I thought again about the realization I think this
Quote:
Originally Posted by ttsasan View Post
Hi Philip
...
3) I can get a pressure distribution file. In this case, I can save a text file with a large number of columns. Each column represents one point on the surface. We will then have the time history of the pressure at each point. We can have different rows, and each row corresponds to a special time-step.
....
should be the best and easy - if exporting and importing is straightforward - way.
Since in my case the patches of the fluid interface surface and the solid interface surface should match, there shouldn't be a problem with interpolation, correct?
Regarding this, I could take the cell data of the patches from time/p/i and directly use it for the time-varying pressure profile in solids4Foam. The problem here would be, how to find and sort the cells in the p-file of the time steps corresponding to the interface patches.
By my research I found the following resources which could possibly help:
Exporting fields via paraview Exporting velocity fileds data with node number and position
Importing fields via software tool Import xyz data
Export nodal forces Export forces at each nodes with OpenFoam

I am really sorry if my questions are newby, but I am not really deep into programming and OpenFOAM, so I am really happy about any help.

Greetings!
philippconen is offline   Reply With Quote

Old   October 6, 2021, 09:37
Default
  #14
New Member
 
Philipp Conen
Join Date: Jul 2021
Location: Germany, NRW
Posts: 22
Rep Power: 4
philippconen is on a distinguished road
Dear Foamers,

I spend some more hours on this topic and would like to come back with further questions.

General questions:
  1. Why I can't use the timeVaryingMappedTotalPressure or the timeVaryingUniformTotalPressure function? Because it does not match with the syntax of blockSolidTraction, correct?

  2. If I create a new function can I "simply" merge the timeVaryingMappedTotalPressure or the timeVaryingUniformTotalPressure with the blockSolidTraction?

  3. In which place I need to push the new function and how to compile? Maybe at
    Code:
    /home/philipp/foam/foam-extend-4.1/src/finiteVolume/fields/fvPatchFields/derived
    ?
    Create a new folder with corresponding .C, .H and .dep files named "blockSolidTimeVaryingMappedPressure"? And also add it to the "CMakeList.txt" in
    Code:
    /home/philipp/foam/foam-extend-4.1/src/finiteVolume
    ?
    Than run the "Allwmake" in
    Code:
    /home/philipp/foam/foam-extend-4.1/src
    ?

Further, I have some questions on minigeotechfoam - just to have a clear understanding:
  1. Is the test case: https://bitbucket.org/tiantang/minig...RodsandSeabed/ only about fluid, structure, or both? If it is only about structure, why do we have U (velocity) and how it is treated?
  2. I am not quite sure about the workflow. Please correct me if I am wrong:
    - Simulate and save pressure field
    - Calculate sigma_s field from pressure field
    - Calculate traction from sigma_s and pressure
    I am pretty sure I didn't get it right because from my point of view the cat would bite its own tail.
  3. Is the workflow fully the same as in my approach?

Lastly, I like to point out my idea again, starting with the export process:
  • Create a fluid case
  • Create a (separate) solid case
  • Run the fluid case (to get the pressure distribution on the interface)
  • Create a program to export the calculated data from the fluid case to the solid case
    • Read each time step folder (t)
    • Copy the pressure values from case/t/p (only from dedecated patch) to case/constant/boundary/patch/t/p
    • Create point-file for boundary folder
  • Execute the program

Then over to the import process:
  1. Use timeVaryingMappedFixedValue, timeVaryingMappedTotalPressure, timeVaryingUniformTotalPressure OR Create a class e.g. "blockSolidTimeVaryingMappedPressure" and implement it like mentioned above.
  2. Run the solid case with the pressure calculated in the fluid case

If this demand proposal is an option there would be two additional questions:
  1. How to find the points pressure values of a specific patch for the case/constant/boundary/patch/t/p files? Are the values in case/time/p listed in a pattern that is reproducible with checkMesh? E.g. knowing that the first patch has points from 0-100 and the second patch from 100-200?
  2. How to create the points-file? Could this code do the trick? https://www.cfd-online.com/Forums/op...ary-patch.html


Again, I appreciate every idea and every help on this topic! Thanks in advice.

Greetings!
philippconen is offline   Reply With Quote

Old   October 26, 2021, 06:18
Default
  #15
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Philipp,

How about the following:
  • I will add the requiring functionality to the solidTraction boundary condition, such thta it can optionally lookup the traction field to apply from another field
  • Can you (or someone else) provide me with a simple (but somewhat interesting) test case? e.g. mesh via a blockMeshDict (with a few thousand cells) and a point cloud traction data (relatively small as we just need an example)
bigphil is offline   Reply With Quote

Old   October 26, 2021, 19:36
Default
  #16
New Member
 
Sasan Tavakoli
Join Date: Sep 2018
Posts: 12
Rep Power: 7
ttsasan is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi Philipp,

How about the following:
  • I will add the requiring functionality to the solidTraction boundary condition, such thta it can optionally lookup the traction field to apply from another field
  • Can you (or someone else) provide me with a simple (but somewhat interesting) test case? e.g. mesh via a blockMeshDict (with a few thousand cells) and a point cloud traction data (relatively small as we just need an example)

Hi Philip
I can do it for you.
Will come back to you soon.
Cheers,

Sasan
ttsasan is offline   Reply With Quote

Old   October 28, 2021, 07:54
Default
  #17
New Member
 
Philipp Conen
Join Date: Jul 2021
Location: Germany, NRW
Posts: 22
Rep Power: 4
philippconen is on a distinguished road
Hi guys,

first of all, many thanks for your reply, Philip! Second, sorry for my late reply.

I made just a really easy case based on the movingCylinder tutorial from solids4Foam (fluids). You can find it here https://github.com/Philipp-Conen/OpenFOAM_QuadInFluid. It is running with FE 4.1.

Is this sufficient?
I would be also interested in helping you to push forward this approach. Do you have any easy tasks with which I can contribute to your work?

Greetings

Philipp
philippconen is offline   Reply With Quote

Old   November 24, 2021, 08:59
Default
  #18
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Thanks for this, and sorry for the delay.

Have a look at commit c81df36f.

solidTraction now allows the pressure field to be specified from another vol field; if this other field uses the timeVaryingMappedFixedValue condition then it essentially allows the pressure field to be specified by a point cloud. Have a look at the included tutorial.

If this makes sense (I think it does) then I can add the same option for a traction field.

Let me know your thoughts.

Philip
bigphil is offline   Reply With Quote

Old   November 24, 2021, 12:00
Default
  #19
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
I added the traction field option now too in 0a00b6c9.

It is currently on the development branch but I will merge it to the master once I have ported it to the other versions (currently I only checked foam-extend-4.0).

Philip
bigphil 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
The difference of cyclic boundry condition and mapped boundary condition caitao OpenFOAM Running, Solving & CFD 1 December 4, 2019 07:29
Similar boundary condition to zero flux condition Navip OpenFOAM Running, Solving & CFD 0 August 13, 2015 04:04
Accessing multiple boundary patches from a custom boundary condition file ripudaman OpenFOAM Programming & Development 0 October 22, 2014 18:34
what "If" condition means in rebound brbbhatti OpenFOAM Programming & Development 0 August 12, 2014 09:18
Internal flow operating condition? kookguy FLUENT 2 June 26, 2014 00:15


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