Boundary type for patchToPatchInterpolation
Dear Foamers,
I am using of1.6ext and I have a question concerning the boundary type for patchToPatchInterpolation: Which boundary type should I use such that it does not overwrite my interpolated values? My interpolator looks like this (with patch2dID and patch3dID properly initiated before): Code:
patchToPatchInterpolation interpolator2d3d Code:
U.boundaryField()[patch3dID] = interpolator2d3d.faceInterpolate <vector> Any suggestions anyone? Would be highly appreciated! Thanks in advance Florian 
Hi Florian,
I presume you are using patchToPatch to explicitly couple two regions? Therefore, the boundary condition to use will depend on the coupling procedure you would like to use. For example, in partitioned fluidstructureinteraction models they typically use DirichletNeumann coupling where one of the coupled patches is Dirichlet (fixedValue) and the other coupled patch is Neumann (fixedGradient). So you would patchToPatch transfer the fluid pressure and shear stresses to the solid and then transfer the displacement to the fluid mesh. So if you give some more information on your model then it might be easier to give advice. Philip 
Hi Philip,
thanks for your reply! You are right, I want to couple two regions explicitly. In one region I solve the Shallow Water Equations, in the other the full NavierStokes Equations using interFoam. Now I want to transfer the velocity values at the outflow of the SWEregion to the inflow of the NSEregion. So only a oneway coupling for a start. Later on I want to do a twoway coupling, which might require an additional iteration procedure, but this will be the next step. Best regards Florian 
Quote:
Can you outline your solution procedure here so I can understand what exactly you are trying to do i.e. solve some equation > set velocity on BC on some patch > etc. Best regards, Philip 
Hi Philip,
sorry for the late reply, there's been quite a lot of other stuff to do plus a short vacation. My solution procedure is the following:  First I solve the shallow water equations on region0. This is a pseudo2dmesh with a unit height of 1  Then I want to transfer the resulting velocity vectors from the outlet of region0 to the inlet of region3d.  On region3d I solve the Navier Stokes Eqs using interFoam. Instead of a fixedValue I want to use the resulting velocities of region0 as Dirichletcondition at the inlet. The patchToPatchinterpolator mentioned above seems to work so far, when using it on some test field it performs the interpolation from my 2doutlet on this test field. But interpolation on the inlet of region3d does not work. When using a fixedValuebc on the inlet, I guess the constdeclaration of the internal values of the patch prevents the interpolation to work. I've been thinking about using const_cast, but this seems to be a bit too rude... Hope this helps to help :) Best regards Florian 
Quote:
OK, when you solve equations in region0 I presume that the outlet boundary condition is a Neumann type (i.e. a fixedGradient of velocity)? Then you want to take this velocity and set it as a Dirichlet condition (fixedValue of velocity) on the inlet of region3D? This is called DirichletNeumann coupling (used in FSI, contact mechanics, region coupling, …). Then after solving equations in region3D, do you want to update the gradient on the outlet of region0 based on the gradient on region3D inlet? I think this should procedure should work, I believe your problems might be due to how you update the boundary conditions. Something like this should work: Code:
// solve equations in region 0 Philip 
Cool, now it's working! Thanks a lot, Philip!
I was missing the second equal sign, just like you presumed... Best regards Florian PS: You forgot the inletPatchIndex in the typechecking. It should be Code:
if(U.boundaryField()[inletPatchIndex].type() != fixedValueFvPatchVectorField::typeName) 
Quote:
Yep, thanks for the typo. Philip 
I am just wondering if this works in parallel

Quote:
The latest FSI solvers and solidContact BCs do this. Best, Philip 
Thank you philip,
can you kindly point me to where I can find the source code? 
updating BCs
1 Attachment(s)
Hi All
I've managed to follow this thread though, and get patchToPatchInterpolation working. I can see this by the info statements from the solver when running. What I cannot do, is get the patch values to become the new BCs. Although the patch values are updating, they are not writing new boundary conditions. I think it's because I only have one loop in my solver, whereas I need 2 (at least). I'm trying to do the same as above, interpolate U1 from an outlet to an inlet. Can anyone help? I've attached my .C file, sorry about the mess it's in. Cheers Ali Edit: I have managed to get it to work now. I was solving both domains at the same time, instead of sequentially. 
Updating pressure gradient
Hi
Although I've managed to get velocity working fairly well, there is still a few issues: I'm using reactingTwoPhaseEulerFoam. This first image shows on the water's velocity magnitude. The left pipe is using patchToPatchInterpolate for U, alpha, and p, whereas the right pipe is the 'standard', with no patches. You can see the patch on the left pipe, just before the bend. My aim is to get the left pipe looking like the right pipe, even although I have a baffle in there. https://dl.dropbox.com/s/50kgso6rk9v...rison.png?dl=0 1) I cannot get the pressure fields to look correct. I've tried to do what Phil mentions in post #6, update the pressure gradient on the outlet, however I haven't managed this. I tried this by including another interpolator at the end of the while loop, but instead of going from outlet to inlet, it goes from inlet to outlet. See below image. https://dl.dropbox.com/s/em75w9zqm21...rison.png?dl=0 Also, I haven't managed to include k or epsilon in the patchToPatch, but I don't think I need to. Correct me if I'm wrong! Any help is appreciated. Ali Edit: I've managed to get the pressure distributions much more similar. The differences were due to the boundary conditions. The two cases are not identical yet though, but this could just be due to the interpolation carried out, giving averaging errors. I'm still unsure about my last question though, should I also be interpolating k, epsilon, and nut? If so, how is this possible? 
Hello
I have managed to interpolate U, p, and Alpha, however the results are different, as I'm not interpolating k + epsilon. Does anyone know how to define these in the .C file? I can find where they are calculated, but can't seem to define them. I've been trying for 2 days now... Ali 
Quote:
k + epsilon are defined in the turbulence model: see $FOAM_SRC/turbulenceModels/incompressible/RAS/kEpsilon. So there are a few ways you could overwrite the k and epsilon boundary conditions; for example:
Philip 
Quote:
Thanks a lot for getting back. I found the kEpsilon.H file, but the trouble I'm having is defining the variables in my .C file, as it cannot find them. Or they 'were not declared in this scope'. Is it because they are 'private' as defined in the .H file? I'm happy to update the values of k + epsilon by using patchToPatch (like I do with 'p' for example), however I cannot define them as variables. What would I need to add to 'myKEpsilon.H' to enable me to interpolate k + epsilon? I hope this is clearer... Thanks again Ali EDIT: I managed to use them by using Code:
volScalarField& k = const_cast<volScalarField&>(mesh.lookupObject<volScalarField>("k.water")); 
All times are GMT 4. The time now is 18:33. 