diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean new file mode 100755 index 0000000000000000000000000000000000000000..0993c14cee915610b0aac195b75341855b7990bd --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean @@ -0,0 +1,7 @@ +#!/bin/sh +set -x + +rm -r PV3FoamReader/Make + +wclean libso vtkPV3Foam + diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 091af74399993b30dbb6ff1388b2d2b26c5ccff6..3e576a77db08c0662d91100f4bb7494e843c6393 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -54,7 +54,7 @@ vtkPV3FoamReader::vtkPV3FoamReader() { Debug = 0; vtkDebugMacro(<<"Constructor"); - + SetNumberOfInputPorts(0); FileName = NULL; @@ -115,7 +115,6 @@ vtkPV3FoamReader::vtkPV3FoamReader() vtkPV3FoamReader::~vtkPV3FoamReader() { vtkDebugMacro(<<"Deconstructor"); - cout << "Destroy ~vtkPV3FoamReader\n"; if (foamData_) { @@ -152,23 +151,30 @@ int vtkPV3FoamReader::RequestInformation ) { vtkDebugMacro(<<"RequestInformation"); - cout<<"REQUEST_INFORMATION\n"; + + + if (Foam::vtkPV3Foam::debug) + { + cout<<"REQUEST_INFORMATION\n"; + } if (!FileName) { vtkErrorMacro("FileName has to be specified!"); return 0; } - + + if (Foam::vtkPV3Foam::debug) { vtkInformation* outputInfo = this->GetOutputPortInformation(0); - outputInfo->Print(cout); - + vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast ( outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()) ); - if (output) + + outputInfo->Print(cout); + if (output) { output->Print(cout); } @@ -177,21 +183,19 @@ int vtkPV3FoamReader::RequestInformation cout << "no output\n"; } - cout << "GetExecutive:\n"; - this->GetExecutive()->GetOutputInformation(0)->Print(cout); - } - - { + int nInfo = outputVector->GetNumberOfInformationObjects(); - cout<<"requestInfo with " << nInfo << " items\n"; + + 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_) @@ -207,15 +211,12 @@ int vtkPV3FoamReader::RequestInformation else { vtkDebugMacro("RequestInformation: updating information"); - foamData_->UpdateInformation(); } int nTimeSteps = 0; double* timeSteps = foamData_->timeSteps(nTimeSteps); - cout<<"Have nTimeSteps: " << nTimeSteps << "\n"; - outInfo->Set ( vtkStreamingDemandDrivenPipeline::TIME_STEPS(), @@ -229,13 +230,16 @@ int vtkPV3FoamReader::RequestInformation timeRange[0] = timeSteps[0]; timeRange[1] = timeSteps[nTimeSteps-1]; - cout<<"nTimeSteps " << nTimeSteps << "\n"; - cout<<"timeRange " << timeRange[0] << " -> " << timeRange[1] << "\n"; + if (Foam::vtkPV3Foam::debug) + { + cout<<"nTimeSteps " << nTimeSteps << "\n"; + cout<<"timeRange " << timeRange[0] << " to " << timeRange[1] << "\n"; -// for (int i = 0; i < nTimeSteps; ++i) -// { -// cout<<"step[" << i << "] = " << timeSteps[i] << "\n"; -// } + for (int i = 0; i < nTimeSteps; ++i) + { + cout<< "step[" << i << "] = " << timeSteps[i] << "\n"; + } + } outInfo->Set ( @@ -247,7 +251,6 @@ int vtkPV3FoamReader::RequestInformation delete timeSteps; - cout<<"done RequestInformation\n"; return 1; } @@ -261,21 +264,27 @@ int vtkPV3FoamReader::RequestData ) { vtkDebugMacro(<<"RequestData"); - cout<<"REQUEST_DATA\n"; if (!FileName) { vtkErrorMacro("FileName has to be specified!"); return 0; } - + { int nInfo = outputVector->GetNumberOfInformationObjects(); - cout<<"requestData with " << nInfo << " items\n"; + if (Foam::vtkPV3Foam::debug) + { + cout<<"requestData with " << nInfo << " items\n"; + } for (int i=0; i<nInfo; i++) { vtkInformation *info = outputVector->GetInformationObject(i); - info->Print(cout); + + if (Foam::vtkPV3Foam::debug) + { + info->Print(cout); + } } } @@ -284,38 +293,38 @@ int vtkPV3FoamReader::RequestData ( outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()) ); - -#if 1 + + if (Foam::vtkPV3Foam::debug) { vtkInformation* outputInfo = this->GetOutputPortInformation(0); outputInfo->Print(cout); - + vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast ( outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()) ); - if (output) + if (output) { output->Print(cout); } else { - cout << "no output\n"; + cout<< "no output\n"; } - + vtkInformation* execInfo = this->GetExecutive()->GetOutputInformation(0); execInfo->Print(cout); - + outInfo->Print(cout); - + vtkMultiBlockDataSet* dobj = vtkMultiBlockDataSet::SafeDownCast ( outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()) ); - if (dobj) + if (dobj) { dobj->Print(cout); - + vtkInformation* dobjInfo = dobj->GetInformation(); dobjInfo->Print(cout); } @@ -323,16 +332,16 @@ int vtkPV3FoamReader::RequestData { cout << "no data_object\n"; } - - } -#endif if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS())) { - cout<<"Has UPDATE_TIME_STEPS\n"; - cout<<"output->GetNumberOfBlocks() " << output->GetNumberOfBlocks() << - "\n"; + if (Foam::vtkPV3Foam::debug) + { + cout<<"Has UPDATE_TIME_STEPS\n"; + cout<<"output->GetNumberOfBlocks() = " + << output->GetNumberOfBlocks() << "\n"; + } // Get the requested time step. // We only supprt requests of a single time step @@ -370,10 +379,6 @@ int vtkPV3FoamReader::RequestData } UpdateGUIOld = GetUpdateGUI(); - cout<<"done RequestData\n"; - cout<<"done output->GetNumberOfBlocks() " - << output->GetNumberOfBlocks() << "\n"; - return 1; } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index e019e299d0c040de44e919658a69e0efbeab9f00..692693d5a6692b7eab8ed9fdf2de357431813ef5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -84,13 +84,15 @@ void Foam::vtkPV3Foam::AddToBlock output->SetBlock(blockNo, block); block->Delete(); } - - if (block) + else { - Info<< "block[" << blockNo << "] has " - << block->GetNumberOfBlocks() - << " datasets prior to adding set " << datasetNo - << " with name: " << blockName << endl; + if (debug) + { + Info<< "block[" << blockNo << "] has " + << block->GetNumberOfBlocks() + << " datasets prior to adding set " << datasetNo + << " with name: " << blockName << endl; + } // when assigning dataset 0, also name the parent block if (!datasetNo && selector.name()) @@ -481,8 +483,11 @@ Foam::vtkPV3Foam::vtkPV3Foam dbPtr_().functionObjects().off(); - cout<<"constructed with output: "; - output_->Print(cout), + if (debug) + { + cout<< "constructed with output: "; + output_->Print(cout); + } resetCounters(); @@ -579,8 +584,8 @@ void Foam::vtkPV3Foam::Update { if (debug) { - Info<< "entered Foam::vtkPV3Foam::Update" << endl; - cout<<"Update\n"; + cout<< "entered Foam::vtkPV3Foam::Update" << nl + <<"Update\n"; output->Print(cout); cout<<"Internally:\n"; @@ -765,7 +770,10 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer) true ); - Info<<"patches: " << selectedPatches <<endl; + if (debug) + { + Info<<"patches: " << selectedPatches <<endl; + } // Find the total number of zones // Each zone will take the patch name diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index f5aadcd0512c9df0c25c43d543d1718c23e0dc44..a1d374cc9d2d5dff2ec71bfc5bcd15ba79cdf0cd 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -172,6 +172,7 @@ public: } }; + private: // Private data @@ -645,85 +646,6 @@ public: }; -// * * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * // - -template<> -void vtkPV3Foam::convertVolField -( - const GeometricField<scalar, fvPatchField, volMesh>& sf, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo, - labelList& superCells -); - - -template<> -void vtkPV3Foam::convertPatchFaceField -( - const word& name, - const Field<scalar>&, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo -); - -template<> -void vtkPV3Foam::convertFaceField -( - const GeometricField<scalar, fvPatchField, volMesh>&, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo, - const fvMesh&, - const labelList& faceLabels -); - - -template<> -void vtkPV3Foam::convertFaceField -( - const GeometricField<scalar, fvPatchField, volMesh>&, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo, - const fvMesh&, - const faceSet& -); - - -template<> -void vtkPV3Foam::convertPointField -( - const GeometricField<scalar, pointPatchField, pointMesh>&, - const GeometricField<scalar, fvPatchField, volMesh>&, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo -); - - -template<> -void vtkPV3Foam::convertPatchPointField -( - const word& name, - const Field<scalar>&, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo -); - - -template<> -void vtkPV3Foam::convertLagrangianField -( - const IOField<scalar>&, - vtkMultiBlockDataSet* output, - const selectionInfo&, - const label datasetNo -); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertFaceField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertFaceField.H index c6b3e51d4783220abcb61e1208c6e103a8251dce..114aab667a5f9347b799b53e8274f0495ede37c4 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertFaceField.H @@ -48,6 +48,8 @@ void Foam::vtkPV3Foam::convertFaceField const labelList& faceLabels ) { + const label nComp = pTraits<Type>::nComponents; + vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -59,33 +61,30 @@ void Foam::vtkPV3Foam::convertFaceField vtkFloatArray *cellData = vtkFloatArray::New(); cellData->SetNumberOfTuples(faceLabels.size()); - cellData->SetNumberOfComponents(Type::nComponents); - cellData->Allocate(Type::nComponents*faceLabels.size()); + cellData->SetNumberOfComponents(nComp); + cellData->Allocate(nComp*faceLabels.size()); cellData->SetName(tf.name().c_str()); - float vec[Type::nComponents]; + float vec[nComp]; forAll(faceLabels, faceI) { const label faceNo = faceLabels[faceI]; if (faceNo < nInternalFaces) { - Type t = 0.5 * - ( - tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]] - ); + Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } } else { const Type& t = tf[faceOwner[faceNo]]; - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } } @@ -108,6 +107,8 @@ void Foam::vtkPV3Foam::convertFaceField const faceSet& fSet ) { + const label nComp = pTraits<Type>::nComponents; + vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -119,11 +120,11 @@ void Foam::vtkPV3Foam::convertFaceField vtkFloatArray *cellData = vtkFloatArray::New(); cellData->SetNumberOfTuples(fSet.size()); - cellData->SetNumberOfComponents(Type::nComponents); - cellData->Allocate(Type::nComponents*fSet.size()); + cellData->SetNumberOfComponents(nComp); + cellData->Allocate(nComp*fSet.size()); cellData->SetName(tf.name().c_str()); - float vec[Type::nComponents]; + float vec[nComp]; label faceI = 0; forAllConstIter(faceSet, fSet, iter) @@ -132,22 +133,19 @@ void Foam::vtkPV3Foam::convertFaceField if (faceNo < nInternalFaces) { - Type t = 0.5 * - ( - tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]] - ); + Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } } else { const Type& t = tf[faceOwner[faceNo]]; - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } } @@ -160,125 +158,6 @@ void Foam::vtkPV3Foam::convertFaceField } -template<> -void Foam::vtkPV3Foam::convertFaceField -( - const GeometricField<scalar, fvPatchField, volMesh>& tf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo, - const fvMesh& mesh, - const labelList& faceLabels -) -{ - vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - const label nInternalFaces = mesh.nInternalFaces(); - const labelList& faceOwner = mesh.faceOwner(); - const labelList& faceNeigh = mesh.faceNeighbour(); - - vtkFloatArray *cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples(faceLabels.size()); - cellData->SetNumberOfComponents(1); - cellData->Allocate(faceLabels.size()); - cellData->SetName(tf.name().c_str()); - - forAll(faceLabels, faceI) - { - const label faceNo = faceLabels[faceI]; - if (faceNo < nInternalFaces) - { - cellData->InsertComponent - ( - faceI, - 0, - 0.5 * (tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]) - ); - } - else - { - cellData->InsertComponent - ( - faceI, 0, tf[faceOwner[faceNo]] - ); - } - - } - - vtkmesh->GetCellData()->AddArray(cellData); - - if (!vtkmesh->GetCellData()->GetScalars()) - { - vtkmesh->GetCellData()->SetScalars(cellData); - } - - cellData->Delete(); -} - - -template<> -void Foam::vtkPV3Foam::convertFaceField -( - const GeometricField<scalar, fvPatchField, volMesh>& tf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo, - const fvMesh& mesh, - const faceSet& fSet -) -{ - vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - const label nInternalFaces = mesh.nInternalFaces(); - const labelList& faceOwner = mesh.faceOwner(); - const labelList& faceNeigh = mesh.faceNeighbour(); - - vtkFloatArray *cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples(fSet.size()); - cellData->SetNumberOfComponents(1); - cellData->Allocate(fSet.size()); - cellData->SetName(tf.name().c_str()); - - label faceI = 0; - forAllConstIter(faceSet, fSet, iter) - { - const label faceNo = iter.key(); - if (faceNo < nInternalFaces) - { - cellData->InsertComponent - ( - faceI, - 0, - 0.5 * (tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]) - ); - } - else - { - cellData->InsertComponent - ( - faceI, 0, tf[faceOwner[faceNo]] - ); - } - ++faceI; - } - - vtkmesh->GetCellData()->AddArray(cellData); - - if (!vtkmesh->GetCellData()->GetScalars()) - { - vtkmesh->GetCellData()->SetScalars(cellData); - } - - cellData->Delete(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H index 7f99944008460041075523cdf90b7b6f2bb0362f..0ccc3f81a04536a507caf3d6cccc59c368a3dde0 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertLagrangianFields.H @@ -95,6 +95,8 @@ void Foam::vtkPV3Foam::convertLagrangianField const label datasetNo ) { + const label nComp = pTraits<Type>::nComponents; + vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -102,24 +104,24 @@ void Foam::vtkPV3Foam::convertLagrangianField vtkFloatArray *pointData = vtkFloatArray::New(); pointData->SetNumberOfTuples(tf.size()); - pointData->SetNumberOfComponents(Type::nComponents); - pointData->Allocate(Type::nComponents*tf.size()); + pointData->SetNumberOfComponents(nComp); + pointData->Allocate(nComp*tf.size()); pointData->SetName(tf.name().c_str()); if (debug) { Info<< "converting Lagrangian <Type>Field: " << tf.name() << nl << "tf.size() = " << tf.size() << nl - << "nComps = " << Type::nComponents << endl; + << "nComp = " << nComp << endl; } - float vec[Type::nComponents]; + float vec[nComp]; forAll(tf, i) { - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = tf[i][d]; + vec[d] = component(tf[i], d); } pointData->InsertTuple(i, vec); @@ -130,48 +132,6 @@ void Foam::vtkPV3Foam::convertLagrangianField } -template<> -void Foam::vtkPV3Foam::convertLagrangianField -( - const IOField<scalar>& sf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo -) -{ - vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - vtkFloatArray *pointData = vtkFloatArray::New(); - pointData->SetNumberOfTuples(sf.size()); - pointData->SetNumberOfComponents(1); - pointData->Allocate(sf.size()); - pointData->SetName(sf.name().c_str()); - - if (debug) - { - Info<< "converting Lagrangian scalarField: " << sf.name() << nl - << "sf.size() = " << sf.size() << nl - << "nComps = 1" << endl; - } - - for (int i=0; i<sf.size(); i++) - { - pointData->InsertComponent(i, 0, sf[i]); - } - - vtkmesh->GetPointData()->AddArray(pointData); - if (!vtkmesh->GetPointData()->GetScalars()) - { - vtkmesh->GetPointData()->SetScalars(pointData); - } - - pointData->Delete(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H index 11954235ea5de5866a05ced9268b4f99af772935..af0fde5e21db913a599b06f0438ab3edb555fd4c 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchFaceField.H @@ -48,6 +48,8 @@ void Foam::vtkPV3Foam::convertPatchFaceField const label datasetNo ) { + const label nComp = pTraits<Type>::nComponents; + vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -55,18 +57,18 @@ void Foam::vtkPV3Foam::convertPatchFaceField vtkFloatArray *cellData = vtkFloatArray::New(); cellData->SetNumberOfTuples(ptf.size()); - cellData->SetNumberOfComponents(Type::nComponents); - cellData->Allocate(Type::nComponents*ptf.size()); + cellData->SetNumberOfComponents(nComp); + cellData->Allocate(nComp*ptf.size()); cellData->SetName(name.c_str()); - float vec[Type::nComponents]; + float vec[nComp]; forAll(ptf, i) { const Type& t = ptf[i]; - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } cellData->InsertTuple(i, vec); @@ -77,43 +79,6 @@ void Foam::vtkPV3Foam::convertPatchFaceField } -template<> -void Foam::vtkPV3Foam::convertPatchFaceField -( - const word& name, - const Field<scalar>& psf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo -) -{ - vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - vtkFloatArray *cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples(psf.size()); - cellData->SetNumberOfComponents(1); - cellData->Allocate(psf.size()); - cellData->SetName(name.c_str()); - - forAll(psf, i) - { - cellData->InsertComponent(i, 0, psf[i]); - } - - vtkmesh->GetCellData()->AddArray(cellData); - - if (!vtkmesh->GetCellData()->GetScalars()) - { - vtkmesh->GetCellData()->SetScalars(cellData); - } - - cellData->Delete(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H index c0a3a92f9ab47c08ef82fad16107ebc5fd8c3f4a..a793958218a2084299fc9a4fd50b85bb9d9078f4 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPatchPointField.H @@ -45,6 +45,8 @@ void Foam::vtkPV3Foam::convertPatchPointField const label datasetNo ) { + const label nComp = pTraits<Type>::nComponents; + vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -52,17 +54,17 @@ void Foam::vtkPV3Foam::convertPatchPointField vtkFloatArray *pointData = vtkFloatArray::New(); pointData->SetNumberOfTuples(pptf.size()); - pointData->SetNumberOfComponents(Type::nComponents); - pointData->Allocate(Type::nComponents*pptf.size()); + pointData->SetNumberOfComponents(nComp); + pointData->Allocate(nComp*pptf.size()); pointData->SetName(name.c_str()); - float vec[Type::nComponents]; + float vec[nComp]; forAll(pptf, i) { - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = pptf[i][d]; + vec[d] = component(pptf[i], d); } pointData->InsertTuple(i, vec); @@ -73,42 +75,6 @@ void Foam::vtkPV3Foam::convertPatchPointField } -template<> -void Foam::vtkPV3Foam::convertPatchPointField -( - const word& name, - const Field<scalar>& ppsf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo -) -{ - vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - vtkFloatArray *pointData = vtkFloatArray::New(); - pointData->SetNumberOfTuples(ppsf.size()); - pointData->SetNumberOfComponents(1); - pointData->Allocate(ppsf.size()); - pointData->SetName(name.c_str()); - - for (int i=0; i<ppsf.size(); i++) - { - pointData->InsertComponent(i, 0, ppsf[i]); - } - - vtkmesh->GetPointData()->AddArray(pointData); - if (!vtkmesh->GetPointData()->GetScalars()) - { - vtkmesh->GetPointData()->SetScalars(pointData); - } - - pointData->Delete(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H index fc16caca71954e3f033848581442a16966ee1cf5..28d7fdfe5d0a8f2ab1bdbc9bc7c4769015c11592 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertPointFields.H @@ -33,8 +33,6 @@ InClass // Foam includes #include "interpolatePointToCell.H" -// VTK includes - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class Type> @@ -145,6 +143,8 @@ void Foam::vtkPV3Foam::convertPointField const label datasetNo ) { + const label nComp = pTraits<Type>::nComponents; + vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -152,17 +152,17 @@ void Foam::vtkPV3Foam::convertPointField vtkFloatArray *pointData = vtkFloatArray::New(); pointData->SetNumberOfTuples(ptf.size() + addPointCellLabels_.size()); - pointData->SetNumberOfComponents(Type::nComponents); - pointData->Allocate(Type::nComponents*ptf.size()); + pointData->SetNumberOfComponents(nComp); + pointData->Allocate(nComp*ptf.size()); pointData->SetName(tf.name().c_str()); - float vec[Type::nComponents]; + float vec[nComp]; forAll(ptf, i) { - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = ptf[i][d]; + vec[d] = component(ptf[i], d); } pointData->InsertTuple(i, vec); @@ -176,9 +176,9 @@ void Foam::vtkPV3Foam::convertPointField { Type t = tf[addPointCellLabels_[api]]; - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } pointData->InsertTuple(i++, vec); @@ -190,9 +190,9 @@ void Foam::vtkPV3Foam::convertPointField { Type t = interpolatePointToCell(ptf, addPointCellLabels_[api]); - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } pointData->InsertTuple(i++, vec); @@ -204,69 +204,6 @@ void Foam::vtkPV3Foam::convertPointField } -template<> -void Foam::vtkPV3Foam::convertPointField -( - const GeometricField<scalar, pointPatchField, pointMesh>& psf, - const GeometricField<scalar, fvPatchField, volMesh>& sf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo -) -{ - vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - vtkFloatArray *pointData = vtkFloatArray::New(); - pointData->SetNumberOfTuples(psf.size() + addPointCellLabels_.size()); - pointData->SetNumberOfComponents(1); - pointData->Allocate(psf.size()); - pointData->SetName(sf.name().c_str()); - - for (int i=0; i<psf.size(); i++) - { - pointData->InsertComponent(i, 0, psf[i]); - } - - label i = psf.size(); - - if (&sf != &GeometricField<scalar, fvPatchField, volMesh>::null()) - { - forAll(addPointCellLabels_, api) - { - pointData->InsertComponent - ( - i++, - 0, - sf[addPointCellLabels_[api]] - ); - } - } - else - { - forAll(addPointCellLabels_, api) - { - pointData->InsertComponent - ( - i++, - 0, - interpolatePointToCell(psf, addPointCellLabels_[api]) - ); - } - } - - internalMesh->GetPointData()->AddArray(pointData); - if (!internalMesh->GetPointData()->GetScalars()) - { - internalMesh->GetPointData()->SetScalars(pointData); - } - - pointData->Delete(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H index 4fcdd1725e2e7bb63169f5edb290fa0f06da31fc..ff2a1d8bcef1fb5614cb0a26b4ee639ec2ad83f5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertVolFields.H @@ -372,6 +372,8 @@ void Foam::vtkPV3Foam::convertVolField labelList& superCells ) { + const label nComp = pTraits<Type>::nComponents; + vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::SafeDownCast ( GetDataSetFromBlock(output, selector, datasetNo) @@ -379,8 +381,8 @@ void Foam::vtkPV3Foam::convertVolField vtkFloatArray* celldata = vtkFloatArray::New(); celldata->SetNumberOfTuples(superCells.size()); - celldata->SetNumberOfComponents(Type::nComponents); - celldata->Allocate(Type::nComponents*superCells.size()); + celldata->SetNumberOfComponents(nComp); + celldata->Allocate(nComp*superCells.size()); celldata->SetName(tf.name().c_str()); if (debug) @@ -388,17 +390,17 @@ void Foam::vtkPV3Foam::convertVolField Info<< "converting vol<Type>Field: " << tf.name() << nl << "field size = " << tf.size() << nl << "nTuples = " << superCells.size() << nl - << "nComps = " << Type::nComponents << endl; + << "nComp = " << nComp << endl; } - float vec[Type::nComponents]; + float vec[nComp]; forAll(superCells, scI) { const Type& t = tf[superCells[scI]]; - for (direction d=0; d<Type::nComponents; d++) + for (direction d=0; d<nComp; d++) { - vec[d] = t[d]; + vec[d] = component(t, d); } celldata->InsertTuple(scI, vec); @@ -409,50 +411,6 @@ void Foam::vtkPV3Foam::convertVolField } -template<> -void Foam::vtkPV3Foam::convertVolField -( - const GeometricField<scalar, fvPatchField, volMesh>& sf, - vtkMultiBlockDataSet* output, - const selectionInfo& selector, - const label datasetNo, - labelList& superCells -) -{ - vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::SafeDownCast - ( - GetDataSetFromBlock(output, selector, datasetNo) - ); - - vtkFloatArray *cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples(superCells.size()); - cellData->SetNumberOfComponents(1); - cellData->Allocate(superCells.size()); - cellData->SetName(sf.name().c_str()); - - if (debug) - { - Info<< "converting volScalarField: " << sf.name() << nl - << "field size = " << sf.size() << nl - << "nTuples = " << superCells.size() << nl - << "nComps = 1" << endl; - } - - forAll(superCells, scI) - { - cellData->InsertComponent(scI, 0, sf[superCells[scI]]); - } - - vtkmesh->GetCellData()->AddArray(cellData); - if (!vtkmesh->GetCellData()->GetScalars()) - { - vtkmesh->GetCellData()->SetScalars(cellData); - } - - cellData->Delete(); -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdate.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdate.C index c1babdcdc989d454c716ab400f6e0775ff2276e9..e7e4ac9106610c84edfe456ab19b65c29d1c71df 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdate.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdate.C @@ -114,6 +114,12 @@ void Foam::vtkPV3Foam::updateVolFields } volPointInterpolation pInterp(mesh, pMesh); +/* + convertVolFields<Foam::label> + ( + mesh, pInterp, objects, arraySelection, output + ); +*/ convertVolFields<Foam::scalar> ( mesh, pInterp, objects, arraySelection, output @@ -159,7 +165,12 @@ void Foam::vtkPV3Foam::updatePointFields { Info<< "converting Foam point fields" << endl; } - +/* + convertPointFields<Foam::label> + ( + mesh, objects, arraySelection, output + ); +*/ convertPointFields<Foam::scalar> ( mesh, objects, arraySelection, output @@ -213,6 +224,11 @@ void Foam::vtkPV3Foam::updateLagrangianFields Info<< "converting Foam Lagrangian fields" << endl; } + convertLagrangianFields<Foam::label> + ( + mesh, objects, arraySelection, output + ); + convertLagrangianFields<Foam::scalar> ( mesh, objects, arraySelection, output diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C index c6a520f6734e8e69eb6051db06e477960cba3912..d86a8a90dc56ba33a316e1051393c0103ffbd2cf 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C @@ -108,15 +108,13 @@ void Foam::vtkPV3Foam::updateInformationLagrangian() { if (debug) { - Info<< "entered Foam::vtkPV3Foam::updateInformationLagrangian at timePath " - << dbPtr_->timePath()/"lagrangian" << endl; + Info<< "entered Foam::vtkPV3Foam::updateInformationLagrangian " + << "at timePath " << dbPtr_->timePath()/"lagrangian" << endl; } vtkDataArraySelection* arraySelection = reader_->GetRegionSelection(); // Search for list of lagrangian objects for this time - // IOobjectList lagrangianObjects(dbPtr(), dbPtr_().timeName(), "lagrangian"); - fileNameList cloudDirs ( readDir(dbPtr_->timePath()/"lagrangian", fileName::DIRECTORY) @@ -144,7 +142,11 @@ void Foam::vtkPV3Foam::updateInformationLagrangian() } else { - Info<<"no cloudDirs @ " << dbPtr_->timePath()/"lagrangian" << endl; + if (debug) + { + Info<<"no clouds identified in " + << dbPtr_->timePath()/"lagrangian" << endl; + } } } @@ -159,7 +161,7 @@ void Foam::vtkPV3Foam::updateInformationPatches() vtkDataArraySelection *arraySelection = reader_->GetRegionSelection(); - //- Read patches + // Read patches polyBoundaryMeshEntries patchEntries ( IOobject @@ -182,7 +184,7 @@ void Foam::vtkPV3Foam::updateInformationPatches() { label nFaces(readLabel(patchEntries[entryI].dict().lookup("nFaces"))); - //- Valid patch if nFace > 0 + // Valid patch if nFace > 0 if (nFaces) { // Add patch to GUI region list @@ -208,7 +210,7 @@ void Foam::vtkPV3Foam::updateInformationZones() vtkDataArraySelection *arraySelection = reader_->GetRegionSelection(); - //- Read cell zone information + // Read cell zone information { zonesEntries zones ( @@ -240,7 +242,7 @@ void Foam::vtkPV3Foam::updateInformationZones() superCellZonesCells_.setSize(selectInfoCellZones_.size()); } - //- Read face zone information + // Read face zone information { zonesEntries zones ( @@ -270,7 +272,7 @@ void Foam::vtkPV3Foam::updateInformationZones() } } - //- Read point zone information + // Read point zone information { zonesEntries zones ( @@ -373,6 +375,11 @@ void Foam::vtkPV3Foam::updateInformationLagrangianFields() "lagrangian"/cloudName_ ); + addFields<IOField<label> > + ( + arraySelection, + objects + ); addFields<IOField<scalar> > ( arraySelection, diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H index d93a88012899ef51f853d005f0904605bacd83f1..91571ca5f4b276f869b7baecb73d3c936acf6cd6 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H @@ -55,6 +55,13 @@ void Foam::vtkPV3Foam::updateInformationFields // Populate the GUI volume/point field arrays //- Add volume fields to GUI +/* + addFields<GeometricField<label, patchType, meshType> > + ( + arraySelection, + objects + ); +*/ addFields<GeometricField<scalar, patchType, meshType> > ( arraySelection, diff --git a/bin/paraFoam b/bin/paraFoam index e32dd57964de94c498089cfc8c7c95cda26b683e..93fb4cf03b12210d8c008ca805eaccb4dceeec7c 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -77,8 +77,8 @@ do [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" done -caseFile="$caseName.foam" -# caseFile="$caseName.OpenFOAM" +#caseFile="$caseName.foam" +caseFile="$caseName.OpenFOAM" case "$ParaView_VERSION" in 2*) diff --git a/src/OpenFOAM/primitives/label/label.H b/src/OpenFOAM/primitives/label/label.H index de4a67fc14f5d7198eaab6b4535e2da1b89231bf..ee18f569ade2a5e52a29e1bdcfe1f95826cdb06e 100644 --- a/src/OpenFOAM/primitives/label/label.H +++ b/src/OpenFOAM/primitives/label/label.H @@ -119,6 +119,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "pTraits.H" +#include "direction.H" namespace Foam { @@ -202,6 +203,16 @@ MAXMIN(long, int, long) MAXMIN(long long, int, long long) MAXMIN(long long, long long, int) +inline label& setComponent(label& l, const direction) +{ + return l; +} + +inline label component(const label l, const direction) +{ + return l; +} + inline label mag(const label l) { return ::abs(l); diff --git a/tutorials/interDyMFoam/sloshingTank/0/U b/tutorials/interDyMFoam/sloshingTank2D/0/U similarity index 91% rename from tutorials/interDyMFoam/sloshingTank/0/U rename to tutorials/interDyMFoam/sloshingTank2D/0/U index ead7f1f8b7862b57dc73c5d1cfe0da0748b4a1af..ae062bdf0d1fa6458df95c93f8ffeb9d7df188be 100644 --- a/tutorials/interDyMFoam/sloshingTank/0/U +++ b/tutorials/interDyMFoam/sloshingTank2D/0/U @@ -33,11 +33,6 @@ boundaryField type movingWallVelocity; value uniform (0 0 0); } - pipe - { - type movingWallVelocity; - value uniform (0 0 0); - } } // ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank/0/gamma.org b/tutorials/interDyMFoam/sloshingTank2D/0/gamma.org similarity index 92% rename from tutorials/interDyMFoam/sloshingTank/0/gamma.org rename to tutorials/interDyMFoam/sloshingTank2D/0/gamma.org index 8c4ab31ce222d6f36b31a0494e37abfc03ddb1ca..2711563003114c5f54dc987dbeca328598f590e8 100644 --- a/tutorials/interDyMFoam/sloshingTank/0/gamma.org +++ b/tutorials/interDyMFoam/sloshingTank2D/0/gamma.org @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object gamma.0; + object gamma; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -32,10 +32,6 @@ boundaryField { type zeroGradient; } - pipe - { - type zeroGradient; - } } // ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank/0/pd b/tutorials/interDyMFoam/sloshingTank2D/0/pd similarity index 94% rename from tutorials/interDyMFoam/sloshingTank/0/pd rename to tutorials/interDyMFoam/sloshingTank2D/0/pd index fdb2ba3ce63d600086213947aa31e7f92ac3edd4..cefcbb7d442aad8e22f25fbaedbfbb0e68eed4b7 100644 --- a/tutorials/interDyMFoam/sloshingTank/0/pd +++ b/tutorials/interDyMFoam/sloshingTank2D/0/pd @@ -32,10 +32,6 @@ boundaryField { type zeroGradient; } - pipe - { - type zeroGradient; - } } // ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank/Allclean b/tutorials/interDyMFoam/sloshingTank2D/Allclean similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/Allclean rename to tutorials/interDyMFoam/sloshingTank2D/Allclean diff --git a/tutorials/interDyMFoam/sloshingTank/Allrun b/tutorials/interDyMFoam/sloshingTank2D/Allrun similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/Allrun rename to tutorials/interDyMFoam/sloshingTank2D/Allrun diff --git a/tutorials/interDyMFoam/sloshingTank/constant/RASProperties b/tutorials/interDyMFoam/sloshingTank2D/constant/RASProperties similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/RASProperties rename to tutorials/interDyMFoam/sloshingTank2D/constant/RASProperties diff --git a/tutorials/interDyMFoam/sloshingTank/constant/dynamicMeshDict b/tutorials/interDyMFoam/sloshingTank2D/constant/dynamicMeshDict similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/dynamicMeshDict rename to tutorials/interDyMFoam/sloshingTank2D/constant/dynamicMeshDict diff --git a/tutorials/interDyMFoam/sloshingTank/constant/environmentalProperties b/tutorials/interDyMFoam/sloshingTank2D/constant/environmentalProperties similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/environmentalProperties rename to tutorials/interDyMFoam/sloshingTank2D/constant/environmentalProperties diff --git a/tutorials/interDyMFoam/sloshingTank/constant/polyMesh/blockMeshDict b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/polyMesh/blockMeshDict rename to tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict diff --git a/tutorials/interDyMFoam/sloshingTank/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/polyMesh/blockMeshDict.m4 rename to tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 diff --git a/tutorials/interDyMFoam/sloshingTank/constant/polyMesh/boundary b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/boundary similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/polyMesh/boundary rename to tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/boundary diff --git a/tutorials/interDyMFoam/sloshingTank/constant/transportProperties b/tutorials/interDyMFoam/sloshingTank2D/constant/transportProperties similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/constant/transportProperties rename to tutorials/interDyMFoam/sloshingTank2D/constant/transportProperties diff --git a/tutorials/interDyMFoam/sloshingTank/system/controlDict b/tutorials/interDyMFoam/sloshingTank2D/system/controlDict similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/system/controlDict rename to tutorials/interDyMFoam/sloshingTank2D/system/controlDict diff --git a/tutorials/interDyMFoam/sloshingTank/system/decomposeParDict b/tutorials/interDyMFoam/sloshingTank2D/system/decomposeParDict similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/system/decomposeParDict rename to tutorials/interDyMFoam/sloshingTank2D/system/decomposeParDict diff --git a/tutorials/interDyMFoam/sloshingTank/system/fvSchemes b/tutorials/interDyMFoam/sloshingTank2D/system/fvSchemes similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/system/fvSchemes rename to tutorials/interDyMFoam/sloshingTank2D/system/fvSchemes diff --git a/tutorials/interDyMFoam/sloshingTank/system/fvSolution b/tutorials/interDyMFoam/sloshingTank2D/system/fvSolution similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/system/fvSolution rename to tutorials/interDyMFoam/sloshingTank2D/system/fvSolution diff --git a/tutorials/interDyMFoam/sloshingTank/system/setFieldsDict b/tutorials/interDyMFoam/sloshingTank2D/system/setFieldsDict similarity index 100% rename from tutorials/interDyMFoam/sloshingTank/system/setFieldsDict rename to tutorials/interDyMFoam/sloshingTank2D/system/setFieldsDict diff --git a/tutorials/interDyMFoam/sloshingTank3D/0/U b/tutorials/interDyMFoam/sloshingTank3D/0/U new file mode 100644 index 0000000000000000000000000000000000000000..df1f4c5a6cac4fec14e0fe27b4ce52192bbb8588 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/0/U @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + walls + { + type movingWallVelocity; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/0/gamma.org b/tutorials/interDyMFoam/sloshingTank3D/0/gamma.org new file mode 100644 index 0000000000000000000000000000000000000000..85902dcba56932d63c672f60079995cbf927b363 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/0/gamma.org @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object gamma; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/0/pd b/tutorials/interDyMFoam/sloshingTank3D/0/pd new file mode 100644 index 0000000000000000000000000000000000000000..25379b239c07f497fa0d81af72650ff736e464f2 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/0/pd @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object pd; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/Allclean b/tutorials/interDyMFoam/sloshingTank3D/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..2ffbd01addc2d4c2c5326f0f401c575945c12b7d --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/Allclean @@ -0,0 +1,4 @@ +#!/bin/sh + +foamCleanTutorials cases +rm -rf 0/gamma.gz probes wallPressure pRefProbe diff --git a/tutorials/interDyMFoam/sloshingTank3D/Allrun b/tutorials/interDyMFoam/sloshingTank3D/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..748dcf65ba56b28289c079d37d4abde3e95f3257 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/Allrun @@ -0,0 +1,9 @@ +#!/bin/sh +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict +runApplication blockMesh +cp 0/gamma.org 0/gamma +runApplication setFields +runApplication interDyMFoam diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/RASProperties b/tutorials/interDyMFoam/sloshingTank3D/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..ac1efb34c5d460ae6483a045c147312455969903 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/RASProperties @@ -0,0 +1,173 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// RASModel kEpsilon; +RASModel laminar; + +turbulence off; + +laminarCoeffs +{ +} + +kEpsilonCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphaEps 0.76923; +} + +RNGkEpsilonCoeffs +{ + Cmu 0.0845; + C1 1.42; + C2 1.68; + alphak 1.39; + alphaEps 1.39; + eta0 4.38; + beta 0.012; +} + +NonlinearKEShihCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphak 1; + alphaEps 0.76932; + A1 1.25; + A2 1000; + Ctau1 -4; + Ctau2 13; + Ctau3 -2; + alphaKsi 0.9; +} + +LienCubicKECoeffs +{ + C1 1.44; + C2 1.92; + alphak 1; + alphaEps 0.76923; + A1 1.25; + A2 1000; + Ctau1 -4; + Ctau2 13; + Ctau3 -2; + alphaKsi 0.9; +} + +QZetaCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphaZeta 0.76923; + anisotropic no; +} + +LaunderSharmaKECoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphaEps 0.76923; +} + +LamBremhorstKECoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphaEps 0.76923; +} + +LienCubicKELowReCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphak 1; + alphaEps 0.76923; + A1 1.25; + A2 1000; + Ctau1 -4; + Ctau2 13; + Ctau3 -2; + alphaKsi 0.9; + Am 0.016; + Aepsilon 0.263; + Amu 0.00222; +} + +LienLeschzinerLowReCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphak 1; + alphaEps 0.76923; + Am 0.016; + Aepsilon 0.263; + Amu 0.00222; +} + +LRRCoeffs +{ + Cmu 0.09; + Clrr1 1.8; + Clrr2 0.6; + C1 1.44; + C2 1.92; + Cs 0.25; + Ceps 0.15; + alphaEps 0.76923; +} + +LaunderGibsonRSTMCoeffs +{ + Cmu 0.09; + Clg1 1.8; + Clg2 0.6; + C1 1.44; + C2 1.92; + C1Ref 0.5; + C2Ref 0.3; + Cs 0.25; + Ceps 0.15; + alphaEps 0.76923; + alphaR 1.22; +} + +SpalartAllmarasCoeffs +{ + alphaNut 1.5; + Cb1 0.1355; + Cb2 0.622; + Cw2 0.3; + Cw3 2; + Cv1 7.1; + Cv2 5.0; +} + +wallFunctionCoeffs +{ + kappa 0.4187; + E 9; +} + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/dynamicMeshDict b/tutorials/interDyMFoam/sloshingTank3D/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..e7a0ec06d662ae2718dffc093a0605bbf62f732f --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/dynamicMeshDict @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object motionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh solidBodyMotionFvMesh; + +solidBodyMotionFvMeshCoeffs +{ + solidBodyMotionFunction SDA; + + SDACoeffs + { + // Centre of gravity + CofG (0 0 0); + + // Model scale ratio + lamda 50; + + // Max roll amplitude [rad] + rollAmax 0.22654; + + // Min roll amplitude [rad] + rollAmin 0.10472; + + // Heave amplitude [m] + heaveA 3.79; + + // Sway amplitude [m] + swayA 2.34; + + // Damping Coefficient [-] + Q 2.00; + + // Time Period for liquid [sec] + Tp 13.93; + + // Natural Period of Ship [sec] + Tpn 11.93; + + // Reference time step [sec] + dTi 0.059; + + // Incr. in Tp/unit 'dTi'[-] + dTp -0.001; + } +} + +// ************************************************************************* // diff --git a/tutorials/icoFoam/cavity/FoamFile b/tutorials/interDyMFoam/sloshingTank3D/constant/environmentalProperties similarity index 61% rename from tutorials/icoFoam/cavity/FoamFile rename to tutorials/interDyMFoam/sloshingTank3D/constant/environmentalProperties index b74a10e4c6eb9704b58817e1a3769d8e8c71b446..40232c0c406c02d21a4ae29a31f702bbf84c6214 100644 --- a/tutorials/icoFoam/cavity/FoamFile +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/environmentalProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -9,6 +9,11 @@ FoamFile { version 2.0; format ascii; - class volScalarField; - object p; + class dictionary; + object environmentalProperties; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +g g [0 1 -2 0 0 0 0] (0 0 -9.81); + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..0d21d111481f4479c9f59f540e7962d4a65e3e4c --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict @@ -0,0 +1,137 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General m4 macros + + + + + + + + + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// User-defined parameters + +convertToMeters 1; + + // Length of tank (x-direction) + // Breadth of tank (y-direction) + // Depth of tank (z-direction) + + // Depth to the top (height) of lower chamfer + // Height of upper chamfer + + // Angle of lower chamfer to the horizontal + // Angle of upper chamfer to the horizontal + + // Centre of gravity in y-direction + // Centre of gravity in z-direction + + // Number of cells in the length (1 for 2D) + // Number of cells in the breadth + // Number of cells in the height of the lower champfer + // Number of cells in the height between the chamfers + // Number of cells in the height of the upper champfer + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Derived parameters + + // Breadth to the top (height) of lower chamfer + // Breadth of upper chamfer + + + + + + + + + + + + + + + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Parametric description + +vertices +( + (-10 -15 -10.0) // Vertex bllcb = 0 + (-10 -20 -5) // Vertex bllc = 1 + (-10 -20 10) // Vertex bluc = 2 + (-10 -10 20) // Vertex bluct = 3 + (-10 15 -10.0) // Vertex brlcb = 4 + (-10 20 -5) // Vertex brlc = 5 + (-10 20 10) // Vertex bruc = 6 + (-10 10 20) // Vertex bruct = 7 + + (10 -15 -10.0) // Vertex fllcb = 8 + (10 -20 -5) // Vertex fllc = 9 + (10 -20 10) // Vertex fluc = 10 + (10 -10 20) // Vertex fluct = 11 + (10 15 -10.0) // Vertex frlcb = 12 + (10 20 -5) // Vertex frlc = 13 + (10 20 10) // Vertex fruc = 14 + (10 10 20) // Vertex fruct = 15 +); + +blocks +( + // block0 + hex (0 4 5 1 8 12 13 9) + (40 6 19) + simpleGrading (1 1 1) + + // block1 + hex (1 5 6 2 9 13 14 10) + (40 16 19) + simpleGrading (1 1 1) + + // block2 + hex (2 6 7 3 10 14 15 11) + (40 12 19) + simpleGrading (1 1 1) +); + +patches +( + patch walls + ( + (0 4 12 8) + (4 5 13 12) + (5 6 14 13) + (6 7 15 14) + (7 3 11 15) + (3 2 10 11) + (2 1 9 10) + (1 0 8 9) + (8 12 13 9) + (9 13 14 10) + (10 14 15 11) + (0 1 5 4) + (1 2 6 5) + (2 3 7 6) + ) +); + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 new file mode 100644 index 0000000000000000000000000000000000000000..5e355fd7025a748a668cd3d55bfe9bd984c78869 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 @@ -0,0 +1,137 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General m4 macros + +changecom(//)changequote([,]) +define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +define(VCOUNT, 0) +define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) + +define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) +define(quad2D, (b$1 b$2 f$2 f$1)) +define(frontQuad, (f$1 f$2 f$3 f$4)) +define(backQuad, (b$1 b$4 b$3 b$2)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// User-defined parameters + +convertToMeters 1; + +define(l, 20) // Length of tank (x-direction) +define(b, 40) // Breadth of tank (y-direction) +define(h, 30) // Depth of tank (z-direction) + +define(hlc, 5) // Depth to the top (height) of lower chamfer +define(huc, 10) // Height of upper chamfer + +define(thetalc, 45) // Angle of lower chamfer to the horizontal +define(thetauc, 45) // Angle of upper chamfer to the horizontal + +define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction +define(CofGz, 10.0) // Centre of gravity in z-direction + +define(Nl, 19) // Number of cells in the length (1 for 2D) +define(Nb, 40) // Number of cells in the breadth +define(Nhlc, 6) // Number of cells in the height of the lower champfer +define(Nh, 16) // Number of cells in the height between the chamfers +define(Nhuc, 12) // Number of cells in the height of the upper champfer + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Derived parameters + +define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer +define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer + +define(Yl, -CofGy) +define(Yllc, calc(Yl + blc)) +define(Yluc, calc(Yl + buc)) + +define(Yr, calc(Yl + b)) +define(Yrlc, calc(Yr - blc)) +define(Yruc, calc(Yr - buc)) + +define(Zb, -CofGz) +define(Zlc, calc(Zb + hlc)) +define(Zt, calc(Zb + h)) +define(Zuc, calc(Zt - huc)) + +define(Xf, calc(l/2.0)) +define(Xb, calc(Xf - l)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Parametric description + +vertices +( + (Xb Yllc Zb) vlabel(bllcb) + (Xb Yl Zlc) vlabel(bllc) + (Xb Yl Zuc) vlabel(bluc) + (Xb Yluc Zt) vlabel(bluct) + (Xb Yrlc Zb) vlabel(brlcb) + (Xb Yr Zlc) vlabel(brlc) + (Xb Yr Zuc) vlabel(bruc) + (Xb Yruc Zt) vlabel(bruct) + + (Xf Yllc Zb) vlabel(fllcb) + (Xf Yl Zlc) vlabel(fllc) + (Xf Yl Zuc) vlabel(fluc) + (Xf Yluc Zt) vlabel(fluct) + (Xf Yrlc Zb) vlabel(frlcb) + (Xf Yr Zlc) vlabel(frlc) + (Xf Yr Zuc) vlabel(fruc) + (Xf Yruc Zt) vlabel(fruct) +); + +blocks +( + // block0 + hex2D(llcb, rlcb, rlc, llc) + (Nb Nhlc Nl) + simpleGrading (1 1 1) + + // block1 + hex2D(llc, rlc, ruc, luc) + (Nb Nh Nl) + simpleGrading (1 1 1) + + // block2 + hex2D(luc, ruc, ruct, luct) + (Nb Nhuc Nl) + simpleGrading (1 1 1) +); + +patches +( + patch walls + ( + quad2D(llcb, rlcb) + quad2D(rlcb, rlc) + quad2D(rlc, ruc) + quad2D(ruc, ruct) + quad2D(ruct, luct) + quad2D(luct, luc) + quad2D(luc, llc) + quad2D(llc, llcb) + frontQuad(llcb, rlcb, rlc, llc) + frontQuad(llc, rlc, ruc, luc) + frontQuad(luc, ruc, ruct, luct) + backQuad(llcb, rlcb, rlc, llc) + backQuad(llc, rlc, ruc, luc) + backQuad(luc, ruc, ruct, luct) + ) +); + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/boundary b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..28068f37d475c1adafedec2ee7c20e8de8d7df32 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/boundary @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + walls + { + type patch; + nFaces 5532; + startFace 74754; + } +) + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/transportProperties b/tutorials/interDyMFoam/sloshingTank3D/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..c20854a9031a956ad8bc154b0a4ae87375add730 --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/transportProperties @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 +{ + transportModel Newtonian; + nu nu [0 2 -1 0 0 0 0] 1e-6; + rho rho [1 -3 0 0 0 0 0] 998.2; +} + +phase2 +{ + transportModel Newtonian; + nu nu [0 2 -1 0 0 0 0] 1.48e-05; + rho rho [1 -3 0 0 0 0 0] 1; +} + +sigma sigma [1 0 -2 0 0 0 0] 0.0; + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/system/controlDict b/tutorials/interDyMFoam/sloshingTank3D/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..b721c9c05888ff377853556eee6154363bc8e05f --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/system/controlDict @@ -0,0 +1,109 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application sloshingFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 40; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 0.05; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression compressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; + +maxDeltaT 1; + +functions +( + probes + { + // Type of functionObject + type probes; + + // Name of the directory for the probe data + name probes; + + // Locations to be probed. runTime modifiable! + probeLocations + ( + (0 9.95 19.77) + (0 -9.95 19.77) + ); + + // Fields to be probed. runTime modifiable! + fields + ( + p + ); + } + + /* + wallPressure + { + // Type of functionObject + type surfaces; + + // Where to load it from (if not already in solver) + functionObjectLibs ("libsampling.so"); + + // Output every 10th time step + interval 10; + + surfaceFormat raw; + + fields + ( + p + ); + + surfaces + ( + walls + { + type patch; + patchName walls; + triangulate false; + } + ); + } + */ +); + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/system/decomposeParDict b/tutorials/interDyMFoam/sloshingTank3D/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..d4594e09475d920c6ca71413fa457c4ec15810ac --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/system/decomposeParDict @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 16; + +method hierarchical; + +simpleCoeffs +{ + n (2 2 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (4 2 2); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights + ( + 1 + 1 + 1 + 1 + ); +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/system/fvSchemes b/tutorials/interDyMFoam/sloshingTank3D/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..f089e4e5e6a14300b65f1deeeda14777be255c0c --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/system/fvSchemes @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(U) Gauss linear; + grad(gamma) Gauss linear; +} + +divSchemes +{ + div(rho*phi,U) Gauss vanLeerV; + div(phi,gamma) Gauss vanLeer; + div(phirb,gamma) Gauss vanLeer; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + pd; + pcorr; + gamma; +} + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/system/fvSolution b/tutorials/interDyMFoam/sloshingTank3D/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..3aaca52375805f2de0bb55235af2d945db86e22c --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/system/fvSolution @@ -0,0 +1,123 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + pcorr PCG + { + preconditioner GAMG + { + tolerance 1e-5; + relTol 0; + + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nBottomSweeps 2; + + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + tolerance 1e-5; + relTol 0; + maxIter 100; + }; + + pd GAMG + { + tolerance 1e-8; + relTol 0.01; + + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + pdFinal PCG + { + preconditioner GAMG + { + tolerance 2e-9; + relTol 0; + + nVcycles 2; + + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + tolerance 2e-9; + relTol 0; + maxIter 20; + }; + + U smoothSolver + { + smoother GaussSeidel; + tolerance 1e-6; + relTol 0; + nSweeps 1; + }; +} + +PISO +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + nGammaCorr 1; + nGammaSubCycles 3; + cGamma 1.5; + correctPhi no; + + pRefProbe + { + fields + ( + p + ); + + probeLocations + ( + (0 0 0.15) + ); + } + + pRefValue 1e5; +} + +relaxationFactors +{ + U 1.0; +} + +// ************************************************************************* // diff --git a/tutorials/interDyMFoam/sloshingTank3D/system/setFieldsDict b/tutorials/interDyMFoam/sloshingTank3D/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..2c881a7ba48d03bc05de5c2d82ab02c90c1928ef --- /dev/null +++ b/tutorials/interDyMFoam/sloshingTank3D/system/setFieldsDict @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue gamma 0 +); + +regions +( + boxToCell + { + box (-100 -100 -100) (100 100 0); + + fieldValues + ( + volScalarFieldValue gamma 1 + ); + } +); + +// ************************************************************************* //