├── .gitignore ├── .vscode └── settings.json ├── Allwclean ├── Allwmake ├── LICENSE ├── README.md ├── doc ├── Doxyfile ├── customdoxygen.css ├── footer.html ├── header.html └── phasicFlowPlus_Logo_github.png ├── phasicFlowCoupling ├── MPIParallelization │ ├── mpiCommunicationPlus.hpp │ ├── mpiTypesPlus.hpp │ ├── procCommunicationPlus.C │ ├── procCommunicationPlus.hpp │ ├── procDEMSystemPlus.C │ ├── procDEMSystemPlus.hpp │ ├── procVectorPlus.hpp │ ├── processorPlus.C │ ├── processorPlus.hpp │ └── scatteredCommunicationPlus.hpp ├── Make │ ├── files │ └── options ├── OFCompatibleHeader.hpp ├── OFVersion.H ├── containers │ ├── centerMassField.C │ ├── centerMassField.hpp │ ├── eventSubscriber │ │ ├── eventMessagePlus.hpp │ │ ├── eventObserverPlus.C │ │ ├── eventObserverPlus.hpp │ │ ├── eventSubscriberPlus.C │ │ └── eventSubscriberPlus.hpp │ ├── phasicFlowOverloads.hpp │ ├── procCMField.hpp │ ├── procCMFields.C │ └── procCMFields.hpp └── couplingSystem │ ├── couplingMesh │ ├── couplingMesh.C │ └── couplingMesh.hpp │ ├── couplingSystem.C │ ├── couplingSystem.hpp │ ├── resolved │ ├── resolvedCouplingSystem.C │ └── resolvedCouplingSystem.hpp │ └── unresolved │ ├── distributions │ ├── Gaussian.C │ ├── Gaussian.hpp │ ├── Gaussian2.C │ ├── Gaussian2.hpp │ ├── GaussianIntegral.C │ ├── GaussianIntegral.hpp │ ├── adaptiveGaussian.C │ ├── adaptiveGaussian.hpp │ ├── distribution.C │ ├── distribution.hpp │ ├── self.C │ └── self.hpp │ ├── grainUnresolvedCouplingSystem │ ├── grainUnresolvedCouplingSystem.C │ ├── grainUnresolvedCouplingSystem.hpp │ └── grainUnresolvedCouplingSystems.C │ ├── interaction │ ├── drag │ │ ├── drag.C │ │ ├── drag.hpp │ │ └── drags.C │ ├── dragClosures │ │ ├── DiFelice.C │ │ ├── DiFelice.hpp │ │ ├── ErgunWenYu.C │ │ ├── ErgunWenYu.hpp │ │ ├── Rong.C │ │ └── Rong.hpp │ ├── grainDrag │ │ ├── grainDrag.C │ │ ├── grainDrag.hpp │ │ └── grainDrags.C │ └── sphereDrag │ │ ├── sphereDrag.C │ │ ├── sphereDrag.hpp │ │ └── sphereDrags.C │ ├── porosity │ ├── PIC │ │ ├── PIC.C │ │ └── PIC.hpp │ ├── diffusion │ │ ├── diffusion.C │ │ └── diffusion.hpp │ ├── porosity │ │ ├── porosity.C │ │ └── porosity.hpp │ ├── porosityCellDistribution │ │ ├── porosityCellDistribution.C │ │ ├── porosityCellDistribution.hpp │ │ └── porosityCellDistributions.C │ ├── subDivision29 │ │ ├── subDivCheck.hpp │ │ ├── subDivision29.C │ │ ├── subDivision29.hpp │ │ ├── subDivision29Mod.C │ │ └── subDivision29Mod.hpp │ └── subDivision9 │ │ ├── subDivision9.C │ │ └── subDivision9.hpp │ ├── sphereUnresolvedCouplingSystem │ ├── sphereUnresolvedCouplingSystem.C │ ├── sphereUnresolvedCouplingSystem.hpp │ └── sphereUnresolvedCouplingSystems.C │ └── unresolvedCouplingSystem │ ├── UnresolvedCouplingSystem.C │ ├── UnresolvedCouplingSystem.hpp │ ├── unresolvedCouplingSystem.C │ └── unresolvedCouplingSystem.hpp ├── solvers ├── particleTrackPFPlus │ └── file.txt ├── resolvedSpherePFPlus │ └── v24 │ │ ├── Make │ │ ├── files │ │ └── options │ │ ├── STL.H │ │ ├── UEqn.H │ │ ├── correctPhi.H │ │ ├── createFields.H │ │ ├── fluidToSolid.H │ │ ├── pEqn.H │ │ ├── resolvedSpherePFPlus.C │ │ └── solidToFluid.H ├── unresolvedGrainPFPisoFoam │ ├── ReadMe.md │ └── v9 │ │ ├── Make │ │ ├── files │ │ └── options │ │ ├── UEqn.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedGrainPFPisoFoam.C ├── unresolvedGrainPFPlus │ ├── v24 │ │ ├── Make │ │ │ ├── files │ │ │ └── options │ │ ├── UEqn.H │ │ ├── correctPhi.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedGrainPFPlus.C │ └── v9 │ │ ├── Make │ │ ├── files │ │ └── options │ │ ├── UEqn.H │ │ ├── correctPhi.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedSpherePFPlus.C ├── unresolvedSpherePFPisoFoam │ ├── ReadMe.md │ ├── v24 │ │ ├── Make │ │ │ ├── files │ │ │ └── options │ │ ├── UEqn.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedSpherePFPisoFoam.C │ └── v9 │ │ ├── Make │ │ ├── files │ │ └── options │ │ ├── UEqn.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedSpherePFPisoFoam.C ├── unresolvedSpherePFPlus │ ├── v24 │ │ ├── Make │ │ │ ├── files │ │ │ └── options │ │ ├── UEqn.H │ │ ├── correctPhi.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedSpherePFPlus.C │ └── v9 │ │ ├── Make │ │ ├── files │ │ └── options │ │ ├── UEqn.H │ │ ├── correctPhi.H │ │ ├── createFields.H │ │ ├── pEqn.H │ │ └── unresolvedSpherePFPlus.C ├── wclean └── wmake ├── tutorials ├── unresolvedGrainPFPisoFoam │ └── fluidizededbed │ │ ├── Allrun │ │ ├── FluidField │ │ ├── U │ │ ├── alpha │ │ └── p │ │ ├── caseSetup │ │ ├── interaction │ │ ├── particleInsertion │ │ └── shapes │ │ ├── constant │ │ ├── couplingProperties │ │ ├── momentumTransport │ │ ├── polyMesh │ │ │ ├── boundary │ │ │ ├── faces │ │ │ ├── neighbour │ │ │ ├── owner │ │ │ └── points │ │ ├── transportProperties │ │ └── turbulenceProperties │ │ ├── settings │ │ ├── domainDict │ │ ├── geometryDict │ │ ├── particlesDict │ │ └── settingsDict │ │ └── system │ │ ├── blockMeshDict │ │ ├── controlDict │ │ ├── decomposeParDict │ │ ├── fvSchemes │ │ └── fvSolution └── unresolvedSpherePFPisoFoam │ └── fluidizededbed │ ├── Allrun │ ├── FluidField │ ├── U │ ├── alpha │ └── p │ ├── caseSetup │ ├── interaction │ ├── particleInsertion │ └── shapes │ ├── constant │ ├── couplingProperties │ ├── momentumTransport │ ├── polyMesh │ │ ├── boundary │ │ ├── faces │ │ ├── neighbour │ │ ├── owner │ │ └── points │ ├── transportProperties │ └── turbulenceProperties │ ├── settings │ ├── domainDict │ ├── geometryDict │ ├── particlesDict │ └── settingsDict │ └── system │ ├── blockMeshDict │ ├── controlDict │ ├── decomposeParDict │ ├── fvSchemes │ └── fvSolution ├── utilities ├── pFCouplingUtilities │ ├── Make │ │ ├── files │ │ └── options │ ├── foamPatchWall │ │ ├── foamPatchWall.C │ │ └── foamPatchWall.hpp │ └── lnInclude │ │ ├── foamPatchWall.C │ │ └── foamPatchWall.hpp ├── wclean └── wmake └── version /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | *.dep 4 | 5 | # files 6 | testLink.C 7 | 8 | # Compiled Object files 9 | *.slo 10 | *.lo 11 | *.o 12 | *.obj 13 | 14 | # Precompiled Headers 15 | *.gch 16 | *.pch 17 | 18 | # Compiled Dynamic libraries 19 | *.so 20 | *.dylib 21 | *.dll 22 | 23 | # Fortran module files 24 | *.mod 25 | *.smod 26 | 27 | # Compiled Static libraries 28 | *.lai 29 | *.la 30 | *.a 31 | *.lib 32 | 33 | # Executables 34 | *.exe 35 | *.out 36 | *.app 37 | 38 | # directories 39 | Make/linux*/** 40 | Make/linux*/**/* 41 | Make/linux*/* 42 | lnInclude/** 43 | **/lnInclude/* 44 | **/Make/linux*/ 45 | test/ 46 | doc/code-documentation/ 47 | doc/DTAGS 48 | 49 | # all possible time folders 50 | **/[0-9] 51 | **/[0-9][0-9] 52 | **/[0-9][0-9][0-9] 53 | **/[0-9][0-9][0-9][0-9] 54 | **/[0-9][0-9][0-9][0-9][0-9] 55 | **/[0-9]*.[0-9] 56 | **/[0-9]*.[0-9][0-9] 57 | **/[0-9]*.[0-9][0-9][0-9] 58 | **/[0-9]*.[0-9][0-9][0-9][0-9] 59 | **/[0-9]*.[0-9][0-9][0-9][0-9][0-9] 60 | **/[0-9]*.[0-9][0-9][0-9][0-9][0-9][0-9] 61 | **/[0-9]*.[0-9][0-9][0-9][0-9][0-9][0-9][0-9] 62 | **/[0-9]*.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] 63 | **/VTK 64 | -------------------------------------------------------------------------------- /Allwclean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | 5 | wclean ./phasicFlowCoupling 6 | solvers/wclean 7 | utilities/wclean 8 | 9 | #------------------------------------------------------------------------------ 10 | -------------------------------------------------------------------------------- /Allwmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | # Parse arguments for library compilation 5 | . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments 6 | 7 | ./version 8 | 9 | # Compile libraries and applications 10 | echo "\nCompiling phasicFlowCoupling library" 11 | wmake ./phasicFlowCoupling 12 | 13 | 14 | echo "\nCompiling utilities" 15 | utilities/wmake 16 | 17 | echo "\nCompiling solvers" 18 | solvers/wmake 19 | #------------------------------------------------------------------------------ 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | . 6 | 7 | **PhasicFlowPlus** is a software package for simulating fluid-particle flows. It is a combination of computational fluid dynamics (CFD) and discrete element method (DEM). The fluid is assumed as a continuum phase and the particles as discrete bodies. 8 | 9 | Here, DEM calculations are handled using features of [PhasicFlow](https://github.com/PhasicFlow/phasicFlow). It is a parallel DEM package that can be run on multi-core CPUs or GPUs. The equations for the fluid phase are discritized based on finite volume (FV) and solved using OpenFOAM. OpenFOAM is parallelized based on MPI for being executed on multicore CPUs. The fluid-particle coupling (PhasicFlowPlus) uses both parallelization methods, shared-memory and MPI, to leverage the maximum computational resoureces. 10 | 11 | Based on the above configuration, PhasicFlowPlus can use the computational resources of a multi-core CPU or use the computational resource of both CPU and GPU. 12 | 13 | ## What is under development? 14 | The following parts are being developed at the moment: 15 | * Course graining for CFD-DEM 16 | * Resolved solver for CFD-DEM 17 | * Modifying some parts for better functionality and performance 18 | 19 | ## How to build version 0.1 20 | First, you need to [install PhasicFlow-v0.1](https://github.com/PhasicFlow/phasicFlow/wiki/How-to-Build-PhasicFlow) and OpenFoam-v9 (For now, it is only tested with [OpenFOAM-v9](https://openfoam.org/download/9-source/)) on your computer. After that, copy [PhasicFlowPlus-v0.1](https://github.com/PhasicFlow/PhasicFlowPlus/releases/tag/v-0.1) on your computer. The `PhasicFlowPlus` folder shoule be located beside `phasicFlow` folder on your computer (in ~/PhasicFlow/ folder). Navigate to the root directory of the code and enter the following commands to install the code. 21 | 22 | ``` 23 | cd ~/PhasicFlow/PhasicFlowPlus/ 24 | ./Allwmake 25 | ``` 26 | 27 | 28 | -------------------------------------------------------------------------------- /doc/customdoxygen.css: -------------------------------------------------------------------------------- 1 | #titlearea 2 | { 3 | background-color: rgb(243, 243, 243); 4 | height: 120px; 5 | padding-top: 8px; 6 | } 7 | 8 | #projectlogo 9 | { 10 | padding-left: 15px; 11 | padding-right: 10px; 12 | } 13 | 14 | #titlearea, #projectname, #projectbrief, #projectnumber 15 | { 16 | font-family: Lato, "Helvetica Neue", Helvetica, sans-serif; 17 | } 18 | 19 | #projectname 20 | { 21 | font-size: 220%; 22 | } 23 | 24 | #projectname a 25 | { 26 | color: rgba(0, 0, 0, 0.75); 27 | } 28 | 29 | #projectname a:hover, #projectbrief a:hover 30 | { 31 | text-decoration: none; 32 | color: rgba(0, 0, 0, 1); 33 | } 34 | 35 | #projectbrief 36 | { 37 | font-size: 150%; 38 | } 39 | 40 | #projectbrief a 41 | { 42 | color: rgba(0, 0, 0, 0.65); 43 | } 44 | 45 | #projectnumber a 46 | { 47 | font-size: 160%; 48 | } 49 | 50 | #titlearea::before 51 | { 52 | padding-left: 300px; 53 | position: absolute; 54 | left: 18%; 55 | top: 40px; 56 | transform: translateY(-50%); 57 | -webkit-transform: translateY(-50%); 58 | -ms-transform: translateY(-50%); 59 | content: "C++ Source Code Documentation"; 60 | font-size: 180%; 61 | } 62 | -------------------------------------------------------------------------------- /doc/footer.html: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /doc/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $projectname: $title 8 | $title 9 | 10 | 11 | 12 | $treeview 13 | $search 14 | $mathjax 15 | 16 | $extrastylesheet 17 | 18 | 19 |
20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
31 | 34 | 35 | 40 |
$projectbrief
41 |
$searchbox
52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/phasicFlowPlus_Logo_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhasicFlow/PhasicFlowPlus/d4bed39cb621a4e33bff9f1cb57d094ddae4a0f2/doc/phasicFlowPlus_Logo_github.png -------------------------------------------------------------------------------- /phasicFlowCoupling/MPIParallelization/mpiTypesPlus.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __mpiTypesPlus_H__ 22 | #define __mpiTypesPlus_H__ 23 | 24 | 25 | #include 26 | 27 | namespace pFlow::Plus 28 | { 29 | // types 30 | using Comm = MPI_Comm; 31 | using Status = MPI_Status; 32 | using Offset = MPI_Offset; 33 | using Request = MPI_Request; 34 | using Operation = MPI_Op; 35 | using File = MPI_File; 36 | using Information = MPI_Info; 37 | using DataType = MPI_Datatype; 38 | 39 | 40 | using FileSize = unsigned long; 41 | 42 | inline Comm CommWorld = MPI_COMM_WORLD; 43 | 44 | // all nulls 45 | 46 | inline auto ProcNull = MPI_PROC_NULL; 47 | inline auto InfoNull = MPI_INFO_NULL; 48 | inline auto RequestNull = MPI_REQUEST_NULL; 49 | inline auto StatusIgnore = MPI_STATUS_IGNORE; 50 | inline auto StatusesIgnore= MPI_STATUSES_IGNORE; 51 | inline auto FileNull = MPI_FILE_NULL; 52 | inline Comm CommNull = MPI_COMM_NULL; 53 | 54 | // file 55 | inline const auto ModeCreate = MPI_MODE_CREATE; 56 | inline const auto ModeAppend = MPI_MODE_APPEND; 57 | inline const auto ModeReadOnly = MPI_MODE_RDONLY; 58 | inline const auto ModeWriteOnly = MPI_MODE_WRONLY; 59 | inline const auto ModeReadWrite = MPI_MODE_RDWR; 60 | 61 | 62 | // errors 63 | inline const auto Success = MPI_SUCCESS; 64 | inline const auto ErrOp = MPI_ERR_OP; 65 | 66 | 67 | inline const auto SumOp = MPI_SUM; 68 | 69 | 70 | inline const size_t MaxNoProcessors = 2048; 71 | 72 | // others 73 | 74 | } 75 | 76 | 77 | 78 | #endif //__mpiTypesPlus_H__ 79 | -------------------------------------------------------------------------------- /phasicFlowCoupling/MPIParallelization/procCommunicationPlus.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #include "procCommunicationPlus.hpp" 22 | 23 | 24 | pFlow::Plus::procCommunication::procCommunication() 25 | { 26 | } -------------------------------------------------------------------------------- /phasicFlowCoupling/MPIParallelization/procDEMSystemPlus.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #include "procDEMSystemPlus.hpp" 22 | #include "procVectorPlus.hpp" 23 | #include "procCommunicationPlus.hpp" 24 | 25 | pFlow::Plus::procDEMSystem::procDEMSystem 26 | ( 27 | word demSystemName, 28 | int argc, 29 | char* argv[], 30 | bool requireRVel 31 | ) 32 | { 33 | if(Plus::processor::isMaster()) 34 | { 35 | demSystem_ = DEMSystem::create( 36 | demSystemName, 37 | procVector( 38 | box 39 | ( 40 | realx3(0), 41 | realx3(1) 42 | )), 43 | argc, 44 | argv, 45 | requireRVel); 46 | } 47 | 48 | procCommunication proc; 49 | 50 | real startT; 51 | if(demSystem_) 52 | { 53 | startT = demSystem_->Control().time().startTime(); 54 | } 55 | else 56 | { 57 | startT = 0; 58 | } 59 | 60 | if(!proc.distributeMasterToAll(startT, startTime_)) 61 | { 62 | fatalErrorInFunction<< "could not get start time"<=2406) || (FOAM_VERSION==9) 36 | return t.timeName(); 37 | #endif 38 | } 39 | 40 | inline 41 | label findPatchID(const polyBoundaryMesh& bndry, const word& patchName) 42 | { 43 | #if (FOAM_VERSION == 12) 44 | return bndry.findIndex(patchName); 45 | #elif(FOAM_VERSION>=2406) || (FOAM_VERSION==9) 46 | return bndry.findPatchID(patchName); 47 | #endif 48 | } 49 | 50 | 51 | template class PatchField, class GeoMesh> 52 | inline 53 | auto& fieldRef(GeometricField& field) 54 | { 55 | #if (FOAM_VERSION==12) 56 | return field.internalFieldRef(); 57 | #elif (FOAM_VERSION>=2406) || (FOAM_VERSION==9) 58 | return field.ref(); 59 | #endif 60 | } 61 | } 62 | 63 | template 64 | inline 65 | T lookupDict(const Foam::dictionary& dict, const Foam::word& keyword) 66 | { 67 | #if (FOAM_VERSION>=9) && (FOAM_VERSION<=12) 68 | return dict.lookup(keyword); 69 | #elif(FOAM_VERSION>=2406) 70 | return dict.get(keyword); 71 | #endif 72 | } 73 | 74 | template 75 | inline 76 | T lookupOrDefaultDict(const Foam::dictionary& dict, const Foam::word& keyword, const T& deflt) 77 | { 78 | #if (FOAM_VERSION>=9) && (FOAM_VERSION<=12) 79 | return dict.lookupOrDefault(keyword, deflt); 80 | #elif(FOAM_VERSION>=2406) 81 | return dict.getOrDefault(keyword, deflt); 82 | #endif 83 | } 84 | 85 | inline 86 | Foam::treeBoundBox treeBoundBoxExtend(const Foam::treeBoundBox& box, Foam::scalar s) 87 | { 88 | static const Foam::vector a((Foam::sqrt(5.0) + 1)/2, Foam::sqrt(2.0), (Foam::sqrt(13.0) - 1)/2); 89 | static const Foam::vector b(a.y(), a.z(), a.x()); 90 | 91 | Foam::treeBoundBox bb(box); 92 | 93 | const Foam::scalar delta = s*Foam::mag(bb.span()); 94 | bb.min() -= Foam::max(delta*a, Foam::vector::uniform(1.0e-7)); 95 | bb.max() += Foam::max(delta*b, Foam::vector::uniform(1.0e-7)); 96 | 97 | return bb; 98 | } 99 | 100 | #endif //__OpenFOAMCompatibility_hpp__ 101 | -------------------------------------------------------------------------------- /phasicFlowCoupling/OFVersion.H: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 9 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | 9 | #ifndef OFVersion_H 10 | #define OFVersion_H 11 | 12 | #define FOAM_VERSION 9 13 | #define FOAM_VERSION_STRING 9 14 | 15 | #endif // OFVersion_H 16 | -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/centerMassField.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #include "centerMassField.hpp" 22 | 23 | 24 | pFlow::Plus::centerMassField::centerMassField(size_t size, size_t capacity) 25 | : 26 | Plus::eventSubscriber(), 27 | std::vector() 28 | { 29 | this->reserve(capacity); 30 | this->resize(size); 31 | } 32 | 33 | bool pFlow::Plus::centerMassField::checkForNewSize(size_t newSize) 34 | { 35 | 36 | if(newSize == this->size()) return true; 37 | 38 | eventMessage msg; 39 | if(newSize <= this->capacity() ) 40 | { 41 | // enough space is avaiable 42 | // only resize the container 43 | msg.add(eventMessage::SIZE_CHANGED); 44 | this->resize(newSize); 45 | } 46 | else if(newSize > this->capacity()) 47 | { 48 | // resize to new size and let std::vector 49 | // decides about capacity 50 | msg.add(eventMessage::SIZE_CHANGED); 51 | msg.add(eventMessage::CAP_CHANGED); 52 | this->resize(newSize); 53 | } 54 | 55 | if( !msg.isNull() ) 56 | { 57 | return this->notify(msg); 58 | } 59 | 60 | return true; 61 | 62 | } -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/centerMassField.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __centerMassField_hpp__ 22 | #define __centerMassField_hpp__ 23 | 24 | #include "phasicFlowOverloads.hpp" 25 | 26 | #include "eventSubscriberPlus.hpp" 27 | #include "span.hpp" 28 | #include "types.hpp" 29 | 30 | namespace pFlow::Plus 31 | { 32 | 33 | class centerMassField 34 | : 35 | public Plus::eventSubscriber, 36 | public std::vector 37 | { 38 | protected: 39 | 40 | using std::vector::reserve; 41 | 42 | using std::vector::resize; 43 | 44 | using std::vector::assign; 45 | 46 | using std::vector::clear; 47 | 48 | using std::vector::erase; 49 | 50 | public: 51 | 52 | TypeInfo("centerMassField"); 53 | 54 | centerMassField() = default; 55 | 56 | centerMassField(size_t size, size_t capacity); 57 | 58 | virtual ~centerMassField()=default; 59 | 60 | bool checkForNewSize(size_t newSize); 61 | 62 | }; 63 | 64 | inline 65 | span makeSpan(centerMassField& cmField) 66 | { 67 | return span( cmField.data(), cmField.size()); 68 | } 69 | 70 | inline 71 | span makeSpan(const centerMassField& cmField) 72 | { 73 | return span( cmField.data(), cmField.size()); 74 | } 75 | 76 | 77 | inline iOstream& operator << (iOstream& os, const centerMassField& f) 78 | { 79 | 80 | // start of 81 | os << token::BEGIN_LIST; 82 | for(size_t i=0; isubscribe(this); 41 | } 42 | } 43 | 44 | pFlow::Plus::eventObserver::~eventObserver() 45 | { 46 | if(subscribed_ && subscriber_) 47 | subscriber_->unsubscribe(this); 48 | } 49 | 50 | bool pFlow::Plus::eventObserver::subscribe(const eventSubscriber& subscriber) 51 | { 52 | subscriber_ = &subscriber; 53 | subscribed_ = subscriber_->subscribe(this); 54 | return subscribed_; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/eventSubscriber/eventObserverPlus.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #ifndef __eventObserverPlus_hpp__ 23 | #define __eventObserverPlus_hpp__ 24 | 25 | #include "eventMessagePlus.hpp" 26 | 27 | namespace pFlow::Plus 28 | { 29 | 30 | class eventSubscriber; 31 | 32 | 33 | class eventObserver 34 | { 35 | protected: 36 | 37 | const eventSubscriber* subscriber_ = nullptr; 38 | 39 | // if this object is linked to subscriber 40 | bool subscribed_ = false; 41 | 42 | public: 43 | 44 | eventObserver(); 45 | 46 | eventObserver(const eventSubscriber& subscriber, bool subscribe = true ); 47 | 48 | virtual ~eventObserver(); 49 | 50 | inline bool subscribed()const {return subscribed_;} 51 | 52 | bool subscribe(const eventSubscriber& subscriber); 53 | 54 | inline void invalidateSubscriber() 55 | { 56 | subscribed_ = false; 57 | } 58 | 59 | virtual bool update(const eventMessage& msg)=0; 60 | }; 61 | 62 | } // pFlow 63 | 64 | 65 | #endif // __eventObserver_hpp__ 66 | -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/eventSubscriber/eventSubscriberPlus.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "eventSubscriberPlus.hpp" 23 | #include 24 | 25 | pFlow::Plus::eventSubscriber::~eventSubscriber() 26 | { 27 | for(auto& observer:observerList_) 28 | { 29 | observer->invalidateSubscriber(); 30 | } 31 | } 32 | 33 | bool pFlow::Plus::eventSubscriber::subscribe 34 | ( 35 | eventObserver* observer 36 | )const 37 | { 38 | if(observer) 39 | { 40 | observerList_.push_back(observer); 41 | return true; 42 | } 43 | else 44 | { 45 | return false; 46 | } 47 | } 48 | 49 | bool pFlow::Plus::eventSubscriber::unsubscribe 50 | ( 51 | eventObserver* observer 52 | )const 53 | { 54 | if(observer) 55 | { 56 | std::remove(observerList_.begin(), observerList_.end(), observer); 57 | } 58 | return true; 59 | } 60 | 61 | bool pFlow::Plus::eventSubscriber::notify 62 | ( 63 | const eventMessage &msg 64 | ) 65 | { 66 | for ( auto& observer:observerList_ ) 67 | { 68 | if(observer) 69 | if( !observer->update(msg) ) return false; 70 | } 71 | 72 | return true; 73 | } 74 | 75 | /*bool pFlow::Plus::eventSubscriber::notify 76 | ( 77 | const eventMessage& msg, 78 | const List& exclutionList 79 | ) 80 | { 81 | std::set sortedExcList(exclutionList.begin(),exclutionList.end()); 82 | 83 | for(auto& observer:observerList_) 84 | { 85 | if( observer && sortedExcList.count(observer) == 0 ) 86 | { 87 | if(!observer->update(msg)) return false; 88 | } 89 | } 90 | 91 | return true; 92 | }*/ -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/eventSubscriber/eventSubscriberPlus.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #ifndef __eventSubscriberPlus_hpp__ 23 | #define __eventSubscriberPlus_hpp__ 24 | 25 | #include 26 | #include "eventObserverPlus.hpp" 27 | #include "eventMessagePlus.hpp" 28 | 29 | namespace pFlow 30 | { 31 | 32 | namespace Plus 33 | { 34 | 35 | 36 | class eventSubscriber 37 | { 38 | protected: 39 | 40 | // - list of subsribed objectd that recieve updage messages 41 | mutable std::vector observerList_; 42 | 43 | public: 44 | 45 | eventSubscriber() 46 | {} 47 | 48 | virtual ~eventSubscriber(); 49 | 50 | virtual bool subscribe(eventObserver* observer)const; 51 | 52 | virtual bool unsubscribe(eventObserver* observer)const; 53 | 54 | bool notify(const eventMessage& msg); 55 | 56 | //bool notify(const eventMessage& msg, const std::vector& exclutionList ); 57 | 58 | 59 | 60 | }; 61 | 62 | } // plus 63 | 64 | } // pFlow 65 | 66 | 67 | 68 | #endif // __eventSubscriber_hpp__ 69 | -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/phasicFlowOverloads.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __phasicFlowOverloads_hpp__ 2 | #define __phasicFlowOverloads_hpp__ 3 | 4 | #include 5 | 6 | #include "iOstream.hpp" 7 | #include "token.hpp" 8 | 9 | namespace pFlow::coupling 10 | { 11 | 12 | template 13 | iOstream& operator<< (iOstream& os, const std::vector vec) 14 | { 15 | 16 | token::punctuationToken sep; 17 | 18 | if(vec.size()<10 ) 19 | sep = token::SPACE; 20 | else 21 | sep = token::NL; 22 | 23 | os<; 26 | 27 | template class pFlow::Plus::procCMField; 28 | 29 | template class pFlow::Plus::procCMField; -------------------------------------------------------------------------------- /phasicFlowCoupling/containers/procCMFields.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "procCMField.hpp" 23 | #include "types.hpp" 24 | 25 | namespace pFlow::Plus 26 | { 27 | 28 | using realProcCMField = pFlow::Plus::procCMField; 29 | 30 | using int32ProcCMField = pFlow::Plus::procCMField; 31 | 32 | using uint32ProcCMField = pFlow::Plus::procCMField; 33 | 34 | using realx3ProcCMField = pFlow::Plus::procCMField; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/distributions/Gaussian2.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | #ifndef __Gaussian2_hpp__ 21 | #define __Gaussian2_hpp__ 22 | 23 | // from PhasicFlowPlus 24 | #include "distribution.hpp" 25 | 26 | 27 | namespace pFlow::coupling 28 | { 29 | 30 | class couplingMesh; 31 | 32 | class Gaussian2 33 | : 34 | public distribution 35 | { 36 | private: 37 | 38 | // radius of circle for cell neighbor list 39 | Foam::scalar standardDeviation_; 40 | 41 | Foam::scalar distLengthExtent_; 42 | 43 | public: 44 | 45 | /// Type info 46 | TypeInfoNV("Gaussian2"); 47 | 48 | /// Construct from dictionary 49 | Gaussian2( 50 | Foam::dictionary dict, 51 | const couplingMesh& cMesh, 52 | const Plus::centerMassField& centerMass); 53 | 54 | /// Destructor 55 | ~Gaussian2() = default; 56 | 57 | inline 58 | auto standardDeviation()const 59 | { 60 | return standardDeviation_; 61 | } 62 | 63 | void updateWeights( 64 | const Plus::procCMField & parCellIndex, 65 | const Plus::procCMField & parDiameter); 66 | 67 | 68 | 69 | }; 70 | 71 | } // pFlow::coupling 72 | 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/distributions/GaussianIntegral.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | #ifndef __GaussianIntegral_hpp__ 21 | #define __GaussianIntegral_hpp__ 22 | 23 | 24 | #include "distribution.hpp" 25 | 26 | 27 | namespace pFlow::coupling 28 | { 29 | 30 | class couplingMesh; 31 | 32 | class GaussianIntegral 33 | : 34 | public distribution 35 | { 36 | private: 37 | 38 | // radius of circule for cell neighbor list 39 | Foam::scalar distLength_; 40 | 41 | public: 42 | 43 | /// Type info 44 | TypeInfoNV("GaussianIntegral"); 45 | 46 | /// Construc from dictionary 47 | GaussianIntegral( 48 | Foam::dictionary dict, 49 | const couplingMesh& cMesh, 50 | const Plus::centerMassField& centerMass); 51 | 52 | /// Destructor 53 | ~GaussianIntegral() = default; 54 | 55 | void updateWeights 56 | ( 57 | const Plus::procCMField & parCellIndex, 58 | const Plus::procCMField & parDiameter 59 | ); 60 | 61 | }; 62 | 63 | } // pFlow::coupling 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/distributions/adaptiveGaussian.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __adaptiveGaussian_hpp__ 22 | #define __adaptiveGaussian_hpp__ 23 | 24 | #include "distribution.hpp" 25 | 26 | namespace pFlow::coupling 27 | { 28 | 29 | class couplingMesh; 30 | 31 | class adaptiveGaussian 32 | : 33 | public distribution 34 | { 35 | 36 | // radius of circule for cell neighbor list 37 | Foam::scalar distLength_; 38 | 39 | Foam::label maxLayers_; 40 | 41 | const static inline Foam::scalar a_ = 0.6142275; 42 | const static inline Foam::scalar exponent_ = -0.6195039; 43 | 44 | inline 45 | Foam::scalar stdDeviation(const Foam::scalar& dx_dp, const Foam::scalar& dcell) const 46 | { 47 | return dcell* a_ * Foam::pow(dx_dp, exponent_); 48 | } 49 | 50 | public: 51 | 52 | /// Type info 53 | TypeInfoNV("adaptiveGaussian"); 54 | 55 | /// Construc from dictionary 56 | adaptiveGaussian( 57 | Foam::dictionary dict, 58 | const couplingMesh& cMesh, 59 | const Plus::centerMassField& centerMass); 60 | 61 | /// Destructor 62 | ~adaptiveGaussian() = default; 63 | 64 | void updateWeights 65 | ( 66 | const Plus::procCMField & parCellIndex, 67 | const Plus::procCMField & parDiameter 68 | ); 69 | 70 | }; // end adaptiveGaussian 71 | 72 | } // end pFlow::coupling 73 | 74 | 75 | 76 | #endif //__adaptiveGaussian_hpp__ -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/distributions/self.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #include "self.hpp" 22 | 23 | 24 | pFlow::coupling::self::self 25 | ( 26 | Foam::dictionary dict, 27 | const couplingMesh& cMesh, 28 | const Plus::centerMassField& centerMass 29 | ) 30 | {} 31 | 32 | void pFlow::coupling::self::updateWeights 33 | ( 34 | const Plus::procCMField & , 35 | const Plus::procCMField & 36 | ) 37 | { 38 | return; 39 | } 40 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/grainUnresolvedCouplingSystem/grainUnresolvedCouplingSystems.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "grainUnresolvedCouplingSystem.hpp" 23 | #include "self.hpp" 24 | #include "Gaussian.hpp" 25 | #include "Gaussian2.hpp" 26 | #include "GaussianIntegral.hpp" 27 | 28 | template class pFlow::coupling::grainUnresolvedCouplingSystem; 29 | template class pFlow::coupling::grainUnresolvedCouplingSystem; 30 | template class pFlow::coupling::grainUnresolvedCouplingSystem; 31 | template class pFlow::coupling::grainUnresolvedCouplingSystem; 32 | 33 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/drag/drags.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "drag.hpp" 23 | #include "self.hpp" 24 | #include "Gaussian.hpp" 25 | #include "Gaussian2.hpp" 26 | #include "GaussianIntegral.hpp" 27 | //#include "adaptiveGaussian.hpp" 28 | //#include "Gaussian29.hpp" 29 | 30 | template class pFlow::coupling::drag; 31 | template class pFlow::coupling::drag; 32 | template class pFlow::coupling::drag; 33 | template class pFlow::coupling::drag; 34 | //template class pFlow::coupling::drag; 35 | //template class pFlow::coupling::drag; 36 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/dragClosures/DiFelice.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "DiFelice.hpp" 23 | 24 | 25 | pFlow::coupling::DiFelice::DiFelice(const Foam::dictionary& dict) 26 | : 27 | residualRe_(lookupDict(dict, "residualRe")) 28 | { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/dragClosures/DiFelice.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __DiFelice_hpp__ 22 | #define __DiFelice_hpp__ 23 | 24 | // from OpenFOAM 25 | #include "OFCompatibleHeader.hpp" 26 | 27 | 28 | #include "typeInfo.hpp" 29 | 30 | namespace pFlow::coupling 31 | { 32 | 33 | class DiFelice 34 | { 35 | 36 | Foam::scalar residualRe_; 37 | 38 | public: 39 | 40 | // type info 41 | TypeInfoNV("DiFelice"); 42 | 43 | DiFelice(const Foam::dictionary& dict); 44 | 45 | inline 46 | Foam::scalar dimlessDrag(Foam::scalar Re, Foam::scalar ep) const 47 | { 48 | 49 | auto Rec = Foam::max(Re,residualRe_); 50 | Foam::scalar xi = 3.7 - 0.65*Foam::exp(-0.5*Foam::pow(1.5-Foam::log10(Rec),2)); 51 | Foam::scalar Cd = Foam::pow(0.63+4.8/Foam::sqrt(Rec),2); 52 | 53 | return Cd/24 * Re * Foam::pow(ep, -xi ); 54 | 55 | } 56 | 57 | inline 58 | Foam::scalar operator()(Foam::scalar Re, Foam::scalar ep)const 59 | { 60 | return dimlessDrag(Re, ep); 61 | } 62 | 63 | }; 64 | 65 | } // pFlow::coupling 66 | 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/dragClosures/ErgunWenYu.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #include "ErgunWenYu.hpp" 22 | 23 | pFlow::coupling::ErgunWenYu::ErgunWenYu 24 | ( 25 | const Foam::dictionary& dict 26 | ) 27 | : 28 | residualRe_(lookupDict(dict, "residualRe")) 29 | {} 30 | 31 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/dragClosures/ErgunWenYu.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __ErgunWenYu_hpp__ 22 | #define __ErgunWenYu_hpp__ 23 | 24 | // from OpenFOAM 25 | #include "OFCompatibleHeader.hpp" 26 | 27 | #include "typeInfo.hpp" 28 | 29 | 30 | namespace pFlow::coupling 31 | { 32 | class ErgunWenYu 33 | { 34 | 35 | Foam::scalar residualRe_; 36 | 37 | 38 | 39 | public: 40 | 41 | // type info 42 | TypeInfoNV("ErgunWenYu"); 43 | 44 | ErgunWenYu(const Foam::dictionary& dict); 45 | 46 | ~ErgunWenYu() = default; 47 | 48 | 49 | inline 50 | Foam::scalar dimlessDrag(Foam::scalar Re, Foam::scalar ep)const 51 | { 52 | if( ep >= 0.8 ) 53 | { 54 | Foam::scalar Cd; 55 | if(Re <= 1000.0 ) 56 | Cd = 24 * ( 1+0.15*Foam::pow(Re,0.687) ) / Re; 57 | else 58 | Cd = 0.44; 59 | return Cd/24 * Re * Foam::pow(ep, -3.65 ); 60 | }else 61 | { 62 | return (150.0*(1.0-ep)+ 1.75*Re )/(18.0*ep*ep); 63 | } 64 | 65 | } 66 | 67 | inline 68 | Foam::scalar operator()(Foam::scalar Re, Foam::scalar ep)const 69 | { 70 | return dimlessDrag(Re, ep); 71 | } 72 | 73 | 74 | }; 75 | 76 | } // pFlow::coupling 77 | 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/dragClosures/Rong.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #include "Rong.hpp" 22 | 23 | 24 | pFlow::coupling::Rong::Rong(const Foam::dictionary& dict) 25 | : 26 | residualRe_(lookupDict(dict, "residualRe")) 27 | { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/dragClosures/Rong.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __Rong_hpp__ 22 | #define __Rong_hpp__ 23 | 24 | // from OpenFOAM 25 | #include "OFCompatibleHeader.hpp" 26 | 27 | #include "typeInfo.hpp" 28 | 29 | namespace pFlow::coupling 30 | { 31 | class Rong 32 | 33 | { 34 | 35 | Foam::scalar residualRe_; 36 | 37 | public: 38 | 39 | // type info 40 | TypeInfo("Rong"); 41 | 42 | Rong(const Foam::dictionary& dict); 43 | 44 | virtual ~Rong() = default; 45 | 46 | inline 47 | Foam::scalar dimlessDrag(Foam::scalar Re, Foam::scalar ep)const 48 | { 49 | 50 | auto Rec = Foam::max(Re,residualRe_); 51 | Foam::scalar xi = 2.65*(1+ep) - (5.3-(3.5*ep))*Foam::pow(ep , 2)*Foam::exp(-0.5*Foam::pow(1.5-Foam::log10(Rec),2)); 52 | Foam::scalar Cd = Foam::pow(0.63+4.8/Foam::sqrt(Rec),2); 53 | 54 | return Cd/24 * Re * Foam::pow(ep, -xi ); 55 | 56 | } 57 | 58 | inline 59 | Foam::scalar operator()(Foam::scalar Re, Foam::scalar ep)const 60 | { 61 | return dimlessDrag(Re, ep); 62 | } 63 | 64 | 65 | }; 66 | 67 | } // pFlow::coupling 68 | 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/interaction/sphereDrag/sphereDrag.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __sphereDrag_hpp__ 22 | #define __sphereDrag_hpp__ 23 | 24 | #include "drag.hpp" 25 | 26 | 27 | namespace pFlow::coupling 28 | { 29 | 30 | template 31 | class sphereDrag 32 | : 33 | public drag 34 | { 35 | public: 36 | 37 | using DragType = drag; 38 | 39 | using SphereDragType = sphereDrag; 40 | 41 | private: 42 | 43 | DragClosureType dragClosure_; 44 | 45 | 46 | void calculateDragForce 47 | ( 48 | const DragClosureType& dragClosure, 49 | const Foam::volVectorField& fluidVelocity, 50 | const Plus::realx3ProcCMField& parVelocity, 51 | const Plus::realProcCMField& diameter, 52 | Plus::realx3ProcCMField& particleForce 53 | ); 54 | 55 | public: 56 | 57 | // type info 58 | TypeInfoTemplate211( 59 | "sphereDrag", 60 | DistributorType::TYPENAME(), 61 | DragClosureType, 62 | useCellDistribution?"withDistribution":"noDistribution"); 63 | 64 | sphereDrag( 65 | const UnresolvedCouplingSystem& uCS, 66 | const porosity& prsty); 67 | 68 | ~sphereDrag() override = default ; 69 | 70 | add_vCtor 71 | ( 72 | DragType, 73 | SphereDragType, 74 | couplingSystem 75 | ); 76 | 77 | 78 | void calculateDragForce( 79 | const Foam::volVectorField& fluidVelocity, 80 | const Plus::realx3ProcCMField& parVelocity, 81 | const Plus::realProcCMField& diameter, 82 | Plus::realx3ProcCMField& particleForce)override; 83 | 84 | bool requireCellDistribution()const override 85 | { 86 | if constexpr (useCellDistribution) 87 | return true; 88 | else 89 | return false; 90 | } 91 | 92 | 93 | }; 94 | 95 | } // pFlow::coupling 96 | 97 | 98 | #include "sphereDrag.C" 99 | 100 | #endif // __sphereDrag_hpp__ 101 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/PIC/PIC.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "PIC.hpp" 23 | #include "self.hpp" 24 | 25 | 26 | pFlow::coupling::PIC::PIC( 27 | const unresolvedCouplingSystem& CS, 28 | const couplingMesh& cMesh, 29 | const Plus::realProcCMField& parDiam) 30 | : 31 | porosity(CS, cMesh, parDiam) 32 | { 33 | 34 | } 35 | 36 | bool pFlow::coupling::PIC::internalFieldUpdate() 37 | { 38 | 39 | self selfCellDist; 40 | 41 | auto solidVolTmp = calculateSolidVol(selfCellDist); 42 | //auto& solidVol = .ref(); 43 | 44 | Foam::fieldRef(*this) = Foam::max( 45 | 1 - solidVolTmp/this->mesh().V(), 46 | static_cast(this->alphaMin()) ); 47 | 48 | return true; 49 | } -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/PIC/PIC.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __PIC_hpp__ 22 | #define __PIC_hpp__ 23 | 24 | #include "virtualConstructor.hpp" 25 | 26 | // from phasicFlow-coupling 27 | #include "porosity.hpp" 28 | 29 | 30 | namespace pFlow::coupling 31 | { 32 | 33 | /** 34 | * Particle In Cell (PIC) model for porosity calculation 35 | * 36 | * This model only considers the particle center and if the particle center 37 | * resides inside a cell, it is assumed that the whole volume of the particle 38 | * is located in that cell. 39 | * 40 | */ 41 | class PIC 42 | : 43 | public porosity 44 | { 45 | public: 46 | 47 | /// Type info 48 | TypeInfo("PIC"); 49 | 50 | /// Construc from dictionary 51 | PIC( 52 | const unresolvedCouplingSystem& CS, 53 | const couplingMesh& cMesh, 54 | const Plus::realProcCMField& parDiam); 55 | 56 | /// Destructor 57 | virtual ~PIC() = default; 58 | 59 | /// Add this constructor to the list of virtual constructors 60 | add_vCtor 61 | ( 62 | porosity, 63 | PIC, 64 | dictionary 65 | ); 66 | 67 | bool internalFieldUpdate() override; 68 | 69 | 70 | }; 71 | 72 | } // pFlow::coupling 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/diffusion/diffusion.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __diffusion_hpp__ 22 | #define __diffusion_hpp__ 23 | 24 | #include "virtualConstructor.hpp" 25 | 26 | // from phasicFlow-coupling 27 | #include "porosity.hpp" 28 | 29 | 30 | namespace pFlow::coupling 31 | { 32 | 33 | /** 34 | * Particle In Cell (diffusion) model for porosity calculation 35 | * 36 | * This model only considers the particle center and if the particle center 37 | * resides inside a cell, it is assumed that the whole volume of the particle 38 | * is located in that cell. 39 | * 40 | */ 41 | class diffusion 42 | : 43 | public porosity 44 | { 45 | private: 46 | 47 | Foam::label nSteps_; 48 | 49 | Foam::scalar boundLength_; 50 | 51 | Foam::scalar intTime_; 52 | 53 | Foam::dimensionedScalar dt_; 54 | 55 | Foam::dimensionedScalar DT_; 56 | 57 | Foam::dictionary picSolDict_; 58 | 59 | 60 | 61 | Foam::tmp> fvmDdt 62 | ( 63 | const Foam::volScalarField& sField 64 | ); 65 | 66 | public: 67 | 68 | /// Type info 69 | TypeInfo("diffusion"); 70 | 71 | /// Construc from dictionary 72 | diffusion( 73 | const unresolvedCouplingSystem& CS, 74 | const couplingMesh& cMesh, 75 | const Plus::realProcCMField& parDiam); 76 | 77 | /// Destructor 78 | virtual ~diffusion() = default; 79 | 80 | /// Add this constructor to the list of virtual constructors 81 | add_vCtor 82 | ( 83 | porosity, 84 | diffusion, 85 | dictionary 86 | ); 87 | 88 | bool internalFieldUpdate() override; 89 | 90 | 91 | }; 92 | 93 | } // pFlow::coupling 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/porosityCellDistribution/porosityCellDistribution.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | 23 | template 24 | pFlow::coupling::porosityCellDistribution::porosityCellDistribution 25 | ( 26 | const unresolvedCouplingSystem& CS, 27 | const couplingMesh& cMesh, 28 | const Plus::realProcCMField& parDiam 29 | ) 30 | : 31 | porosity(CS, cMesh, parDiam), 32 | cellDistributor_( 33 | static_cast&>(CS).cellDistribution()) 34 | { 35 | 36 | } 37 | 38 | template 39 | bool pFlow::coupling::porosityCellDistribution::internalFieldUpdate() 40 | { 41 | 42 | auto solidVolTmp = calculateSolidVol(cellDistributor_); 43 | 44 | Foam::fieldRef(*this) = Foam::max( 45 | 1 - solidVolTmp/this->mesh().V(), 46 | static_cast(this->alphaMin()) ); 47 | 48 | return true; 49 | } -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/porosityCellDistribution/porosityCellDistribution.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __porosityCellDistribution_hpp__ 22 | #define __porosityCellDistribution_hpp__ 23 | 24 | #include "virtualConstructor.hpp" 25 | 26 | // from phasicFlow-coupling 27 | #include "porosity.hpp" 28 | #include "UnresolvedCouplingSystem.hpp" 29 | 30 | namespace pFlow::coupling 31 | { 32 | 33 | /** 34 | * Particle In Cell (porosityCellDistribution) model for porosity calculation 35 | * 36 | * This model only considers the particle center and if the particle center 37 | * resides inside a cell, it is assumed that the whole volume of the particle 38 | * is located in that cell. 39 | * 40 | */ 41 | template 42 | class porosityCellDistribution 43 | : 44 | public porosity 45 | { 46 | private: 47 | 48 | const DistributorType& cellDistributor_; 49 | 50 | public: 51 | 52 | /// Type info 53 | TypeInfoTemplate11("porosityCellDistribution", DistributorType); 54 | 55 | /// Construc from dictionary 56 | porosityCellDistribution( 57 | const unresolvedCouplingSystem& CS, 58 | const couplingMesh& cMesh, 59 | const Plus::realProcCMField& parDiam); 60 | 61 | /// Destructor 62 | virtual ~porosityCellDistribution() = default; 63 | 64 | /// Add this constructor to the list of virtual constructors 65 | add_vCtor 66 | ( 67 | porosity, 68 | porosityCellDistribution, 69 | dictionary 70 | ); 71 | 72 | bool internalFieldUpdate() override; 73 | 74 | bool requireCellDistribution()const override 75 | { 76 | return true; 77 | } 78 | 79 | }; 80 | 81 | } // pFlow::coupling 82 | 83 | #include "porosityCellDistribution.C" 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/porosityCellDistribution/porosityCellDistributions.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "porosityCellDistribution.hpp" 23 | #include "self.hpp" 24 | #include "Gaussian.hpp" 25 | #include "Gaussian2.hpp" 26 | #include "GaussianIntegral.hpp" 27 | //#include "adaptiveGaussian.hpp" 28 | //#include "Gaussian29.hpp" 29 | 30 | template class pFlow::coupling::porosityCellDistribution; 31 | template class pFlow::coupling::porosityCellDistribution; 32 | template class pFlow::coupling::porosityCellDistribution; 33 | template class pFlow::coupling::porosityCellDistribution; 34 | //template class pFlow::coupling::porosityCellDistribution; 35 | //template class pFlow::coupling::porosityCellDistribution; 36 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/subDivision29/subDivCheck.hpp: -------------------------------------------------------------------------------- 1 | { 2 | realx3 subPoint = pPos + offset; 3 | 4 | // cell id of subPoint 5 | auto subCellId = cMesh_.findCellTree(subPoint, cellId); 6 | 7 | 8 | if(subCellId >= 0 ) 9 | { 10 | if(cellId == subCellId ) 11 | { 12 | numInCenter++; 13 | } 14 | else 15 | { 16 | solidVol[subCellId] += pSubVol; 17 | } 18 | 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/subDivision29/subDivision29.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __subDivision29_hpp__ 22 | #define __subDivision29_hpp__ 23 | 24 | // from phasicFlow-coupling 25 | #include "porosity.hpp" 26 | 27 | 28 | namespace pFlow::coupling 29 | { 30 | 31 | /** 32 | * sub-division model for calculating fluid porosity 33 | * 34 | * This model divides a sphere into 29 equal parts and locate each of these 35 | * parts in the cells. The volume of each part located in each cell is 36 | * considered as the solid volume in that cell. 37 | * 38 | */ 39 | class subDivision29 40 | : 41 | public porosity 42 | { 43 | public: 44 | 45 | /// Type info 46 | TypeInfo("subDivision29"); 47 | 48 | /// Construct from dictionary 49 | subDivision29( 50 | const unresolvedCouplingSystem& CS, 51 | const couplingMesh& cMesh, 52 | const Plus::realProcCMField& parDiam); 53 | 54 | /// Destructor 55 | virtual ~subDivision29() = default; 56 | 57 | /// Add this constructor to the list of virtual constructors 58 | add_vCtor 59 | ( 60 | porosity, 61 | subDivision29, 62 | dictionary 63 | ); 64 | 65 | bool internalFieldUpdate() override; 66 | 67 | 68 | }; 69 | 70 | } // pFlow::coupling 71 | 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/subDivision29/subDivision29Mod.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __subDivision29Mod_hpp__ 22 | #define __subDivision29Mod_hpp__ 23 | 24 | // from phasicFlow-coupling 25 | #include "porosity.hpp" 26 | 27 | 28 | namespace pFlow::coupling 29 | { 30 | 31 | /** 32 | * sub-division model for calculating fluid porosity 33 | * 34 | * This model divides a sphere into 29 equal parts and locate each of these 35 | * parts in the cells. The volume of each part located in each cell is 36 | * considered as the solid volume in that cell. 37 | * 38 | */ 39 | class subDivision29Mod 40 | : 41 | public porosity 42 | { 43 | public: 44 | 45 | /// Type info 46 | TypeInfo("subDivision29Mod"); 47 | 48 | /// Construct from dictionary 49 | subDivision29Mod( 50 | const unresolvedCouplingSystem& CS, 51 | const couplingMesh& cMesh, 52 | const Plus::realProcCMField& parDiam); 53 | 54 | /// Destructor 55 | virtual ~subDivision29Mod() = default; 56 | 57 | /// Add this constructor to the list of virtual constructors 58 | add_vCtor 59 | ( 60 | porosity, 61 | subDivision29Mod, 62 | dictionary 63 | ); 64 | 65 | bool internalFieldUpdate() override; 66 | 67 | }; 68 | 69 | } // pFlow::coupling 70 | 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/porosity/subDivision9/subDivision9.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __subDivision9_hpp__ 22 | #define __subDivision9_hpp__ 23 | 24 | 25 | // from phasicFlow-coupling 26 | #include "porosity.hpp" 27 | 28 | 29 | namespace pFlow::coupling 30 | { 31 | 32 | /** 33 | * sub-division model for calculating fluid porosity 34 | * 35 | * This model divides a sphere into 9 equal parts and locate each of these 36 | * parts in the cells. The volume of each part located in each cell is 37 | * considered as the solid volume in that cell. 38 | * 39 | */ 40 | class subDivision9 41 | : 42 | public porosity 43 | { 44 | public: 45 | 46 | /// Type info 47 | TypeInfo("subDivision9"); 48 | 49 | /// Construct from dictionary 50 | subDivision9( 51 | const unresolvedCouplingSystem& CS, 52 | const couplingMesh& cMesh, 53 | const Plus::realProcCMField& parDiam); 54 | 55 | /// Destructor 56 | virtual ~subDivision9() = default; 57 | 58 | /// Add this constructor to the list of virtual constructors 59 | add_vCtor 60 | ( 61 | porosity, 62 | subDivision9, 63 | dictionary 64 | ); 65 | 66 | bool internalFieldUpdate() override; 67 | 68 | 69 | }; 70 | 71 | } // pFlow::coupling 72 | 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/sphereUnresolvedCouplingSystem/sphereUnresolvedCouplingSystems.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | 22 | #include "sphereUnresolvedCouplingSystem.hpp" 23 | #include "self.hpp" 24 | #include "Gaussian.hpp" 25 | #include "Gaussian2.hpp" 26 | #include "GaussianIntegral.hpp" 27 | 28 | template class pFlow::coupling::sphereUnresolvedCouplingSystem; 29 | template class pFlow::coupling::sphereUnresolvedCouplingSystem; 30 | template class pFlow::coupling::sphereUnresolvedCouplingSystem; 31 | template class pFlow::coupling::sphereUnresolvedCouplingSystem; 32 | 33 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/unresolvedCouplingSystem/UnresolvedCouplingSystem.C: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | template 22 | pFlow::coupling::UnresolvedCouplingSystem::UnresolvedCouplingSystem 23 | ( 24 | word shapeTypeName, 25 | Foam::fvMesh& mesh, 26 | int argc, 27 | char* argv[] 28 | ) 29 | : 30 | unresolvedCouplingSystem(shapeTypeName, mesh, argc, argv), 31 | cellDistribution_(unresolvedDict().subDict("cellDistribution"), cMesh(), centerMass()) 32 | {} 33 | -------------------------------------------------------------------------------- /phasicFlowCoupling/couplingSystem/unresolved/unresolvedCouplingSystem/UnresolvedCouplingSystem.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __UnresolvedCouplingSystem_hpp__ 22 | #define __UnresolvedCouplingSystem_hpp__ 23 | 24 | 25 | #include "unresolvedCouplingSystem.hpp" 26 | 27 | 28 | namespace pFlow::coupling 29 | { 30 | 31 | template 32 | class UnresolvedCouplingSystem 33 | : 34 | public unresolvedCouplingSystem 35 | { 36 | private: 37 | 38 | DistributorType cellDistribution_; 39 | 40 | protected: 41 | 42 | DistributorType& cellDistribution() 43 | { 44 | return cellDistribution_; 45 | } 46 | 47 | public: 48 | 49 | 50 | UnresolvedCouplingSystem( 51 | word shapeTypeName, 52 | Foam::fvMesh& mesh, 53 | int argc, 54 | char* argv[]); 55 | 56 | 57 | 58 | ~UnresolvedCouplingSystem() override = default; 59 | 60 | 61 | const DistributorType& cellDistribution()const 62 | { 63 | return cellDistribution_; 64 | } 65 | 66 | }; 67 | 68 | } // pFlow::coupling 69 | 70 | #include "UnresolvedCouplingSystem.C" 71 | 72 | #endif //__UnresolvedCouplingSystem_hpp__ 73 | -------------------------------------------------------------------------------- /solvers/particleTrackPFPlus/file.txt: -------------------------------------------------------------------------------- 1 | this folder is empty 2 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/Make/files: -------------------------------------------------------------------------------- 1 | resolvedSpherePFPlus.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/resolvedSpherePFPlus 4 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mpi-rules 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 10 | -I$(LIB_SRC)/meshTools/lnInclude \ 11 | -I$(LIB_SRC)/sampling/lnInclude \ 12 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ 13 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ 14 | -I$(LIB_SRC)/transportModels \ 15 | -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ 16 | -I$(LIB_SRC)/dynamicMesh/lnInclude \ 17 | -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ 18 | -I$(LIB_SRC)/regionFaModels/lnInclude \ 19 | -I$(LIB_SRC)/surfMesh/lnInclude \ 20 | -I$(LIB_SRC)/fileFormats/lnInclude \ 21 | -I../../../phasicFlowCoupling/lnInclude \ 22 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 23 | -I$(pFlow_INCLUDE_DIR) \ 24 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 25 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 26 | -I$(pFlow_INCLUDE_DIR)/Utilities 27 | 28 | EXE_LIBS = \ 29 | -lfiniteVolume \ 30 | -lfvOptions \ 31 | -lmeshTools \ 32 | -lsampling \ 33 | -lturbulenceModels \ 34 | -lincompressibleTurbulenceModels \ 35 | -lincompressibleTransportModels \ 36 | -ldynamicMesh \ 37 | -ldynamicFvMesh \ 38 | -ltopoChangerFvMesh \ 39 | -latmosphericModels \ 40 | -lregionFaModels \ 41 | -lfiniteArea \ 42 | -lsurfMesh \ 43 | -lOpenFOAM \ 44 | -L$(FOAM_USER_LIBBIN)/ \ 45 | -lphasicFlowCoupling \ 46 | -lpFCouplingUtilities \ 47 | -L$(pFlow_Project)/lib \ 48 | -lphasicFlow \ 49 | -lDEMSystems \ 50 | -lUtilities 51 | 52 | EXE_INC += $(PFLAGS) $(PINC) 53 | EXE_LIBS += $(PLIBS) 54 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/UEqn.H: -------------------------------------------------------------------------------- 1 | tmp tUEqn 2 | ( 3 | fvm::ddt(U) + fvm::div(phi, U) 4 | + turbulence->divDevReff(U) 5 | == 6 | fvOptions(U) 7 | ); 8 | 9 | fvVectorMatrix& UEqn = tUEqn.ref(); 10 | 11 | UEqn.relax(); 12 | 13 | fvOptions.constrain(UEqn); 14 | 15 | if (pimple.momentumPredictor()) 16 | { 17 | solve(UEqn == - fvc::grad(p)); 18 | 19 | fvOptions.correct(U); 20 | } 21 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/correctPhi.H: -------------------------------------------------------------------------------- 1 | CorrectPhi 2 | ( 3 | U, 4 | phi, 5 | p, 6 | dimensionedScalar("rAUf", dimTime, 1), 7 | geometricZeroField(), 8 | pimple 9 | ); 10 | 11 | #include "continuityErrs.H" 12 | 13 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/fluidToSolid.H: -------------------------------------------------------------------------------- 1 | Foam::volSymmTensorField devRhoReff = -rho*turbulence->nu()*dev(twoSymm(fvc::grad(U))); 2 | 3 | // Calculating the fluid to solid interaction 4 | coupling.calculateFluidInteraction 5 | ( 6 | p, 7 | rho, 8 | devRhoReff, 9 | particleSTLs 10 | ); 11 | 12 | //Sending fluid forces and torques to DEM 13 | coupling.sendFluidForceToDEM(); 14 | coupling.sendFluidTorqueToDEM(); 15 | 16 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 3 | surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); 4 | 5 | if (p.needReference()) 6 | { 7 | fvc::makeRelative(phiHbyA, U); 8 | adjustPhi(phiHbyA, U, p); 9 | fvc::makeAbsolute(phiHbyA, U); 10 | } 11 | 12 | tmp rAtU(rAU); 13 | 14 | if (pimple.consistent()) 15 | { 16 | rAtU = 1.0/max(1.0/rAU - UEqn.H1(), 0.1/rAU); 17 | phiHbyA += 18 | fvc::interpolate(rAtU() - rAU)*fvc::snGrad(p)*mesh.magSf(); 19 | HbyA -= (rAU - rAtU())*fvc::grad(p); 20 | } 21 | 22 | if (pimple.nCorrPISO() <= 1) 23 | { 24 | tUEqn.clear(); 25 | } 26 | 27 | // Update the pressure BCs to ensure flux consistency 28 | constrainPressure(p, U, phiHbyA, rAtU()); 29 | 30 | // Non-orthogonal pressure corrector loop 31 | while (pimple.correctNonOrthogonal()) 32 | { 33 | volScalarField ddtAlpha = fvc::ddt(alpha); 34 | // Calculation of new ddtAlpha by using divergence of particle fluxes instead 35 | // volScalarField ddtAlpha=fvc::div(Us*(1.0-alpha)); 36 | 37 | fvScalarMatrix pEqn 38 | ( 39 | fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA) + ddtAlpha 40 | ); 41 | 42 | pEqn.setReference(pRefCell, pRefValue); 43 | 44 | pEqn.solve(p.select(pimple.finalInnerIter())); 45 | 46 | if (pimple.finalNonOrthogonalIter()) 47 | { 48 | phi = phiHbyA - pEqn.flux(); 49 | } 50 | } 51 | 52 | #include "continuityErrs.H" 53 | 54 | // Explicitly relax pressure for momentum corrector 55 | p.relax(); 56 | 57 | U = HbyA - rAtU*fvc::grad(p); 58 | U.correctBoundaryConditions(); 59 | 60 | // Correction for DEM IBM 61 | U=(1.0-alpha)*Us+alpha*U; 62 | 63 | fvScalarMatrix IBVolFractionEqn 64 | ( 65 | fvm::laplacian(IBVolFraction) 66 | == 67 | fvc::ddt(alpha) 68 | + fvc::div(U) 69 | ); 70 | 71 | if(IBVolFraction.needReference()) 72 | { 73 | setRefCell(IBVolFraction, pimple.dict(), pRefCell, pRefValue); 74 | } 75 | 76 | IBVolFractionEqn.solve(); 77 | 78 | U=U-fvc::grad(IBVolFraction); 79 | U.correctBoundaryConditions(); 80 | 81 | p=p+IBVolFraction/U.mesh().time().deltaT(); 82 | p.correctBoundaryConditions(); 83 | 84 | fvOptions.correct(U); 85 | 86 | // Correct Uf if the mesh is moving 87 | fvc::correctUf(Uf, U, phi); 88 | 89 | // Make the fluxes relative to the mesh motion 90 | fvc::makeRelative(phi, U); 91 | 92 | -------------------------------------------------------------------------------- /solvers/resolvedSpherePFPlus/v24/solidToFluid.H: -------------------------------------------------------------------------------- 1 | // Solid->Fluid interaction: Just the particles that are inside each CFD sub-domain are considered 2 | 3 | volScalarField& alpha = coupling.alpha(); 4 | 5 | const auto& pDiameters = coupling.particleDiameter(); 6 | const auto& pCentersOfMass = coupling.centerMass(); 7 | Foam::scalar resolution = Foam::readScalar(coupling.lookup("sphereSTLResolution")); 8 | 9 | // Creating sphere STLs for each particle 10 | PtrList particleSTLs(coupling.numParticles()); 11 | 12 | for(pFlow::uint32 i = 0; i < pDiameters.size(); i++) 13 | { 14 | Foam::vector cm{pCentersOfMass[i].x(), 15 | pCentersOfMass[i].y(), 16 | pCentersOfMass[i].z()}; 17 | 18 | particleSTLs.emplace_set( 19 | i, 20 | generateSphere 21 | ( 22 | cm, 23 | pDiameters[i], 24 | resolution 25 | ) 26 | ); 27 | } 28 | 29 | // Calculating the solid to fluid interaction 30 | coupling.calculateSolidInteraction 31 | ( 32 | mesh, 33 | particleSTLs, 34 | alpha, 35 | particleID, 36 | Us 37 | ); 38 | 39 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPisoFoam/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Important note 2 | 3 | This solver will be removed upon the official release of v-1.0 4 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPisoFoam/v9/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedGrainPFPisoFoam.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedGrainPFPisoFoam 4 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPisoFoam/v9/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mplibType 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ 10 | -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels/lnInclude \ 12 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 13 | -I$(LIB_SRC)/meshTools/lnInclude \ 14 | -I$(LIB_SRC)/sampling/lnInclude \ 15 | -I../../../phasicFlowCoupling/lnInclude \ 16 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 17 | -I$(pFlow_INCLUDE_DIR) \ 18 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 19 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 20 | -I$(pFlow_INCLUDE_DIR)/Utilities 21 | 22 | 23 | EXE_LIBS = \ 24 | -lmomentumTransportModels \ 25 | -lincompressibleMomentumTransportModels \ 26 | -ltransportModels \ 27 | -lfiniteVolume \ 28 | -lmeshTools \ 29 | -lfvModels \ 30 | -lfvConstraints \ 31 | -lsampling \ 32 | -L$(FOAM_USER_LIBBIN)/ \ 33 | -lphasicFlowCoupling \ 34 | -lpFCouplingUtilities \ 35 | -L$(pFlow_Project)/lib \ 36 | -lphasicFlow \ 37 | -lDEMSystems \ 38 | -lUtilities 39 | 40 | EXE_INC += $(PFLAGS) $(PINC) 41 | EXE_LIBS += $(PLIBS) 42 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPisoFoam/v9/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | phi = fvc::interpolate(U * coupling.alpha()) & mesh.Sf(); 3 | 4 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 5 | 6 | fvVectorMatrix UEqn 7 | ( 8 | fvm::ddt(coupling.alpha(), U) 9 | + fvm::div(phi, U) 10 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 11 | + fvm::Sp(coupling.Sp()/rho, U) 12 | == 13 | - coupling.Su()/rho 14 | + fvModels.source(U) 15 | ); 16 | 17 | UEqn.relax(); 18 | 19 | fvConstraints.constrain(UEqn); 20 | 21 | if (piso.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvConstraints.constrain(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPisoFoam/v9/createFields.H: -------------------------------------------------------------------------------- 1 | 2 | Info<< "Reading field p\n" << endl; 3 | volScalarField p 4 | ( 5 | IOobject 6 | ( 7 | "p", 8 | runTime.timeName(), 9 | mesh, 10 | IOobject::MUST_READ, 11 | IOobject::AUTO_WRITE 12 | ), 13 | mesh 14 | ); 15 | 16 | Info<< "Reading field U\n" << endl; 17 | volVectorField U 18 | ( 19 | IOobject 20 | ( 21 | "U", 22 | runTime.timeName(), 23 | mesh, 24 | IOobject::MUST_READ, 25 | IOobject::AUTO_WRITE 26 | ), 27 | mesh 28 | ); 29 | 30 | // by default this is created on the master processor 31 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 32 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("grain", mesh, argc, argv); 33 | auto& coupling = couplingPtr(); 34 | 35 | Info<< "Reading/calculating face flux field phi\n" << endl; 36 | 37 | surfaceScalarField phi 38 | ( 39 | IOobject 40 | ( 41 | "phi", 42 | runTime.timeName(), 43 | mesh, 44 | IOobject::READ_IF_PRESENT, 45 | IOobject::AUTO_WRITE 46 | ), 47 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 48 | ); 49 | 50 | 51 | pressureReference pressureReference(p, piso.dict()); 52 | 53 | mesh.setFluxRequired(p.name()); 54 | 55 | 56 | singlePhaseTransportModel laminarTransport(U, phi); 57 | 58 | autoPtr turbulence 59 | ( 60 | incompressible::momentumTransportModel::New(U, phi, laminarTransport) 61 | ); 62 | 63 | Info<< "Creating field rho\n" << endl; 64 | volScalarField rho 65 | ( 66 | IOobject 67 | ( 68 | "rho", 69 | runTime.timeName(), 70 | mesh 71 | ), 72 | mesh, 73 | dimensionedScalar("rho", dimDensity, laminarTransport.lookup("rho")) 74 | ); 75 | 76 | #include "createFvModels.H" 77 | #include "createFvConstraints.H" 78 | 79 | 80 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPisoFoam/v9/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | volScalarField rAUAlpha("rAUAlpha",rAU * coupling.alpha()); 3 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 4 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 5 | surfaceScalarField phiHbyA 6 | ( 7 | "phiHbyA", 8 | fvc::flux(HbyA * coupling.alpha()) 9 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi) 10 | ); 11 | 12 | adjustPhi(phiHbyA, U, p); 13 | 14 | // Update the pressure BCs to ensure flux consistency 15 | constrainPressure(p, U, phiHbyA, rAUAlpha); 16 | 17 | volScalarField rAUAlpha2("rAUAlpha2",rAU * coupling.alpha() * coupling.alpha()); 18 | 19 | // Non-orthogonal pressure corrector loop 20 | while (piso.correctNonOrthogonal()) 21 | { 22 | // Pressure corrector 23 | 24 | fvScalarMatrix pEqn 25 | ( 26 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 27 | ); 28 | 29 | pEqn.setReference 30 | ( 31 | pressureReference.refCell(), 32 | pressureReference.refValue() 33 | ); 34 | 35 | pEqn.solve(); 36 | 37 | if (piso.finalNonOrthogonalIter()) 38 | { 39 | phi = phiHbyA - pEqn.flux(); 40 | } 41 | } 42 | 43 | #include "continuityErrs.H" 44 | 45 | U = fvc::reconstruct(phi)/coupling.alpha(); 46 | U.correctBoundaryConditions(); 47 | fvConstraints.constrain(U); 48 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v24/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedGrainPFPlus.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedGrainPFPlus 4 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v24/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mpi-rules 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ 10 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels \ 12 | -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ 13 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 14 | -I$(LIB_SRC)/sampling/lnInclude \ 15 | -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ 16 | -I$(LIB_SRC)/dynamicMesh/lnInclude \ 17 | -I$(LIB_SRC)/meshTools/lnInclude \ 18 | -I../../../phasicFlowCoupling/lnInclude \ 19 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 20 | -I$(pFlow_INCLUDE_DIR) \ 21 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 22 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 23 | -I$(pFlow_INCLUDE_DIR)/Utilities 24 | 25 | EXE_LIBS = \ 26 | -lturbulenceModels \ 27 | -lincompressibleTurbulenceModels \ 28 | -lincompressibleTransportModels \ 29 | -lfiniteVolume \ 30 | -lmeshTools \ 31 | -lfvOptions \ 32 | -lsampling \ 33 | -ldynamicFvMesh \ 34 | -ltopoChangerFvMesh \ 35 | -ldynamicMesh \ 36 | -lmeshTools \ 37 | -L$(FOAM_USER_LIBBIN)/ \ 38 | -lphasicFlowCoupling \ 39 | -lpFCouplingUtilities \ 40 | -L$(pFlow_Project)/lib \ 41 | -lphasicFlow \ 42 | -lDEMSystems \ 43 | -lUtilities 44 | 45 | EXE_INC += $(PFLAGS) $(PINC) 46 | EXE_LIBS += $(PLIBS) 47 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v24/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 3 | 4 | tmp tUEqn 5 | ( 6 | fvm::ddt(coupling.alpha(), U) 7 | + fvm::div(phi, U) 8 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 9 | + fvm::Sp(coupling.Sp()/rho, U) 10 | == 11 | - coupling.Su()/rho 12 | + fvOptions(U) 13 | ); 14 | 15 | fvVectorMatrix& UEqn = tUEqn.ref(); 16 | 17 | UEqn.relax(); 18 | 19 | fvOptions.constrain(UEqn); 20 | 21 | if (pimple.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvOptions.correct(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v24/correctPhi.H: -------------------------------------------------------------------------------- 1 | // Calculate absolute flux 2 | // from the mapped surface velocity 3 | phi = mesh.Sf() & Uf(); 4 | 5 | correctUphiBCs(U, phi); 6 | 7 | CorrectPhi 8 | ( 9 | U, 10 | phi, 11 | p, 12 | dimensionedScalar("rAUf", dimTime, 1), 13 | geometricZeroField(), 14 | pimple 15 | ); 16 | 17 | #include "continuityErrs.H" 18 | 19 | // Make the flux relative to the mesh motion 20 | fvc::makeRelative(phi, U); 21 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v24/createFields.H: -------------------------------------------------------------------------------- 1 | #include "createRDeltaT.H" 2 | 3 | Info<< "Reading field p\n" << endl; 4 | volScalarField p 5 | ( 6 | IOobject 7 | ( 8 | "p", 9 | runTime.timeName(), 10 | mesh, 11 | IOobject::MUST_READ, 12 | IOobject::AUTO_WRITE 13 | ), 14 | mesh 15 | ); 16 | 17 | Info<< "Reading field U\n" << endl; 18 | volVectorField U 19 | ( 20 | IOobject 21 | ( 22 | "U", 23 | runTime.timeName(), 24 | mesh, 25 | IOobject::MUST_READ, 26 | IOobject::AUTO_WRITE 27 | ), 28 | mesh 29 | ); 30 | 31 | // by default this is created on the master processor 32 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 33 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("grain", mesh, argc, argv); 34 | auto& coupling = couplingPtr(); 35 | 36 | Info<< "Reading/calculating face flux field phi\n" << endl; 37 | 38 | surfaceScalarField phi 39 | ( 40 | IOobject 41 | ( 42 | "phi", 43 | runTime.timeName(), 44 | mesh, 45 | IOobject::READ_IF_PRESENT, 46 | IOobject::AUTO_WRITE 47 | ), 48 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 49 | ); 50 | 51 | label pRefCell = 0; 52 | scalar pRefValue = 0.0; 53 | setRefCell(p, pimple.dict(), pRefCell, pRefValue); 54 | mesh.setFluxRequired(p.name()); 55 | 56 | 57 | singlePhaseTransportModel laminarTransport(U, phi); 58 | 59 | autoPtr turbulence 60 | ( 61 | incompressible::turbulenceModel::New(U, phi, laminarTransport) 62 | ); 63 | 64 | Info<< "Creating field rho\n" << endl; 65 | volScalarField rho 66 | ( 67 | IOobject 68 | ( 69 | "rho", 70 | runTime.timeName(), 71 | mesh 72 | ), 73 | mesh, 74 | dimensionedScalar("rho", dimDensity, laminarTransport) 75 | ); 76 | 77 | #include "createFvOptions.H" 78 | 79 | autoPtr Uf; 80 | 81 | if (mesh.dynamic()) 82 | { 83 | Info<< "Constructing face velocity Uf\n" << endl; 84 | 85 | Uf = Foam::autoPtr::New 86 | ( 87 | IOobject 88 | ( 89 | "Uf", 90 | runTime.timeName(), 91 | mesh, 92 | IOobject::READ_IF_PRESENT, 93 | IOobject::AUTO_WRITE 94 | ), 95 | fvc::interpolate(U * coupling.alpha()) 96 | ); 97 | } 98 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v24/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 3 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 4 | surfaceScalarField phiHbyA 5 | ( 6 | "phiHbyA", 7 | fvc::flux(HbyA * coupling.alpha()) 8 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi, Uf) // ----> attention by Uf 9 | ); 10 | 11 | if (p.needReference()) 12 | { 13 | fvc::makeRelative(phiHbyA, U); 14 | adjustPhi(phiHbyA, U, p); 15 | fvc::makeAbsolute(phiHbyA, U); 16 | } 17 | 18 | tmp rAtU(rAU); 19 | 20 | if (pimple.consistent()) 21 | { 22 | rAtU = 1.0/max(1.0/rAU - UEqn.H1(), 0.1/rAU); 23 | phiHbyA += 24 | fvc::interpolate((rAtU() - rAU)*coupling.alpha())*fvc::snGrad(p)*mesh.magSf(); 25 | HbyA -= (rAU - rAtU())*fvc::grad(p); 26 | } 27 | 28 | if (pimple.nCorrPISO() <= 1) 29 | { 30 | tUEqn.clear(); 31 | } 32 | 33 | volScalarField rAUAlpha("rAUAlpha",rAtU() * coupling.alpha()); 34 | 35 | // Update the pressure BCs to ensure flux consistency 36 | constrainPressure(p, U, phiHbyA, rAUAlpha); 37 | 38 | volScalarField rAUAlpha2("rAUAlpha2",rAtU() * coupling.alpha() * coupling.alpha()); 39 | 40 | // Non-orthogonal pressure corrector loop 41 | while (pimple.correctNonOrthogonal()) 42 | { 43 | fvScalarMatrix pEqn 44 | ( 45 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 46 | ); 47 | 48 | pEqn.setReference(pRefCell, pRefValue); 49 | 50 | pEqn.solve(); 51 | 52 | if (pimple.finalNonOrthogonalIter()) 53 | { 54 | phi = phiHbyA - pEqn.flux(); 55 | } 56 | } 57 | 58 | #include "continuityErrs.H" 59 | 60 | // Explicitly relax pressure for momentum corrector 61 | p.relax(); 62 | 63 | //U = fvc::reconstruct(phi)/coupling.alpha(); 64 | U = HbyA - coupling.alpha() * rAU*fvc::grad(p); 65 | U.correctBoundaryConditions(); 66 | fvOptions.correct(U); 67 | 68 | // Correct Uf if the mesh is moving 69 | if (mesh.dynamic()) 70 | { 71 | Uf() = fvc::interpolate(U * coupling.alpha()); 72 | surfaceVectorField n(mesh.Sf()/mesh.magSf()); 73 | Uf() += n*(phi/mesh.magSf() - (n & Uf())); 74 | } 75 | 76 | // Make the fluxes relative to the mesh motion 77 | if (phi.mesh().moving()) 78 | { 79 | phi -= fvc::meshPhi(U * coupling.alpha()); 80 | } 81 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v9/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedGrainPFPlus.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedGrainPFPlus 4 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v9/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mplibType 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ 10 | -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels/lnInclude \ 12 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 13 | -I$(LIB_SRC)/sampling/lnInclude \ 14 | -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ 15 | -I$(LIB_SRC)/dynamicMesh/lnInclude \ 16 | -I$(LIB_SRC)/meshTools/lnInclude \ 17 | -I../../phasicFlowCoupling/lnInclude \ 18 | -I../../utilities/pFCouplingUtilities/lnInclude \ 19 | -I$(pFlow_INCLUDE_DIR) \ 20 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 21 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 22 | -I$(pFlow_INCLUDE_DIR)/Utilities 23 | 24 | EXE_LIBS = \ 25 | -lmomentumTransportModels \ 26 | -lincompressibleMomentumTransportModels \ 27 | -ltransportModels \ 28 | -lfiniteVolume \ 29 | -lfvModels \ 30 | -lfvConstraints \ 31 | -lsampling \ 32 | -ldynamicFvMesh \ 33 | -ltopoChangerFvMesh \ 34 | -ldynamicMesh \ 35 | -lmeshTools \ 36 | -L$(FOAM_USER_LIBBIN)/ \ 37 | -lphasicFlowCoupling \ 38 | -lpFCouplingUtilities \ 39 | -L$(pFlow_Project)/lib \ 40 | -lphasicFlow \ 41 | -lDEMSystems \ 42 | -lUtilities 43 | 44 | EXE_INC += $(PFLAGS) $(PINC) 45 | EXE_LIBS += $(PLIBS) 46 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v9/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 3 | 4 | tmp tUEqn 5 | ( 6 | fvm::ddt(coupling.alpha(), U) 7 | + fvm::div(phi, U) 8 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 9 | + fvm::Sp(coupling.Sp()/rho, U) 10 | == 11 | - coupling.Su()/rho 12 | + fvModels.source(U) 13 | ); 14 | 15 | fvVectorMatrix& UEqn = tUEqn.ref(); 16 | 17 | UEqn.relax(); 18 | 19 | fvConstraints.constrain(UEqn); 20 | 21 | if (pimple.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvConstraints.constrain(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v9/correctPhi.H: -------------------------------------------------------------------------------- 1 | // Calculate absolute flux 2 | // from the mapped surface velocity 3 | phi = mesh.Sf() & Uf(); 4 | 5 | correctUphiBCs(U, phi, true); 6 | 7 | CorrectPhi 8 | ( 9 | phi, 10 | U, 11 | p, 12 | dimensionedScalar("rAUf", dimTime, 1), 13 | geometricZeroField(), 14 | pressureReference, 15 | pimple 16 | ); 17 | 18 | #include "continuityErrs.H" 19 | 20 | // Make the flux relative to the mesh motion 21 | fvc::makeRelative(phi, U); 22 | 23 | 24 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v9/createFields.H: -------------------------------------------------------------------------------- 1 | #include "createRDeltaT.H" 2 | 3 | Info<< "Reading field p\n" << endl; 4 | volScalarField p 5 | ( 6 | IOobject 7 | ( 8 | "p", 9 | runTime.timeName(), 10 | mesh, 11 | IOobject::MUST_READ, 12 | IOobject::AUTO_WRITE 13 | ), 14 | mesh 15 | ); 16 | 17 | Info<< "Reading field U\n" << endl; 18 | volVectorField U 19 | ( 20 | IOobject 21 | ( 22 | "U", 23 | runTime.timeName(), 24 | mesh, 25 | IOobject::MUST_READ, 26 | IOobject::AUTO_WRITE 27 | ), 28 | mesh 29 | ); 30 | 31 | // by default this is created on the master processor 32 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 33 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("sphere", mesh, argc, argv); 34 | auto& coupling = couplingPtr(); 35 | 36 | Info<< "Reading/calculating face flux field phi\n" << endl; 37 | 38 | surfaceScalarField phi 39 | ( 40 | IOobject 41 | ( 42 | "phi", 43 | runTime.timeName(), 44 | mesh, 45 | IOobject::READ_IF_PRESENT, 46 | IOobject::AUTO_WRITE 47 | ), 48 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 49 | ); 50 | 51 | pressureReference pressureReference(p, pimple.dict()); 52 | 53 | mesh.setFluxRequired(p.name()); 54 | 55 | 56 | singlePhaseTransportModel laminarTransport(U, phi); 57 | 58 | autoPtr turbulence 59 | ( 60 | incompressible::momentumTransportModel::New(U, phi, laminarTransport) 61 | ); 62 | 63 | Info<< "Creating field rho\n" << endl; 64 | volScalarField rho 65 | ( 66 | IOobject 67 | ( 68 | "rho", 69 | runTime.timeName(), 70 | mesh 71 | ), 72 | mesh, 73 | dimensionedScalar("rho", dimDensity, laminarTransport.lookup("rho")) 74 | ); 75 | 76 | #include "createFvModels.H" 77 | #include "createFvConstraints.H" 78 | 79 | autoPtr Uf; 80 | 81 | if (mesh.dynamic()) 82 | { 83 | Info<< "Constructing face velocity Uf\n" << endl; 84 | 85 | Uf = new surfaceVectorField 86 | ( 87 | IOobject 88 | ( 89 | "Uf", 90 | runTime.timeName(), 91 | mesh, 92 | IOobject::READ_IF_PRESENT, 93 | IOobject::AUTO_WRITE 94 | ), 95 | fvc::interpolate(U * coupling.alpha()) 96 | ); 97 | } 98 | -------------------------------------------------------------------------------- /solvers/unresolvedGrainPFPlus/v9/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 3 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 4 | surfaceScalarField phiHbyA 5 | ( 6 | "phiHbyA", 7 | fvc::flux(HbyA * coupling.alpha()) 8 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi, Uf) // ----> attention by Uf 9 | ); 10 | 11 | if (p.needReference()) 12 | { 13 | fvc::makeRelative(phiHbyA, U); 14 | adjustPhi(phiHbyA, U, p); 15 | fvc::makeAbsolute(phiHbyA, U); 16 | } 17 | 18 | tmp rAtU(rAU); 19 | 20 | if (pimple.consistent()) 21 | { 22 | rAtU = 1.0/max(1.0/rAU - UEqn.H1(), 0.1/rAU); 23 | phiHbyA += 24 | fvc::interpolate((rAtU() - rAU)*coupling.alpha())*fvc::snGrad(p)*mesh.magSf(); 25 | HbyA -= (rAU - rAtU())*fvc::grad(p); 26 | } 27 | 28 | if (pimple.nCorrPiso() <= 1) 29 | { 30 | tUEqn.clear(); 31 | } 32 | 33 | volScalarField rAUAlpha("rAUAlpha",rAtU() * coupling.alpha()); 34 | 35 | // Update the pressure BCs to ensure flux consistency 36 | constrainPressure(p, U, phiHbyA, rAUAlpha); 37 | 38 | volScalarField rAUAlpha2("rAUAlpha2",rAtU() * coupling.alpha() * coupling.alpha()); 39 | 40 | // Non-orthogonal pressure corrector loop 41 | while (pimple.correctNonOrthogonal()) 42 | { 43 | fvScalarMatrix pEqn 44 | ( 45 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 46 | ); 47 | 48 | pEqn.setReference 49 | ( 50 | pressureReference.refCell(), 51 | pressureReference.refValue() 52 | ); 53 | 54 | pEqn.solve(); 55 | 56 | if (pimple.finalNonOrthogonalIter()) 57 | { 58 | phi = phiHbyA - pEqn.flux(); 59 | } 60 | } 61 | 62 | #include "continuityErrs.H" 63 | 64 | // Explicitly relax pressure for momentum corrector 65 | p.relax(); 66 | 67 | //U = fvc::reconstruct(phi)/coupling.alpha(); 68 | U = HbyA - coupling.alpha() * rAU*fvc::grad(p); 69 | U.correctBoundaryConditions(); 70 | fvConstraints.constrain(U); 71 | 72 | // Correct Uf if the mesh is moving 73 | if (mesh.dynamic()) 74 | { 75 | Uf() = fvc::interpolate(U * coupling.alpha()); 76 | surfaceVectorField n(mesh.Sf()/mesh.magSf()); 77 | Uf() += n*(phi/mesh.magSf() - (n & Uf())); 78 | } 79 | 80 | // Make the fluxes relative to the mesh motion 81 | if (phi.mesh().moving()) 82 | { 83 | phi -= fvc::meshPhi(U * coupling.alpha()); 84 | } 85 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Important note 2 | 3 | This solver will be removed upon the official release of v-1.0 4 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v24/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedSpherePFPisoFoam.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedSpherePFPisoFoam 4 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v24/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mpi-rules 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ 10 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels \ 12 | -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ 13 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 14 | -I$(LIB_SRC)/meshTools/lnInclude \ 15 | -I$(LIB_SRC)/sampling/lnInclude \ 16 | -I../../../phasicFlowCoupling/lnInclude \ 17 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 18 | -I$(pFlow_INCLUDE_DIR) \ 19 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 20 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 21 | -I$(pFlow_INCLUDE_DIR)/Utilities 22 | 23 | 24 | EXE_LIBS = \ 25 | -lturbulenceModels \ 26 | -lincompressibleTurbulenceModels \ 27 | -lincompressibleTransportModels \ 28 | -lfiniteVolume \ 29 | -lmeshTools \ 30 | -lfvOptions \ 31 | -lsampling \ 32 | -L$(FOAM_USER_LIBBIN)/ \ 33 | -lphasicFlowCoupling \ 34 | -lpFCouplingUtilities \ 35 | -L$(pFlow_Project)/lib \ 36 | -lphasicFlow \ 37 | -lDEMSystems \ 38 | -lUtilities 39 | 40 | EXE_INC += $(PFLAGS) $(PINC) 41 | EXE_LIBS += $(PLIBS) 42 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v24/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | phi = fvc::interpolate(U * coupling.alpha()) & mesh.Sf(); 3 | 4 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 5 | 6 | fvVectorMatrix UEqn 7 | ( 8 | fvm::ddt(coupling.alpha(), U) 9 | + fvm::div(phi, U) 10 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 11 | + fvm::Sp(coupling.Sp()/rho, U) 12 | == 13 | - coupling.Su()/rho 14 | + fvOptions(U) 15 | ); 16 | 17 | UEqn.relax(); 18 | 19 | fvOptions.constrain(UEqn); 20 | 21 | if (piso.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvOptions.correct(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v24/createFields.H: -------------------------------------------------------------------------------- 1 | 2 | Info<< "Reading field p\n" << endl; 3 | volScalarField p 4 | ( 5 | IOobject 6 | ( 7 | "p", 8 | runTime.timeName(), 9 | mesh, 10 | IOobject::MUST_READ, 11 | IOobject::AUTO_WRITE 12 | ), 13 | mesh 14 | ); 15 | 16 | Info<< "Reading field U\n" << endl; 17 | volVectorField U 18 | ( 19 | IOobject 20 | ( 21 | "U", 22 | runTime.timeName(), 23 | mesh, 24 | IOobject::MUST_READ, 25 | IOobject::AUTO_WRITE 26 | ), 27 | mesh 28 | ); 29 | 30 | // by default this is created on the master processor 31 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 32 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("sphere", mesh, argc, argv); 33 | auto& coupling = couplingPtr(); 34 | 35 | Info<< "Reading/calculating face flux field phi\n" << endl; 36 | 37 | surfaceScalarField phi 38 | ( 39 | IOobject 40 | ( 41 | "phi", 42 | runTime.timeName(), 43 | mesh, 44 | IOobject::READ_IF_PRESENT, 45 | IOobject::AUTO_WRITE 46 | ), 47 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 48 | ); 49 | 50 | label pRefCell = 0; 51 | scalar pRefValue = 0.0; 52 | setRefCell(p, piso.dict(), pRefCell, pRefValue); 53 | mesh.setFluxRequired(p.name()); 54 | 55 | singlePhaseTransportModel laminarTransport(U, phi); 56 | 57 | autoPtr turbulence 58 | ( 59 | incompressible::turbulenceModel::New(U, phi, laminarTransport) 60 | ); 61 | 62 | Info<< "Creating field rho\n" << endl; 63 | volScalarField rho 64 | ( 65 | IOobject 66 | ( 67 | "rho", 68 | runTime.timeName(), 69 | mesh 70 | ), 71 | mesh, 72 | dimensionedScalar("rho", dimDensity, laminarTransport) 73 | ); 74 | 75 | #include "createFvOptions.H" 76 | 77 | 78 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v24/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | volScalarField rAUAlpha("rAUAlpha",rAU * coupling.alpha()); 3 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 4 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 5 | surfaceScalarField phiHbyA 6 | ( 7 | "phiHbyA", 8 | fvc::flux(HbyA * coupling.alpha()) 9 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi) 10 | ); 11 | 12 | adjustPhi(phiHbyA, U, p); 13 | 14 | // Update the pressure BCs to ensure flux consistency 15 | constrainPressure(p, U, phiHbyA, rAUAlpha); 16 | 17 | volScalarField rAUAlpha2("rAUAlpha2",rAU * coupling.alpha() * coupling.alpha()); 18 | 19 | // Non-orthogonal pressure corrector loop 20 | while (piso.correctNonOrthogonal()) 21 | { 22 | // Pressure corrector 23 | 24 | fvScalarMatrix pEqn 25 | ( 26 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 27 | ); 28 | 29 | pEqn.setReference(pRefCell, pRefValue); 30 | 31 | pEqn.solve(); 32 | 33 | if (piso.finalNonOrthogonalIter()) 34 | { 35 | phi = phiHbyA - pEqn.flux(); 36 | } 37 | } 38 | 39 | #include "continuityErrs.H" 40 | 41 | U = fvc::reconstruct(phi)/coupling.alpha(); 42 | U.correctBoundaryConditions(); 43 | fvOptions.correct(U); 44 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v9/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedSpherePFPisoFoam.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedSpherePFPisoFoam 4 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v9/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mplibType 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ 10 | -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels/lnInclude \ 12 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 13 | -I$(LIB_SRC)/meshTools/lnInclude \ 14 | -I$(LIB_SRC)/sampling/lnInclude \ 15 | -I../../../phasicFlowCoupling/lnInclude \ 16 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 17 | -I$(pFlow_INCLUDE_DIR) \ 18 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 19 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 20 | -I$(pFlow_INCLUDE_DIR)/Utilities 21 | 22 | 23 | EXE_LIBS = \ 24 | -lmomentumTransportModels \ 25 | -lincompressibleMomentumTransportModels \ 26 | -ltransportModels \ 27 | -lfiniteVolume \ 28 | -lmeshTools \ 29 | -lfvModels \ 30 | -lfvConstraints \ 31 | -lsampling \ 32 | -L$(FOAM_USER_LIBBIN)/ \ 33 | -lphasicFlowCoupling \ 34 | -lpFCouplingUtilities \ 35 | -L$(pFlow_Project)/lib \ 36 | -lphasicFlow \ 37 | -lDEMSystems \ 38 | -lUtilities 39 | 40 | EXE_INC += $(PFLAGS) $(PINC) 41 | EXE_LIBS += $(PLIBS) 42 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v9/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | phi = fvc::interpolate(U * coupling.alpha()) & mesh.Sf(); 3 | 4 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 5 | 6 | fvVectorMatrix UEqn 7 | ( 8 | fvm::ddt(coupling.alpha(), U) 9 | + fvm::div(phi, U) 10 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 11 | + fvm::Sp(coupling.Sp()/rho, U) 12 | == 13 | - coupling.Su()/rho 14 | + fvModels.source(U) 15 | ); 16 | 17 | UEqn.relax(); 18 | 19 | fvConstraints.constrain(UEqn); 20 | 21 | if (piso.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvConstraints.constrain(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v9/createFields.H: -------------------------------------------------------------------------------- 1 | 2 | Info<< "Reading field p\n" << endl; 3 | volScalarField p 4 | ( 5 | IOobject 6 | ( 7 | "p", 8 | Foam::timeName(runTime), 9 | mesh, 10 | IOobject::MUST_READ, 11 | IOobject::AUTO_WRITE 12 | ), 13 | mesh 14 | ); 15 | 16 | Info<< "Reading field U\n" << endl; 17 | volVectorField U 18 | ( 19 | IOobject 20 | ( 21 | "U", 22 | Foam::timeName(runTime), 23 | mesh, 24 | IOobject::MUST_READ, 25 | IOobject::AUTO_WRITE 26 | ), 27 | mesh 28 | ); 29 | 30 | // by default this is created on the master processor 31 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 32 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("sphere", mesh, argc, argv); 33 | auto& coupling = couplingPtr(); 34 | 35 | Info<< "Reading/calculating face flux field phi\n" << endl; 36 | 37 | surfaceScalarField phi 38 | ( 39 | IOobject 40 | ( 41 | "phi", 42 | Foam::timeName(runTime), 43 | mesh, 44 | IOobject::READ_IF_PRESENT, 45 | IOobject::AUTO_WRITE 46 | ), 47 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 48 | ); 49 | 50 | 51 | pressureReference pressureReference(p, piso.dict()); 52 | 53 | mesh.setFluxRequired(p.name()); 54 | 55 | singlePhaseTransportModel laminarTransport(U, phi); 56 | 57 | autoPtr turbulence 58 | ( 59 | incompressible::momentumTransportModel::New(U, phi, laminarTransport) 60 | ); 61 | 62 | Info<< "Creating field rho\n" << endl; 63 | volScalarField rho 64 | ( 65 | IOobject 66 | ( 67 | "rho", 68 | Foam::timeName(runTime), 69 | mesh 70 | ), 71 | mesh, 72 | dimensionedScalar("rho", dimDensity, laminarTransport.lookup("rho")) 73 | ); 74 | 75 | #include "createFvModels.H" 76 | #include "createFvConstraints.H" 77 | 78 | 79 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPisoFoam/v9/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | volScalarField rAUAlpha("rAUAlpha",rAU * coupling.alpha()); 3 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 4 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 5 | surfaceScalarField phiHbyA 6 | ( 7 | "phiHbyA", 8 | fvc::flux(HbyA * coupling.alpha()) 9 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi) 10 | ); 11 | 12 | adjustPhi(phiHbyA, U, p); 13 | 14 | // Update the pressure BCs to ensure flux consistency 15 | constrainPressure(p, U, phiHbyA, rAUAlpha); 16 | 17 | volScalarField rAUAlpha2("rAUAlpha2",rAU * coupling.alpha() * coupling.alpha()); 18 | 19 | // Non-orthogonal pressure corrector loop 20 | while (piso.correctNonOrthogonal()) 21 | { 22 | // Pressure corrector 23 | 24 | fvScalarMatrix pEqn 25 | ( 26 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 27 | ); 28 | 29 | pEqn.setReference 30 | ( 31 | pressureReference.refCell(), 32 | pressureReference.refValue() 33 | ); 34 | 35 | pEqn.solve(); 36 | 37 | if (piso.finalNonOrthogonalIter()) 38 | { 39 | phi = phiHbyA - pEqn.flux(); 40 | } 41 | } 42 | 43 | #include "continuityErrs.H" 44 | 45 | U = fvc::reconstruct(phi)/coupling.alpha(); 46 | U.correctBoundaryConditions(); 47 | fvConstraints.constrain(U); 48 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v24/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedSpherePFPlus.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedSpherePFPlus 4 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v24/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mpi-rules 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ 10 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels \ 12 | -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ 13 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 14 | -I$(LIB_SRC)/sampling/lnInclude \ 15 | -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ 16 | -I$(LIB_SRC)/dynamicMesh/lnInclude \ 17 | -I$(LIB_SRC)/meshTools/lnInclude \ 18 | -I../../../phasicFlowCoupling/lnInclude \ 19 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 20 | -I$(pFlow_INCLUDE_DIR) \ 21 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 22 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 23 | -I$(pFlow_INCLUDE_DIR)/Utilities 24 | 25 | EXE_LIBS = \ 26 | -lturbulenceModels \ 27 | -lincompressibleTurbulenceModels \ 28 | -lincompressibleTransportModels \ 29 | -lfiniteVolume \ 30 | -lmeshTools \ 31 | -lfvOptions \ 32 | -lsampling \ 33 | -ldynamicFvMesh \ 34 | -ltopoChangerFvMesh \ 35 | -ldynamicMesh \ 36 | -lmeshTools \ 37 | -L$(FOAM_USER_LIBBIN)/ \ 38 | -lphasicFlowCoupling \ 39 | -lpFCouplingUtilities \ 40 | -L$(pFlow_Project)/lib \ 41 | -lphasicFlow \ 42 | -lDEMSystems \ 43 | -lUtilities 44 | 45 | EXE_INC += $(PFLAGS) $(PINC) 46 | EXE_LIBS += $(PLIBS) 47 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v24/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 3 | 4 | tmp tUEqn 5 | ( 6 | fvm::ddt(coupling.alpha(), U) 7 | + fvm::div(phi, U) 8 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 9 | + fvm::Sp(coupling.Sp()/rho, U) 10 | == 11 | - coupling.Su()/rho 12 | + fvOptions(U) 13 | ); 14 | 15 | fvVectorMatrix& UEqn = tUEqn.ref(); 16 | 17 | UEqn.relax(); 18 | 19 | fvOptions.constrain(UEqn); 20 | 21 | if (pimple.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvOptions.correct(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v24/correctPhi.H: -------------------------------------------------------------------------------- 1 | // Calculate absolute flux 2 | // from the mapped surface velocity 3 | phi = mesh.Sf() & Uf(); 4 | 5 | correctUphiBCs(U, phi); 6 | 7 | CorrectPhi 8 | ( 9 | U, 10 | phi, 11 | p, 12 | dimensionedScalar("rAUf", dimTime, 1), 13 | geometricZeroField(), 14 | pimple 15 | ); 16 | 17 | #include "continuityErrs.H" 18 | 19 | // Make the flux relative to the mesh motion 20 | fvc::makeRelative(phi, U); 21 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v24/createFields.H: -------------------------------------------------------------------------------- 1 | #include "createRDeltaT.H" 2 | 3 | Info<< "Reading field p\n" << endl; 4 | volScalarField p 5 | ( 6 | IOobject 7 | ( 8 | "p", 9 | runTime.timeName(), 10 | mesh, 11 | IOobject::MUST_READ, 12 | IOobject::AUTO_WRITE 13 | ), 14 | mesh 15 | ); 16 | 17 | Info<< "Reading field U\n" << endl; 18 | volVectorField U 19 | ( 20 | IOobject 21 | ( 22 | "U", 23 | runTime.timeName(), 24 | mesh, 25 | IOobject::MUST_READ, 26 | IOobject::AUTO_WRITE 27 | ), 28 | mesh 29 | ); 30 | 31 | // by default this is created on the master processor 32 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 33 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("sphere", mesh, argc, argv); 34 | auto& coupling = couplingPtr(); 35 | 36 | Info<< "Reading/calculating face flux field phi\n" << endl; 37 | 38 | surfaceScalarField phi 39 | ( 40 | IOobject 41 | ( 42 | "phi", 43 | runTime.timeName(), 44 | mesh, 45 | IOobject::READ_IF_PRESENT, 46 | IOobject::AUTO_WRITE 47 | ), 48 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 49 | ); 50 | 51 | label pRefCell = 0; 52 | scalar pRefValue = 0.0; 53 | setRefCell(p, pimple.dict(), pRefCell, pRefValue); 54 | mesh.setFluxRequired(p.name()); 55 | 56 | 57 | singlePhaseTransportModel laminarTransport(U, phi); 58 | 59 | autoPtr turbulence 60 | ( 61 | incompressible::turbulenceModel::New(U, phi, laminarTransport) 62 | ); 63 | 64 | Info<< "Creating field rho\n" << endl; 65 | volScalarField rho 66 | ( 67 | IOobject 68 | ( 69 | "rho", 70 | runTime.timeName(), 71 | mesh 72 | ), 73 | mesh, 74 | dimensionedScalar("rho", dimDensity, laminarTransport) 75 | ); 76 | 77 | #include "createFvOptions.H" 78 | 79 | autoPtr Uf; 80 | 81 | if (mesh.dynamic()) 82 | { 83 | Info<< "Constructing face velocity Uf\n" << endl; 84 | 85 | Uf = Foam::autoPtr::New 86 | ( 87 | IOobject 88 | ( 89 | "Uf", 90 | runTime.timeName(), 91 | mesh, 92 | IOobject::READ_IF_PRESENT, 93 | IOobject::AUTO_WRITE 94 | ), 95 | fvc::interpolate(U * coupling.alpha()) 96 | ); 97 | } 98 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v24/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 3 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 4 | surfaceScalarField phiHbyA 5 | ( 6 | "phiHbyA", 7 | fvc::flux(HbyA * coupling.alpha()) 8 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi, Uf) // ----> attention by Uf 9 | ); 10 | 11 | if (p.needReference()) 12 | { 13 | fvc::makeRelative(phiHbyA, U); 14 | adjustPhi(phiHbyA, U, p); 15 | fvc::makeAbsolute(phiHbyA, U); 16 | } 17 | 18 | tmp rAtU(rAU); 19 | 20 | if (pimple.consistent()) 21 | { 22 | rAtU = 1.0/max(1.0/rAU - UEqn.H1(), 0.1/rAU); 23 | phiHbyA += 24 | fvc::interpolate((rAtU() - rAU)*coupling.alpha())*fvc::snGrad(p)*mesh.magSf(); 25 | HbyA -= (rAU - rAtU())*fvc::grad(p); 26 | } 27 | 28 | if (pimple.nCorrPISO() <= 1) 29 | { 30 | tUEqn.clear(); 31 | } 32 | 33 | volScalarField rAUAlpha("rAUAlpha",rAtU() * coupling.alpha()); 34 | 35 | // Update the pressure BCs to ensure flux consistency 36 | constrainPressure(p, U, phiHbyA, rAUAlpha); 37 | 38 | volScalarField rAUAlpha2("rAUAlpha2",rAtU() * coupling.alpha() * coupling.alpha()); 39 | 40 | // Non-orthogonal pressure corrector loop 41 | while (pimple.correctNonOrthogonal()) 42 | { 43 | fvScalarMatrix pEqn 44 | ( 45 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 46 | ); 47 | 48 | pEqn.setReference(pRefCell, pRefValue); 49 | 50 | pEqn.solve(); 51 | 52 | if (pimple.finalNonOrthogonalIter()) 53 | { 54 | phi = phiHbyA - pEqn.flux(); 55 | } 56 | } 57 | 58 | #include "continuityErrs.H" 59 | 60 | // Explicitly relax pressure for momentum corrector 61 | p.relax(); 62 | 63 | //U = fvc::reconstruct(phi)/coupling.alpha(); 64 | U = HbyA - coupling.alpha() * rAU*fvc::grad(p); 65 | U.correctBoundaryConditions(); 66 | fvOptions.correct(U); 67 | 68 | // Correct Uf if the mesh is moving 69 | if (mesh.dynamic()) 70 | { 71 | Uf() = fvc::interpolate(U * coupling.alpha()); 72 | surfaceVectorField n(mesh.Sf()/mesh.magSf()); 73 | Uf() += n*(phi/mesh.magSf() - (n & Uf())); 74 | } 75 | 76 | // Make the fluxes relative to the mesh motion 77 | if (phi.mesh().moving()) 78 | { 79 | phi -= fvc::meshPhi(U * coupling.alpha()); 80 | } 81 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v9/Make/files: -------------------------------------------------------------------------------- 1 | unresolvedSpherePFPlus.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/unresolvedSpherePFPlus 4 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v9/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | -include $(GENERAL_RULES)/mplibType 7 | 8 | EXE_INC = \ 9 | -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ 10 | -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ 11 | -I$(LIB_SRC)/transportModels/lnInclude \ 12 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 13 | -I$(LIB_SRC)/sampling/lnInclude \ 14 | -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ 15 | -I$(LIB_SRC)/dynamicMesh/lnInclude \ 16 | -I$(LIB_SRC)/meshTools/lnInclude \ 17 | -I../../../phasicFlowCoupling/lnInclude \ 18 | -I../../../utilities/pFCouplingUtilities/lnInclude \ 19 | -I$(pFlow_INCLUDE_DIR) \ 20 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 21 | -I$(pFlow_INCLUDE_DIR)/DEMSystems \ 22 | -I$(pFlow_INCLUDE_DIR)/Utilities 23 | 24 | EXE_LIBS = \ 25 | -lmomentumTransportModels \ 26 | -lincompressibleMomentumTransportModels \ 27 | -ltransportModels \ 28 | -lfiniteVolume \ 29 | -lfvModels \ 30 | -lfvConstraints \ 31 | -lsampling \ 32 | -ldynamicFvMesh \ 33 | -ltopoChangerFvMesh \ 34 | -ldynamicMesh \ 35 | -lmeshTools \ 36 | -L$(FOAM_USER_LIBBIN)/ \ 37 | -lphasicFlowCoupling \ 38 | -lpFCouplingUtilities \ 39 | -L$(pFlow_Project)/lib \ 40 | -lphasicFlow \ 41 | -lDEMSystems \ 42 | -lUtilities 43 | 44 | EXE_INC += $(PFLAGS) $(PINC) 45 | EXE_LIBS += $(PLIBS) 46 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v9/UEqn.H: -------------------------------------------------------------------------------- 1 | // Solve the Momentum equation 2 | volScalarField alphaNuEff(coupling.alpha() * turbulence->nuEff()); 3 | 4 | tmp tUEqn 5 | ( 6 | fvm::ddt(coupling.alpha(), U) 7 | + fvm::div(phi, U) 8 | - fvc::div(alphaNuEff * dev(fvc::grad(U)().T())) 9 | + fvm::Sp(coupling.Sp()/rho, U) 10 | == 11 | - coupling.Su()/rho 12 | + fvModels.source(U) 13 | ); 14 | 15 | fvVectorMatrix& UEqn = tUEqn.ref(); 16 | 17 | UEqn.relax(); 18 | 19 | fvConstraints.constrain(UEqn); 20 | 21 | if (pimple.momentumPredictor()) 22 | { 23 | solve(UEqn == - coupling.alpha() * fvc::grad(p)); 24 | 25 | fvConstraints.constrain(U); 26 | } 27 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v9/correctPhi.H: -------------------------------------------------------------------------------- 1 | // Calculate absolute flux 2 | // from the mapped surface velocity 3 | phi = mesh.Sf() & Uf(); 4 | 5 | correctUphiBCs(U, phi, true); 6 | 7 | CorrectPhi 8 | ( 9 | phi, 10 | U, 11 | p, 12 | dimensionedScalar("rAUf", dimTime, 1), 13 | geometricZeroField(), 14 | pressureReference, 15 | pimple 16 | ); 17 | 18 | #include "continuityErrs.H" 19 | 20 | // Make the flux relative to the mesh motion 21 | fvc::makeRelative(phi, U); 22 | 23 | 24 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v9/createFields.H: -------------------------------------------------------------------------------- 1 | #include "createRDeltaT.H" 2 | 3 | Info<< "Reading field p\n" << endl; 4 | volScalarField p 5 | ( 6 | IOobject 7 | ( 8 | "p", 9 | runTime.timeName(), 10 | mesh, 11 | IOobject::MUST_READ, 12 | IOobject::AUTO_WRITE 13 | ), 14 | mesh 15 | ); 16 | 17 | Info<< "Reading field U\n" << endl; 18 | volVectorField U 19 | ( 20 | IOobject 21 | ( 22 | "U", 23 | runTime.timeName(), 24 | mesh, 25 | IOobject::MUST_READ, 26 | IOobject::AUTO_WRITE 27 | ), 28 | mesh 29 | ); 30 | 31 | // by default this is created on the master processor 32 | Info<< "Creating sphere coupling system for unresolved solver \n" << endl; 33 | auto couplingPtr = pFlow::coupling::unresolvedCouplingSystem::create("sphere", mesh, argc, argv); 34 | auto& coupling = couplingPtr(); 35 | 36 | Info<< "Reading/calculating face flux field phi\n" << endl; 37 | 38 | surfaceScalarField phi 39 | ( 40 | IOobject 41 | ( 42 | "phi", 43 | runTime.timeName(), 44 | mesh, 45 | IOobject::READ_IF_PRESENT, 46 | IOobject::AUTO_WRITE 47 | ), 48 | linearInterpolate(U * coupling.alpha()) & mesh.Sf() 49 | ); 50 | 51 | pressureReference pressureReference(p, pimple.dict()); 52 | 53 | mesh.setFluxRequired(p.name()); 54 | 55 | 56 | singlePhaseTransportModel laminarTransport(U, phi); 57 | 58 | autoPtr turbulence 59 | ( 60 | incompressible::momentumTransportModel::New(U, phi, laminarTransport) 61 | ); 62 | 63 | Info<< "Creating field rho\n" << endl; 64 | volScalarField rho 65 | ( 66 | IOobject 67 | ( 68 | "rho", 69 | runTime.timeName(), 70 | mesh 71 | ), 72 | mesh, 73 | dimensionedScalar("rho", dimDensity, laminarTransport.lookup("rho")) 74 | ); 75 | 76 | #include "createFvModels.H" 77 | #include "createFvConstraints.H" 78 | 79 | autoPtr Uf; 80 | 81 | if (mesh.dynamic()) 82 | { 83 | Info<< "Constructing face velocity Uf\n" << endl; 84 | 85 | Uf = new surfaceVectorField 86 | ( 87 | IOobject 88 | ( 89 | "Uf", 90 | runTime.timeName(), 91 | mesh, 92 | IOobject::READ_IF_PRESENT, 93 | IOobject::AUTO_WRITE 94 | ), 95 | fvc::interpolate(U * coupling.alpha()) 96 | ); 97 | } 98 | -------------------------------------------------------------------------------- /solvers/unresolvedSpherePFPlus/v9/pEqn.H: -------------------------------------------------------------------------------- 1 | volScalarField rAU(1.0/UEqn.A()); 2 | surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); 3 | volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); 4 | surfaceScalarField phiHbyA 5 | ( 6 | "phiHbyA", 7 | fvc::flux(HbyA * coupling.alpha()) 8 | + rAUf * fvc::interpolate(coupling.alpha())*fvc::ddtCorr(U, phi, Uf) // ----> attention by Uf 9 | ); 10 | 11 | if (p.needReference()) 12 | { 13 | fvc::makeRelative(phiHbyA, U); 14 | adjustPhi(phiHbyA, U, p); 15 | fvc::makeAbsolute(phiHbyA, U); 16 | } 17 | 18 | tmp rAtU(rAU); 19 | 20 | if (pimple.consistent()) 21 | { 22 | rAtU = 1.0/max(1.0/rAU - UEqn.H1(), 0.1/rAU); 23 | phiHbyA += 24 | fvc::interpolate((rAtU() - rAU)*coupling.alpha())*fvc::snGrad(p)*mesh.magSf(); 25 | HbyA -= (rAU - rAtU())*fvc::grad(p); 26 | } 27 | 28 | if (pimple.nCorrPiso() <= 1) 29 | { 30 | tUEqn.clear(); 31 | } 32 | 33 | volScalarField rAUAlpha("rAUAlpha",rAtU() * coupling.alpha()); 34 | 35 | // Update the pressure BCs to ensure flux consistency 36 | constrainPressure(p, U, phiHbyA, rAUAlpha); 37 | 38 | volScalarField rAUAlpha2("rAUAlpha2",rAtU() * coupling.alpha() * coupling.alpha()); 39 | 40 | // Non-orthogonal pressure corrector loop 41 | while (pimple.correctNonOrthogonal()) 42 | { 43 | fvScalarMatrix pEqn 44 | ( 45 | fvm::laplacian(rAUAlpha2, p) == fvc::div(phiHbyA) + fvc::ddt(coupling.alpha()) 46 | ); 47 | 48 | pEqn.setReference 49 | ( 50 | pressureReference.refCell(), 51 | pressureReference.refValue() 52 | ); 53 | 54 | pEqn.solve(); 55 | 56 | if (pimple.finalNonOrthogonalIter()) 57 | { 58 | phi = phiHbyA - pEqn.flux(); 59 | } 60 | } 61 | 62 | #include "continuityErrs.H" 63 | 64 | // Explicitly relax pressure for momentum corrector 65 | p.relax(); 66 | 67 | //U = fvc::reconstruct(phi)/coupling.alpha(); 68 | U = HbyA - coupling.alpha() * rAU*fvc::grad(p); 69 | U.correctBoundaryConditions(); 70 | fvConstraints.constrain(U); 71 | 72 | // Correct Uf if the mesh is moving 73 | if (mesh.dynamic()) 74 | { 75 | Uf() = fvc::interpolate(U * coupling.alpha()); 76 | surfaceVectorField n(mesh.Sf()/mesh.magSf()); 77 | Uf() += n*(phi/mesh.magSf() - (n & Uf())); 78 | } 79 | 80 | // Make the fluxes relative to the mesh motion 81 | if (phi.mesh().moving()) 82 | { 83 | phi -= fvc::meshPhi(U * coupling.alpha()); 84 | } 85 | -------------------------------------------------------------------------------- /solvers/wclean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | 5 | # Compile OpenFOAM libraries and applications based on version 6 | if [ "$WM_PROJECT_VERSION" = "9" ]; then 7 | echo " -> Cleaning solvers for OpenFOAM 9" 8 | wclean ./unresolvedSpherePFPlus/v9 9 | wclean ./unresolvedSpherePFPisoFoam/v9 10 | wclean ./unresolvedGrainPFPisoFoam/v9 11 | elif [ "$WM_PROJECT_VERSION" = "v2406" ] || [ "$WM_PROJECT_VERSION" = "v2412" ]; then 12 | echo " -> Cleaning solvers for OpenFOAM $WM_PROJECT_VERSION" 13 | wclean ./unresolvedSpherePFPlus/v24 14 | wclean ./unresolvedSpherePFPisoFoam/v24 15 | wclean ./unresolvedGrainPFPisoFoam/v24 16 | wclean ./resolvedSpherePFPlus/v24 17 | else 18 | echo " -> Error: Unknown OpenFOAM version: $WM_PROJECT_VERSION" 19 | echo " -> Cannot proceed with wclean" 20 | exit 1 21 | fi 22 | 23 | 24 | 25 | 26 | #------------------------------------------------------------------------------ 27 | -------------------------------------------------------------------------------- /solvers/wmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | 5 | # Compile OpenFOAM libraries and applications 6 | # Check OpenFOAM version 7 | echo " -> detected OpenFOAM version: $WM_PROJECT_VERSION" 8 | 9 | # Compile OpenFOAM libraries and applications based on version 10 | if [ "$WM_PROJECT_VERSION" = "9" ]; then 11 | echo " -> building solvers for OpenFOAM 9" 12 | wmake ./unresolvedSpherePFPlus/v9 13 | wmake ./unresolvedSpherePFPisoFoam/v9 14 | wmake ./unresolvedGrainPFPisoFoam/v9 15 | elif [ "$WM_PROJECT_VERSION" = "v2406" ] || [ "$WM_PROJECT_VERSION" = "v2412" ]; then 16 | echo " -> building solvers for OpenFOAM $WM_PROJECT_VERSION" 17 | wmake ./unresolvedSpherePFPisoFoam/v24 18 | wmake ./unresolvedSpherePFPlus/v24 19 | wmake ./unresolvedGrainPFPlus/v24 20 | wmake ./resolvedSpherePFPlus/v24 21 | else 22 | echo " -> Error: Unknown OpenFOAM version: $WM_PROJECT_VERSION" 23 | echo " -> Cannot proceed with build" 24 | exit 1 25 | fi 26 | 27 | 28 | 29 | 30 | #------------------------------------------------------------------------------ 31 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/Allrun: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | # Source tutorial run functions 5 | # First run OpenFoam Aplication 6 | 7 | echo "\n<--------------------------------------------------------------------->" 8 | echo "1) Running blockmesh" 9 | echo "<--------------------------------------------------------------------->\n" 10 | blockMesh 11 | 12 | echo "\n<--------------------------------------------------------------------->" 13 | echo "2) Running Step 1 (0-2 DEM) " 14 | echo "<--------------------------------------------------------------------->\n" 15 | 16 | echo " 2.1) add Particle " 17 | particlesPhasicFlow 18 | echo " 2.2) add Geometry " 19 | geometryPhasicFlow 20 | echo " 2.3) Running " 21 | grainGranFlow 22 | 23 | 24 | echo "\n<--------------------------------------------------------------------->" 25 | echo "3) Copy Orginal Data to 2s (P , U , Alpha ) " 26 | echo "<--------------------------------------------------------------------->\n" 27 | cp ./FluidField/alpha ./1 28 | cp ./FluidField/p ./1 29 | cp ./FluidField/U ./1 30 | 31 | echo "\n<--------------------------------------------------------------------->" 32 | echo "3) Running Step 2 (2-10 CFD-DEM) " 33 | echo "<--------------------------------------------------------------------->\n" 34 | unresolvedGrainPFPisoFoam 35 | 36 | echo "\n<--------------------------------------------------------------------->" 37 | echo "4) Making VTK File " 38 | echo "<--------------------------------------------------------------------->\n" 39 | foamToVTK 40 | pFlowToVTK 41 | pFlowToVTK -t 2:10 42 | 43 | #------------------------------------------------------------------------------ 44 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/FluidField/U: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class volVectorField; 12 | object U; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | dimensions [0 1 -1 0 0 0 0]; 17 | 18 | internalField uniform (0 0 0); 19 | 20 | boundaryField 21 | { 22 | fixedWalls 23 | { 24 | type noSlip; 25 | value uniform (0 0 0); 26 | } 27 | inlet 28 | { 29 | type fixedValue; 30 | value uniform (0.0 1.5 0); 31 | } 32 | outlet 33 | { 34 | type zeroGradient; 35 | } 36 | } 37 | 38 | // ************************************************************************* // 39 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/FluidField/alpha: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class volScalarField; 12 | object alpha; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | dimensions [0 0 0 0 0 0 0]; 17 | 18 | internalField uniform 1; 19 | 20 | boundaryField 21 | { 22 | inlet 23 | { 24 | type fixedValue; 25 | value uniform 1; 26 | } 27 | outlet 28 | { 29 | type zeroGradient; 30 | } 31 | fixedWalls 32 | { 33 | type zeroGradient; 34 | } 35 | } 36 | 37 | // ************************************************************************* // 38 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/FluidField/p: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class volScalarField; 12 | object p; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | dimensions [0 2 -2 0 0 0 0]; 17 | 18 | internalField uniform 0; 19 | 20 | boundaryField 21 | { 22 | inlet 23 | { 24 | type zeroGradient; 25 | } 26 | outlet 27 | { 28 | type fixedValue; 29 | value uniform 0; 30 | } 31 | fixedWalls 32 | { 33 | type zeroGradient; 34 | } 35 | } 36 | 37 | // ************************************************************************* // 38 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/caseSetup/interaction: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName interaction; 7 | objectType dicrionary; 8 | fileFormat ASCII; 9 | 10 | materials (sphereMat wallMat); // a list of materials names 11 | densities (2500 2500); // density of materials [kg/m3] 12 | 13 | contactListType sortedContactList; 14 | 15 | model 16 | { 17 | contactForceModel cGRelativeLinearLimited; 18 | rollingFrictionModel normal; 19 | additionalDissipationModel GB; 20 | 21 | Yeff (1.0e6 1.0e6 // Young modulus [Pa] 22 | 1.0e6 ); 23 | 24 | Geff (0.8e6 0.8e6 // Shear modulus [Pa] 25 | 0.8e6 ); 26 | 27 | nu (0.25 0.25 // Poisson's ratio [-] 28 | 0.25 ); 29 | 30 | // coefficient of normal restitution 31 | en (0.97 0.97 0.97); 32 | 33 | et (1.0 1.0 // coefficient of tangential restitution 34 | 1.0 ); 35 | 36 | mu (0.3 0.3 // dynamic friction 37 | 0.3 ); 38 | 39 | mur (0.1 0.1 // rolling friction 40 | 0.1 ); 41 | 42 | kn (1050 1050 43 | 1050); 44 | 45 | kt (800 800 46 | 800); 47 | 48 | } 49 | 50 | contactSearch 51 | { 52 | 53 | method NBS; // method for broad search 54 | 55 | updateInterval 10; 56 | 57 | sizeRatio 1.1; 58 | 59 | cellExtent 0.55; 60 | 61 | adjustableBox Yes; 62 | } 63 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/caseSetup/particleInsertion: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName particleInsertion; 7 | objectType dicrionary; 8 | fileFormat ASCII; 9 | 10 | active no; // is insertion active? 11 | 12 | collisionCheck No; // not implemented for yes 13 | 14 | 15 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/caseSetup/shapes: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName grainDict; 7 | objectType grainShape; 8 | fileFormat ASCII; 9 | 10 | names (sph1); // names of shapes 11 | grainDiameters (0.0032 ); // diameter of grains 12 | sphereDiameters (0.0016 ); // diameter of orginal particles 13 | materials (sphereMat ); // material names for shapes 14 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/constant/couplingProperties: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "constant"; 13 | object couplingProperties; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | 18 | 19 | 20 | 21 | particleMapping 22 | { 23 | // based on the maximum particle diameter in the simulation. 24 | domainExpansionRatio 1; 25 | 26 | domainUpdateInterval 0.01; 27 | 28 | decompositionMode facePlanes; 29 | } 30 | 31 | 32 | particleMapping 33 | { 34 | // based on the maximum particle diameter in the simulation. 35 | domainExpansionRatio 1; 36 | 37 | domainUpdateInterval 0.01; 38 | 39 | decompositionMode facePlanes; 40 | } 41 | 42 | unresolved 43 | { 44 | 45 | cellDistribution 46 | { 47 | // type of cell distribution method (if required) 48 | // self: no distribution (cell itself) 49 | // Gaussian: distribute values on sorounding cells based on a neighbor length 50 | // Power: similar to Gaussian, but with power law distribution 51 | type Gaussian; 52 | neighborLength 0.0075; 53 | } 54 | 55 | porosity 56 | { 57 | // Options are PIC, subDivision29, subDivision9, diffusion, cellDistribution 58 | method cellDistribution; 59 | 60 | // minimum alpha allowed 61 | alphaMin 0.25; 62 | } 63 | 64 | drag 65 | { 66 | // Drag force closure, other options are ErgunWenYu, Rong 67 | type DiFelice; 68 | 69 | // type of fluid velocity used in the drag force calculations 70 | // cell: uses fluid velocity of the cell that contains the particle center 71 | // interpolation: uses averaged fluid velocity based on cell velocities around particle 72 | fluidVelocity cell; 73 | 74 | // weather to distribute calculated drag force on cells 75 | // off: set the calculated drag force on cell itself 76 | // on: distributed the calculated drag force on cells (using cellDistribution method) 77 | cellDistribution on; 78 | 79 | residualRe 10e-6; 80 | } 81 | 82 | } 83 | 84 | // ************************************************************************* // 85 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/constant/momentumTransport: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "constant"; 13 | object momentumTransport; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | simulationType laminar; 18 | 19 | // ************************************************************************* // 20 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/constant/polyMesh/boundary: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class polyBoundaryMesh; 12 | location "constant/polyMesh"; 13 | object boundary; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | 3 18 | ( 19 | outlet 20 | { 21 | type patch; 22 | nFaces 120; 23 | startFace 32612; 24 | } 25 | fixedWalls 26 | { 27 | type wall; 28 | inGroups List 1(wall); 29 | nFaces 5096; 30 | startFace 32732; 31 | } 32 | inlet 33 | { 34 | type patch; 35 | nFaces 120; 36 | startFace 37828; 37 | } 38 | ) 39 | 40 | // ************************************************************************* // 41 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/constant/transportProperties: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "constant"; 13 | object transportProperties; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | transportModel Newtonian; 18 | 19 | nu [0 2 -1 0 0 0 0] 1.5e-05; 20 | 21 | rho [1 -3 0 0 0 0 0] 1.2; 22 | 23 | // ************************************************************************* // 24 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/constant/turbulenceProperties: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: v2412 | 5 | | \\ / A nd | Website: www.openfoam.com | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | object turbulenceProperties; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | simulationType laminar; 18 | 19 | 20 | // ************************************************************************* // 21 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/settings/domainDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | objectName domainDict; 6 | objectType dictionary; 7 | fileFormat ASCII; 8 | /*---------------------------------------------------------------------------*/ 9 | 10 | globalBox // Simulation domain: every particles that goes outside this domain will be deleted 11 | { 12 | min (-0.01 -0.01 -0.01); 13 | 14 | max (0.16 0.71 0.05); // upper corner point of the box 15 | } 16 | 17 | decomposition 18 | { 19 | direction z; 20 | } 21 | 22 | boundaries 23 | { 24 | 25 | 26 | neighborListUpdateInterval 50; /* Determines how often (how many iterations) do you want to 27 | 28 | rebuild the list of particles in the neighbor list 29 | 30 | of all boundaries in the simulation domain */ 31 | 32 | updateInterval 10; // Determines how often do you want to update the new changes in the boundary 33 | 34 | neighborLength 0.004; // The distance from the boundary plane within which particles are marked to be in the boundary list 35 | 36 | left 37 | { 38 | type exit; // other options: periodict, reflective 39 | } 40 | 41 | right 42 | { 43 | type exit; // other options: periodict, reflective 44 | } 45 | 46 | bottom 47 | { 48 | type exit; // other options: periodict, reflective 49 | } 50 | 51 | top 52 | { 53 | type exit; // other options: periodict, reflective 54 | } 55 | 56 | rear 57 | { 58 | type exit; // other options: periodict, reflective 59 | } 60 | 61 | front 62 | { 63 | type exit; // other options: periodict, reflective 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/settings/geometryDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName geometryDict; 7 | objectType dictionary; 8 | fileFormat ASCII; 9 | /* ------------------------------------------------------------------------- */ 10 | 11 | // motion model: all surfaces are fixed 12 | motionModel stationary; 13 | 14 | stationaryInfo 15 | { 16 | } 17 | 18 | 19 | surfaces 20 | { 21 | allWall 22 | { 23 | type cuboidWall; // type of the wall 24 | center (0.075 0.35 0.02); 25 | edgeLength (0.15 0.70 0.040); 26 | numDiv (3 14 1); 27 | material wallMat; // material name of this wall 28 | motion none; // motion component name 29 | } 30 | 31 | 32 | 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/settings/particlesDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName particlesDict; 7 | objectType dictionary; 8 | fileFormat ASCII; 9 | 10 | setFields 11 | { 12 | defaultValue 13 | { 14 | velocity realx3 (0.0 0 0); // linear velocity (m/s) 15 | rVelocity realx3 (0 0 0); // rotational velocity (rad/s) 16 | shapeName word sph1; // name of the particle shape 17 | } 18 | 19 | selectors 20 | {} 21 | } 22 | 23 | // positions particles 24 | positionParticles 25 | { 26 | method ordered; // positionRandom; 27 | 28 | orderedInfo 29 | { 30 | // minimum space between centers of particles 31 | distance 0.0035; 32 | 33 | // number of particles in the simulation 34 | numPoints 40000; 35 | 36 | // axis order for filling the space with particles 37 | axisOrder (x y z); 38 | } 39 | regionType box; 40 | boxInfo 41 | { 42 | min (0.001 0.001 0.001); 43 | max (0.14 0.35 0.039); 44 | } 45 | 46 | maxNumberOfParticles 110001; // maximum number of particles in the simulation 47 | mortonSorting Yes; // perform initial sorting based on morton code? 48 | 49 | } 50 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/settings/settingsDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | objectName settingsDict; 6 | objectType dictionary; 7 | fileFormat ASCII; 8 | 9 | run fluidizedBed; 10 | 11 | libs ("libpFCouplingUtilities.so"); 12 | 13 | dt 0.00001; // time step for integration (s) 14 | 15 | startTime 0; // start time for simulation 16 | 17 | endTime 2; // end time for simulation 18 | 19 | saveInterval 0.1; // time interval for saving the simulation 20 | 21 | timePrecision 4; // maximum number of digits for time folder 22 | 23 | g (0 -9.8 0); // gravity vector (m/s2) 24 | 25 | 26 | includeObjects (diameter); 27 | 28 | integrationMethod AdamsBashforth2; // integration method 29 | 30 | timersReport Yes; // report timers? 31 | 32 | timersReportInterval 0.01; // time interval for reporting timers 33 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/system/blockMeshDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | object blockMeshDict; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | convertToMeters 1; 17 | 18 | vertices 19 | ( 20 | (0.0 0 0) 21 | (0.15 0 0) 22 | (0.15 0.7 0) 23 | (0.0 0.7 0) 24 | (0.0 0 0.04) 25 | (0.15 0 0.04) 26 | (0.15 0.7 0.04) 27 | (0.0 0.7 0.04) 28 | ); 29 | 30 | blocks 31 | ( 32 | hex (0 1 2 3 4 5 6 7) (20 98 6) simpleGrading (1 1 1) 33 | ); 34 | 35 | edges 36 | ( 37 | ); 38 | 39 | boundary 40 | ( 41 | outlet 42 | { 43 | type patch; 44 | faces 45 | ( 46 | (3 7 6 2) 47 | ); 48 | } 49 | fixedWalls 50 | { 51 | type wall; 52 | faces 53 | ( 54 | (0 4 7 3) 55 | (2 6 5 1) 56 | (0 3 2 1) 57 | (4 5 6 7) 58 | ); 59 | } 60 | 61 | inlet 62 | { 63 | type patch; 64 | faces 65 | ( 66 | (1 5 4 0) 67 | ); 68 | } 69 | 70 | ); 71 | 72 | mergePatchPairs 73 | ( 74 | ); 75 | 76 | // ************************************************************************* // 77 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/system/controlDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object controlDict; 14 | version 2; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | application unresolvedPFFoam; 19 | 20 | startFrom startTime; 21 | 22 | startTime 1; 23 | 24 | stopAt endTime; 25 | 26 | endTime 10; 27 | 28 | deltaT 0.001; 29 | 30 | writeControl runTime; 31 | 32 | writeInterval 0.1; 33 | 34 | purgeWrite 0; 35 | 36 | writeFormat ascii; 37 | 38 | writePrecision 6; 39 | 40 | writeCompression off; 41 | 42 | timeFormat general; 43 | 44 | timePrecision 6; 45 | 46 | runTimeModifiable true; 47 | 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/system/decomposeParDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object decomposeParDict; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | numberOfSubdomains 2; 18 | 19 | method hierarchical; 20 | // method ptscotch; 21 | 22 | simpleCoeffs 23 | { 24 | n (2 1 1); 25 | } 26 | 27 | hierarchicalCoeffs 28 | { 29 | n (2 1 1); 30 | order xyz; 31 | } 32 | 33 | manualCoeffs 34 | { 35 | dataFile "cellDecomposition"; 36 | } 37 | 38 | 39 | // ************************************************************************* // 40 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/system/fvSchemes: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object fvSchemes; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | ddtSchemes 18 | { 19 | default Euler; 20 | } 21 | 22 | gradSchemes 23 | { 24 | default Gauss linear; 25 | } 26 | 27 | divSchemes 28 | { 29 | default none;; 30 | div(phi,U) Gauss upwind; 31 | div((nuEff*dev2(T(grad(U))))) Gauss linear; 32 | div(((alpha*nuEff)*dev(grad(U).T()))) Gauss linear; 33 | } 34 | 35 | laplacianSchemes 36 | { 37 | default Gauss linear corrected; 38 | } 39 | 40 | interpolationSchemes 41 | { 42 | default linear; 43 | } 44 | 45 | snGradSchemes 46 | { 47 | default corrected; 48 | } 49 | 50 | 51 | // ************************************************************************* // 52 | -------------------------------------------------------------------------------- /tutorials/unresolvedGrainPFPisoFoam/fluidizededbed/system/fvSolution: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object fvSolution; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | solvers 18 | { 19 | p 20 | { 21 | solver PCG; 22 | preconditioner DIC; 23 | tolerance 1e-06; 24 | relTol 0.01; 25 | } 26 | 27 | pFinal 28 | { 29 | $p; 30 | tolerance 1e-06; 31 | relTol 0; 32 | } 33 | 34 | "(rho|U|h|Tsolid|k|epsilon|omega)" 35 | { 36 | solver smoothSolver; 37 | smoother symGaussSeidel; 38 | tolerance 1e-05; 39 | relTol 0.1; 40 | } 41 | 42 | "(rho|U|h|Tsolid|k|epsilon|omega)Final" 43 | { 44 | $U; 45 | tolerance 1e-05; 46 | relTol 0; 47 | } 48 | } 49 | 50 | 51 | PISO 52 | { 53 | momentumPredictor yes; 54 | nCorrectors 2; 55 | nNonOrthogonalCorrectors 0; 56 | pRefCell 0; 57 | pRefValue 0; 58 | } 59 | 60 | relaxationFactors 61 | { 62 | equations 63 | { 64 | ".*" 0.9; 65 | } 66 | } 67 | 68 | // ************************************************************************* // 69 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/Allrun: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | # Source tutorial run functions 5 | # First run OpenFoam Aplication 6 | 7 | echo "\n<--------------------------------------------------------------------->" 8 | echo "1) Running blockmesh" 9 | echo "<--------------------------------------------------------------------->\n" 10 | blockMesh 11 | 12 | echo "\n<--------------------------------------------------------------------->" 13 | echo "2) Running Step 1 (0-2 DEM) " 14 | echo "<--------------------------------------------------------------------->\n" 15 | 16 | echo " 2.1) add Particle " 17 | particlesPhasicFlow 18 | echo " 2.2) add Geometry " 19 | geometryPhasicFlow 20 | echo " 2.3) Running " 21 | sphereGranFlow 22 | 23 | 24 | echo "\n<--------------------------------------------------------------------->" 25 | echo "3) Copy Orginal Data to 2s (P , U , Alpha ) " 26 | echo "<--------------------------------------------------------------------->\n" 27 | cp ./FluidField/alpha ./2 28 | cp ./FluidField/p ./2 29 | cp ./FluidField/U ./2 30 | 31 | echo "\n<--------------------------------------------------------------------->" 32 | echo "3) Running Step 2 (2-10 CFD-DEM) " 33 | echo "<--------------------------------------------------------------------->\n" 34 | unresolvedSpherePFPisoFoam 35 | 36 | echo "\n<--------------------------------------------------------------------->" 37 | echo "4) Making VTK File " 38 | echo "<--------------------------------------------------------------------->\n" 39 | foamToVTK -time 2:10 40 | pFlowToVTK -t 2:10 41 | 42 | #------------------------------------------------------------------------------ 43 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/FluidField/U: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class volVectorField; 12 | object U; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | dimensions [0 1 -1 0 0 0 0]; 17 | 18 | internalField uniform (0 0 0); 19 | 20 | boundaryField 21 | { 22 | fixedWalls 23 | { 24 | type noSlip; 25 | value uniform (0 0 0); 26 | } 27 | inlet 28 | { 29 | type fixedValue; 30 | value uniform (0.0 1.3 0); 31 | } 32 | outlet 33 | { 34 | type zeroGradient; 35 | } 36 | } 37 | 38 | // ************************************************************************* // 39 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/FluidField/alpha: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class volScalarField; 12 | object alpha; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | dimensions [0 0 0 0 0 0 0]; 17 | 18 | internalField uniform 1; 19 | 20 | boundaryField 21 | { 22 | inlet 23 | { 24 | type fixedValue; 25 | value uniform 1; 26 | } 27 | outlet 28 | { 29 | type zeroGradient; 30 | } 31 | fixedWalls 32 | { 33 | type zeroGradient; 34 | } 35 | } 36 | 37 | // ************************************************************************* // 38 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/FluidField/p: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class volScalarField; 12 | object p; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | dimensions [0 2 -2 0 0 0 0]; 17 | 18 | internalField uniform 0; 19 | 20 | boundaryField 21 | { 22 | inlet 23 | { 24 | type zeroGradient; 25 | } 26 | outlet 27 | { 28 | type fixedValue; 29 | value uniform 0; 30 | } 31 | fixedWalls 32 | { 33 | type zeroGradient; 34 | } 35 | } 36 | 37 | // ************************************************************************* // 38 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/caseSetup/interaction: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName interaction; 7 | objectType dicrionary; 8 | fileFormat ASCII; 9 | 10 | materials (sphereMat wallMat); // a list of materials names 11 | densities (1000 2500); // density of materials [kg/m3] 12 | 13 | contactListType sortedContactList; 14 | 15 | model 16 | { 17 | contactForceModel nonLinearLimited; 18 | rollingFrictionModel normal; 19 | 20 | Yeff (1.0e6 1.0e6 // Young modulus [Pa] 21 | 1.0e6 ); 22 | 23 | Geff (0.8e6 0.8e6 // Shear modulus [Pa] 24 | 0.8e6 ); 25 | 26 | nu (0.25 0.25 // Poisson's ratio [-] 27 | 0.25 ); 28 | 29 | // coefficient of normal restitution 30 | en (0.97 0.97 31 | 0.97 ); 32 | 33 | et (1.0 1.0 // coefficient of tangential restitution 34 | 1.0 ); 35 | 36 | mu (0.65 0.65 // dynamic friction 37 | 0.65 ); 38 | 39 | mur (0.1 0.1 // rolling friction 40 | 0.1 ); 41 | 42 | } 43 | 44 | contactSearch 45 | { 46 | 47 | method NBS; // method for broad search 48 | 49 | updateInterval 10; 50 | 51 | sizeRatio 1.1; 52 | 53 | cellExtent 0.55; 54 | 55 | adjustableBox Yes; 56 | } 57 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/caseSetup/particleInsertion: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName particleInsertion; 7 | objectType dicrionary; 8 | fileFormat ASCII; 9 | 10 | active no; // is insertion active? 11 | 12 | collisionCheck No; // not implemented for yes 13 | 14 | 15 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/caseSetup/shapes: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName sphereDict; 7 | objectType sphereShape; 8 | fileFormat ASCII; 9 | 10 | names (sph1); // names of shapes 11 | diameters (0.0016 ); // diameter of shapes 12 | materials (sphereMat ); // material names for shapes 13 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/constant/couplingProperties: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "constant"; 13 | object couplingProperties; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | particleMapping 18 | { 19 | // based on the maximum particle diameter in the simulation. 20 | domainExpansionRatio 1; 21 | 22 | domainUpdateInterval 0.01; 23 | 24 | decompositionMode facePlanes; 25 | } 26 | 27 | unresolved 28 | { 29 | 30 | cellDistribution 31 | { 32 | // type of cell distribution method (if required) 33 | // self: no distribution (cell itself) 34 | // Gaussian: distribute values on sorounding cells based on a neighbor length 35 | // Power: similar to Gaussian, but with power law distribution 36 | type self; 37 | } 38 | 39 | porosity 40 | { 41 | // Options are PIC, subDivision29, subDivision9, diffusion, cellDistribution 42 | method subDivision29Mod; 43 | 44 | // minimum alpha allowed 45 | alphaMin 0.25; 46 | } 47 | 48 | drag 49 | { 50 | // Drag force closure, other options are ErgunWenYu, Rong 51 | type DiFelice; 52 | 53 | // type of fluid velocity used in the drag force calculations 54 | // cell: uses fluid velocity of the cell that contains the particle center 55 | // interpolation: uses averaged fluid velocity based on cell velocities around particle 56 | fluidVelocity cell; 57 | 58 | // weather to distribute calculated drag force on cells 59 | // off: set the calculated drag force on cell itself 60 | // on: distributed the calculated drag force on cells (using cellDistribution method) 61 | cellDistribution off; 62 | 63 | residualRe 10e-6; 64 | } 65 | 66 | } 67 | 68 | // ************************************************************************* // 69 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/constant/momentumTransport: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "constant"; 13 | object momentumTransport; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | simulationType laminar; 18 | 19 | // ************************************************************************* // 20 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/constant/polyMesh/boundary: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class polyBoundaryMesh; 12 | location "constant/polyMesh"; 13 | object boundary; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | 3 18 | ( 19 | outlet 20 | { 21 | type patch; 22 | nFaces 240; 23 | startFace 95240; 24 | } 25 | fixedWalls 26 | { 27 | type wall; 28 | inGroups List 1(wall); 29 | nFaces 10640; 30 | startFace 95480; 31 | } 32 | inlet 33 | { 34 | type patch; 35 | nFaces 240; 36 | startFace 106120; 37 | } 38 | ) 39 | 40 | // ************************************************************************* // 41 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/constant/transportProperties: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "constant"; 13 | object transportProperties; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | transportModel Newtonian; 18 | 19 | nu [0 2 -1 0 0 0 0] 1.5e-05; 20 | 21 | rho [1 -3 0 0 0 0 0] 1.2; 22 | 23 | // ************************************************************************* // 24 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/constant/turbulenceProperties: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: v2412 | 5 | | \\ / A nd | Website: www.openfoam.com | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | object turbulenceProperties; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | simulationType laminar; 18 | 19 | 20 | // ************************************************************************* // 21 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/settings/domainDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | objectName domainDict; 6 | objectType dictionary; 7 | fileFormat ASCII; 8 | /*---------------------------------------------------------------------------*/ 9 | 10 | globalBox // Simulation domain: every particles that goes outside this domain will be deleted 11 | { 12 | min (-0.01 -0.01 -0.01); 13 | 14 | max (0.16 0.71 0.05); // upper corner point of the box 15 | } 16 | 17 | decomposition 18 | { 19 | direction z; 20 | } 21 | 22 | boundaries 23 | { 24 | 25 | 26 | neighborListUpdateInterval 50; /* Determines how often (how many iterations) do you want to 27 | 28 | rebuild the list of particles in the neighbor list 29 | 30 | of all boundaries in the simulation domain */ 31 | 32 | updateInterval 10; // Determines how often do you want to update the new changes in the boundary 33 | 34 | neighborLength 0.004; // The distance from the boundary plane within which particles are marked to be in the boundary list 35 | 36 | left 37 | { 38 | type exit; // other options: periodict, reflective 39 | } 40 | 41 | right 42 | { 43 | type exit; // other options: periodict, reflective 44 | } 45 | 46 | bottom 47 | { 48 | type exit; // other options: periodict, reflective 49 | } 50 | 51 | top 52 | { 53 | type exit; // other options: periodict, reflective 54 | } 55 | 56 | rear 57 | { 58 | type exit; // other options: periodict, reflective 59 | } 60 | 61 | front 62 | { 63 | type exit; // other options: periodict, reflective 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/settings/geometryDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName geometryDict; 7 | objectType dictionary; 8 | fileFormat ASCII; 9 | /* ------------------------------------------------------------------------- */ 10 | 11 | // motion model: all surfaces are fixed 12 | motionModel stationary; 13 | 14 | stationaryInfo 15 | { 16 | } 17 | 18 | 19 | surfaces 20 | { 21 | allWall 22 | { 23 | type cuboidWall; // type of the wall 24 | center (0.075 0.35 0.02); 25 | edgeLength (0.15 0.70 0.040); 26 | numDiv (3 14 1); 27 | material wallMat; // material name of this wall 28 | motion none; // motion component name 29 | } 30 | 31 | 32 | 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/settings/particlesDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | 6 | objectName particlesDict; 7 | objectType dictionary; 8 | fileFormat ASCII; 9 | 10 | setFields 11 | { 12 | defaultValue 13 | { 14 | velocity realx3 (0.0 0 0); // linear velocity (m/s) 15 | rVelocity realx3 (0 0 0); // rotational velocity (rad/s) 16 | shapeName word sph1; // name of the particle shape 17 | } 18 | 19 | selectors 20 | {} 21 | } 22 | 23 | // positions particles 24 | positionParticles 25 | { 26 | method random; // positionRandom; 27 | 28 | randomInfo 29 | { 30 | numPoints 50000; 31 | distance 0.0016; 32 | maxIterations 50; 33 | axisOrder (z x y); 34 | } 35 | regionType box; 36 | boxInfo 37 | { 38 | min (0.001 0.001 0.001); 39 | max (0.14 0.35 0.039); 40 | } 41 | 42 | maxNumberOfParticles 110001; // maximum number of particles in the simulation 43 | mortonSorting Yes; // perform initial sorting based on morton code? 44 | 45 | } 46 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/settings/settingsDict: -------------------------------------------------------------------------------- 1 | /* -------------------------------*- C++ -*--------------------------------- *\ 2 | | phasicFlow File | 3 | | copyright: www.cemf.ir | 4 | \* ------------------------------------------------------------------------- */ 5 | objectName settingsDict; 6 | objectType dictionary; 7 | fileFormat ASCII; 8 | 9 | run fluidizedBed; 10 | 11 | libs ("libpFCouplingUtilities.so"); 12 | 13 | dt 0.00001; // time step for integration (s) 14 | 15 | startTime 0; // start time for simulation 16 | 17 | endTime 2; // end time for simulation 18 | 19 | saveInterval 0.05; // time interval for saving the simulation 20 | 21 | timePrecision 4; // maximum number of digits for time folder 22 | 23 | g (0 -9.8 0); // gravity vector (m/s2) 24 | 25 | /* 26 | Simulation domain 27 | every particles that goes outside this domain is deleted. 28 | */ 29 | 30 | domain 31 | { 32 | min (-0.11 -0.01 -0.11); 33 | max (0.11 0.41 0.11); 34 | } 35 | 36 | integrationMethod AdamsBashforth2; // integration method 37 | 38 | timersReport Yes; // report timers? 39 | 40 | timersReportInterval 0.01; // time interval for reporting timers 41 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/system/blockMeshDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | object blockMeshDict; 13 | } 14 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 15 | 16 | convertToMeters 1; 17 | 18 | vertices 19 | ( 20 | (0.0 0 0) 21 | (0.15 0 0) 22 | (0.15 0.7 0) 23 | (0.0 0.7 0) 24 | (0.0 0 0.04) 25 | (0.15 0 0.04) 26 | (0.15 0.7 0.04) 27 | (0.0 0.7 0.04) 28 | ); 29 | 30 | blocks 31 | ( 32 | hex (0 1 2 3 4 5 6 7) (30 140 8) simpleGrading (1 1 1) 33 | ); 34 | 35 | edges 36 | ( 37 | ); 38 | 39 | boundary 40 | ( 41 | outlet 42 | { 43 | type patch; 44 | faces 45 | ( 46 | (3 7 6 2) 47 | ); 48 | } 49 | fixedWalls 50 | { 51 | type wall; 52 | faces 53 | ( 54 | (0 4 7 3) 55 | (2 6 5 1) 56 | (0 3 2 1) 57 | (4 5 6 7) 58 | ); 59 | } 60 | 61 | inlet 62 | { 63 | type patch; 64 | faces 65 | ( 66 | (1 5 4 0) 67 | ); 68 | } 69 | 70 | ); 71 | 72 | mergePatchPairs 73 | ( 74 | ); 75 | 76 | // ************************************************************************* // 77 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/system/controlDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object controlDict; 14 | version 2; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | application unresolvedPFFoam; 19 | 20 | startFrom startTime; 21 | 22 | startTime 2; 23 | 24 | stopAt endTime; 25 | 26 | endTime 10; 27 | 28 | deltaT 0.001; 29 | 30 | writeControl runTime; 31 | 32 | writeInterval 0.02; 33 | 34 | purgeWrite 0; 35 | 36 | writeFormat ascii; 37 | 38 | writePrecision 6; 39 | 40 | writeCompression off; 41 | 42 | timeFormat general; 43 | 44 | timePrecision 6; 45 | 46 | runTimeModifiable true; 47 | 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/system/decomposeParDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object decomposeParDict; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | numberOfSubdomains 2; 18 | 19 | method hierarchical; 20 | // method ptscotch; 21 | 22 | simpleCoeffs 23 | { 24 | n (2 1 1); 25 | } 26 | 27 | hierarchicalCoeffs 28 | { 29 | n (2 1 1); 30 | order xyz; 31 | } 32 | 33 | manualCoeffs 34 | { 35 | dataFile "cellDecomposition"; 36 | } 37 | 38 | 39 | // ************************************************************************* // 40 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/system/fvSchemes: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object fvSchemes; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | ddtSchemes 18 | { 19 | default Euler; 20 | } 21 | 22 | gradSchemes 23 | { 24 | default Gauss linear; 25 | } 26 | 27 | divSchemes 28 | { 29 | default none;; 30 | div(phi,U) Gauss upwind; 31 | div((nuEff*dev2(T(grad(U))))) Gauss linear; 32 | div(((alpha*nuEff)*dev(grad(U).T()))) Gauss linear; 33 | } 34 | 35 | laplacianSchemes 36 | { 37 | default Gauss linear corrected; 38 | } 39 | 40 | interpolationSchemes 41 | { 42 | default linear; 43 | } 44 | 45 | snGradSchemes 46 | { 47 | default corrected; 48 | } 49 | 50 | 51 | // ************************************************************************* // 52 | -------------------------------------------------------------------------------- /tutorials/unresolvedSpherePFPisoFoam/fluidizededbed/system/fvSolution: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 9 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | format ascii; 11 | class dictionary; 12 | location "system"; 13 | object fvSolution; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | solvers 18 | { 19 | p 20 | { 21 | solver PCG; 22 | preconditioner DIC; 23 | tolerance 1e-06; 24 | relTol 0.01; 25 | } 26 | 27 | pFinal 28 | { 29 | $p; 30 | tolerance 1e-06; 31 | relTol 0; 32 | } 33 | 34 | "(rho|U|h|Tsolid|k|epsilon|omega)" 35 | { 36 | solver smoothSolver; 37 | smoother symGaussSeidel; 38 | tolerance 1e-05; 39 | relTol 0.1; 40 | } 41 | 42 | "(rho|U|h|Tsolid|k|epsilon|omega)Final" 43 | { 44 | $U; 45 | tolerance 1e-05; 46 | relTol 0; 47 | } 48 | } 49 | 50 | 51 | PISO 52 | { 53 | momentumPredictor yes; 54 | nCorrectors 2; 55 | nNonOrthogonalCorrectors 0; 56 | pRefCell 0; 57 | pRefValue 0; 58 | } 59 | 60 | relaxationFactors 61 | { 62 | equations 63 | { 64 | ".*" 0.9; 65 | } 66 | } 67 | 68 | // ************************************************************************* // 69 | -------------------------------------------------------------------------------- /utilities/pFCouplingUtilities/Make/files: -------------------------------------------------------------------------------- 1 | foamPatchWall/foamPatchWall.C 2 | 3 | 4 | 5 | LIB = $(FOAM_USER_LIBBIN)/libpFCouplingUtilities 6 | -------------------------------------------------------------------------------- /utilities/pFCouplingUtilities/Make/options: -------------------------------------------------------------------------------- 1 | ptFLAGS += -std=c++17 -Wno-old-style-cast 2 | 3 | pFlow_Project = $(pFlow_PROJECT_DIR) 4 | pFlow_INCLUDE_DIR =$(pFlow_Project)/include 5 | 6 | CUDA_PATH =/usr/local/cuda 7 | 8 | -include $(GENERAL_RULES)/mplibType 9 | -include $(GENERAL_RULES)/mpi-rules 10 | 11 | EXE_INC = \ 12 | -I$(pFlow_INCLUDE_DIR) \ 13 | -I$(pFlow_INCLUDE_DIR)/phasicFlow \ 14 | -I$(pFlow_INCLUDE_DIR)/Geometry \ 15 | -I$(pFlow_INCLUDE_DIR)/Utilities \ 16 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 17 | -I$(LIB_SRC)/meshTools/lnInclude \ 18 | -I$(LIB_SRC)/Pstream/mpi/lnInclude \ 19 | -I../../phasicFlowCoupling/lnInclude 20 | 21 | LIB_LIBS = \ 22 | -L$(pFlow_Project)/lib \ 23 | -lphasicFlow \ 24 | -lGeometry \ 25 | -lUtilities \ 26 | -lOpenFOAM \ 27 | -L$(FOAM_LIBBIN)/openmpi-system -lPstream \ 28 | -L$(FOAM_LIBBIN)/sys-openmpi -lPstream \ 29 | -lfiniteVolume \ 30 | -lmeshTools 31 | 32 | EXE_INC += $(PFLAGS) $(PINC) 33 | LIB_LIBS += $(PLIBS) 34 | -------------------------------------------------------------------------------- /utilities/pFCouplingUtilities/foamPatchWall/foamPatchWall.hpp: -------------------------------------------------------------------------------- 1 | /*------------------------------- phasicFlow --------------------------------- 2 | O C enter of 3 | O O E ngineering and 4 | O O M ultiscale modeling of 5 | OOOOOOO F luid flow 6 | ------------------------------------------------------------------------------ 7 | Copyright (C): www.cemf.ir 8 | email: hamid.r.norouzi AT gmail.com 9 | ------------------------------------------------------------------------------ 10 | Licence: 11 | This file is part of phasicFlow code. It is a free software for simulating 12 | granular and multiphase flows. You can redistribute it and/or modify it under 13 | the terms of GNU General Public License v3 or any other later versions. 14 | 15 | phasicFlow is distributed to help others in their research in the field of 16 | granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the 17 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -----------------------------------------------------------------------------*/ 20 | 21 | #ifndef __foamPatchWall_hpp__ 22 | #define __foamPatchWall_hpp__ 23 | 24 | #include "Wall.hpp" 25 | #include "types.hpp" 26 | 27 | namespace pFlow::coupling 28 | { 29 | 30 | class foamPatchWall 31 | : 32 | public Wall 33 | { 34 | protected: 35 | 36 | word patchName_; 37 | 38 | public: 39 | 40 | TypeInfo("foamPatchWall"); 41 | 42 | foamPatchWall(); 43 | 44 | foamPatchWall(const dictionary& dict); 45 | 46 | add_vCtor 47 | ( 48 | Wall, 49 | foamPatchWall, 50 | dictionary 51 | ); 52 | 53 | }; 54 | 55 | } // pFlow::coupling 56 | 57 | 58 | 59 | #endif //__foamPatchWall_hpp__ -------------------------------------------------------------------------------- /utilities/pFCouplingUtilities/lnInclude/foamPatchWall.C: -------------------------------------------------------------------------------- 1 | ../foamPatchWall/foamPatchWall.C -------------------------------------------------------------------------------- /utilities/pFCouplingUtilities/lnInclude/foamPatchWall.hpp: -------------------------------------------------------------------------------- 1 | ../foamPatchWall/foamPatchWall.hpp -------------------------------------------------------------------------------- /utilities/wclean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | 5 | wclean ./pFCouplingUtilities 6 | 7 | 8 | 9 | 10 | #------------------------------------------------------------------------------ 11 | -------------------------------------------------------------------------------- /utilities/wmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # Run from this directory 3 | 4 | 5 | # Compile OpenFOAM libraries and applications 6 | echo " -> building pFCouplingUtilities" 7 | wmake ./pFCouplingUtilities 8 | 9 | 10 | 11 | 12 | #------------------------------------------------------------------------------ 13 | -------------------------------------------------------------------------------- /version: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if WM_PROJECT_VERSION environment variable is set 4 | if [ -z "$WM_PROJECT_VERSION" ]; then 5 | echo "Error: WM_PROJECT_VERSION environment variable is not set. Load environment variables of OpenFOAM first." 6 | exit 1 7 | fi 8 | 9 | # Define the header file path 10 | HEADER_FILE="./phasicFlowCoupling/OFVersion.H" 11 | 12 | # Determine what to write based on WM_PROJECT_VERSION 13 | case "$WM_PROJECT_VERSION" in 14 | 9) 15 | VERSION_VALUE="9" 16 | VERSION_STRING="9" 17 | ;; 18 | 12) 19 | VERSION_VALUE="12" 20 | VERSION_STRING="12" 21 | ;; 22 | v2406) 23 | VERSION_VALUE="2406" 24 | VERSION_STRING="v2406" 25 | ;; 26 | v2412) 27 | VERSION_VALUE="2412" 28 | VERSION_STRING="v2412" 29 | ;; 30 | *) 31 | echo "Error: WM_PROJECT_VERSION has an unsupported value: $WM_PROJECT_VERSION" 32 | echo "Supported values are: 9, 12, v2406, v2412" 33 | exit 1 34 | ;; 35 | esac 36 | 37 | # Check if file already exists and has the correct version 38 | if [ -f "$HEADER_FILE" ]; then 39 | CURRENT_VERSION=$(grep -o "FOAM_VERSION_STRING $VERSION_STRING" "$HEADER_FILE") 40 | if [ ! -z "$CURRENT_VERSION" ]; then 41 | echo "File $HEADER_FILE already exists with correct version $VERSION_STRING. No update needed." 42 | exit 0 43 | fi 44 | fi 45 | 46 | 47 | 48 | # Write the version to the header file 49 | echo "/*--------------------------------*- C++ -*----------------------------------*\\" > "$HEADER_FILE" 50 | echo "| ========= | |" >> "$HEADER_FILE" 51 | echo "| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |" >> "$HEADER_FILE" 52 | echo "| \\\\ / O peration | Version: $VERSION_STRING |" >> "$HEADER_FILE" 53 | echo "| \\\\ / A nd | Web: www.OpenFOAM.org |" >> "$HEADER_FILE" 54 | echo "| \\\\/ M anipulation | |" >> "$HEADER_FILE" 55 | echo "\\*---------------------------------------------------------------------------*/" >> "$HEADER_FILE" 56 | echo "" >> "$HEADER_FILE" 57 | echo "#ifndef OFVersion_H" >> "$HEADER_FILE" 58 | echo "#define OFVersion_H" >> "$HEADER_FILE" 59 | echo "" >> "$HEADER_FILE" 60 | echo "#define FOAM_VERSION $VERSION_VALUE" >> "$HEADER_FILE" 61 | echo "#define FOAM_VERSION_STRING $VERSION_STRING" >> "$HEADER_FILE" 62 | echo "" >> "$HEADER_FILE" 63 | echo "#endif // OFVersion_H" >> "$HEADER_FILE" 64 | 65 | echo "Successfully created $HEADER_FILE with OpenFOAM version $VERSION_VALUE" 66 | --------------------------------------------------------------------------------