|
[Sponsors] |
April 7, 2018, 23:23 |
Copy boundaryField into adjacent cell
|
#1 |
New Member
Join Date: May 2017
Posts: 8
Rep Power: 9 |
Hello everyone,
I have a volScalarField E, and I need to copy the boundary field (i.e., the value defined as bc in the 0 folder) into the cells adjacent to the boundary. In other words, for every patch and for every face of the patch: internalField of E = boundary field of E, for that patch and that face. I tried different solutions, but I deleted them since none of them worked. Someone can help me? Thank you and best regards. |
|
April 8, 2018, 01:22 |
|
#2 |
Senior Member
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15 |
One easy solution may be:
Let the simulation run for a sohrt time. In the result folder you find a result for your fields. This replaces the original "internal field uniform .." line. Analyze this field to find out which values belongs to which part of the geometry. If you use blockMesh und your geometry is not very complicated, this is not an hard task. Write a little program in any programming language which sets the initial field the way you need it.
__________________
Uwe Pilz -- Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950) |
|
April 8, 2018, 05:34 |
|
#3 |
New Member
Join Date: May 2017
Posts: 8
Rep Power: 9 |
Thanks Uwe,
but the mesh is complex and I need some loop who does it automatically. I was trying this one, but it doesn't work: Code:
forAll (mesh.boundaryMesh(), patchI) { forAll (mesh.boundaryMesh()[patchI], faceI) { label ownerI = mesh.faceOwner()[faceI]; E[ownerI] = E.boundaryField()[patchI][faceI]; //E is the volScalarField I want to modify } } The boundaryFields containes eiher zeros or positive numbers (they are ficedValue BC's). Any idea? Thanks. |
|
April 8, 2018, 08:35 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
You are probably looking for the method patchInternalField(). Here is an example (actually doing the opposite of what you want to do: Set the boundary values based on the internal values): https://github.com/OpenFOAM/OpenFOAM...FvPatchField.C
|
|
April 13, 2018, 05:50 |
|
#5 | |
Member
|
Quote:
I think this should do the job for you Code:
forAll(mesh.boundary(), patchI) { forAll(mesh.boundaryMesh()[patchI],faceI) { const label& bCellID = mesh.boundaryMesh()[patchI].faceCells()[faceI]; E[bCellID] = E.boundaryField()[patchI][faceI]; } } |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error in fireFoam, when running the case wallFireSpread2D | zhoubiao1088 | OpenFOAM Running, Solving & CFD | 9 | February 1, 2018 18:45 |
Energy source for cell that are adjacent to wall | BIANBOSHEN | Fluent UDF and Scheme Programming | 0 | December 28, 2016 00:15 |
Checking if a cell thread is adjacent to a face thread | twcp0104 | Fluent UDF and Scheme Programming | 17 | December 20, 2016 05:58 |
adjacent cell thread | RKH | ANSYS Meshing & Geometry | 0 | January 4, 2010 16:17 |
how to connect faces(only one adjacent cell thread | BC | FLUENT | 8 | July 13, 2005 16:07 |