|
[Sponsors] |
Fields and mesh access from lagrangian submodel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 8, 2020, 09:47 |
Fields and mesh access from lagrangian submodel
|
#1 |
New Member
Örjan Fjällborg
Join Date: Aug 2019
Posts: 4
Rep Power: 7 |
Hi everyone!
I have big trouble with getting access to fields, for example the mass fraction Y species fields, inside a lagrangian submodel: - Code:
-> FOAM FATAL ERROR: Sum of mass fractions is zero for species 4(N2 O2 CO2 H2O) Code:
// ------------------------------------------------------------------- // Name: calculate //- Update surface reactions // Parameters: // dt (I) - timestep // Re (I) - Surface Reynolds number // (see \intermediate\parcels\Templates\ReactingHeterogeneousParcel.C) // nu (I) - Surface nu number, mus/rhos // (see \intermediate\parcels\Templates\ReactingHeterogeneousParcel.C) // celli (I) - Cell index // d (I) - Diameter [m] // T (I) - Temperature [K] // Tc (I) - Continuous phase Temperature [K] // pc (I) - Continuous phase pressure [Pa] // rhoc (I) - Continuous phase density [kg/m3] // Uc (I) - Continuous phase velocity [m/s] // mass (I) - Mass [kg] // Ysolid (I) - Mass fract. of remaining components in bed // F (I/O) - Cohesion factor 0 - 1 (summarized progress // of all reactions) // N (I) - Flux of species emitted from particle // NCpW (I/?) - Sum Ni*Cpi*Wi of emission species, not used // dMassSolid (I/O) - Solid-phase mass transfer [kg] // (Fe3O4, Fe2O3, CaCO3, CaO, Dolomite, MgO, // H2O) // dMassSRCarrier(I/O) - Carrier-phase mass transfer [kg] // (O2, H2O, CO2, N2) // Returns: Heat of reaction [J] // ------------------------------------------------------------------- template<class CloudType> Foam::scalar Foam::BEDSIMheterogeneousRate<CloudType>::calculate ( const scalar dt, const scalar Re, const scalar nu, const label celli, const scalar d, const scalar T, const scalar Tc, const scalar pc, const scalar rhoc, const vector Uc, //New Uc local gas velocity vector const scalar mass, const scalarField& YSolid, scalarField& F, const scalar N, scalar& NCpW, scalarField& dMassSolid, scalarField& dMassSRCarrier ) const { const objectRegistry& db = this->owner().db(); const volVectorField& U = db.lookupObject<volVectorField>("U"); const fvMesh& mesh = U.mesh(); autoPtr<rhoReactionThermo> pMix(rhoReactionThermo::New(mesh)); rhoReactionThermo& mix = pMix(); SLGThermo slgThermo(mesh, mix); ... } Code:
const objectRegistry& db = db(); const volVectorField& U = db().lookupObject<volVectorField>("U"); Code:
lnInclude/BEDSIMheterogeneousRate.C:549:60: error: expected primary-expression before ‘>’ token const volVectorField& U = db().lookupObject<volVectorField>("U"); /Örjan |
|
January 10, 2020, 06:36 |
|
#2 |
Member
Join Date: Sep 2010
Location: Leipzig, Germany
Posts: 96
Rep Power: 16 |
You only have direct access to fields that are defined the cloud, if you are lucky. You can try with something like
Code:
this->owner().Uc() Check your relevant ...Cloud.H in lagrangian/intermediate/clouds/Templates/...Cloud, there you will find a section with Member Functions giving you access to some fields. |
|
January 13, 2020, 02:48 |
|
#3 |
New Member
Örjan Fjällborg
Join Date: Aug 2019
Posts: 4
Rep Power: 7 |
Thanks Oswald!
I found that I actually can access the Y fields via the mesh in the lagrangian model: const fvMesh& mesh = this->owner().T().mesh(); const volScalarField& n2 = mesh.lookupObject<volScalarField>("N2"); const volScalarField& o2 = mesh.lookupObject<volScalarField>("O2"); const volScalarField& co2 = mesh.lookupObject<volScalarField>("CO2"); const volScalarField& h2o = mesh.lookupObject<volScalarField>("H2O"); const volVectorField& U = mesh.lookupObject<volVectorField>("U"); autoPtr<rhoReactionThermo> pMix(rhoReactionThermo::New(mesh)); But there is still something that is different with the mesh, because of the error when creating the thermodynamic package. I think that when the termodynamic package is created, some problem with the mesh forces basicMultiComponentMixture.C to initialize the species Y_ fields to zero! Can the mesh be checked for consistency to find out what's the problem? Best regards! /Örjan |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] SnappyHexMesh/splitMeshRegion : region1 in zone "-1" | GuiMagyar | OpenFOAM Meshing & Mesh Conversion | 3 | August 4, 2023 13:38 |
foam-extend-4.1 release | hjasak | OpenFOAM Announcements from Other Sources | 19 | July 16, 2021 06:02 |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 06:38 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
an odd(at least for me!) reconstructPar error on a field | immortality | OpenFOAM Running, Solving & CFD | 3 | June 3, 2013 23:36 |