|
[Sponsors] |
[swak4Foam] Map fields between domains using swak4Foam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 22, 2013, 16:41 |
Map fields between domains using swak4Foam
|
#1 |
New Member
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 27
Rep Power: 15 |
Dear all,
I have a domain with a U field for which I need to map planes (perpendicular to the flow direction) to a plane within another domain. Specifically, every plane along the flow direction of the U field in the first domain is copied into a plane in a second domain at every time-step. I understand that one way to do something similar is by sampling the planes of the first domain, saving them and later plug them in the second domain at the inlet by using timeVaryingMappedFixedValue boundary condition. However, what I need is actually to map only a section of each of the planes of the first domain not to the inlet, but to a plane at a certain position inside the second domain, also for every time-step. Interpolation should not be an issue as the number of cells as well as their size is the same in each region. Does anybody knows how to to this? Seems to me that swak4Foam should be able to do this, but I don't know how (one of the reasons is that the region in the second domain is not a patch, when I'm thinking of groovyBC). Furthermore, using swak maybe there is even a more "direct" way, this is, to sample the planes from the first domain at the same time they're being transported in the second domain. Any thoughts? Thank you, Hugo |
|
February 24, 2013, 08:22 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
What could work (but I don't fully understand what you're trying to do - a sketch would be helpful) is the directMappedPatch (or mappedPatch. Name depends on the OpenFOAM-version) which allows to map the values from cells in one region to a patch. You'd have to introduce a pair of patches (a baffle) at the place where you want to interpolate the values TO and then with the appropriate boundary conditions (but I can't comment on that without knowing what the actual physical problem is) it could work. Even without swak. Where the current version of swak in the development-repository (Not the release) can help you is that it now allows on a directMapped/mapped-patch with a function "mapped(T)" to access the mapped values. Also external variables that access the mapped patch are now non-homogenous. Also a utility calcNonUniformOffsetsForMapped that allows setting the sampling offsets. Currently only docu for all this is the README and the cases in Examples/test with mapped in the name
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
February 24, 2013, 20:24 |
|
#3 |
New Member
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 27
Rep Power: 15 |
Hello Bernhard,
Thanks a lot for your quick and thorough answer. So, the actual problem goes like this: I'm simulating the wake of a wind turbine, so I have a domain where the rotor is simulated using transient source (rather sink) terms in the momentum equation. I'm interested in the influence that the turbulence in the incoming wind flow produces on the wake of the rotor, so I need to create a turbulence field in a precursor mesh. For a number of reasons I create the turbulence field using matlab but the values of the U field as well as the mesh are converted to an OF case that I can manipulate. In this turbulence field, each cell in the streamwise direction in space corresponds to a time-step in the domain that contains the rotor. Thus, I have a precursor domain containing as many cells in the longitudinal direction as time-steps I want to simulate in the domain with the rotor. So, what is needed is to sample planes perpendicular to this streamwise direction in the turbulent field and introduce them into the domain where the wake is simulated, at a certain distance d from the rotor (as in the attached figure). The planes are not introduced at the inlet since there is no production of turbulence in the domain with the rotor, so the turbulence will decay as it moves with the wind flow (x-direction) and this effect is attenuated by introducing the turbulence close to the rotor. Moreover, these planes do not cover the whole cross-section of the rotor domain (y-z planes in the drawing) as only the cells in the central region are uniform (rotor is located there). Cells are stretched towards the boundaries so turbulence (which is generated in a uniform mesh) should not be mapped into those zones. Ideally, the turbulence planes should be inserted by using source term (analogous to the rotor) and also Gaussian-distributed along some cells to avoid continuity problems. But for now, the direct use of the velocity should suffice. Therefore, what I need to map are the values of the cell centers from one plane to another. cellSet should work to select the region ahead of the rotor, but the planes of the U field are obviously non-homogenous. However, I could modify the mesh so that this region corresponds to a surface where mesh blocks are connected and in this way, a pair of patches can be defined. In that case, the cell centers of the turbulence planes would have to be interpolated into cell faces, which I'm not sure how good it would work. On the other hand, the good news is that if I can access the non-uniform mapped values with swak, they can be "easily" manipulated and that could be very helpful when the turbulence is introduced using a source term. What do you think? Will it be possible to map the cell values of the planes into the planes ahead of the rotor? Or could I use any other mapping solution even though the field is non-uniform? Thanks a lot again, Hugo |
|
February 26, 2013, 19:16 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Have you checked timeVaryingMappedFixedValueFvPatchField in OF? Maybe that is more what you want. You'll need a patch for that to and do a different conversion for the MATLAB-data. But I never worked with that BC
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
April 4, 2013, 02:09 |
|
#5 |
New Member
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 27
Rep Power: 15 |
Hello Bernhard,
Thanks a lot for your reply. It's been some time since the last post but I thought I should make some test before replying and I did not do it until recently. What is more, I thought that setting the baffle to timeVaryingMappedFixedValue to import the sampled U field will solve the problem more or less straightforwardly. But that's never the case. The issue is that I want to "add" the imported U plane to the local field in the domain where I perform the calculations, i.e. to impose the turbulence field on the laminar field coming from the inlet. But if the downwind side of the baffle is set to timeVaryingMappedFixedValue, how could I make that boundary completely porous to the inflow velocity? Moreover, I am not so sure what to prescribe at the baffle for the other variables (e.g nuSgs, p) so it does not alter their values. On the other hand, following the use of the fan patch, it would make sense to set the baffle to cyclic for all the other variables except U, which obviously could no longer be defined as timeVaryingMappedFixedValue at the same time. But coming back to swak, in spite of what you have said regarding the non-uniform field support, will it be possible, perhaps, to use a groovy BC and set the baffle to timeVaryingMappedFixedValue PLUS the value of the U field at the position of the patch (or the previous cell centers)? I know is bold but I am running out of ideas about how to import the field to the baffle while making it transparent to the fields. Thanks a lot for all the help, Hugo |
|
April 7, 2013, 09:10 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
But I've never used that for imposing a jump on the velocity. Value "at next cell center" would be internalField(U) but you'll have to experiment how to get that from "the other side" (neighbourField(U) would be the patch-value for that, but I don't think there is such a function for internalField ... hold on. I read doxygen. Seems neighbourField IS the internalField of the neighbour. But you'd have to check that). I don't think that a cyclic patch (which is prerequisite for a jump) can be directMapped at the same time (but you'd have to try that to be sure) which if I remember it correctly would be what you wanted in the first place
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
April 8, 2013, 16:32 |
|
#7 |
New Member
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 27
Rep Power: 15 |
Hello Bernhard,
Thanks for the reply. I have not tried the jumpBC, I missed that one. If I understand correctly, that would work as long as long as I could "add" the U field brought in by the timeVaryingMappedFixedValue to the neighbourField. Will the fields let themselves to be manipulated in such way? I'll have to try it. For the time being, I use an advective BC for all the fields at the downwind patch and a mapped BC for those at he upwind (except U). I import the U fields using timeVaryingMappedFixedValue at the downwind patch. This does not do exactly what I wanted as the U field is imposed as is, instead of importing a U field containing only fluctuations and add them to the local U field at the baffle location. Therefore, some blockage/discontinuity effects could be expected. Nevertheless, preliminary tests don't look too bad, so far. Thanks, Hugo |
|
Tags |
fields, map, swak4foam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Map fields to a parallel target in OF 2.4.0 | DominicTNC | OpenFOAM Running, Solving & CFD | 3 | November 2, 2017 19:32 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
a reconstructPar issue | immortality | OpenFOAM Post-Processing | 8 | June 16, 2013 12:25 |
an odd(at least for me!) reconstructPar error on a field | immortality | OpenFOAM Running, Solving & CFD | 3 | June 3, 2013 23:36 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |