For learning purposes, how do I create an scalar variable like temperature divided by 2 and outputs it on files generated?
1 Answer
Supposing that your variable is totally dependent of T, so you don't need to read it on "0" file.
On createFields.h add:
Info<< "Creating T2\n" << endl;
volScalarField T2
(
IOobject
(
"T2",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,dimensionedScalar("T2", dimensionSet(0,0,0,1,0,0,0),0.0 )
);
0.0 inside dimensioned scalar just initializes the variable.
Then you should add the equation to your runTimeLoop:
T2=T/2;