|
[Sponsors] |
May 21, 2014, 04:07 |
Non-const fvMesh& from BC
|
#1 |
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 |
Hi all,
I would like to create a regular (non-constant) reference to the mesh within a boundary condition. The goal is to register a dictionary, so that it will be available for all the boundary conditions that are alike. However, I have not figured out how to do that, as I can only access const fvMesh& references. Of course I have an ace up my sleeve and can pre-register the dictionary within the solver, but I'd rather not modify it. This way that the BCs could still be included in controlDict dynamically. I understand the current implementation is safe, as the initial mesh is not modified in any way. With the great power of modifying the mesh comes great responsibility, but I think I can manage. Is this even possible without major changes in other basic classes? Thanks! Pablo |
|
May 21, 2014, 07:01 |
|
#2 |
Senior Member
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21 |
[QUOTE]
... The goal is to register a dictionary, so that it will be available for all the boundary conditions that are alike. ... [QUOTE] Why go outside the boundary condition class at all? Reading the sentence above it seems that the dictionary is a common data attribute to a bunch of similar boundary conditions. Make a parent class that is inherited by all similar boundary conditions. Put the dictionary as the private attribute and provide non-const access to it via a protected member function to make it accessible only to the derived boundary conditions. Make the dictionary a sub-dict of the usual BC dictionary input. Read it by the base class constructor. Done. This does not require you to modify any existing code, but to extend the BCs in the appropriate way by introducing your BC class hierarchy.
__________________
When asking a question, prepare a SSCCE. |
|
May 21, 2014, 08:31 |
|
#3 |
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 |
Hi Tomislav,
thanks for all the details, it certainly makes more sense than my approach. I will try that! Best, Pablo |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Second Derivative Zero - Boundary Condition | fu-ki-pa | OpenFOAM | 11 | March 27, 2021 05:28 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 02:47 |
Wall bounded values and streamlines | Ruli | OpenFOAM Post-Processing | 5 | February 2, 2014 17:45 |
[snappyHexMesh] Error in SnappyHexMesh | gooya_kabir | OpenFOAM Meshing & Mesh Conversion | 2 | October 23, 2013 05:41 |
LiftDrag coefficient in LES | fabian_korn | OpenFOAM Post-Processing | 1 | September 22, 2008 03:34 |