Commit f3e10059 authored by sergio's avatar sergio

Merge branch 'master' of develop.openfoam.com:Development/OpenFOAM-plus

parents 16fb52d4 a18d7b94
<!--
*** Please read this first! ***
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "bug" label and check to see if it has already been reported
-->
<!--
All text between these markers are comments and will not be present in the
report
-->
### Summary
<!-- Summarize the bug encountered concisely -->
### Steps to reproduce
<!-- How one can reproduce the issue - this is very important -->
### Example case
<!--
If possible, please create a SMALL example and attach it to your report
If you are using an older version of OpenFOAM this will also determine
whether the bug has been fixed in a more recent version
-->
### What is the current *bug* behaviour?
<!-- What actually happens -->
### What is the expected *correct* behavior?
<!-- What you should see instead -->
### Relevant logs and/or images
<!--
Paste any relevant logs - please use code blocks (```) to format console
output, logs, and code as it's very hard to read otherwise.
-->
### Environment information
<!--
Providing details of your set-up can help us identify any issues, e.g.
OpenFOAM version : v1806|v1812|v1906 etc
Operating system : ubuntu|openSUSE|centos etc
Hardware info : any info that may help?
Compiler : gcc|intel|clang etc
-->
OpenFOAM version :
Operating system :
Compiler :
### Possible fixes
<!--
If you can, link to the line of code that might be responsible for the
problem
-->
/label ~bug
### Functionality to add/problem to solve
(Brief scope)
### Target audience
(Who will benefit from the changes?)
(What type of cases?)
### Proposal
(How are we going to solve the problem?)
### What does success look like, and how can we measure that?
(What are the success factors and acceptance criteria? e.g. test cases, error margins)
### Links / references
(Links to literature, supporting information)
### Funding
(Does the functionality already exist/is sponsorship available?)
/label ~feature
### Summary
(Summarize the changes concisely)
### Resolved bugs (If applicable)
(Links to issues)
### Details of new models (If applicable)
(New options, user inputs etc)
(Images are nice :))
### Risks
(Possible regressions?)
(Changes to user inputs?)
api=1812
patch=0
patch=190403
Info<< "Mean pressure:" << p.weightedAverage(mesh.V()).value() << endl;
Info<< "Mean temperature:" << thermo.T().weightedAverage(mesh.V()).value()
<< endl;
Info<< "Mean u':"
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
<< endl;
{
const scalar meanP = p.weightedAverage(mesh.V()).value();
const scalar meanT = thermo.T().weightedAverage(mesh.V()).value();
const scalar meanUp =
(sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value();
const scalar meanB = b.weightedAverage(mesh.V()).value();
logSummaryFile()
<< runTime.theta() << tab
<< p.weightedAverage(mesh.V()).value() << tab
<< thermo.T().weightedAverage(mesh.V()).value() << tab
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
<< tab
<< 1 - b.weightedAverage(mesh.V()).value()
<< endl;
Info<< "Mean pressure:" << meanP << nl
<< "Mean temperature:" << meanT << nl
<< "Mean u':" << meanUp << endl;
if (Pstream::master())
{
logSummaryFile()
<< runTime.theta() << tab
<< meanP << tab
<< meanT << tab
<< meanUp << tab
<< 1 - meanB
<< endl;
}
}
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
_FOAM_API $FOAM_API;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
udr_checker.c
EXE = $(FOAM_USER_APPBIN)/ensightFoamReader-udr_checker
EXE_INC = \
-DUSERD_API_203
EXE_LIBS = \
-luserd-foam
udr_checker
-----------
udr_checker.c is a routine that can be used to debug EnSight User-defined
readers. It exists because of the difficulty of debugging dynamic shared
libraries when you don't have the source for the calling program (EnSight).
If udr_checker.c is compiled and linked with your reader source code (including
access to any libraries needed, and the global_extern.h file), it will exercise
most options of you reader, giving feedback as it goes. The resulting
executable can be debugged using your favorite debugger. And if you have
memory/bounds checking software (such as purify), you can (and should) run it
with this executable to make sure that you are not overwriting things. Readers
that bash memory will cause problems when run with EnSight!
You will note that the Makefile provided with the readers in the EnSight
distribution have a "checker" object. If you do a "make checker" instead of
just a "make", the "checker"executable will be produced. You may need to
modify these makefiles slightly if the locations of your reader files are
different than the normal.
--------------------------------------
Once the "checker" executable exists, you can run the checker program by simply
invoking it:
> checker
And you will be prompted for the type of information that you provide in the
EnSight Data Reader dialog, namely:
The path
filename_1
[filename_2] Only if your reader uses two fields
swapbytes flag
<toggle flags> Only if your reader implements extra GUI
<pulldown flags> one flag value per line
<field contents> one field string per line
There are certain command line options that you can use to control some aspects
of the checker program. One of the more useful is the ability to provide the
input just described in a file. This is done in this fashion:
> checker -p <playfile>
And <playfile> would be a simple ascii file with 3 [0r 4] lines:
line 1: the path
line 2: filename_1
line 3: [filename_2] (if two_fields is TRUE)
line 3 or 4: 0 or 1, for swapbytes (0 is FALSE, 1 is TRUE)
remaining lines 0 or 1 for toggle disable enabled
one line for each toggle
0 - num_pulldown_values for pulldown choice
one line for each pulldown
strings
one line for each field
example playfile for an EnSight Gold reader casefile (entitled cube.play)
could look something like the following: (Note: two_fields is FALSE)
-------------------
/usr/local/bin/data/ens
cube.case
0
And you would invoke checker as:
> checker -p check.play
Another example playfile
with swapbytes 0,
two enabled toggles,
three pulldowns with the value 0 chosen
and a single field "sample field value"
could look something like the following::
----------------------
/mydirectory/subdir/
myfile
0
1
1
0
0
0
sample field value
Other command line arguments are:
---------------------------------
-server_number For checking server number routines. If you use this
option, you will be prompted for the total number of
servers and the current server number. These will then be
used in the calls to the server number routines.
-gts # For specifying the geometry timestep to test. The default
is step 0.
The # is the (zero based) time step to read for geometry.
-vts # For specifying the variable timestep to test. The default
is step 0.
The # is the (zero based) time step to read for variables.
Testing optional routines using #defines
-----------------------------------------
For optional routines, such as the extra_gui, or var_extract_gui routines, you
must uncomment the proper #define in udr_checker.c
Currently the ones available are:
#define _EGS for extra gui routines
#define _VES for var extract gui routines
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# ensightFoamReaderTest
#
# Description
# start ensightFoamReader-udr_checker
#
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION]
options:
-case dir specify alternative case directory
* start ensightFoamReader-udr_checker
USAGE
exit 1
}
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-case)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
shift 2
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
# check existence of essential files
for check in system/controlDict system/fvSchemes system/fvSolution
do
[ -s "$check" ] || usage "file does not exist: '$check'"
done
# export values that might be needed
export FOAM_CASE=$PWD
export FOAM_CASENAME=${PWD##*/}
pathName=${PWD%/*}
playFile=/tmp/ensightFoamReader.$$
trap "rm -f $playFile 2>/dev/null; exit 0" EXIT TERM INT
cat << PLAY_FILE > $playFile
$pathName
$FOAM_CASENAME
0
PLAY_FILE
echo "ensightFoamReader-udr_checker -p $playFile"
ensightFoamReader-udr_checker -p $playFile
#------------------------------------------------------------------------------
../../utilities/postProcessing/graphics/ensightFoamReader/global_extern.h
\ No newline at end of file
../../utilities/postProcessing/graphics/ensightFoamReader/global_extern_proto.h
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
udr_checker-80.c
\ No newline at end of file
// Read time index from */uniform/time, but treat 0 and constant specially
// or simply increment from the '-index' option if it was supplied
label timeIndex = 0;
label timeIndex = 0;
{
if (optIndex)
{
timeIndex = indexingNumber++;
......@@ -37,7 +37,4 @@
continue;
}
}
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
// end-of-file
}
......@@ -94,7 +94,7 @@ if (doLagrangian)
);
Info<< " Lagrangian: "
<< runTime.relativePath(writer.output()) << nl;
<< args.relativePath(writer.output()) << nl;
writer.writeTimeValue(mesh.time().value());
writer.writeGeometry();
......
......@@ -107,7 +107,7 @@ Description
);
Info<< " Surface : "
<< runTime.relativePath(writer.output()) << nl;
<< args.relativePath(writer.output()) << nl;
writer.writeTimeValue(timeValue);
......@@ -211,7 +211,7 @@ Description
);
Info<< " FaceZone : "
<< runTime.relativePath(writer.output()) << nl;
<< args.relativePath(writer.output()) << nl;
writer.beginFile(fz.name());
......
......@@ -42,7 +42,7 @@ if (faceSetName.size())
);
Info<< " faceSet : "
<< runTime.relativePath(outputName) << nl;
<< args.relativePath(outputName) << nl;
vtk::writeFaceSet
(
......@@ -70,7 +70,7 @@ if (pointSetName.size())
);
Info<< " pointSet : "
<< runTime.relativePath(outputName) << nl;
<< args.relativePath(outputName) << nl;
vtk::writePointSet
(
......
......@@ -113,7 +113,7 @@ Description
);
Info<< " Internal : "
<< runTime.relativePath(internalWriter->output()) << nl;
<< args.relativePath(internalWriter->output()) << nl;
internalWriter->writeTimeValue(mesh.time().value());
internalWriter->writeGeometry();
......@@ -163,7 +163,7 @@ Description
);
Info<< " Boundaries: "
<< runTime.relativePath(writer->output()) << nl;
<< args.relativePath(writer->output()) << nl;
writer->writeTimeValue(timeValue);
writer->writeGeometry();
......@@ -229,7 +229,7 @@ Description
);
Info<< " Boundary : "
<< runTime.relativePath(writer->output()) << nl;
<< args.relativePath(writer->output()) << nl;
writer->writeTimeValue(timeValue);
writer->writeGeometry();
......
......@@ -575,7 +575,7 @@ int main(int argc, char *argv[])
fvMeshSubsetProxy::subsetType cellSubsetType = fvMeshSubsetProxy::NONE;
string vtkName = runTime.globalCaseName();
string vtkName = args.globalCaseName();
if (regionNames.size() == 1)
{
......@@ -628,7 +628,7 @@ int main(int argc, char *argv[])
// Sub-directory for output
const word vtkDirName = args.opt<word>("name", "VTK");
const fileName outputDir(runTime.globalPath()/vtkDirName);
const fileName outputDir(args.globalPath()/vtkDirName);
if (Pstream::master())
{
......@@ -650,7 +650,7 @@ int main(int argc, char *argv[])
if (args.found("overwrite") && isDir(regionDir))
{
Info<< "Removing old directory "
<< runTime.relativePath(regionDir)
<< args.relativePath(regionDir)
<< nl << endl;
rmDir(regionDir);
}
......
......@@ -30,6 +30,7 @@ License
#include "areaFaMesh.H"
#include "faMesh.H"
#include "fvMesh.H"
#include "foamVersion.H"
#include "Time.H"
#include "patchZones.H"
#include "IOobjectList.H"
......@@ -314,6 +315,9 @@ Foam::vtkPVFoam::vtkPVFoam
fullCasePath = cwd();
}
// OPENFOAM API
setEnv("FOAM_API", std::to_string(foamVersion::api), true);
// The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false);
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -29,6 +29,7 @@ License
// OpenFOAM includes
#include "blockMesh.H"
#include "blockMeshTools.H"
#include "foamVersion.H"
#include "Time.H"
#include "patchZones.H"
#include "StringStream.H"
......@@ -206,6 +207,9 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
fullCasePath = cwd();
}