Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. 如何在src文件中创建标量物理filed并且调用

如何在src文件中创建标量物理filed并且调用

已定时 已固定 已锁定 已移动 OpenFOAM
27 帖子 3 发布者 17.4k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • chengan.wangC 离线
    chengan.wangC 离线
    chengan.wang
    在 中回复了 李东岳 最后由 编辑
    #21

    @李东岳 还是不行

    lnInclude/ParticleCollector.C: In member function ‘virtual void Foam::ParticleCollector<CloudType>::postMove(Foam::ParticleCollector<CloudType>::parcelType&, Foam::label, Foam::scalar, const point&, bool&)’:
    lnInclude/ParticleCollector.C:746:43: error: ‘const InternalField {aka const class Foam::Field<double>}’ has no member named ‘ref’
         scalar& PPC = summass.internalField().ref() [cellIp]; 
                                               ^
    lnInclude/ParticleCollector.C: In member function ‘virtual void Foam::ParticleCollector<CloudType>::postMove(Foam::ParticleCollector<CloudType>::parcelType&, Foam::label, Foam::scalar, const point&, bool&)’:
    lnInclude/ParticleCollector.C:746:43: error: ‘const InternalField {aka const class Foam::Field<double>}’ has no member named ‘ref’
         scalar& PPC = summass.internalField().ref() [cellIp]; 
    
    1 条回复 最后回复
  • 李东岳李 离线
    李东岳李 离线
    李东岳 管理员
    写于 最后由 编辑
    #22

    你不声明PPC,直接用summass呢?

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    chengan.wangC 1 条回复 最后回复
  • chengan.wangC 离线
    chengan.wangC 离线
    chengan.wang
    在 中回复了 李东岳 最后由 编辑
    #23

    @李东岳 李老师,还是不行

        const volScalarField& summass = p.mesh().objectRegistry::lookupObject<volScalarField>("summass");
        const label cellIp = p.cell();  
        summass.internalField() [cellIp] += p.nParticle()*p.mass();
    

    编译出错

    lnInclude/ParticleCollector.C:749:38: error: assignment of read-only location ‘(&(& summass)->Foam::GeometricField<Type, PatchField, GeoMesh>::internalField<double, Foam::fvPatchField, Foam::volMesh>())->Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[]<double>(((Foam::label)cellIp))’
         summass.internalField() [cellIp] += p.nParticle()*p.mass();
                                          ^
    lnInclude/ParticleCollector.C: In instantiation of ‘void Foam::ParticleCollector<CloudType>::postMove(Foam::ParticleCollector<CloudType>::parcelType&, Foam::label, Foam::scalar, const point&, bool&) [with CloudType = Foam::KinematicCloud<Foam::Cloud<Foam::CollidingParcel<Foam::KinematicParcel<Foam::particle> > > >; Foam::ParticleCollector<CloudType>::parcelType = Foam::CollidingParcel<Foam::KinematicParcel<Foam::particle> >; Foam::label = int; Foam::scalar = double; Foam::point = Foam::Vector<double>]’:
    parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C:53:1:   required from here
    lnInclude/ParticleCollector.C:749:38: error: assignment of read-only location ‘(&(& summass)->Foam::GeometricField<Type, PatchField, GeoMesh>::internalField<double, Foam::fvPatchField, Foam::volMesh>())->Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[]<double>(((Foam::label)cellIp))’
         summass.internalField() [cellIp] += p.nParticle()*p.mass();
    
    
    1 条回复 最后回复
  • 李东岳李 离线
    李东岳李 离线
    李东岳 管理员
    写于 最后由 编辑
    #24

    volScalarField& summass = p.mesh().objectRegistry::lookupObjectRef<volScalarField>("summass");

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    chengan.wangC 1 条回复 最后回复
  • chengan.wangC 离线
    chengan.wangC 离线
    chengan.wang
    在 中回复了 李东岳 最后由 编辑
    #25

    @李东岳 李老师,这句命令

    volScalarField& summass = p.mesh().objectRegistry::lookupObjectRef<volScalarField>("summass");
    

    又报错了

    lnInclude/ParticleCollector.C:745:71: error: ‘class Foam::objectRegistry’ has no member named ‘lookupObjectRef’
         volScalarField& summass = p.mesh().objectRegistry::lookupObjectRef<volScalarField>("summass");
    
    
    1 条回复 最后回复
  • 李东岳李 离线
    李东岳李 离线
    李东岳 管理员
    写于 最后由 编辑
    #26

    2.4版本太老了,你试下这个

    volScalarField& summass = const_cast<voScalarField&>(p.mesh().objectRegistry::lookupObject<volScalarField>("summass"));
    

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    chengan.wangC 1 条回复 最后回复
  • chengan.wangC 离线
    chengan.wangC 离线
    chengan.wang
    在 中回复了 李东岳 最后由 编辑
    #27

    @李东岳 非常感谢李老师,终于搞定,能输出数据了,但还需要进一步验证是否正确。差点放弃想升级新版本of。

        volScalarField& summass = const_cast<volScalarField&>(p.mesh().objectRegistry::lookupObject<volScalarField>("summass")); 
        const label cellIp = p.cell();  
        scalar& PPC = summass.internalField() [cellIp]; 
        PPC += p.nParticle()*p.mass();
    

    希望对以后需要的朋友有点借鉴作用。特别感谢 @星星星星晴 不厌其烦的解答:146:

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]