|
[Sponsors] |
OF v2112: problem with twoPhaseEulerFoam & scalarCodedSource |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 7, 2022, 06:44 |
OF v2112: problem with twoPhaseEulerFoam & scalarCodedSource
|
#1 |
New Member
Join Date: Apr 2009
Posts: 13
Rep Power: 17 |
Hi foamers,
I use scalarCodedSource for adding mass for a phase in twoPhaseEulerFoam, which used to work in OpenFoam v2012. The same code gives an error "Not implemented" in v2112. A very simple example for fvOptions is: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2112 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // testsource { type scalarCodedSource; active true; name sourceTime; scalarCodedSourceCoeffs { selectionMode all; fields (thermo:rho.air); codeInclude #{ #}; codeCorrect #{ Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ Info << " addSup " << endl; #}; codeConstrain #{ Pout<< "**codeConstrain**" << endl; #}; code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } Code:
--> FOAM FATAL ERROR: (openfoam-2112) Not implemented From virtual void Foam::fv::sourceTimeFvOptionscalarSource::addSup(const volScalarField&, Foam::fvMatrix<double>&, Foam::label) in file /home/user/user-v2112/run/bubbleColumn/constant/fvOptions.testsource.scalarCodedSourceCoeffs at line 59. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::simpleExit(int, bool) at ??:? #2 Foam::error::exiting(int, bool) at ??:? #3 Foam::tmp<Foam::fvMatrix<double> > Foam::fv::optionList::operator()<double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) at ??:? #4 ? at ??:? #5 __libc_start_main in /lib64/libc.so.6 #6 ? at ??:? Did somebody experience similar issues? A quick test with simpleFoam and the field "k" worked as expected in v2012 and 2112. Any help is appreciated. Ulf |
|
February 7, 2022, 14:11 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
How does it look if you also define codeAddSupRho ?
Seems to have been missed out on the release notes/upgrade-guides but see the following commit for some info: https://develop.openfoam.com/Develop...b8b3c23a154725 FWIW the older code that "worked", probably didn't actually use the density. |
|
February 7, 2022, 15:45 |
|
#3 |
New Member
Join Date: Apr 2009
Posts: 13
Rep Power: 17 |
Thank your very much for your time and fast answer! As you guessed, codeAddSupRho is the correct way and it seems to work. I'm feeling a little bit ashamed...
I will check the older cases and try to read the release-notes next time more carefully Ulf |
|
February 7, 2022, 17:45 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
Actually I'm not even sure it shows up in the release notes properly at all. Might have slipped under the radar. |
||
April 8, 2022, 21:52 |
|
#5 |
New Member
Juan Salazar
Join Date: Jun 2019
Posts: 19
Rep Power: 7 |
Just for clarification,
If I wish to add a source to the energy equation in rhoPimpleFoam by using fvOptions, then I should define this source in codeAddSupRho? If given source is in units of W/mˆ3, do I need to multiply by rho? I noticed that in EEqn.H, fvOptions is called with the operator() in the form fvOptions (rho, he). Code:
{ volScalarField& he = thermo.he(); fvScalarMatrix EEqn ( fvm::ddt(rho, he) + fvm::div(phi, he) + fvc::ddt(rho, K) + fvc::div(phi, K) + ( he.name() == "e" ? fvc::div ( fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)" ) : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) == fvOptions(rho, he) ); Code:
template<class Type> Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator() ( const volScalarField& rho, GeometricField<Type, fvPatchField, volMesh>& field, const word& fieldName ) { checkApplied(); const dimensionSet ds ( rho.dimensions()*field.dimensions()/dimTime*dimVolume ); tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds)); fvMatrix<Type>& mtx = tmtx.ref(); forAll(*this, i) { option& source = this->operator[](i); label fieldi = source.applyToField(fieldName); if (fieldi != -1) { addProfiling(fvopt, "fvOption()." + source.name()); source.setApplied(fieldi); if (source.isActive()) { if (debug) { Info<< "Applying source " << source.name() << " to field " << fieldName << endl; } source.addSup(rho, mtx, fieldi); } } } return tmtx; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
area does not match neighbour by ... % -- possible face ordering problem | St.Pacholak | OpenFOAM | 11 | September 4, 2024 05:28 |
fvOptions problem in TwoPhaseEulerFoam | mshehata85 | OpenFOAM Running, Solving & CFD | 14 | May 4, 2017 12:31 |
Fluent Parallelization Problem After AC Power Dropped | pawl | Hardware | 5 | November 13, 2016 07:08 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |