|
[Sponsors] |
timeVaryingMappedFixedValueFvPatchField for Traction control at boundaries |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 18, 2011, 10:34 |
timeVaryingMappedFixedValueFvPatchField for Traction control at boundaries
|
#1 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 Last edited by Hisham; September 18, 2011 at 12:35. |
|
September 18, 2011, 12:48 |
|
#2 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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????
|
|
September 18, 2011, 13:38 |
|
#3 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34 |
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 |
|
September 18, 2011, 14:00 |
|
#4 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 |
|
September 18, 2011, 14:18 |
|
#5 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34 |
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"); if(patchID == -1) { Info << "Patch of interest not found." << endl; return 0; } tractionDisplacementFvPatchVectorField& Dpatch = refCast<tractionDisplacementFvPatchVectorField> ( D.boundaryField()[patchID] ); vectorField patchFaceCentres = mesh.boundaryMesh()[patchID].faceCentres(); forAll(Dpatch.traction(), facei) { Dpatch.traction()[facei] = runTime.value() * patchFaceCentres[facei]; } Philip Last edited by bigphil; September 19, 2011 at 13:05. Reason: Typo: Changed "Upatch" to "Dpatch" |
|
September 18, 2011, 17:12 |
|
#6 | ||
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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? Last edited by Hisham; September 19, 2011 at 13:32. |
|||
September 19, 2011, 05:49 |
|
#7 | |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34 |
Hisham,
Quote:
Code:
#include "tractionDisplacementFvPatchVectorField.H" Sorry the Upatch is meant to be "Dpatch". (In my solvers I call the displacement variable U.) If it still doesn't compile then paste the full compilation log here. Philip |
||
September 19, 2011, 12:48 |
|
#8 | ||
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
Philip,
The include line is: Quote:
Quote:
|
|||
September 19, 2011, 13:05 |
|
#9 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34 |
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 |
|
September 19, 2011, 13:42 |
|
#10 | |||
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
Quote:
Quote:
Quote:
I will as soon as I return to the machine that has the code. Nevertheless, I commented out all lines except the includes, the lines you suggest and the time loop. Last edited by Hisham; September 19, 2011 at 14:08. |
||||
September 19, 2011, 13:52 |
|
#11 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 |
|
September 19, 2011, 14:03 |
|
#12 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34 |
Great,
Hopefully it will do what you want. Philip |
|
September 19, 2011, 14:13 |
|
#13 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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. |
|
September 19, 2011, 14:30 |
|
#14 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34 |
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(); forAll(D.internalField(), celli) { D.internalField()[celli] = cellCentres[celli] * runTime.value() * .....; } |
|
September 19, 2011, 14:59 |
|
#15 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 Last edited by Hisham; September 19, 2011 at 16:23. |
|
September 19, 2011, 15:20 |
|
#16 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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 |
||
September 19, 2011, 15:36 |
|
#17 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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 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! Last edited by Hisham; September 19, 2011 at 16:05. |
|
Tags |
groovybc, groovytractiondispbc, soliddisplacementfoam, timevaryingmappedbc, tractiondisplacement |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problems of running Oscillating plate tutorial | vovogoal | CFX | 20 | February 4, 2016 08:03 |
error in two way fsi | kmgraju | CFX | 1 | May 2, 2011 03:32 |
periodic boundaries - flow through a net | PK | FLUENT | 0 | July 12, 2007 12:58 |
maintaining a logarithmic velocity distribution | Morten Andersen | CFX | 1 | January 8, 2007 12:37 |
mass flux correction at outflow boundaries | Subhra Datta | Main CFD Forum | 2 | November 24, 2003 14:11 |