# TimeVaryingMappedFixedValue for Direct Numerical Simulation inlet

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 June 22, 2010, 14:23 TimeVaryingMappedFixedValue for Direct Numerical Simulation inlet #1 Senior Member   John Deas Join Date: Mar 2009 Posts: 160 Rep Power: 8 Hi, I want to compute a Direct Numerical Simulation of a turbulent channel flow perturbed by an obstacle. I use two different channels to this end: a turbulent precursor channel with periodic boundary conditions and a fixed mean pressure gradient in which I sample velocity profiles, as portrayed in this schematic (sorry for the French caption, I hope you get the idea). Those profiles are then used as inlet boundary conditions (TimeVaryingMappedFixedValue) of another channel containing my perturbator. From now on, I will call my periodic turbulent channel precur, and the perturbed channel perturb. To achieve this, I sample the velocity field on a plane, in precur, using a method similar to the one found in Write cells and data intersecting a plane cuttingPlane, that is, I first define a sampling plane: Code: ```vector direction(1,0,0); plane pl1(pnt,direction); cuttingPlane cutPlane(mesh,pl1); const labelList& cutCells = cutPlane.cells(); word setName("samplingPlane"); cellSet currentSet(mesh,setName,cutCells); fvMeshSubset subsetter(mesh); label patchI=-1; subsetter.setLargeCellSubset(currentSet, patchI, true);``` and then export to files the cells centers and velocity vectors value using subsetter.subMesh().C() (at the beginning of the run) and vectorField UFld(subsetter.interpolate(U)) (at each timestep). The file containing the cell centers is slighty modified: the value of x is changed to coincide with the value of x at the inlet of the perturb. The U profiles files are reformated from vectorField to vectorAverageField as needed by TimeVaryingMappedFixedValue (the value (0 0 0) is used for the average, as setAverage is disabled when the boundary condition is used) by a script. The rest of the profiles is left unchanged. All the files are then transfered to the directory constant/boundaryData/inlet of the channel with the perturbator. The main problem is that when I put probes in the sampling plane in the precursor channel and on the inlet patch (manually created by finding the closest cells for the precursor, and face for the inlet, getting its index number and then exporting the value at each timestep), at the same y and z coordinates, I expect to see the same signal, but I don't. Here is the signal in the sampling plane: , and here is the corresponding signal at the inlet condition: . The values are very different: the probe at the precur starts at 1.5, while the probe at the perturb start at nearly 0.135, which corresponds to bulk temperature prescribed in the precur. If, for a given timestep, I compare the sampled velocity fields in the precursor using Paraview (instead of the sampling method described above), with the field used at the inlet, I observe two very different fields, while expecting the same. On this figure: , the backward profile corresponds to the profile applied by timeVaryingMappedFixedValue, while the profile frontward corresponds to the profile sampled by Paraview at the same time step (after 500 iterations). The inlet profile seems more smooth. Aside from those problems, the boundary condition seems to be working: here we can see the continuity between the inlet profile and the internal velocity field: . It is just that the turbulent profiles do not correspond to the turbulent profiles used. And I don't know where the one I see at the inlet come from. I am using OF-1.5, and made tests with the latest 1.5-dev to check if the problems came from outdated sources, but I obtained the same results. I would like to know if somebody could help me diagnose my problem ? Regards

 June 23, 2010, 11:07 #2 Senior Member   John Deas Join Date: Mar 2009 Posts: 160 Rep Power: 8 When I activate the debug flag for timeVaryingMappedFixedValue, I get the following output: Code: ```/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.5-dev | | \\ / A nd | Revision: exported | | \\/ M anipulation | Web: http://www.OpenFOAM.org | \*---------------------------------------------------------------------------*/ Exec : channelFoam Date : Jun 23 2010 Time : 16:48:47 Host : noproxy-laptop PID : 2141 Case : /home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1 nProcs : 1 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading transportProperties Reading field p Reading field U timeVaryingMappedFixedValue : construct from dictionary timeVaryingMappedFixedValueFvPatchField : Read 1500 sample points from "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/constant/boundaryData/inlet/points" timeVaryingMappedFixedValueFvPatchField : Used points (0 0.00480001 0.0333333) (0 0.0148983 0.0333333) (0 0.00480001 0.1) to define coordinate system with normal (1 0 0) readSamplePoints : Dumping triangulated surface to triangulation.stl readSamplePoints : Dumping face centres to "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/localFaceCentres.obj" timeVaryingMappedFixedValueFvPatchField : In directory "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/constant/boundaryData/inlet" found times 102 ( 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4 4.2 4.4 4.6 4.8 5 5.2 5.4 5.6 5.8 6 6.2 6.4 6.6 6.8 7 7.2 7.4 7.6 7.8 8 8.2 8.4 8.6 8.8 9 9.2 9.4 9.6 9.8 10 10.2 10.4 10.6 10.8 11 11.2 11.4 11.6 11.8 12 12.2 12.4 12.6 12.8 13 13.2 13.4 13.6 13.8 14 14.2 14.4 14.6 14.8 15 15.2 15.4 15.6 15.8 16 16.2 16.4 16.6 16.8 17 17.2 17.4 17.6 17.8 18 18.2 18.4 18.6 18.8 19 19.2 19.4 19.6 19.8 20 100 ) findTime : Found time 0 inbetween index:0 time:0 and index:1 time:0.2 checkTable : Reading startValues from "boundaryData/inlet/0" checkTable : Reading endValues from "boundaryData/inlet/0.2" updateCoeffs : Sampled, interpolated values between start time:0 and end time:0.2 with weight:0 updateCoeffs : set fixedValue to min:(0.00357314 -0.0289583 -0.0227479) max:(0.180687 0.0267451 0.0309067) timeVaryingMappedFixedValue : copy construct, resetting internal field Reading/calculating face flux field phi Creating field pMean Creating field pPrime2Mean Creating field TMean Creating field TPrime2Mean Creating field entroViscMean Creating field entroTempMean Creating field Umean Creating field vortMean Creating field UPrimeTPrimePtr Creating field R Creating field vortPrime2Mean "bottomWall" area : 18 "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/wallStress" "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/heatFlow" "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/probe1" probe1, closest cell detected on proc n° 0 At location: (2.03049 1.5114 1.03333) "/home/noproxy/Desktop/code/OpenFOAM/apps/channelFoam/perturb1/probeInlet" probeInlet, closest face detected on proc n° 0 At location: (0 1.5114 1.03333) Starting time loop Time = 0.2 Courant Number mean: 0.0456125 max: 0.658503 velocity magnitude: 0.180687 findTime : Found time 0.2 inbetween index:1 time:0.2 and index:2 time:0.4 checkTable : Setting startValues to (already read) "boundaryData/inlet/0.2" checkTable : Reading endValues from "boundaryData/inlet/0.4" updateCoeffs : Sampled, interpolated values between start time:0.2 and end time:0.4 with weight:0 updateCoeffs : set fixedValue to min:(0.00356535 -0.0294255 -0.0217288) max:(0.180381 0.0272071 0.0297718) timeVaryingMappedFixedValue : copy construct, resetting internal field timeVaryingMappedFixedValue : copy construct, resetting internal field PBiCG: Solving for Ux, Initial residual = 1, Final residual = 3.82518e-06, No Iterations 2 PBiCG: Solving for Uy, Initial residual = 1, Final residual = 1.98295e-07, No Iterations 2 PBiCG: Solving for Uz, Initial residual = 1, Final residual = 5.32558e-07, No Iterations 2 PCG: Solving for p, Initial residual = 1, Final residual = 0.049956, No Iterations 69 time step continuity errors : sum local = 7.13607e-05, global = 9.1351e-06, cumulative = 9.1351e-06 findTime : Found time 0.2 inbetween index:1 time:0.2 and index:2 time:0.4 updateCoeffs : Sampled, interpolated values between start time:0.2 and end time:0.4 with weight:0 updateCoeffs : set fixedValue to min:(0.00356535 -0.0294255 -0.0217288) max:(0.180381 0.0272071 0.0297718) PCG: Solving for p, Initial residual = 0.283579, Final residual = 0.0138729, No Iterations 53 time step continuity errors : sum local = 3.99148e-05, global = 5.90075e-06, cumulative = 1.50359e-05 findTime : Found time 0.2 inbetween index:1 time:0.2 and index:2 time:0.4 updateCoeffs : Sampled, interpolated values between start time:0.2 and end time:0.4 with weight:0 updateCoeffs : set fixedValue to min:(0.00356535 -0.0294255 -0.0217288) max:(0.180381 0.0272071 0.0297718) PBiCG: Solving for T, Initial residual = 1, Final residual = 1.07351e-08, No Iterations 5 ExecutionTime = 10.37 s ClockTime = 12 s Time = 0.4 Courant Number mean: 0.0486329 max: 0.657388 velocity magnitude: 0.180381 findTime : Found time 0.4 inbetween index:2 time:0.4 and index:3 time:0.6 checkTable : Setting startValues to (already read) "boundaryData/inlet/0.4" checkTable : Reading endValues from "boundaryData/inlet/0.6" updateCoeffs : Sampled, interpolated values between start time:0.4 and end time:0.6 with weight:0 updateCoeffs : set fixedValue to min:(0.00356612 -0.0294211 -0.0208712) max:(0.179775 0.0274508 0.0278956) PBiCG: Solving for Ux, Initial residual = 0.281365, Final residual = 8.91132e-08, No Iterations 3 PBiCG: Solving for Uy, Initial residual = 0.328873, Final residual = 1.93933e-07, No Iterations 3 PBiCG: Solving for Uz, Initial residual = 0.269943, Final residual = 1.46781e-07, No Iterations 3 PCG: Solving for p, Initial residual = 0.619328, Final residual = 0.0291315, No Iterations 40 time step continuity errors : sum local = 6.04081e-05, global = -1.19477e-06, cumulative = 1.38411e-05 findTime : Found time 0.4 inbetween index:2 time:0.4 and index:3 time:0.6 updateCoeffs : Sampled, interpolated values between start time:0.4 and end time:0.6 with weight:0 updateCoeffs : set fixedValue to min:(0.00356612 -0.0294211 -0.0208712) max:(0.179775 0.0274508 0.0278956) PCG: Solving for p, Initial residual = 0.606199, Final residual = 0.0299789, No Iterations 30 time step continuity errors : sum local = 1.81533e-05, global = 9.78026e-07, cumulative = 1.48191e-05 findTime : Found time 0.4 inbetween index:2 time:0.4 and index:3 time:0.6 updateCoeffs : Sampled, interpolated values between start time:0.4 and end time:0.6 with weight:0 updateCoeffs : set fixedValue to min:(0.00356612 -0.0294211 -0.0208712) max:(0.179775 0.0274508 0.0278956) PBiCG: Solving for T, Initial residual = 0.0873212, Final residual = 2.69014e-08, No Iterations 4 ExecutionTime = 15.35 s ClockTime = 17 s ...``` Which might be more readable here: http://pastebin.com/iJZKyfV8

 June 29, 2010, 17:04 #3 Senior Member   John Deas Join Date: Mar 2009 Posts: 160 Rep Power: 8 I have solved my problem. Part of my codes were bugged. Once everything was settled, I had this comparison between the sampled plane and the inlet flow: Which is what is to be expected !

 March 2, 2011, 00:18 #4 New Member   Walter Join Date: Feb 2011 Posts: 8 Rep Power: 6 Hi John, I was just wondering if you would mind posting the code that you used to take your recycled inlet to feed downstream flow. I read through the thread you cited and tried the code you mentioned, but I am new to openfoam and objective c. It seems the first error I am running into is with the subsetter.subMesh().C() line, which I put just before my while (runTime.loop()) line. I get the error shown below. My interpretation of it is that "subsetter" is not properly defined. how do I define that? The problem I am trying this out on is a tube flow that feeds another tube flow. Ideally, I would try and get the cut plane in the boundaryData format (foamFile?) straight out of the solver. Thanks, -w. pisoFoam_bodyForce_samp.C: In function ‘int main(int, char**)’: pisoFoam_bodyForce_samp.C:54: error: ‘subsetter’ was not declared in this scope pisoFoam_bodyForce_samp.C:56: error: expected ‘;’ before ‘while’ pisoFoam_bodyForce_samp.C:42: warning: unused variable ‘samplingCount’ /opt/openfoam170/src/finiteVolume/lnInclude/initContinuityErrs.H:37: warning: unused variable ‘cumulativeContErr’ pisoFoam_bodyForce_samp.C:229: error: expected ‘}’ at end of input make: *** [Make/linux64GccDPOpt/pisoFoam_bodyForce_samp.o] Error 1

 September 26, 2011, 16:55 #5 New Member   Perry L. Johnson Join Date: Feb 2011 Location: Orlando, FL, USA Posts: 17 Rep Power: 6 Why not just put both domains in the same case and use directMapped B.C.?

 May 21, 2014, 07:11 #6 Member   Niu Join Date: Apr 2014 Posts: 42 Rep Power: 3 DearJohn, I'm doing similar job with yours, would you mind sharing your detailed procedures of mapped velocity of every time step of turbulent precursor channel to another channel containing my perturbator?

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post PATELAM CFX 0 November 19, 2009 12:24 buzzybee CFX 10 June 11, 2009 20:15 leaf Main CFD Forum 0 June 20, 2006 01:57 Jerome JOURNADE Main CFD Forum 6 June 3, 1999 13:30 Qing Hao Main CFD Forum 2 January 9, 1999 00:31

All times are GMT -4. The time now is 13:10.

 Contact Us - CFD Online - Top