Re: [Nektar-users] [EXTERNAL] Re: Mapped boundaries
Hi James, Just to clarify, since sending my original email, I have moved away from trying to use the history points filter. My mesh is structured hexahedral, so every mesh point on the boundary corresponds to a mesh point on the source plane from which I'd like to extract values. Rather than interpolating I use something like the following to get a list of points that define the source plane. for (int i=0; i < nBndPts; ++i) //for each point in boundary { dist = 1e6; srcPointi = {location, bndYCoords[i], bndZCoords[i]}; for (int j=0; j < nVolPts; ++j) //for each point in volume { volPointj = {volXCoords[j], volYCoords[j], volZCoords[j]}; tdist = Nektar::distanceBetween(srcPointi, volPointj); if (tdist < dist) { dist = tdist; srcPtsIdx = j; } } } m_mappedParams[fldid][bndid]->m_mapidx.push_back(srcPtsIdx); Here, location is the x-coordinate of the plane I want to extract values from. This populates the fromptsidx array, and then I read values from volume field using: MultiRegions::ExpListSharedPtr &VolFieldExp = m_fields[fldid]; VolFieldExp->GetPhys(fromptsidx[i]) And then I am attempting to simply set the boundary values for each mesh point to be the same as the value from the corresponding point of the source plane: Bvals = BndCondExp->UpdatePhys(); for (int i; i < exp_npts; ++i) { Bvals[i] = VolFieldExp->GetPhys(fromptsidx[i]); } I understand that this is not going to work for the general case of an arbitrary mesh, but for my case with the hexahedral mesh, I suppose it should work? *Marc Goldbach* PhD Student, Department of Mechanical Engineering University of North Carolina at Charlotte On Thu, Aug 11, 2022 at 8:54 PM Slaughter, James W < j.slaughter19@imperial.ac.uk> wrote:
Hi Marc,
Yep, so with regards to the plane in History points it will create something equispaced. Data at these points will just be interpolated and dumped essentially as a vector rather than containing any connectivity information etc. You'd need to translate that data to the inlet and then interpolate to the boundary and onto the mesh. We do have a utility for that - if you check the functionality in FieldUtils/ProcessModules/Interpdatatofield.cpp it should take in a somewhat of a n x m array and interpolate it to a field object. But just trying to grab an ID from the HistoryPoints object won't work.
I suppose if you got the bounding box of the boundary region - then used that to translate and then interpolated to the boundary - it might be feasible. Just may take a fair bit of tweaking to get setup.
I'm not sure of the problem you're considering as well but with our stabilisation methodologies and if you have much heterogeneity in your mesh you can actually filter any of the inlet turbulence as well. This is probably still more of an issue in FVM because of the diffusivity/dispersion characteristics of the methods. But it is one of the advantages of the method Andrea uses in the paper - that its local to the body/region of interest so can have greater control over the desired characteristics of the noise or whatever thats applied.
Good luck with it! And let me know if you get it running - its definitely something I'd like to consider in the future.
Cheers, James. ------------------------------ *From:* Marc Goldbach <mgoldbac@uncc.edu> *Sent:* 12 August 2022 01:38 *To:* Slaughter, James W <j.slaughter19@imperial.ac.uk>; nektar-users < nektar-users@imperial.ac.uk> *Subject:* Re: [EXTERNAL] Re: [Nektar-users] Mapped boundaries
Thanks James for your response. You are correct… I am trying to setup a turbulent inlet bc. I will check the reference you provided.
In regards to writing the data to file, I was hoping to be able to read the values from memory to avoid the need to write a large amount of data, but I am guessing there is something wrong with my approach here.
Regards, Marc
On Thu, Aug 11, 2022 at 8:19 PM Slaughter, James W < j.slaughter19@imperial.ac.uk> wrote:
[*Caution*: Email from External Sender. Do not click or open links or attachments unless you know this sender.]
Hi Marc,
I'm guessing you're trying to setup a mapped inlet turbulent bc?
If you look at a paper by Andrea Cassinelli titled ON THE EFFECT OF INFLOW DISTURBANCES ON THE FLOW PAST A LINEAR LPT VANE USING SPECTRAL/HP ELEMENT METHODS you'll see some of the ways we usually set turbulence parameters.
The mapped plane method isn't something we really can do easily at the moment. I guess when we have python wrappers for the solvers this might be a lot more possible. But you'll need to translate then interpolate the HistoryPoints sampled plane to the inlet points. This coupling I'm not sure would be easily achievable given what we have there at the moment.
Dumping to file as you suggest as well is the obvious solution but considering the length and timescales of the turbulent structures you probably want at the inlet - it'd be a lot of files and a lot of data.
I'd wait and see if you get a response from one of the Senior Devs who might have a bit more of an idea on if it might be achievable - but from my experience this would be extremely tricky and would require a fair bit of development time.
Cheers, James. ------------------------------ *From:* nektar-users-bounces@imperial.ac.uk < nektar-users-bounces@imperial.ac.uk> on behalf of Marc Goldbach < mgoldbac@uncc.edu> *Sent:* 11 August 2022 21:45 *To:* nektar-users <nektar-users@imperial.ac.uk> *Subject:* Re: [Nektar-users] Mapped boundaries
This email from mgoldbac@uncc.edu originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list <https://spam.ic.ac.uk/SpamConsole/Senders.aspx> to disable email stamping for this address.
Hi All,
To accomplish what I had described below, I am trying to implement a new boundary condition. Basically, I have implemented "SetUpMappedBoundary" and "SetMappedBoundary" functions in " solvers/IncNavierStokesSolver/EquationSystems/IncNavierStokes.cpp" similar to how the Womersly boundary is implemented. In " SetUpMappedBoundary", a "fromptsidx" array is populated where each element in the array corresponds to a node on the boundary, and the values of the "fromptsidx" array stores the corresponding index in the volume field expansion from which the physical value is to be extracted.
In "SetMappedBoundary", I expect to be able to set the boundary using:
Bvals = BndCondExp->UpdatePhys();
for (int i; i < exp_npts; ++i) { Bvals[i] = VolFieldExp->GetPhys(fromptsidx[i]); }
However, when running the simulation the boundary values are not updated (but are set to a 0 value everywhere on the boundary). When printing debugging information from SetMappedBoundary function it seems that the Bvals array does contain non-zero values:
Setting mapped boundary... min volField, fldid = 0: -0.236872 max volField, fldid = 0: 0.0905436 avg volField, fldid = 0: -0.00344391 nVolField: 198 min Bval, fldid = 0: -0.233878 max Bval, fldid = 0: 1
Any suggestions on how I can correctly update inlet boundary values from the Bvals array?
Regards,
*Marc Goldbach* PhD Student, Department of Mechanical Engineering University of North Carolina at Charlotte
On Sun, Jun 5, 2022 at 6:44 PM Marc Goldbach <mgoldbac@uncc.edu> wrote:
Hi All,
I would like to sample data from a plane within my domain (turbulent channel), and use those values as the inlet boundary. The plane at which data is sampled is in the middle of the domain, so a periodic boundary is not suitable. Is this possible, and if so how can I do this?
So far I have looked at using the "HistoryPoints" filter to extract data from the simulation along a plane, but I cannot quite figure out how to read the time dependent boundary data from file:
88 <BOUNDARYCONDITIONS> 95 <REGION REF="0"> 96 <D VAR="u" FILE="periodicInlet_<!--What do I put here??-->"/> 97 <D VAR="v" VALUE="0" /> 98 <D VAR="w" VALUE="0" /> 99 <N VAR="p" USERDEFINEDTYPE="H" VALUE="0" /> 100 </REGION> ... 185 </BOUNDARYCONDITIONS> ... 256 <FILTER TYPE="HistoryPoints"> 257 <PARAM NAME="OutputFile">periodicInlet</PARAM> 258 <PARAM NAME="OutputFrequency">1</PARAM> 259 <PARAM NAME="OutputOneFile">false</PARAM> 260 <PARAM NAME="plane"> 261 100, 100, 262 0, 0, 0, 263 0, 7, 0, 264 0, 0, 2, 265 0, 7, 2 266 </PARAM> 267 </FILTER>
When using <PARAM NAME="OutputOneFile">false</PARAM>, the history point data is saved in files based on index (e.g. periodicInlet_0, periodicInlet_1, periodicInlet_2, etc.)
Any suggestions are appreciated.
Regards,
*Marc Goldbach* PhD Student, Department of Mechanical Engineering University of North Carolina at Charlotte
--
*Marc Goldbach* PhD Student, Department of Mechanical Engineering University of North Carolina at Charlotte
participants (1)
- 
                
                Marc Goldbach