View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004073 | OpenFOAM | Bug | public | 2024-04-22 08:58 | 2024-04-22 13:40 |
Reporter | tniemi | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0004073: JohnsonJackson -boundary conditions not working in dev | ||||
Description | In current dev the JohnsonJackson-boundary conditions, ie. https://github.com/OpenFOAM/OpenFOAM-dev/tree/master/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields refuse to restart, because the dimensionend scalars are written to disk such that the name of the scalar is duplicated an restitutionCoefficient restitutionCoefficient [0 0 0 0 0 0 0] 0.8 This used to work, but in the latest dev this syntax is no longer tolerated. To fix this, either the entries could be changed to write the values, ie. writeEntry(os, "restitutionCoefficient", restitutionCoefficient_.value()); writeEntry(os, "specularityCoefficient", specularityCoefficient_.value()); or I have attached a patch where the dimensionedScalars are converted to scalars as they are dimLess and they are always used through .value() anyways. | ||||
Steps To Reproduce | In tutorials/multiphaseEuler/fluidisedBed set it to startFrom latestTime; stopAt writeNow; and try to run twice. The second run will refuse. | ||||
Additional Information | I tried to search for other uses of reading/writing of dimensionedScalars in BCs, but to my surprise didn't seem to find other examples. | ||||
Tags | No tags attached. | ||||
|
patch.diff (8,487 bytes)
diff --git a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index 0d59cd97ea..ce6ed769e2 100644 --- a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,17 +50,12 @@ JohnsonJacksonParticleSlipFvPatchVectorField ) : partialSlipFvPatchVectorField(p, iF), - specularityCoefficient_ - ( - "specularityCoefficient", - dimless, - dict.lookup("specularityCoefficient") - ) + specularityCoefficient_(dict.lookup<scalar>("specularityCoefficient")) { if ( - (specularityCoefficient_.value() < 0) - || (specularityCoefficient_.value() > 1) + (specularityCoefficient_ < 0) + || (specularityCoefficient_ > 1) ) { FatalErrorInFunction @@ -163,7 +158,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() constant::mathematical::pi *alpha *gs0 - *specularityCoefficient_.value() + *specularityCoefficient_ *sqrt(3*Theta) /max(6*nu*phase.alphaMax(), small) ); diff --git a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H index 635a094f16..da5339f46d 100644 --- a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H +++ b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ class JohnsonJacksonParticleSlipFvPatchVectorField // Private Data //- Specularity coefficient - dimensionedScalar specularityCoefficient_; + scalar specularityCoefficient_; public: diff --git a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index a11dae3123..dd61a6df65 100644 --- a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,23 +49,13 @@ JohnsonJacksonParticleThetaFvPatchScalarField ) : mixedFvPatchScalarField(p, iF, dict, false), - restitutionCoefficient_ - ( - "restitutionCoefficient", - dimless, - dict.lookup("restitutionCoefficient") - ), - specularityCoefficient_ - ( - "specularityCoefficient", - dimless, - dict.lookup("specularityCoefficient") - ) + restitutionCoefficient_(dict.lookup<scalar>("restitutionCoefficient")), + specularityCoefficient_(dict.lookup<scalar>("specularityCoefficient")) { if ( - (restitutionCoefficient_.value() < 0) - || (restitutionCoefficient_.value() > 1) + (restitutionCoefficient_ < 0) + || (restitutionCoefficient_ > 1) ) { FatalErrorInFunction @@ -75,8 +65,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField if ( - (specularityCoefficient_.value() < 0) - || (specularityCoefficient_.value() > 1) + (specularityCoefficient_ < 0) + || (specularityCoefficient_ > 1) ) { FatalErrorInFunction @@ -182,13 +172,13 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs() const scalarField Theta(patchInternalField()); // calculate the reference value and the value fraction - if (restitutionCoefficient_.value() != 1.0) + if (restitutionCoefficient_ != 1.0) { this->refValue() = (2.0/3.0) - *specularityCoefficient_.value() + *specularityCoefficient_ *magSqr(U) - /(scalar(1) - sqr(restitutionCoefficient_.value())); + /(scalar(1) - sqr(restitutionCoefficient_)); this->refGrad() = 0.0; @@ -197,7 +187,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs() constant::mathematical::pi *alpha *gs0 - *(scalar(1) - sqr(restitutionCoefficient_.value())) + *(scalar(1) - sqr(restitutionCoefficient_)) *sqrt(3*Theta) /max(4*kappa*phase.alphaMax(), small) ); @@ -214,7 +204,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs() this->refGrad() = pos0(alpha - small) *constant::mathematical::pi - *specularityCoefficient_.value() + *specularityCoefficient_ *alpha *gs0 *sqrt(3*Theta) diff --git a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H index 2b45fc3912..24b67c127a 100644 --- a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H +++ b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,10 +69,10 @@ class JohnsonJacksonParticleThetaFvPatchScalarField // Private Data //- Particle-wall restitution coefficient - dimensionedScalar restitutionCoefficient_; + scalar restitutionCoefficient_; //- Specularity coefficient - dimensionedScalar specularityCoefficient_; + scalar specularityCoefficient_; public: |
|
Alternative fix would be to change the constructors used to read the coefficients. This would allow backward compatibility as it accepts both ways, ie. without repeating the name or by repeating the name. patch2.diff (3,185 bytes)
diff --git a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index 0d59cd97ea..bc57869075 100644 --- a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,12 +50,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField ) : partialSlipFvPatchVectorField(p, iF), - specularityCoefficient_ - ( - "specularityCoefficient", - dimless, - dict.lookup("specularityCoefficient") - ) + specularityCoefficient_(dict.lookup("specularityCoefficient")) { if ( diff --git a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index a11dae3123..40b9997981 100644 --- a/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/modules/multiphaseEuler/momentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,18 +49,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField ) : mixedFvPatchScalarField(p, iF, dict, false), - restitutionCoefficient_ - ( - "restitutionCoefficient", - dimless, - dict.lookup("restitutionCoefficient") - ), - specularityCoefficient_ - ( - "specularityCoefficient", - dimless, - dict.lookup("specularityCoefficient") - ) + restitutionCoefficient_(dict.lookup("restitutionCoefficient")), + specularityCoefficient_(dict.lookup("specularityCoefficient")) { if ( |
|
Resolved by commit 6a3c7ab502f963220ff8000a43be9b4afdc1d4dd |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-04-22 08:58 | tniemi | New Issue | |
2024-04-22 08:58 | tniemi | File Added: patch.diff | |
2024-04-22 10:21 | tniemi | Note Added: 0013231 | |
2024-04-22 10:21 | tniemi | File Added: patch2.diff | |
2024-04-22 13:40 | henry | Assigned To | => henry |
2024-04-22 13:40 | henry | Status | new => resolved |
2024-04-22 13:40 | henry | Resolution | open => fixed |
2024-04-22 13:40 | henry | Fixed in Version | => dev |
2024-04-22 13:40 | henry | Note Added: 0013232 |