|
[Sponsors] |
March 26, 2022, 00:23 |
operate on volScalarField as a whole
|
#1 |
New Member
becher
Join Date: Dec 2018
Posts: 4
Rep Power: 7 |
hello,
I am trying to add a scalar transport equation to multiPhaseInterFoam.The diffusion coefficient Ds is defined as a volScalarField cause it should be weighted based on the value of the fraction of phases in each cell. i.e. Ds = D1*alpha1+D2*alpha2+D3*alpha3... Following code was used to achieve that, ScalarList Dlist stores diffusivity D for each phase. Code:
forAll(Ds, celli) { Ds[celli] = scalar(0); int im = 0; for (volScalarField alpha : mixture.phases()) { Ds[celli] += Dlist[im] * alpha[celli]; im +=1; } } So I wonder if I can operate the volScalarField as a whole to save time, following code was used. Code:
Ds = volScalarField<0>; int im = 0; for (volScalarField alpha : mixture.phases()) { dimensionedScalar a = (dimensionSet(0,2,-1,0,0,0,0),Dlist[im]); Ds += a * alpha; im += 1; } Code:
--> FOAM FATAL ERROR: (openfoam-2106) tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> deallocated From const T& Foam::tmp<T>::cref() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>] in file /home/beck/OpenFOAM/OpenFOAM-v2106/src/OpenFOAM/lnInclude/tmpI.H at line 217. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::exitOrAbort(int, bool) at ??:? #2 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in ~/OpenFOAM/beck-v2106/platforms/linux64GccDPInt32Opt/bin/ladleFoam #3 ? in ~/OpenFOAM/beck-v2106/platforms/linux64GccDPInt32Opt/bin/ladleFoam #4 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 #5 ? in ~/OpenFOAM/beck-v2106/platforms/linux64GccDPInt32Opt/bin/ladleFoam Sorry for my bad English and programing skills. Any advice on where I'm going wrong is appreciated. Thanks |
|
Tags |
multiphaseinterfoam, scalar transport, volscalarfield |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error message | Bruno_Jorge | Main CFD Forum | 1 | February 5, 2019 12:12 |
namespace Foam | Argen | OpenFOAM | 4 | February 5, 2019 09:55 |
execFlowFunctionObjects - unknown field problem | Toorop | OpenFOAM Post-Processing | 16 | March 14, 2016 04:25 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 07:16 |
Operate on volScalarField as whole v access elements | adhiraj | OpenFOAM | 2 | November 29, 2012 13:35 |