mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
release on 2012-07-17_15-53-04
This commit is contained in:
3
applications/utilities/cfdemPostproc/Make/files
Normal file
3
applications/utilities/cfdemPostproc/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
cfdemPostproc.C
|
||||
|
||||
EXE=$(FOAM_USER_APPBIN)/cfdemPostproc
|
||||
17
applications/utilities/cfdemPostproc/Make/options
Normal file
17
applications/utilities/cfdemPostproc/Make/options
Normal file
@ -0,0 +1,17 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(CFDEM_SRC_DIR)/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-L$(FOAM_USER_LIBBIN)\
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-l$(CFDEM_LIB_NAME) \
|
||||
|
||||
140
applications/utilities/cfdemPostproc/cfdemPostproc.C
Normal file
140
applications/utilities/cfdemPostproc/cfdemPostproc.C
Normal file
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
cfdemPostproc
|
||||
|
||||
Description
|
||||
Tool for DEM->CFD (Lagrange->Euler) mapping to calculate local voidfraction
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
#include "cfdemCloud.H"
|
||||
#include "dataExchangeModel.H"
|
||||
#include "voidFractionModel.H"
|
||||
#include "regionModel.H"
|
||||
#include "locateModel.H"
|
||||
#include "averagingModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
|
||||
// create cfdemCloud
|
||||
cfdemCloud particleCloud(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
int count=0;
|
||||
int DEM_dump_Interval=1000;
|
||||
|
||||
double **positions_;
|
||||
double **velocities_;
|
||||
double **radii_;
|
||||
double **voidfractions_;
|
||||
double **particleWeights_;
|
||||
double **particleVolumes_;
|
||||
double **cellIDs_;
|
||||
|
||||
particleCloud.dataExchangeM().allocateArray(positions_,0.,3);
|
||||
particleCloud.dataExchangeM().allocateArray(velocities_,0.,3);
|
||||
particleCloud.dataExchangeM().allocateArray(radii_,0.,1);
|
||||
particleCloud.dataExchangeM().allocateArray(voidfractions_,0.,1);
|
||||
particleCloud.dataExchangeM().allocateArray(particleWeights_,0.,1);
|
||||
particleCloud.dataExchangeM().allocateArray(particleVolumes_,0.,1);
|
||||
particleCloud.dataExchangeM().allocateArray(cellIDs_,0.,1);
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
count+=DEM_dump_Interval;// proceed loading new data
|
||||
|
||||
|
||||
|
||||
particleCloud.regionM().resetVolFields(Us);
|
||||
|
||||
particleCloud.dataExchangeM().couple();
|
||||
|
||||
particleCloud.dataExchangeM().getData("x","vector-atom",positions_,count);
|
||||
particleCloud.dataExchangeM().getData("v","vector-atom",velocities_,count);
|
||||
particleCloud.dataExchangeM().getData("radius","scalar-atom",radii_,count);
|
||||
|
||||
particleCloud.set_radii(radii_);
|
||||
|
||||
particleCloud.locateM().findCell(particleCloud.regionM().inRegion(),positions_,cellIDs_,particleCloud.numberOfParticles());
|
||||
|
||||
particleCloud.set_cellIDs(cellIDs_);
|
||||
|
||||
particleCloud.voidFractionM().setvoidFraction
|
||||
(
|
||||
particleCloud.regionM().inRegion(),voidfractions_,particleWeights_,particleVolumes_
|
||||
);
|
||||
|
||||
voidfraction.internalField() = particleCloud.voidFractionM().voidFractionInterp();
|
||||
voidfraction.correctBoundaryConditions();
|
||||
|
||||
particleCloud.averagingM().setVectorAverage
|
||||
(
|
||||
particleCloud.averagingM().UsNext(),
|
||||
velocities_,
|
||||
particleWeights_,
|
||||
particleCloud.averagingM().UsWeightField(),
|
||||
particleCloud.regionM().inRegion()
|
||||
);
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
|
||||
}
|
||||
|
||||
delete positions_;
|
||||
delete velocities_;
|
||||
delete radii_;
|
||||
delete voidfractions_;
|
||||
delete particleWeights_;
|
||||
delete particleVolumes_;
|
||||
delete cellIDs_;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
82
applications/utilities/cfdemPostproc/createFields.H
Normal file
82
applications/utilities/cfdemPostproc/createFields.H
Normal file
@ -0,0 +1,82 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -2, 0, 0), 1.0)
|
||||
);
|
||||
|
||||
Info<< "Reading physical velocity field U" << endl;
|
||||
Info<< "Note: only if voidfraction at boundary is 1, U is superficial velocity!!!\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector("0", dimensionSet(0, 1, -1, 0, 0), vector::zero)
|
||||
);
|
||||
|
||||
//========================
|
||||
// drag law modelling
|
||||
//========================
|
||||
|
||||
|
||||
Info<< "\nReading voidfraction field voidfraction = (Vgas/Vparticle)\n" << endl;
|
||||
volScalarField voidfraction
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"voidfraction",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 0, 0, 0, 0), 1.)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading particle velocity field Us\n" << endl;
|
||||
volVectorField Us
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Us",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector("0", dimensionSet(0, 1, -1, 0, 0), vector::zero)
|
||||
);
|
||||
|
||||
//========================
|
||||
# include "createPhi.H"
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
68
applications/utilities/vizClock/matPlot.py
Normal file
68
applications/utilities/vizClock/matPlot.py
Normal file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
import csv, sys
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Open the data
|
||||
datafile = "timeEvalFull.txt"
|
||||
f = open(datafile, 'r')
|
||||
reader = csv.reader(f, dialect='excel-tab')
|
||||
reader.next()
|
||||
|
||||
header = []
|
||||
identifier = []
|
||||
deltaT = []
|
||||
maxdeltaT = []
|
||||
nOfRuns = []
|
||||
level = []
|
||||
parentNr = []
|
||||
parentName = []
|
||||
|
||||
|
||||
i = 0
|
||||
for row in reader:
|
||||
if i == 0:
|
||||
for column in row:
|
||||
header.append(column)
|
||||
print header
|
||||
else:
|
||||
identifier.append(row[0])
|
||||
deltaT.append(float(row[1]))
|
||||
maxdeltaT.append(float(row[2]))
|
||||
nOfRuns.append(int(row[3]))
|
||||
level.append(int(row[4]))
|
||||
parentNr.append(int(row[5]))
|
||||
parentName.append(row[6])
|
||||
i+=1
|
||||
|
||||
bottom = []
|
||||
childheight = []
|
||||
|
||||
for i in range(len(identifier)):
|
||||
bottom.append(0)
|
||||
childheight.append(0)
|
||||
|
||||
levelZero = 0.0
|
||||
|
||||
#loop levels
|
||||
for j in range(len(identifier)):
|
||||
#loop indices
|
||||
for i in range(len(identifier)):
|
||||
if level[i] == j:
|
||||
if parentNr[i] != -1:
|
||||
bottom[i] = bottom[parentNr[i]] + childheight[parentNr[i]]
|
||||
childheight[parentNr[i]] += deltaT[i]
|
||||
else:
|
||||
bottom[i] = levelZero
|
||||
levelZero += deltaT[i]
|
||||
|
||||
#Output
|
||||
for i in range(len(identifier)):
|
||||
plt.bar(level[i],deltaT[i],width = 0.2, bottom=bottom[i])
|
||||
plt.text(level[i]+0.22,bottom[i]+deltaT[i]/2,identifier[i]+" "+str(nOfRuns[i])+"x",verticalalignment='center')
|
||||
plt.xlabel('run level')
|
||||
plt.ylabel('CPU time in s')
|
||||
plt.title('time measurement')
|
||||
plt.show()
|
||||
|
||||
|
||||
13
applications/utilities/vizClock/timeEvalFull.txt
Normal file
13
applications/utilities/vizClock/timeEvalFull.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Parallel Measurements in CPU-seconds of all Processors:
|
||||
Name avgdeltaT maxdeltaT nOfRuns level parentNr parentName
|
||||
X 5.000000e-06 5.000000e-06 1 0 -1 none
|
||||
A 3.240000e-04 3.240000e-04 1 0 -1 none
|
||||
B 1.680000e-04 1.680000e-04 1 1 1 A
|
||||
C 9.000000e-06 9.000000e-06 3 2 2 B
|
||||
D 6.000000e-06 6.000000e-06 3 3 3 C
|
||||
E 1.500000e-04 1.500000e-04 3 2 2 B
|
||||
F 2.400000e-05 2.400000e-05 3 1 1 A
|
||||
G 6.000000e-06 6.000000e-06 3 1 1 A
|
||||
X 6.000000e-06 6.000000e-06 3 2 7 G
|
||||
H 4.000000e-05 4.000000e-05 5 1 1 A
|
||||
I 2.000000e-05 2.000000e-05 1 1 1 A
|
||||
Reference in New Issue
Block a user