|
[Sponsors] |
Calculate a quantity based on another quantity solved by Openfoam. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 23, 2012, 13:26 |
Calculate a quantity based on another quantity solved by Openfoam.
|
#1 |
Senior Member
Join Date: Nov 2012
Posts: 171
Rep Power: 13 |
Dear All,
I would like to calculate and output a quantity based on a scalar and added the following lines in createFields.H: volScalarField vc ( IOobject ( "vc", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)) ); I added several lines to solve the goeverning equation to obtain the scalar fields c. I can confirm that the solutions of c is correct. However, for vc, I found that the above lines did not work at all. Does anybody know what is the problem behind it? Thank you very much. h |
|
December 23, 2012, 18:18 |
|
#3 |
Senior Member
Join Date: Nov 2012
Posts: 171
Rep Power: 13 |
Hi,
that quantity should be calculated each time step, but I found that its value always failed to be updated suing the expression. I did not figure it out about this. Thank you very much. best regards, h |
|
December 23, 2012, 18:33 |
|
#4 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18 |
Hi,
I think you can update the vc field at each time step if you add the following line in the time loop. Code:
vc = 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)); fumiya |
|
December 23, 2012, 18:42 |
|
#5 |
Senior Member
Join Date: Nov 2012
Posts: 171
Rep Power: 13 |
Hi,
Thank you very much for your suggestion. If I adopt your method, but if I still want to output this quantity, maybe I need to add the following lines in createFields.H: volScalarField vc ( IOobject ( "vc", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh ); But When I do this, compilation is successful, but when I run the code, some error information appears as follows: #0 Foam::error:rintStack(Foam::Ostream&) in "/users/abc/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64Gcc45DPOpt/lib/libOpenFOAM.so" #1 Foam::sigFpe::sigHandler(int) in "/users/abc/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64Gcc45DPOpt/lib/libOpenFOAM.so" #2 ?? in "/lib64/libc.so.6" #3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/users/abc/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64Gcc45DPOpt/lib/libOpenFOAM.so" #4 void Foam::divide<Foam::fvsPatchField>(Foam::FieldField <Foam::fvsPatchField, double>&, Foam::FieldField<Foam::fvsPatchField, double> const&, Foam::FieldField<Foam::fvsPatchField, double> const&) in "/users/abc/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64Gcc45DPOpt/lib/libcompressibleRASModels.so" #5 Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam:perator/<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&) in "/users/abc/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64Gcc45DPOpt/lib/libcompressibleRASModels.so" #6 Foam::fv::backwardDdtScheme<Foam::Vector<double> >::fvcDdtPhiCorr(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/users/abc/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64Gcc45DPOpt/lib/libfiniteVolume.so" #7 Foam::tmp<Foam::GeometricField<Foam::flux<Foam::Ve ctor<double> >::type, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::fvc::ddtPhiCorr<Foam::Vector<double> >(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::flux<Foam::Vector<doubl e> >::type, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/users/abc/OpenFOAM/abc-2.1.1/platforms/linux64Gcc45DPOpt/bin/cmcPimpleFoam" #8 main in "/users/abc/OpenFOAM/abc-2.1.1/platforms/linux64Gcc45DPOpt/bin/cmcPimpleFoam" #9 __libc_start_main in "/lib64/libc.so.6" #10 Foam::UOPstream::write(char) in "/users/abc/OpenFOAM/abc-2.1.1/platforms/linux64Gcc45DPOpt/bin/cmcPimpleFoam" Floating point exception |
|
December 23, 2012, 18:54 |
|
#6 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18 |
Hi,
How about if you use the code in your post #1 with my suggestion? In the createFields.H volScalarField vc ( IOobject ( "vc", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)) ); and in the time loop vc = 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)); Best regards, fumiya |
|
December 23, 2012, 19:00 |
|
#7 |
Senior Member
Join Date: Nov 2012
Posts: 171
Rep Power: 13 |
Hi fumiya,
I tried the method mentioned post #6, but the error info is totally the same as those in post #5. I do know why these errors appear. Do you have further suggestions? best h |
|
December 23, 2012, 19:30 |
|
#8 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18 |
Hi hz283,
I have confirmed that the scalarTransportFoam added the lines in the post #6 runs well without error. If you can post the solver and case, I think you will get further suggestions. Best regards, fumiya |
|
December 24, 2012, 08:36 |
|
#9 |
Senior Member
Join Date: Nov 2012
Posts: 171
Rep Power: 13 |
Hi fumiya,
In the createFields.H, if I use the following instead of IOobject, the code can run successfully: volScalarFields("vc", 0.1*mag(fvc::grad(c))*mag(fvc::grad(c))). This indicates that the Input/Output is not correct. But I still do not know about the cause. Merry Xmas. h |
|
December 26, 2012, 14:17 |
|
#10 | |
Senior Member
Join Date: Nov 2012
Posts: 171
Rep Power: 13 |
Quote:
If I add the following lines in createFields.H: volScalarField vc ( IOobject ( "vc", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)) ); But If I donot have the following lines in the time loop: vc = 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)); It seems that the quantity will only calculated once just in the beginning and will not be updated with the time advancement. Is my understanding correct about this? Thanks. |
||
December 27, 2012, 01:47 |
|
#11 |
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18 |
Hi hz283,
I think you are correct. We have to add the following line vc = 0.1*mag(fvc::grad(c))*mag(fvc::grad(c)); in the time loop in order to update the value vc. fumiya |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Phase Field modeling in OpenFOAM | adona058 | OpenFOAM Running, Solving & CFD | 35 | November 16, 2021 00:16 |
OpenFOAM Live USB based on openSUSE 11.1 created with SUSE Studio | alberto | OpenFOAM | 40 | May 23, 2010 16:15 |
OpenFOAM 1.5.x package - CentOS 5.3 x86_64 | linnemann | OpenFOAM Installation | 7 | July 30, 2009 03:14 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 05:56 |
64bitrhel5 OF installation instructions | mirko | OpenFOAM Installation | 2 | August 12, 2008 18:07 |