|
[Sponsors] |
March 2, 2024, 03:27 |
Referencing variable from different code
|
#1 |
Member
Song Young Ik
Join Date: Apr 2022
Location: South Korea
Posts: 57
Rep Power: 4 |
Hello, I am modifying scalartransportFoam to make some multiple scalar properties I need. I first modified to create scalar named 'zeta', by modifying PDE from scalarTransport.c and changing name of scalar from 's' to 'zeta'. Then, i made another code which is also modified version of scalarTransport.c, which uses 'zeta' scalar for transport equation.
So, I tried to make the code gets data of 'zeta' as it does to rho and phi, so I wrote the line 'zetaName_ = dict.lookupOrDefault<word>("zeta", "zeta");' and 'mesh_.lookupObject<volScalarField>(zetaName_);' each below the part they reference rho and phi. However it seems like the code doesn't compile well. Below is the error code Code:
avgageTransport.C: In member function ‘virtual bool Foam::functionObjects::avgageTransport::read(const Foam::dictionary&)’: avgageTransport.C:212:5: error: ‘zetaName_’ was not declared in this scope 212 | zetaName_ = dict.lookupOrDefault<word>("zeta", "zeta"); | ^~~~~~~~~ avgageTransport.C: In member function ‘virtual bool Foam::functionObjects::avgageTransport::execute()’: avgageTransport.C:252:44: error: ‘zetaName_’ was not declared in this scope 252 | mesh_.lookupObject<volScalarField>(zetaName_); | ^~~~~~~~~ avgageTransport.C:263:27: warning: unused variable ‘fvModels’ [-Wunused-variable] 263 | const Foam::fvModels& fvModels(Foam::fvModels::New(mesh_)); | ^~~~~~~~ make: *** [/opt/openfoam11/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/avgageTransport.o] Error 1 What may have caused the problem? Do these lookupOrDefault and lookupObject functions work different to rho/phi and zeta? I am not sure about how OF saves and load variable data |
|
Tags |
lookup, scalartransport, variable, zeta |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
general ARCHITECTURAL structure of the code of a CFD code | mecobio | Main CFD Forum | 0 | August 12, 2013 08:04 |
The FOAM Documentation Project - SHUT-DOWN | holger_marschall | OpenFOAM | 242 | March 7, 2013 12:30 |
Problems with additional variable | Krishna Premi | CFX | 1 | October 29, 2007 08:19 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 15:56 |
own Code vs. commercial code | Bernhard Mueck | Main CFD Forum | 10 | February 16, 2000 10:07 |