|
[Sponsors] |
How to access the alpha.water field when coding a velocity boundary. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 27, 2017, 06:27 |
How to access the alpha.water field when coding a velocity boundary.
|
#1 |
Member
Xiantao Zhang
Join Date: Nov 2014
Posts: 31
Rep Power: 12 |
Hi all,
I am now modifying the "oscillatingFixedValue" and apply this modified boundary to the velocity field. However, in the modified boundary, I need to call the alpha.water value at the same patch. And the sentences of codes for calling alpha.water is given as follows, this->patch().template lookupPatchField<volScalarField, scalar> ( "alpha.water" ); When I compile the modified boundary, there is no error. However, when I execute the solver interFoam, the error is given as follows, /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.4.0-f0842aea0e77 Exec : interFoam Date : Apr 27 2017 Time : 01:10:38 Host : "ubuntu" PID : 18706 Case : /home/zhxt/waves2Foam/research/OEpaper1/l3m/l3mT1scalculation nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 1.64 PIMPLE: Operating solver in PISO mode Reading field p_rgh Reading field U --> FOAM FATAL ERROR: request for volScalarField alpha.water from objectRegistry region0 failed available objects of type volScalarField are 1(p_rgh) From function objectRegistry::lookupObject<Type>(const word&) const in file /home/openfoam/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 198. FOAM aborting #0 Foam::error:rintStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const& Foam:bjectRegistry::lookupObject<Foam::Geometric Field<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const at ??:? #3 Foam:amBreakInflowBoundaryFvPatchField:amBreak InflowBoundaryFvPatchField(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #4 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam:amBreakI nflowBoundaryFvPatchField>::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #5 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #6 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::readField( Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:? #7 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields(Foam::dictionary const&) at ??:? #8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields() at ??:? #9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) at ??:? #10 ? at ??:? #11 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #12 ? at ??:? Aborted (core dumped) It seems that the error is that the alpha.water is not registered. And Then I look at the creatFields.h file. The p_rgh and U field are registered. However, it seems that the alpha1 (water phase) is called using the definition : volScalarField& alpha1(mixture.alpha1()); So how should I call the alpha.water field in my modified boundary?? Any help will be greatly appreciated! Info<< "Reading field p_rgh\n" << endl; volScalarField p_rgh ( IOobject ( "p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); #include "createPhi.H" Info<< "Reading transportProperties\n" << endl; immiscibleIncompressibleTwoPhaseMixture mixture(U, phi); volScalarField& alpha1(mixture.alpha1()); volScalarField& alpha2(mixture.alpha2()); const dimensionedScalar& rho1 = mixture.rho1(); const dimensionedScalar& rho2 = mixture.rho2(); |
|
April 27, 2017, 22:06 |
|
#2 |
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 |
Hi Zhang,
it might not be registered in region0, but it needs to be in the database. Try the following: https://github.com/phicau/OLAFOAM/bl...orField.C#L352 Code:
const volScalarField& alpha = db().lookupObject<volScalarField>("alpha.water"); Best, Pablo |
|
April 27, 2017, 22:38 |
|
#3 |
Member
Xiantao Zhang
Join Date: Nov 2014
Posts: 31
Rep Power: 12 |
Hi Pablo,
Thanks for your reply. According to your suggestion, the code of calling alpha.water is modified as follows, const volScalarField& alpha = db().lookupObject<volScalarField> ("alpha.water"); const fvMesh& mesh=alpha.mesh(); const word patchName = this->patch().name(); const label patchID = mesh.boundaryMesh().findPatchID(patchName); const scalarField alphaB=alpha.boundaryField()[patchID]; Also the compilation has no problem. However, when running interFoam, the same error still exists, i.e. Create time Create mesh for time = 1.64 PIMPLE: Operating solver in PISO mode Reading field p_rgh Reading field U --> FOAM FATAL ERROR: request for volScalarField alpha.water from objectRegistry region0 failed available objects of type volScalarField are 1(p_rgh) From function objectRegistry::lookupObject<Type>(const word&) const in file /home/openfoam/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 198. FOAM aborting Do you know the reason? Many thanks Xiantao |
|
April 27, 2017, 22:58 |
|
#4 |
Member
Xiantao Zhang
Join Date: Nov 2014
Posts: 31
Rep Power: 12 |
Hi Pablo,
The problem has been solved. The problem is that I add the following code line: const volScalarField& alpha = db().lookupObject<volScalarField> ("alpha.water"); const fvMesh& mesh=alpha.mesh(); const word patchName = this->patch().name(); const label patchID = mesh.boundaryMesh().findPatchID(patchName); const scalarField alphaB=alpha.boundaryField()[patchID]; in both updateCoeff() and constructors. It seem that if I delete the above line in constructors, then there is no problems Kind Regards Xiantao |
|
December 24, 2021, 08:57 |
|
#5 |
Member
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7 |
Hello,
Although my question is not directly related to this thread, I have a question that is similar to this problem. I am trying to modify icoReactingMultiphaseInterFoam to model multicomponent evaporation in the presence of electric field. In order to solve the electrostatic equations, I need to define dielectric properties as a function of phase fractions. I am unable to access the alpha fields. Could some one direct me how to access the alpha fields in domain ? I have three phases air, water and vapour. I want to access the phase fractions of these phases. If I want to use the method stated in this thread, which file should I modify ? Thank You. -Pavithra. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 08:30 |
My radial inflow turbine | Abo Anas | CFX | 27 | May 11, 2018 02:44 |
Wrong flow in ratating domain problem | Sanyo | CFX | 17 | August 15, 2015 07:20 |
RPM in Wind Turbine | Pankaj | CFX | 9 | November 23, 2009 05:05 |