timeVaryingMappedFixedValueFvPatchField for Traction control at boundaries
Dear Foamers,
Using the solidDisplacementFoam, I need to introduce a timeVaryingMappedFixedValue -like BC for traction. As far as I know, the tractionDisplacement BC supports integration over neither time nor space. However, I am not so sure what the autoMap and rmap functions do exactly! If there were any such BC out there, I would highly appreciate it if it were to be shared :) Else, to introduce such BC, what do you suggest I should start with? I found this groovyTractionDisplacementBC and I thought to use it as a guideline. Any help or advice is appreciated. Thanks in advance and best regards, Hisham |
I think I'll copy the timeVaryingMappedFixedValue BC files, rename them and let them inhere tractionDisplacementFvPatchVectorField to use it's autoMap, rmap, updateCoeffs & write functions. I would, then, "untemplate" the functions and modify them for a tractionDisplacementFvPatchField instead of a fixedValue one. Am I planning in the right direction????
|
Hi Hisham,
Using groovyTractionDisplacementBC would be the easiest option, it will give you a time-varying traction boundary condition. tractionDisplacementFvPatchField derives from a fixedGradientFvPatchField so you would need to start with some sort of timeVaryingMappedFixedGradient boundary condition, but I think this would be quite a bit of effort so groovy is a more straight forward option. Philip |
Hi Phillip
My problem is that I have a random time series for traction/pressure that is, also, not uniform (also random) all over the patch. Therefore, I need some space and time interpolation and hence I am thinking of using timeVaryingMappedFixedValue as a base for a new BC and to replace whatever fixed value patch field with a traction Displacement one which inherits a fixed gradient patch by default. Is it possible to use groovyBC in my case? Can you elaborate please! Thanks Hisham |
Hisham,
You want your boundary to vary in time AND space, OK I don't think the current groovyTractionDisplacement can do that at the moment (but could probably be altered to do this). I think the easiest way for you to achieve what you want would be to create a header file in the time loop that updates your boundary conditions. The header file should be something like the following: Code:
label patchID = mesh.boundaryMesh().findPatchID("patch_of_interest"); Philip |
I got the error:
Quote:
Quote:
I have no clue to what I'm doing wrong. Also, what is the Upatch in the forAll loop? |
Hisham,
Quote:
Code:
#include "tractionDisplacementFvPatchVectorField.H" Quote:
If it still doesn't compile then paste the full compilation log here. Philip |
Philip,
The include line is: Quote:
Quote:
|
Hisham,
Did you include the traction BC file at the top of your solver? (ie before the main() function NOT inside the main function. Also normally when I include a BC in my solver I add it to Make/files (ie tractionDisplacementFvPatchVectorField.C) and I use "wclean" and "wmake" to compile the solver and the BC will be automatically linked. I am not sure what "wmake all" does in this situation... Could you post a "stripped-down" version of your solver here so I can try to compile it? Philip |
Quote:
Quote:
Quote:
Quote:
|
Sorry Philip, you are right. I had, foolishly, misplaced the include inside int Main()
I edited it and it compiled (for solidDisplacementFoam). I will post further info later. Thanks a lot :) |
Great,
Hopefully it will do what you want. Philip |
It has worked beautifully. I have another question though! How can I apply that to internal faces? Say I need to define a variable (e.g. displacement) for a face or volume inside the domain.
I want to know how to define an internal face (not a boundary patch) and assign values to its parameters from within the code. |
Hisham,
Hmmnn I am not really sure what you mean by applying a BC to internal face... The value at an internal face is solved for so you could set the value of D at an internal cell but when you solve the system then the value an this internal face will change. Maybe I am not quite understanding. Also D is stored (and solved for) at cell centres not faces. If you really wanted to set the value of D in the internal cells, something like this would do it (but when you solve the equations then these values will be overwritten): Code:
vectorField cellCentres = mesh.C(); |
Thanks a lot Philip for your quick responses.
I do not mean the full domain. Just a pre-defined face. For example, I see there is a faceZone and cellZone. I know how to assign cellZones in say blockMesh or Gmsh (sadly I can't say the same for faceZones). How can I retrieve the id of contained or nearest cells "for faceZone case" (or loop them knowing their position) and assign variables to these cells. I guess it is possible take for example that setFields (funkySetFields) utility can work for time steps other than the initial. Thanks again Hisham |
Quote:
swak4Foam (which now is the home of funkySetFields) has two possibilities to do that (fix the solution in selected cells): - the functionObject manipulateField. That overwrites the values of a field in selected cells at the end of each timesteps. That doesn't need a modification of the solver but as the equation is solved for those cells anyway the results may be weird - an object forceEquation that helps to fix the equations in selected cells before they are solved. You'll have to modify the solver for this (there comes an example of a modified interFoam with swak4Foam). It does so using the setValues-method of the fvMatrix-class (so you can also do that without swak4Foam, but you're on your own here) Please beware that if used wrongly both of them are ugly hacks and I don't accept responsibility for wrong physics Bernhard |
Hi Bernhard,
The idea is, for example, if I want to define the temperature inside part of a given domain for a thermal-stress analysis (it is not wrong physically). I am sure (as you said) it is possible to implement such constraint on a numerical solution. I will research the forceEquation option as it seems the proper tool for the task. I will look into swak4Foam for that. Another thing is: how can I recognize cells for a cellZone or faceZone from inside the code (and their positions). And (if not yet too much to ask) how can I define faceZones in input :confused: Thanks a lot Bernhard & Philip Hisham EDIT: from the gmshToFoam code, it seems that any internal surface defined as physical surface is transformed into a faceZone! |
All times are GMT -4. The time now is 10:52. |