|
[Sponsors] |
How would you code this simple term into OpenFOAM? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 13 ![]() |
Hello,
I would like to add the following term to the dissipation equation: partial/partial(x_k) * [nu*delta_jk * partial(epsilon)/partial(x_j)] (I couldn't figure out how to nicely display an equation on here so I've attached it as an image) From my understanding, this term should only be added when the indices j and k are equal (i.e.: each individual term in the diagonal of partial^2(epsilon)/partial(x_j,x_k) NOT THE TRACE). Although this is very simple mathematically, I'm having a hard time translating it into compile-able code. My approach was to take the gradient of epsilon twice, which would give me a tensor of rank=2, and then to do element-by-element multiplication (still haven't figured out how to do this either) with nuEff*I. I can't figure out how to multiply nuEff by I without getting errors, or how to do the element-by-element multiplication. Could someone please give me a hand? My programming skills aren't the best so I have been basing my modifications on the existing code >_< Below are my definitions and where I want to add the line of code (I've tried changing the field type on nuI and it hasn't helped) Perhaps there is a better, more efficient, approach so I am open to suggestions. Thank you! Code:
volVectorField gradEps(fvc::grad(epsilon_)); volTensorField gradsqEps(fvc::grad(gradEps)); volTensorField nuI(nuEff()*I); ... fvm::ddt(epsilon_) + fvm::div(phi_, epsilon_) - fvm::laplacian(DissDest(), epsilon_) //Don't worry about this line //ADD NEW LINE HERE == ... Code:
sebastian@navier1:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/SPLRRIP$ wmake libso wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file SPLRRIP.C SOURCE=SPLRRIP.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/turbulenceModels -I/opt/openfoam220/src/transportModels -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/SPLRRIP.o SPLRRIP.C: In member function ‘virtual void Foam::incompressible::RASModels::SPLRRIP::correct()’: SPLRRIP.C:403:30: error: no matching function for call to ‘Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::tmp<Foam::GeometricField<Foam::SphericalTensor<double>, Foam::fvPatchField, Foam::volMesh> >)’ SPLRRIP.C:403:30: note: candidates are: /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const wordList&, const wordList&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: candidate expects 4 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: candidate expects 3 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: candidate expects 2 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: candidate expects 2 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: candidate expects 2 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: no known conversion for argument 1 from ‘Foam::tmp<Foam::GeometricField<Foam::SphericalTensor<double>, Foam::fvPatchField, Foam::volMesh> >’ to ‘const Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >&’ /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: no known conversion for argument 1 from ‘Foam::tmp<Foam::GeometricField<Foam::SphericalTensor<double>, Foam::fvPatchField, Foam::volMesh> >’ to ‘const Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&’ /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dictionary&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: candidate expects 3 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: candidate expects 2 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::Field<TypeR>&, const Foam::PtrList<PatchField<Type> >&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: candidate expects 5 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const wordList&, const wordList&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: candidate expects 5 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const Foam::word&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: candidate expects 4 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const wordList&, const wordList&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: candidate expects 5 arguments, 1 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: candidate expects 4 arguments, 1 provided make: *** [Make/linux64GccDPOpt/SPLRRIP.o] Error 1 |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 13 ![]() |
This was very simple...
fvm::laplacian(nu(), epsilon_) |
|
![]() |
![]() |
![]() |
Tags |
kronecker delta |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Include OpenFoam code Latex | emirust | OpenFOAM Post-Processing | 5 | November 28, 2012 02:56 |
adding a C code to OpenFOAM | latvietis | OpenFOAM Programming & Development | 1 | November 21, 2012 03:46 |
How to code integral of (DU/Dt - 2000 ) in openFoam | erncyc | OpenFOAM | 5 | September 13, 2012 06:33 |
Specific OpenFOAM Code | pbhuter | OpenFOAM | 13 | June 30, 2012 19:06 |
New OpenFOAM Forum Structure | jola | OpenFOAM | 2 | October 19, 2011 06:55 |