|
[Sponsors] |
June 15, 2013, 10:38 |
adding "h" field to sonicFoam
|
#1 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
Hi
how can add "h" field to sonicFoam?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 15, 2013, 12:00 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Hi Ehsan,
It depends on how exactly you want to calculate the field "h" and if it should affect the flow of the fluid as well or not. I did a bit of searching and this does not look like to be an easy task, at least according to this bug report: http://www.openfoam.org/mantisbt/view.php?id=86 Best regards, Bruno
__________________
|
|
June 15, 2013, 12:20 |
|
#3 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
Hi dear Bruno
it only suffice that be calculated through e,p nd rho as you know:h=e+p/rho and doesn't affect the flow.is it difficult to define a field for that so that it obtains from three other fields(e,p,rho)?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 15, 2013, 12:46 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Mmm... the "e" is a field that already exists... OK, try adding the following code, after the equation for "e" is solved:
Code:
volScalarField h ( IOobject ( "h", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, e+p/rho );
__________________
|
|
June 15, 2013, 12:57 |
|
#5 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
you mean in createFields,right?
where it should be exactly added? Code:
Info<< "Reading thermophysical properties\n" << endl; autoPtr<psiThermo> pThermo ( psiThermo::New(mesh) ); psiThermo& thermo = pThermo(); thermo.validate(args.executable(), "e"); volScalarField& p = thermo.p(); volScalarField& e = thermo.he(); const volScalarField& psi = thermo.psi(); volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh ), thermo.rho() ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field gas\n" << endl; volScalarField gas ( IOobject ( "gas", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); #include "compressibleCreatePhi.H" Info<< "Creating turbulence model\n" << endl; autoPtr<compressible::turbulenceModel> turbulence ( compressible::turbulenceModel::New ( rho, U, phi, thermo ) );
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 15, 2013, 13:00 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
No, no... I said after solving the equation "e"... this means in "eEqn.H", if I'm not mistaken on the name of the file.
__________________
|
|
June 15, 2013, 13:47 |
|
#7 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
is it true?
Code:
{ solve ( fvm::ddt(rho, e) + fvm::div(phi, e) - fvm::laplacian(turbulence->alphaEff(), e) == - p*fvc::div(phi/fvc::interpolate(rho)) ); thermo.correct(); } volScalarField h ( IOobject ( "h", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, e+p/rho );
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 15, 2013, 13:51 |
|
#8 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
Bruno its the error:
Code:
ehsan@Ehsan-com:~/Desktop/Solvers/sonicFoamWGMaxCo_220$ wmake Making dependency list for source file sonicFoamModified.C SOURCE=sonicFoamModified.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/thermophysicalModels/basic/lnInclude -I/opt/openfoam220/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/finiteVolume/cfdTools -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/sampling/lnInclude -I/opt/openfoam220/src/fvOptions/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/sonicFoamModified.o In file included from sonicFoamModified.C:64:0: eEqn.H: In function ‘int main(int, char**)’: eEqn.H:25:1: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject, Foam::fvMesh&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’ eEqn.H:25:1: 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 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: no known conversion for argument 2 from ‘Foam::fvMesh’ to ‘const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&’ /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 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: no known conversion for argument 2 from ‘Foam::fvMesh’ to ‘const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&’ /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 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: candidate expects 2 arguments, 3 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 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: candidate expects 2 arguments, 3 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 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: candidate expects 2 arguments, 3 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 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: candidate expects 1 argument, 3 provided /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: candidate expects 1 argument, 3 provided /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 = 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: no known conversion for argument 3 from ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘const Foam::dictionary&’ /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = 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, 3 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 = 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, 3 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 = 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, 3 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 = 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: no known conversion for argument 3 from ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘const Foam::dimensioned<double>&’ /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 = 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, 3 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 = 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: no known conversion for argument 3 from ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘const Foam::dimensionSet&’ /opt/openfoam220/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable] /opt/openfoam220/src/finiteVolume/lnInclude/readPISOControls.H:12:16: warning: unused variable ‘momentumPredictor’ [-Wunused-variable] /opt/openfoam220/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable] make: *** [Make/linux64GccDPOpt/sonicFoamModified.o] Error 1
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 15, 2013, 14:04 |
|
#9 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
I'm trying this myself and it doesn't work. "p/rho" doesn't have the same units as "e" (edit: or structure?).
But I've just now remembered something... what thermal properties have you defined for your case? Because the "e" field is in fact "thermo.he()", which means that it can be "h", depending on the options, therefore not requiring any additional coding.
__________________
Last edited by wyldckat; June 15, 2013 at 14:04. Reason: see "edit:" |
|
June 15, 2013, 14:45 |
|
#10 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26 |
yes they both have the same dimension.
no it doesn't accept enthalpy as the bug link you gave confirm it.maybe can replace it by R*T that R is approximately 287.14 for air is it possible? in general adding a new field from existing fields doesn't have a routine method?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 15, 2013, 16:07 |
|
#11 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Hi Ehsan,
Sorry, but something strange happened back then. I know that compiling went wrong when using "h = e + p/rho", but now it's working... very strange ... OK, the modifications I did were as follows:
Code:
wmake _____________ In regards to the initial idea, I had forgotten that the following: Code:
volScalarField h ( IOobject ( "h", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, e+p/rho );
Bruno
__________________
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 05:49 |
Adding Temperature field to IcoFoam | yapalparvi | OpenFOAM Programming & Development | 14 | November 19, 2015 05:57 |
Field functions and table | crevoise | Siemens | 0 | March 20, 2013 11:51 |
Error trying to run steady-state sonicFoam | dancfd | OpenFOAM Running, Solving & CFD | 2 | February 12, 2013 04:15 |
Adding temperature field to InterFoam | yapalparvi | OpenFOAM Running, Solving & CFD | 8 | October 14, 2009 21:18 |