|
[Sponsors] |
How to code integral of (DU/Dt - 2000 ) in openFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 10, 2012, 09:05 |
How to code integral of (DU/Dt - 2000 ) in openFoam
|
#1 |
New Member
ernest
Join Date: Jun 2010
Posts: 21
Rep Power: 15 |
Dear Foamers,
I am trying to code the expression DU/Dt - 2000, in openFoam. DU/Dt is a volVectorField. I have tried the code below but I get the error posted. Any help will be appreciated. Thanks. DDtU = (fvc::ddt(U) + fvc::div(phi, U) - fvc::div(phi)*U) - 2000; Compilation error: error: no match for ‘operator-’ in ‘Foam:perator-(const Foam::tmp<Foam::GeometricField<TypeR, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type1, PatchField, GeoMesh> >&) [with Type1 = Foam::Vector<double>, Type2 = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<Foam::Vector<double >, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<Foam::Vector<double >, Foam::fvPatchField, Foam::volMesh> >*)(& Foam:perator*(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)((const Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>*)(& U)))))))) - 2000’ /opt/openfoam201/src/OpenFOAM/lnInclude/septernionI.H:190: note: candidates are: Foam::septernion Foam:perator-(const Foam::septernion&, const Foam::vector&) /opt/openfoam201/src/OpenFOAM/lnInclude/quaternionI.H:279: note: Foam::quaternion Foam:perator-(const Foam::quaternion&, const Foam::quaternion&) /opt/openfoam201/src/OpenFOAM/lnInclude/quaternionI.H:273: note: Foam::quaternion Foam:perator-(const Foam::quaternion&) |
|
September 10, 2012, 10:21 |
|
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
answer these simple questions:
1) do you know different type (scalar and vector)? 2)do you know OpenFOAM analysis dimensions? 3) do you read programmer guide which show how to implement a source to your solver? |
|
September 10, 2012, 11:02 |
|
#3 |
New Member
ernest
Join Date: Jun 2010
Posts: 21
Rep Power: 15 |
The answer is yes to all 3 questions............I have initialised DDtU as a volVectorField (which as you know has field values and boundary values). I guess what I am asking is how to convert the scalar (2000) into a volVectorField (or vice versa) if at all possible...i know it is a simple question...but can't just get my head around it ...pardon me.
|
|
September 13, 2012, 07:26 |
Segmentation fault - multiphase- vof - interFoam
|
#5 |
New Member
ernest
Join Date: Jun 2010
Posts: 21
Rep Power: 15 |
Hello Nima,
I hope you are fine. Thank you for the reply which was helpful. I have tried to advance my code and so far it is compiling (although I am a bit suspicious about it), but when I try to run it (OF 2.0.1) I get a segmentation fault as shown below: Basically I am trying to do the algorithm below (in a 2D rectangular domain with a virtual cylinder defined by a function eta) in order to obtain the variable dp2. I have included part of my code in each step. Thank you for finding time to read this. Ernest Step 1: finding the initial acceleration (a==a2) of a rigid body, where dimensionedVector g2 (g4.lookup("g1")); volVectorField DDtU1 = (fvc::ddt(U) + fvc::div(phi, U) - fvc::div(phi)*U); vector K = fvc::domainIntegrate(DDtU1 - g2).value(); volVectorField a2 = 1000*0.000002826*eta*K/0.00254 + g2.value(); //volume of cylinder = 0.000002826 Step 2: rigid body velocity (vp2) is updated according to: Vp2n+1 = Vp2n + a2n∆t volVectorField vp2 = vp2 + (runTime.deltaT().value())*a2; dpn+1 = dpn + vpn+1∆t volVectorField dp2 = dp2 + (runTime.deltaT().value())*vp2; Step 4: I then set an intermediate velocity within the cylindrical region (to achieve no slip boundary), according to: un+1 = Vp2n+1 + a2n∆t U = U*(1 - eta) + eta*vp2; Where eta is the function that defines the cylindrical region (eta = 1 in cylinder and zero elsewhere). #0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 in "/lib/libc.so.6" #3 std::basic_string<char, std::char_traits<char>, std::allocator<char> > std:perator+<char, std::char_traits<char>, std::allocator<char> >(char, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" #4 Foam::tmp<Foam::GeometricField<Foam::typeOfSum<Foa m::Vector<double>, Foam::Vector<double> >::type, Foam::fvPatchField, Foam::volMesh> > Foam:perator+<Foam::Vector<double>, Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<Foam::Vector<d ouble>, Foam::fvPatchField, Foam::volMesh> const&, Foam::tmp<Foam::GeometricField<Foam::Vector<double >, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" #5 in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" #6 __libc_start_main in "/lib/libc.so.6" #7 in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" Segmentation fault |
|
September 13, 2012, 07:33 |
Segmentation fault - multiphase- vof - interFoam
|
#6 |
New Member
ernest
Join Date: Jun 2010
Posts: 21
Rep Power: 15 |
Hello Nima,
Sorry for the double post ...the equation image did not appear in earlier post. I hope you are fine. Thank you for the reply which was helpful. I have tried to advance my code and so far it is compiling (although I am a bit suspicious about it), but when I try to run it (OF 2.0.1) I get a segmentation fault as shown below: Basically I am trying to do the algorithm below (in a 2D rectangular domain with a virtual cylinder defined by a function eta) in order to obtain the variable dp2. I have included part of my code in each step. Thank you for finding time to read this. Ernest Step 1: finding the initial acceleration (a==a2) of a rigid body, where ma = integration {rhoX[DU/Dt] - rho*g}dV + mg dimensionedVector g2 (g4.lookup("g1")); volVectorField DDtU1 = (fvc::ddt(U) + fvc::div(phi, U) - fvc::div(phi)*U); vector K = fvc::domainIntegrate(DDtU1 - g2).value(); volVectorField a2 = 1000*0.000002826*eta*K/0.00254 + g2.value(); //volume of cylinder = 0.000002826 Step 2: rigid body velocity (vp2) is updated according to: Vp2n+1 = Vp2n + a2n∆t volVectorField vp2 = vp2 + (runTime.deltaT().value())*a2; dpn+1 = dpn + vpn+1∆t volVectorField dp2 = dp2 + (runTime.deltaT().value())*vp2; Step 4: I then set an intermediate velocity within the cylindrical region (to achieve no slip boundary), according to: un+1 = Vp2n+1 + a2n∆t U = U*(1 - eta) + eta*vp2; Where eta is the function that defines the cylindrical region (eta = 1 in cylinder and zero elsewhere). #0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 in "/lib/libc.so.6" #3 std::basic_string<char, std::char_traits<char>, std::allocator<char> > std:perator+<char, std::char_traits<char>, std::allocator<char> >(char, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" #4 Foam::tmp<Foam::GeometricField<Foam::typeOfSum<Foa m::Vector<double>, Foam::Vector<double> >::type, Foam::fvPatchField, Foam::volMesh> > Foam:perator+<Foam::Vector<double>, Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<Foam::Vector<d ouble>, Foam::fvPatchField, Foam::volMesh> const&, Foam::tmp<Foam::GeometricField<Foam::Vector<double >, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" #5 in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" #6 __libc_start_main in "/lib/libc.so.6" #7 in "/home/ernest/OpenFOAM/ernest-2.0.1/platforms/linux64GccDPOpt/bin/myInterFoam" Segmentation fault |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Gerris or Openfoam? | houkensjtu | Main CFD Forum | 15 | September 15, 2024 03:24 |
Specific OpenFOAM Code | pbhuter | OpenFOAM | 13 | June 30, 2012 20:06 |
OpenFoam code | McCarra | OpenFOAM Programming & Development | 1 | November 19, 2010 08:16 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 06:56 |
What kind of Cmmercial CFD code you feel well? | Lans | Main CFD Forum | 13 | October 27, 1998 11:20 |