|
[Sponsors] |
functionObject solver, storing fields in dataBase |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Join Date: Feb 2022
Posts: 25
Rep Power: 4 ![]() |
Hello,
I am taking a look at the functionObject solver scalarTransport. Here, a function exists to create a new field if not found in the dataBase and return a reference to it. Code:
volScalarField& transportedField(); Code:
Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField() { if (!foundObject<volScalarField>(fieldName_)) { auto tfldPtr = tmp<volScalarField>::New ( IOobject ( fieldName_, mesh_.time().timeName(), mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh_ ); store(fieldName_, tfldPtr); if (phaseName_ != "none") { mesh_.setFluxRequired(fieldName_); } } return lookupObjectRef<volScalarField>(fieldName_); } Code:
store(fieldName_, tfldPtr); e.g., Code:
volScalarField& myTransportedField = mesh.lookupObjectRef<volScalarField>("nameOfmyTransportedField") Some calculation with this field Wouldn't it be helpful to have a variable defined inside the functionObject to store the reference to the volScalarField given by the function? Code:
volScalarField& transportedField_ (transportedField()) |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 ![]() ![]() |
The idea is not some silly handling of local field storage but rather to define/update a field that should be visible outside of the function object. For example, you might want to use a sampled surface function object to sample and write a slice through the field. For any of this to happen, the field has to be globally available - aka objectRegistry
|
|
![]() |
![]() |
![]() |
![]() |
#3 | |
New Member
Join Date: Feb 2022
Posts: 25
Rep Power: 4 ![]() |
Quote:
Hello Mr Olesen, Thank you very much for your insight! Now I know what is the intent! |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Population Balance Modeling (PBM) - Ansys Fluent | chittipo | FLUENT | 164 | November 18, 2023 11:54 |
How do I connect a geometry to my solver | devansh.purohit | Main CFD Forum | 4 | November 16, 2021 08:51 |
Floating Point Exception Error | nyox | FLUENT | 11 | November 30, 2018 12:31 |
[ANSYS Meshing] Help with element size | sandri_92 | ANSYS Meshing & Geometry | 14 | November 14, 2018 07:54 |
Can you help me with a problem in ansys static structural solver? | sourabh.porwal | Structural Mechanics | 0 | March 27, 2016 17:07 |