|
[Sponsors] | |||||
make a dimensionedScalar to be volScalarField |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 866
Rep Power: 19 ![]() |
Hi,
I wanna make the diameter of the particle to be variable. Before I revise the code, d_ is a dimensionedScalar, locates in /opt/openfoam222/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel Code:
//- Characteristic diameter of phase
dimensionedScalar d_;
Code:
//- Characteristic diameter of phase
volScalarField d_;
.....
volScalarField& d()
{
return d_;
}
....
....
d_
(
IOobject
(
"d" + phaseName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
),
Code:
Foam::tmp<Foam::volScalarField> Foam::GidaspowSchillerNaumann::K
(
const volScalarField& Ur
) const
{
volScalarField alpha2(max(scalar(1) - alpha1_, scalar(1e-6)));
volScalarField bp(pow(alpha2, -2.65));
volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)));
volScalarField Cds
(
neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
+ pos(Re - 1000)*0.44
);
return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d();
}
Code:
SOURCE=dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam222/src/finiteVolume/lnInclude -I../phaseModel/lnInclude -IlnInclude -I. -I/opt/openfoam222/src/OpenFOAM/lnInclude -I/opt/openfoam222/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/GidaspowSchillerNaumann.o dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C: In member function ‘virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::GidaspowSchillerNaumann::K(const volScalarField&) const’: dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C:74:47: error: passing ‘const Foam::phaseModel’ as ‘this’ argument of ‘Foam::volScalarField& Foam::phaseModel::d()’ discards qualifiers [-fpermissive] dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C:82:51: error: passing ‘const Foam::phaseModel’ as ‘this’ argument of ‘Foam::volScalarField& Foam::phaseModel::d()’ discards qualifiers [-fpermissive] make: *** [Make/linux64GccDPOpt/GidaspowSchillerNaumann.o] Error 1 Actually my thought is very simple, in twoPhaseEulerFoam, particle's diameter is constant. you can set it in your transportDict. Well cua I wanna implant PBM into it, so this diameter should be variable. So I wanna implant PBM step by step. At first I should change this constant diameter to be changeable. This is why I revise the code. |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
|
Hi,
you've changed d_ in header file but did not change initialization of the field in constructor, it still initialized like (phaseModel/phaseModel/phaseModel.C): Code:
...
d_
(
"d",
dimLength,
dict_.lookup("d")
),
...
Problem appears here (interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C): Code:
volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); |
|
|
|
|
|
|
|
|
#3 | |
|
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 866
Rep Power: 19 ![]() |
Quote:
Yes, I also changed that. So phase.C is wmaked successfully. But when I wmake GidaspowSchillerNaumann.C, it failed. Code:
volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); You get my point, Thanks anyway. |
||
|
|
|
||
|
|
|
#4 |
|
Senior Member
|
Well,
you can change Code:
volScalarField& d()
{
return d_;
}
Code:
const volScalarField& d() const
{
return d_;
}
Code:
tmp<volScalarField> d() const
{
return d_;
}
Code:
GeometricField (const GeometricField< Type, PatchField, GeoMesh > &) Last edited by alexeym; April 2, 2014 at 06:45. Reason: additional comment |
|
|
|
|
|
|
|
|
#5 | |
|
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 866
Rep Power: 19 ![]() |
Quote:
|
||
|
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 10:21 |
| Problem with pow and volScalarField | _Stefan_ | OpenFOAM Programming & Development | 15 | April 14, 2019 23:20 |
| changing a volScalarField to a dimensionedScalar | wschosta | OpenFOAM Running, Solving & CFD | 5 | May 6, 2015 11:20 |
| multiplicate all elements of volScalarField with scalar to get new volScalarField | maybee | OpenFOAM Programming & Development | 2 | February 18, 2014 16:43 |
| Confused about how OF handles operation between volScalarField and dimensionedScalar | Edy | OpenFOAM | 3 | September 30, 2010 11:07 |