
[Sponsors] 
April 12, 2013, 11:32 
Boundary type for patchToPatchInterpolation

#1 
New Member
Florian
Join Date: Mar 2012
Location: Munich
Posts: 12
Rep Power: 5 
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 ( mesh.boundaryMesh()[patch2dID], mesh3d.boundaryMesh()[patch3dID], // to patch intersection::FULL_RAY, intersection::VECTOR ); Code:
U.boundaryField()[patch3dID] = interpolator2d3d.faceInterpolate <vector> ( U2d.boundaryField()[patch2dID] ); Info << "U2dPatch = " << U2d.boundaryField()[patch2dID] << endl; Info << "U3dPatch = " << U.boundaryField()[patch3dID] << endl; Any suggestions anyone? Would be highly appreciated! Thanks in advance Florian 

April 14, 2013, 15:00 

#2 
Senior Member
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19 
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 

April 17, 2013, 05:30 

#3 
New Member
Florian
Join Date: Mar 2012
Location: Munich
Posts: 12
Rep Power: 5 
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 

April 30, 2013, 16:25 

#4  
Senior Member
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19 
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 

June 3, 2013, 13:35 

#5 
New Member
Florian
Join Date: Mar 2012
Location: Munich
Posts: 12
Rep Power: 5 
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 

June 4, 2013, 06:18 

#6  
Senior Member
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19 
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 // then create interpolator patchToPatchInterpolation outletToInletInterpolate ( mesh.boundaryMesh()[outletPatchIndex], // from patch mesh.boundaryMesh()[inletPatchIndex], // to patch intersection::VISIBLE, intersection::CONTACT_SPHERE ); // perform interpolation of outlet velocity to inlet patch vectorField interpolatedInletU = outletToInletInterpolate.faceInterpolate<vector> ( U.boundaryField()[outletPatchIndex] ); // update inlet velocity boundary condition // you should probably make sure that the patch is fixedValue if(U.boundaryField().type() != fixedValueFvPatchVectorField::typeName) FatalError << "inlet patch should be fixedValue!" << exit(FatalError); // note that "==" is needed to reset actual boundary condition // not just change patch values U.boundaryField()[inletPatchIndex] == interpolatedInletU; // then solve equation in region3D // then you can update the gradient on the outlet of region0 if you want Philip 

June 4, 2013, 08:39 

#7 
New Member
Florian
Join Date: Mar 2012
Location: Munich
Posts: 12
Rep Power: 5 
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) FatalError << "inlet patch should be fixedValue!" << exit(FatalError); 

June 4, 2013, 09:27 

#8  
Senior Member
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19 
Quote:
Yep, thanks for the typo. Philip 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Need help with boundary conditions: open to atmosphere  Wolle  OpenFOAM  2  April 11, 2011 07:32 
Boundary condition setting for nonpremixed combustion using reactingFoam  skyopener  OpenFOAM  0  May 23, 2010 22:55 
RPM in Wind Turbine  Pankaj  CFX  9  November 23, 2009 05:05 
pipe with buoyantFoam buoyancy, boundary conditions  Thomas Baumann  OpenFOAM  0  June 15, 2009 08:58 
Problem with compile the setParabolicInlet  ivanyao  OpenFOAM Running, Solving & CFD  6  September 5, 2008 20:50 