CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

SRF pointer usage

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 24, 2012, 11:10
Default SRF pointer usage
  #1
otm
New Member
 
Join Date: Jun 2009
Posts: 22
Rep Power: 16
otm is on a distinguished road
Hello!

I'm trying to modify the settlingFoam solver so that it can be used within a rotating frame of reference. I have more or less tried to copy what is done in the SRFPimpleFoam solver. However, some additional modifications are necessary also in e.g. the drift velocity definitions and in the calculation of the hydrostatic pressure. And this is where I run into problems (related to my very limited C++ experience).

I tried to modify the drift velocity so that it reads:
Code:
 
    Vdj = mag(V0)*(SRF->Fcentrifugal())/mag(g)*
    (
        exp(-a*max(alpha - alphaMin, scalar(0)))
      - exp(-a1*max(alpha - alphaMin, scalar(0)))
    );
But that gives me the compilation error:
Code:
 
calcVdj.H:7: error: no match for ?operator*? in ?Foam::operator/(const Foam::tmp<Foam::DimensionedField<Type, GeoMesh> >&, const Foam::dimensioned<double>&) [with Type = Foam::Vector<double>, GeoMesh = Foam::volMesh](((const Foam::dimensioned<double>&)((const Foam::dimensioned<double>*)(& Foam::mag(const Foam::dimensioned<Type>&) [with Type = Foam::Vector<double>]())))) * Foam::operator-(const Foam::tmp<Foam::GeometricField<TypeR, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type1, PatchField, GeoMesh> >&) [with Type1 = double, Type2 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >*)(& Foam::exp(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&) [with PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]()))))?
In other places of the code I get similar errors when I try to form,
Code:
)mag(SRF->Fcentrifugal())
I'm obviuosly using SRF->Fcentrifugal() in the wrong way. But how should I write to make the code do what I want it to do??

BR
Olle
otm is offline   Reply With Quote

Old   January 25, 2012, 08:55
Default
  #2
otm
New Member
 
Join Date: Jun 2009
Posts: 22
Rep Power: 16
otm is on a distinguished road
Hello again!

Still trying to understand/solve this problem.

I think the problem could be related to types being incompatible.

The member function returning the centrifugal force is defined in SRFModel.C as a DimensionedField<vector, volMesh>, see below:

Code:
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
Foam::SRF::SRFModel::Fcentrifugal() const
{
   return tmp<DimensionedField<vector, volMesh> >
   (
       new DimensionedField<vector, volMesh>
       (
           IOobject
           (
               "Fcentrifugal",
               mesh_.time().timeName(),
               mesh_,
               IOobject::NO_READ,
               IOobject::NO_WRITE
           ),
           omega_ ^ (omega_ ^ mesh_.C())
       )
   );
}
My problems occur when I try to use this DimensionedField to calculate something of type volScalarField or volVectorField.

The DimensionedField can be used as a term in the momentum equations (see e.g. UrelEqn.H in SRFPimpleFoam) but it seems not to be possible to use it in algebraic expressions used to define a volScalarField or volVectorField.

If someone with deeper knowledge cold tell me how to resolve this problem I would be very grateful.

BR
Olle
otm is offline   Reply With Quote

Old   January 25, 2012, 10:01
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
The DimensionedField is only defined over the internal field. A GeometricField is defined over the internal field and the boundary surfaces. It's a little like trying to add a vector and a scalar... one has three values, the other has only one... how do you want me to add them?

So you need to decide what happens on the boundary field. If nothing happens, you can define your algebraic exrpession in terms of the internal field only:

Code:
// U is a volVectorField
    U.dimensionedField() = srfModel.FCentrifugal() / mass * ... etc.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Reply

Tags
pointers, settlingfoam, srf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent- Error: Null Domain Pointer Mary FLUENT 12 February 28, 2020 10:44
FloWorks and CPU usage? cvp_dk FloEFD, FloWorks & FloTHERM 6 June 20, 2011 08:57
OpenFOAM Solver/BC usage description murrayjc OpenFOAM 3 August 25, 2009 04:48
thread pointer comparison crash in Fluent UDF Miriam Main CFD Forum 0 August 31, 2008 16:40
pointer 'p' in UDF Umesh Shah FLUENT 8 June 20, 2003 08:36


All times are GMT -4. The time now is 07:30.