Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stress data #125

Merged
merged 8 commits into from Jun 8, 2020
Merged

Support stress data #125

merged 8 commits into from Jun 8, 2020

Conversation

davidscn
Copy link
Member

This PR adds an option for users to map stresses instead of forces.

I tried to balance the similarity between the existing forces module by inheriting it and reuse some existing functionalities there Therefore, it still has its own class (as usual for each data module). The stress calculation is very similar: The multiplication by the face are is skipped and a normal vector is used instead.

The code runs, but it is not testes yet.

Closes #41.

@davidscn davidscn added enhancement Nice to have, but not a problem FSI Fluid-structure interaction labels Mar 16, 2020
@davidscn davidscn requested a review from MakisH March 16, 2020 06:59
FSI/Stress.C Outdated Show resolved Hide resolved
Copy link
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It goes into the correct direction. Some changes are still needed, however.

FSI/Force.C Outdated Show resolved Hide resolved
FSI/Force.H Show resolved Hide resolved
FSI/Force.H Show resolved Hide resolved
FSI/Force.H Outdated Show resolved Hide resolved
FSI/Stress.C Outdated Show resolved Hide resolved
FSI/Stress.C Show resolved Hide resolved
FSI/Stress.H Show resolved Hide resolved
@davidscn davidscn changed the title WIP: Support stress data Support stress data Mar 20, 2020
@davidscn
Copy link
Member Author

This is now ready to merge. We should maybe test it before or add some tests for the module.

@MakisH
Copy link
Member

MakisH commented Mar 20, 2020

We should maybe test it before or add some tests for the module.

Could you modify the existing OpenFOAM-CalculiX flap_perp tutorial with comments on how to switch to stresses? We could then use this as a test.

Instructions in the wiki should be enough, unless you find that the changes are quite extensive. Then it would be nice to have a comparison between Force-Displacement and Stress-Displacement, to see at least that the coupling makes sense.

@davidscn
Copy link
Member Author

davidscn commented Mar 20, 2020

In order to test we would need to modify the solid solver, i.e. it needs to work with stress instead of forces. I cannot modify the calculix adapter, if that is your question.
Assuming we have such a solid solver, a user needs to select a consistent instead of a conservative mapping, this should be sufficien.
Does the calculix adapter support stress data?

@MakisH
Copy link
Member

MakisH commented Mar 20, 2020

Does the calculix adapter support stress data?

Indeed, it does not support stresses right now, but we could either:

  • Compute the stresses using a python action in preCICE
  • Prepare an example in deal.II? I assume that would be easier.

Otherwise, to not leave this PR open forever, we could merge it but document that it has not yet been tested and needs some validation. In that case, let's throw a warning when using this writer.

@davidscn
Copy link
Member Author

Alright, I will make a test in deal.II

@davidscn
Copy link
Member Author

Tested and works fine. I added a comment in the source code. This is now a scaled variant of the force vector, which is commonly used in FE applications. If you resolve the discussion above, this can be merged.

@MakisH
Copy link
Member

MakisH commented Mar 21, 2020

Could you maybe contribute the test as a tutorial in the tutorials repository? It would be a useful example.

@uekerman
Copy link
Member

Quick remark: To transform stresses to forces in preCICE, you don't need a Python action. There are already implemented actions doing this. multiply-by-area and divide-by-area. The wiki gives more information. Would be quite a nice test (and tutorial) actually if it also works with OpenFOAM (stresses) - preCICE (conversion) - CalculiX (forces). I guess users don't understand this feature yet as there are no tutorials for it. Depending on which side you do the conversion you could either map consistently or conservatively. It's quite a powerful feature.

@davidscn
Copy link
Member Author

But one needs to be careful using this method, since preCICE always scales according to the initial mesh configuration, right? The forces usually provided by OF scale with the deformed configuration. I am not sure, which one is needed by CalculiX, but this could result in some differences.
I think the stress mapping here needs to be consistent instead of conservative, still not completely sure about it, but I will test it.

@uekerman
Copy link
Member

But one needs to be careful using this method, since preCICE always scales according to the initial mesh configuration, right? The forces usually provided by OF scale with the deformed configuration. I am not sure, which one is needed by CalculiX, but this could result in some differences.

Yes, preCICE scales with the initial (reference) mesh. This issue with reference vs. physical mesh is really sth we need to investigate better. But beyond this PR, I guess.

I think the stress mapping here needs to be consistent instead of conservative, still not completely sure about it, but I will test it.

Yes, stresses need to be mapped consistently. But with the scaling actions, you still have all freedom in the configuration:

  • write stresses, map stresses consistently, communicates stresses, scale stresses to forces, read forces; or
  • write stresses, scale stresses to forces, map forces conservatively, communicate forces, read forces.

FSI/Stress.H Outdated Show resolved Hide resolved
Copy link
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice and clean, I have not tested it with any example yet.

Co-authored-by: Gerasimos Chourdakis <makishourdakis@gmail.com>
@davidscn
Copy link
Member Author

davidscn commented Jun 8, 2020

Looks nice and clean, I have not tested it with any example yet.

I have #125 (comment) and tutorials will be in precice/tutorials#79.

@davidscn davidscn merged commit 671104a into develop Jun 8, 2020
@davidscn davidscn deleted the support_stress_data branch June 8, 2020 08:27
pachesp added a commit that referenced this pull request Sep 30, 2020
commit 045d0d2
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Wed Jul 29 13:54:01 2020 +0200

    Cleanup sonicLiquidFoam case files

commit 91160d7
Author: uekerman <benjamin.uekermann@gmail.com>
Date:   Wed Jul 29 10:13:52 2020 +0200

    Tune FF sonicLiquidFoam to converge

commit c0e61f5
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Fri Jul 24 14:04:39 2020 +0200

    Add todo for determining solverType of multiphase solvers

commit 35cc2c2
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Wed Jul 22 21:57:15 2020 +0200

    Add pressure-based solver type guessing

commit c38f109
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Wed Jul 22 21:41:43 2020 +0200

    Update FF/FF.C

commit 03cee93
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Wed Jul 22 21:38:32 2020 +0200

    Update preCICE logger for consistency

commit fcb2c37
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Wed Jul 22 21:35:14 2020 +0200

    Remove density from transportProperties

commit a39035d
Merge: 78fc865 46c1dcf
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Wed Jul 22 18:22:28 2020 +0200

    Merge branch 'develop' into FF

commit 46c1dcf
Merge: 84a3178 0eb0742
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Tue Jun 30 10:47:18 2020 +0200

    Merge pull request #131 from precice/refactor-assign-construct

    Refactor to reduce assigning fields at creation

commit 0eb0742
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Mon Jun 29 21:21:45 2020 +0200

    Refactor to reduce assigning fields at creation

    This replaces statements such as:

        scalarField one_field = another_field;

    by constructors:

        scalarField one_field(another_field);

    This can be safer and faster, as it avoids implicit conversions in between.

commit 84a3178
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Tue Jun 23 21:19:26 2020 +0200

    Tutorials: Add removeObsoleteFolders.sh script

    Related to #26

    Already implemented separately for the FSI tutorials
    in the precice/tutorials repository.

commit 55a1d57
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Tue Jun 23 21:03:51 2020 +0200

    Simplify precice-config.xml of tutorials

    Hides the timing:initial of mapping (not needed) and extrapolation-order (not important).
    Moves the max-iterations together with the relative-convergence-measure (more natural to explain).

commit 671104a
Author: David Schneider <dav.schneider@tum.de>
Date:   Mon Jun 8 10:27:37 2020 +0200

    Support stress data (#125)

    Add support for stress data writing

commit 42a3d6d
Author: Gerasimos Chourdakis <makishourdakis@gmail.com>
Date:   Tue Mar 24 10:07:35 2020 +0100

    Workaround for #109 (NP tutorial)

commit b7c7a7c
Author: David Schneider <dav.schneider@tum.de>
Date:   Fri Mar 20 20:39:04 2020 +0100

    Determine solver type by pressure dimension (#124)

    Determine solver type by pressure dimensions and throw error if automatic process fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Nice to have, but not a problem FSI Fluid-structure interaction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants