|
[Sponsors] |
How to exchange information within coded fvpatchfield between different fields |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 16, 2022, 05:25 |
How to exchange information within coded fvpatchfield between different fields
|
#1 |
New Member
Join Date: May 2020
Posts: 14
Rep Power: 6 |
Dear foamers,
I want to define a field within a volScalarField called psi and access it within another volVectorField named psiVector. I have followed the thread objectRegistry::lookupObject<scalar>. I defined an IOdictionary within createField.H, and tried to modify it within psi field. However, when I tried to access the IOdictionary object within psiVector, the IOdictionary I accessed from the registry was empty. In order to illustrate it more clearly, there are the codes and output. 1. Define an IOobject within createFields.H file. Code:
IOdictionary regedDictionary ( IOobject ( "regedDictionary", runTime.constant(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ) ); Code:
left { type codedFixedValue; name leftCodedVal; value uniform 0.2; code #{ const Time &runTime = this->db().time(); const fvMesh &mesh = this->patch().boundaryMesh().mesh(); Info << "time = " << runTime.value() << endl; IOdictionary ®edDict = mesh.lookupObjectRef<IOdictionary>("regedDictionary"); dictionary scalardict; scalardict.set("value",2 * runTime.value()); regedDict.set("scalardict",scalardict); dictionary vectordict; vectordict.set("value",3 * runTime.value()); regedDict.set("vectordict", vectordict); const IOdictionary &searchRegDict = this->db().lookupObject<IOdictionary>("regedDictionary"); Info << "IOdictionary regedDictionary from psi:" << endl << searchRegDict << endl; #}; } Code:
left { type codedFixedValue; value uniform (0.2 0.2 0.2); name leftVecCodedVal; code #{ const IOdictionary ®edDict = this->db().lookupObject<IOobject>("regedDictionary"); Info << "IOdictionary regedDictionary from psiVector: " << endl << regedDict << endl; #}; } Code:
IOdictionary regedDictionary from psi: { scalardict { value 4; } vectordict { value 6; } } IOdictionary regedDictionary from psiVector: { } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Extracting ParaView Data into Python Arrays | Jeffzda | ParaView | 30 | November 6, 2023 21:00 |
ERROR #001100279 has occurred in subroutine ErrAction. | smnaryal | CFX | 11 | December 20, 2017 16:32 |
OpenFOAM 2D simulation - Freelancer Job- Information will be provided | sanjar | CFD Freelancers | 0 | March 7, 2017 09:45 |
libz.so.1: no version information available | dmaz | OpenFOAM Running, Solving & CFD | 3 | January 4, 2015 16:54 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 09:11 |