-2

For learning purposes, how do I create an scalar variable like temperature divided by 2 and outputs it on files generated?

Vitor Abella
  • 173
  • 1
  • 9
  • This is a question specific to OpenFOAM -- which you should ask on the OpenFOAM-specific mailing lists and forums because that's where the people who know this software hang out. – Wolfgang Bangerth Aug 31 '18 at 21:10

1 Answers1

0

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;
Vitor Abella
  • 173
  • 1
  • 9