CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   macro substitutions in fvSolution (https://www.cfd-online.com/Forums/openfoam-programming-development/149644-macro-substitutions-fvsolution.html)

sharonyue March 5, 2015 16:48

macro substitutions in fvSolution
 
Hi guys,

for some reason I want to make this snippet work:(this is quite abnormal to do this but this is just an example)

Code:

PIMPLE

    nOuterCorrectors $nCorrectors;
    nCorrectors    3;
    nNonOrthogonalCorrectors 0;
}

But it does not! it says:
Code:


--> FOAM FATAL IO ERROR:
Illegal dictionary entry or environment variable name "nCorrectors"
Valid dictionary entries are
0
(
)

How can I make it work? thanks.

olivierG March 6, 2015 10:32

hello,

Maybe put the scalar definition outside the PIMPLE Dict ...
regards,
olivier

zfaraday March 6, 2015 11:19

Hi,

The variable you are calling should be defined first, that's why it's complaining because the code can't recognize tha variable you call. I think that something like that should work instead:

Code:

PIMPLE

    nOuterCorrectors 3;
    nCorrectors    $nOuterCorrectors;
    nNonOrthogonalCorrectors 0;
}

Hope it helps!

Regards,

Alex

sharonyue March 6, 2015 11:22

Thank you guys,

what a pity...I forgot why I wanna do this...


All times are GMT -4. The time now is 09:14.