|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
HBR
Join Date: Jun 2018
Posts: 6
Rep Power: 4 ![]() |
Hello!
I'm a very beginner in OpenFoam programming, and I would like to ask the community some help with an issue I have not been able to find any information of in this forum, or even in google. First of all I am modelling the wind over complex terrain. I have introduced some source terms in the equations that depend on the vertical coordinate. The problem is that I need to fix the reference for the z coordinate over the ground and not over the plane z=0. Therefore I need to subtract from every cell z coordinate in the volume mesh the corresponding height of the coincident (x,y) point of the ground. I have think of the function Foam ![]() ![]() For this reason I've used (I don't think that properly) this function as follows: Code:
label patchID = mesh.boundaryMesh().findPatchID("terrain"); scalarField d;//distances are stored in this variable patchWave w(mesh, patchID, true); d = w.distance(); Code:
204901{-1e+15} Thank you in advance. Héctor |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Aug 2015
Posts: 440
Rep Power: 11 ![]() |
Have you looked into wallDist (https://github.com/OpenFOAM/OpenFOAM...ist/wallDist.H)? It should be what you need.
Caelan |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
HBR
Join Date: Jun 2018
Posts: 6
Rep Power: 4 ![]() |
Thank you so much for your suggestion. The fact is that I saw this function but I didn't know how to extract a new volScalarField from the function wallDist. Could you guide me a little?
I know that the functions that wallDist has return a newmesh with updateMesh. But my goal is obtain a volscalarField with all the cell distances to the required patch. Thank you so much for your patience. Héctor |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Aug 2015
Posts: 440
Rep Power: 11 ![]() |
Fair warning -- I'm not sure if I've used it before, but I've seen it in e.g. turbulence models. I pulled this snippet from the kOmegaSST base... it might help :
Code:
y_(wallDist::New(this->mesh_).y()) Caelan |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
HBR
Join Date: Jun 2018
Posts: 6
Rep Power: 4 ![]() |
Thank you so much Caelan. So much appreciated! At the end it was much easier than I thought.
|
|
![]() |
![]() |
![]() |
Tags |
distance, patch, vertical distance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] SnappyHexMesh running killed! | Mark JIN | OpenFOAM Meshing & Mesh Conversion | 3 | March 12, 2020 18:50 |
y+ and u+ values with low-Re RANS turbulence models: utility + testcase | florian_krause | OpenFOAM | 113 | June 25, 2019 01:58 |
[snappyHexMesh] sHM layer process keeps getting killed | MBttR | OpenFOAM Meshing & Mesh Conversion | 4 | August 15, 2016 04:21 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |
[snappyHexMesh] snappyHexMesh aborting | Tobi | OpenFOAM Meshing & Mesh Conversion | 0 | November 10, 2010 04:23 |