Commit ce111a89 authored by Andrew Heather's avatar Andrew Heather
Browse files
parents 6663702c 170c4349
/*---------------------------------------------------------------------------* \
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
......@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
adjustPhi(phi, U, p);
......
......@@ -5,15 +5,12 @@ set -x
# run from this directory only
cd ${0%/*} || exit 1
# build libccmio if required
if [ ! -e $FOAM_LIBBIN/libccmio.so ]
then
# build libccmio and create lnInclude directory
(
cd $WM_THIRD_PARTY_DIR && ./AllwmakeLibccmio
)
fi
# if the library built okay, the headers must exist too
# if the library built okay, the headers should exist too
if [ -e $FOAM_LIBBIN/libccmio.so ]
then
wmake ccm26ToFoam
......
......@@ -22,9 +22,29 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
blockMesh
Description
A multi-block mesh generator.
Uses the block mesh description found in
@a constant/polyMesh/blockMeshDict
(or @a constant/\<region\>/polyMesh/blockMeshDict).
Usage
- blockMesh [OPTION]
@param -blockTopology \n
Write the topology as a set of edges in OBJ format.
@param -region \<name\> \n
Specify an alternative mesh region.
@param -dict \<dictionary\> \n
Specify an alternative dictionary for the block mesh description.
\*---------------------------------------------------------------------------*/
#include "Time.H"
......@@ -60,59 +80,70 @@ int main(int argc, char *argv[])
word regionName;
fileName polyMeshDir;
word dictName("blockMeshDict");
fileName dictPath(runTime.constant());
if (args.options().found("region"))
{
regionName = args.options()["region"];
// constant/<region>/polyMesh/blockMeshDict
regionName = args.options()["region"];
polyMeshDir = regionName/polyMesh::meshSubDir;
Info<< nl << "Generating mesh for region " << regionName << endl;
}
else
{
regionName = polyMesh::defaultRegion;
// constant/polyMesh/blockMeshDict
regionName = polyMesh::defaultRegion;
polyMeshDir = polyMesh::meshSubDir;
}
Info<< nl << "Reading block mesh description dictionary" << endl;
word dictName("blockMeshDict");
fileName dictPath(runTime.constant()/polyMeshDir);
fileName dictLocal = polyMeshDir;
if (args.options().found("dict"))
{
fileName userDict(args.options()["dict"]);
wordList elems(fileName(args.options()["dict"]).components());
dictName = elems[elems.size()-1];
dictPath = elems[0];
dictLocal = "";
dictName = userDict.name();
dictPath = userDict.path();
if (elems.size() == 1)
{
dictPath = ".";
}
else if (elems.size() > 2)
{
dictLocal = fileName(SubList<word>(elems, elems.size()-2, 1));
}
}
IOobject meshDescriptionIOobject
IOobject meshDictIo
(
dictName,
dictPath,
dictLocal,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (!meshDescriptionIOobject.headerOk())
if (!meshDictIo.headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open mesh description file: " << nl
<< dictPath/dictName << nl
<< "Cannot open mesh description file\n "
<< meshDictIo.objectPath()
<< nl
<< exit(FatalError);
}
IOdictionary meshDescription(meshDescriptionIOobject);
Info<< nl << "Creating block mesh" << endl;
Info<< nl << "Creating block mesh from\n "
<< meshDictIo.objectPath() << endl;
blockMesh blocks(meshDescription);
IOdictionary meshDict(meshDictIo);
blockMesh blocks(meshDict);
if (writeTopo)
{
......@@ -169,7 +200,7 @@ int main(int argc, char *argv[])
(
runTime,
runTime.constant(),
polyMeshDir, //polyMesh::meshSubDir
polyMeshDir,
patchNames,
patchTypes,
defaultFacesName,
......@@ -197,11 +228,11 @@ int main(int argc, char *argv[])
// Read in a list of dictionaries for the merge patch pairs
if (meshDescription.found("mergePatchPairs"))
if (meshDict.found("mergePatchPairs"))
{
List<Pair<word> > mergePatchPairs
(
meshDescription.lookup("mergePatchPairs")
meshDict.lookup("mergePatchPairs")
);
if (mergePatchPairs.size())
......
......@@ -275,6 +275,12 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
patchIndices[patchI] = patchIndex(bm[patchI]);
}
// Temporary: update number of allowable patches. This should be
// determined at the top - before adding anything.
meshMod_.setNumPatches(patchNames_.size());
const faceZoneMesh& fz = m.faceZones();
labelList faceZoneIndices(fz.size());
......@@ -315,12 +321,6 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
}
}
newOwn = own[faceI];
if (newOwn > -1) newOwn = renumberCells[newOwn];
newNei = nei[faceI];
if (newNei > -1) newNei = renumberCells[newNei];
if (faceI < m.nInternalFaces() || faceI >= m.nFaces())
{
newPatch = -1;
......@@ -330,6 +330,20 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
newPatch = patchIndices[bm.whichPatch(faceI)];
}
newOwn = own[faceI];
if (newOwn > -1) newOwn = renumberCells[newOwn];
if (newPatch > -1)
{
newNei = -1;
}
else
{
newNei = nei[faceI];
newNei = renumberCells[newNei];
}
newZone = fz.whichZone(faceI);
newZoneFlip = false;
......
......@@ -58,4 +58,15 @@ manualCoeffs
dataFile "decompositionData";
}
//// Is the case distributred
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //
#!/bin/sh
set -x
rm -r PV3FoamReader/Make
rm -rf PV3FoamReader/Make
wclean libso vtkPV3Foam
<ParaViewReaders>
<Reader name="PV3FoamReader"
extensions="OpenFOAM"
file_description="OpenFOAM">
file_description="OpenFOAM Reader">
</Reader>
</ParaViewReaders>
......@@ -31,26 +31,6 @@
<TimeRangeInformationHelper/>
</DoubleVectorProperty>
<!-- Update GUI check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
<!-- Cache mesh check box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
<!-- ExtrapolateWalls check box -->
<IntVectorProperty
name="ExtrapolateWalls"
......@@ -186,34 +166,25 @@
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available times array -->
<!-- PV3FOAM_TIMESELECTION must be defined when compiling vtkPV3Foam
might discard this in the future
<StringVectorProperty
name="TimeArrayInfo"
information_only="1">
<ArraySelectionInformationHelper
attribute_name="Time"/>
</StringVectorProperty>
<StringVectorProperty
name="TimeStatus"
command="SetTimeArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="TimeArrayInfo">
<ArraySelectionDomain
name="array_list">
<RequiredProperties>
<Property name="TimeArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Cache mesh check box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
PV3FOAM_TIMESELECTION
-->
<!-- Update GUI check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
</SourceProxy>
</ProxyGroup>
......
......@@ -21,32 +21,19 @@
// VTK includes
#include "vtkCallbackCommand.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkDataArraySelection.h"
#include "vtkDirectory.h"
#include "vtkDoubleArray.h"
#include "vtkErrorCode.h"
#include "vtkFloatArray.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkIntArray.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkObjectFactory.h"
#include "vtkPoints.h"
#include "vtkRenderer.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkStringArray.h"
#include "vtkUnstructuredGrid.h"
#include "vtkUnstructuredGridAlgorithm.h"
#include "vtkAlgorithmOutput.h"
#include "vtkMultiBlockDataSet.h"
// Foam includes
#include "vtkPV3Foam.H"
vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.2$");
vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$");
vtkStandardNewMacro(vtkPV3FoamReader);
......@@ -60,17 +47,22 @@ vtkPV3FoamReader::vtkPV3FoamReader()
FileName = NULL;
foamData_ = NULL;
CacheMesh = 0;
output1_ = NULL;
UpdateGUI = 1;
UpdateGUIOld = 1;
TimeStep = 0;
TimeStepRange[0] = 0;
TimeStepRange[1] = 0;
CacheMesh = 0;
ExtrapolateWalls = 0;
IncludeSets = 0;
IncludeZones = 0;
ShowPatchNames = 0;
TimeSelection = vtkDataArraySelection::New();
UpdateGUI = 1;
UpdateGUIOld = 1;
RegionSelection = vtkDataArraySelection::New();
VolFieldSelection = vtkDataArraySelection::New();
PointFieldSelection = vtkDataArraySelection::New();
......@@ -85,11 +77,6 @@ vtkPV3FoamReader::vtkPV3FoamReader()
);
SelectionObserver->SetClientData(this);
TimeSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
RegionSelection->AddObserver
(
vtkCommand::ModifiedEvent,
......@@ -112,6 +99,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
);
}
vtkPV3FoamReader::~vtkPV3FoamReader()
{
vtkDebugMacro(<<"Deconstructor");
......@@ -126,7 +114,6 @@ vtkPV3FoamReader::~vtkPV3FoamReader()
delete [] FileName;
}
TimeSelection->RemoveObserver(this->SelectionObserver);
RegionSelection->RemoveObserver(this->SelectionObserver);
VolFieldSelection->RemoveObserver(this->SelectionObserver);
PointFieldSelection->RemoveObserver(this->SelectionObserver);
......@@ -134,7 +121,6 @@ vtkPV3FoamReader::~vtkPV3FoamReader()
SelectionObserver->Delete();
TimeSelection->Delete();
RegionSelection->Delete();
VolFieldSelection->Delete();
PointFieldSelection->Delete();
......@@ -152,7 +138,6 @@ int vtkPV3FoamReader::RequestInformation
{
vtkDebugMacro(<<"RequestInformation");
if (Foam::vtkPV3Foam::debug)
{
cout<<"REQUEST_INFORMATION\n";
......@@ -164,38 +149,6 @@ int vtkPV3FoamReader::RequestInformation
return 0;
}
if (Foam::vtkPV3Foam::debug)
{
vtkInformation* outputInfo = this->GetOutputPortInformation(0);
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
(
outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
);
outputInfo->Print(cout);
if (output)
{
output->Print(cout);
}
else
{
cout << "no output\n";
}
this->GetExecutive()->GetOutputInformation(0)->Print(cout);
int nInfo = outputVector->GetNumberOfInformationObjects();
cout<< "requestInfo with " << nInfo << " items:\n";
for (int i=0; i<nInfo; i++)
{
vtkInformation *info = outputVector->GetInformationObject(i);
info->Print(cout);
}
}
vtkInformation *outInfo = outputVector->GetInformationObject(0);
if (!foamData_)
......@@ -205,17 +158,22 @@ int vtkPV3FoamReader::RequestInformation
(
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
);
foamData_ = new Foam::vtkPV3Foam(FileName, this, output);
foamData_->UpdateInformation();
if (Foam::vtkPV3Foam::debug)
{
cout<< "constructed vtkPV3Foam with output: ";
output->Print(cout);
}
foamData_ = new Foam::vtkPV3Foam(FileName, this);
}
else
{
vtkDebugMacro("RequestInformation: updating information");
foamData_->UpdateInformation();
}
int nTimeSteps = 0;
double* timeSteps = foamData_->timeSteps(nTimeSteps);
double* timeSteps = foamData_->findTimes(nTimeSteps);
outInfo->Set
(
......@@ -230,7 +188,7 @@ int vtkPV3FoamReader::RequestInformation
timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1];
if (Foam::vtkPV3Foam::debug)
if (Foam::vtkPV3Foam::debug > 1)
{
cout<<"nTimeSteps " << nTimeSteps << "\n";
cout<<"timeRange " << timeRange[0] << " to " << timeRange[1] << "\n";
......@@ -271,20 +229,15 @@ int vtkPV3FoamReader::RequestData
return 0;
}
if (Foam::vtkPV3Foam::debug)
{
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3Foam::debug)
{
cout<<"requestData with " << nInfo << " items\n";
}
for (int i=0; i<nInfo; i++)
cout<<"requestData with " << nInfo << " items\n";
for (int i = 0; i < nInfo; ++i)
{
vtkInformation *info = outputVector->GetInformationObject(i);
if (Foam::vtkPV3Foam::debug)
{
info->Print(cout);
}
info->Print(cout);
}
}
......@@ -330,7 +283,7 @@ int vtkPV3FoamReader::RequestData
}
else
{
cout << "no data_object\n";
cout<< "no data_object\n";
}
}
......@@ -423,91 +376,29 @@ void vtkPV3FoamReader::removePatchNamesFromView()
}
void vtkPV3FoamReader::PrintSelf
(
ostream& os,
vtkIndent indent
)
void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDebugMacro(<<"PrintSelf");
this->Superclass::PrintSelf(os,indent);
os<< indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
os<< indent << "Number of meshes: " << foamData_->numberOfMeshes() << "\n";
os<< indent << "Number of nodes: " << foamData_->numberOfPoints() << "\n";
os<< indent << "Number of cells: " << foamData_->numberOfCells() << "\n";
os<< indent << "Number of available time steps: " << foamData_->numberOfAvailableTimes()
<< endl;
foamData_->PrintSelf(os, indent);
os<< indent << "Time step range: "
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
<< endl;
<< "\n";
os<< indent << "Time step: " << this->TimeStep << endl;
return;
}
vtkDataArraySelection* vtkPV3FoamReader::GetTimeSelection()
{
vtkDebugMacro(<<"GetTimeSelection");
return TimeSelection;
}
int vtkPV3FoamReader::GetNumberOfTimeArrays()
{
vtkDebugMacro(<<"GetNumberOf TimeArrays");