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

this->refValue()[faceI] = ??

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By jherb
  • 1 Post By peteryuan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 30, 2014, 04:39
Question this->refValue()[faceI] = ??
  #1
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
Dear OF users,

as mentioned in my last post, I am doing a coupling between OF and another programm with pvm. http://www.cfd-online.com/Forums/ope...m-pvm-how.html
I modified the transferData() in externalCoupledTemperatureMixedFvPatchScalarField. C and readData() in externalCoupledMixedFvPatchField.C with pvm data transfer. After some debugging the code finally works. Now I face a new problem in externalCoupledMixedFvPatchField.C:

// so it receives a double temp[faceI] for example:
pvm_recv(tid, faceI);
pvm_upkdouble(&temp[faceI],1,1);
// how do I get this double temp[faceI] into refValue()[faceI] ??
this->refValue()[faceI] = ??

I was trying to send tempratures to this .so, so it is just a scalar.
I appreciate any advices.
peter
peteryuan is offline   Reply With Quote

Old   February 1, 2014, 17:42
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Peter,

I'm having a bit of difficulty understanding your question.
Because, the answer seems to be as simple as:
Code:
this->refValue()[faceI] = temp[faceI];
But I can only assume that you tried this and it didn't work?
If it didn't, then please provide more information.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 3, 2014, 12:03
Default
  #3
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
Hi Bruno, thanks for your reply!
I tried that option already - right at the beginning. But it that solution is too nice and simple to be right.
Here is the error message from wmake:
Code:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:350:33: error: no match for ‘operator=’ (operand types are 
‘Foam::Vector<double>’ and ‘double’)
         this->refValue()[faceI] = temp[faceI];
So after that I just followed my feelings and tried different things out. Nothing worked out yet. I commented out all the different things I tried in the following code.
Code:
template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::readData()
{
    // ********************************************************************* //
    // pvm part beginning...
    int tid;
    char buf[100];
    double temp[1000];
    double tempi;
    // foam::vector<double> refV(tempi, 0, 0);
    // vector<double> refV(tempi, 0, 0);
    vector<type> refV(tempi, 0, 0);
    // vector refV(tempi, 0, 0);
    // ********************************************************************* //
    // send message to xfoam:
    Info<< "lib.so::readData ==> sending message to xfoam -> \n";
    printf("lib.so::readData ==> mytid: %x\n", pvm_mytid());
    tid = pvm_gettid("xf", 0);
    if (tid<0) {
        Info<< "readData() cannot find xfoam tid!!";
        exit(FatalError);
    }
    strcpy(buf, "feed me now");
    pvm_initsend(PvmDataDefault);
    pvm_pkstr(buf);
    pvm_send(tid, 9998);
    Info<< "lib.so::readData ==> just ordered food.\n";
    // ********************************************************************* //
    // now the loop for data transfer:
    forAll(this->patch(), faceI)
    {
        pvm_recv(tid, faceI);
        pvm_upkdouble(&temp[faceI],1,1);
        tempi = temp[faceI];
        // this->refValue()[faceI] = pTraits<Type>::zero;
        // this->refValue()[faceI] = pTraits<Type>(temp[faceI]);
        this->refValue()[faceI] = pTraits<Type>(refV);
        // this->refValue()[faceI] = pTraits<scalar>::zero;
        // this->refValue()[faceI] = temp[faceI];
        // this->refValue()[faceI] = refV;
        // this->refValue()[faceI] = tempi;
        this->refGrad()[faceI] = pTraits<Type>::zero;
        this->valueFraction()[faceI] = 1;
//      is  >> this->refValue()[faceI]
//          >> this->refGrad()[faceI]
//          >> this->valueFraction()[faceI];
        Info<< "lib.so::readData ==> received data for face " << faceI << endl;
        Info<< "received value = " << temp[faceI] << endl;
        // send confirm:
        strcpy(buf, "okay from libfinite!");
        pvm_initsend(PvmDataDefault);
        pvm_pkstr(buf);
        pvm_send(tid, 2015);
    }
    // ********************************************************************* //

    initialised_ = true;
    Info<< "lib.so::readData ==> finished receiving for one step!" << endl;

    // update the value from the mixed condition
    mixedFvPatchField<Type>::evaluate();
}
Almost all errors told me that the types did not match each other. I am still learning c++ programming and openfoam source code. This problem is way beyond my level at the moment...
peteryuan is offline   Reply With Quote

Old   February 3, 2014, 12:06
Default
  #4
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
By the way, this is the only one that worked until now. But this does not help me much.

this->refValue()[faceI] = pTraits<Type>::zero;
peteryuan is offline   Reply With Quote

Old   February 3, 2014, 12:59
Default
  #5
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
The error seems to indicate that you are trying to assign a double to vector double (or vice-versa). How is temp read in and what does it contain?
mturcios777 is offline   Reply With Quote

Old   February 3, 2014, 16:41
Default
  #6
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
pvm_upkdouble(&temp[faceI],1,1);
With this function pvm would assign the unpacked double value to temp[faceI],
so temp[0], temp[1], temp[3] ... are just single double values, like 312.99
I also tried this->refValue()[faceI] = some vector double, it did not work either.
peteryuan is offline   Reply With Quote

Old   February 3, 2014, 16:51
Default
  #7
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
I figured out a real dummy solution for my problem.
I firstly use lockfile as an output file stream os:
os << temp[faceI]
then define lockfile as a input file stream is:
is >> this->refValue()[faceI]
and then os.flush()
I tested it and it worked out.

But this is really dummy. There must be a neater way.
peteryuan is offline   Reply With Quote

Old   February 3, 2014, 17:20
Default
  #8
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
[QUOTE=peteryuan;473162]
Code:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:350:33: error: no match for ‘operator=’ (operand types are 
‘Foam::Vector<double>’ and ‘double’)
         this->refValue()[faceI] = temp[faceI];
I think this error message mean you have to assign a Vector so something like
Code:
         this->refValue()[faceI] = Vector(1, 2, 3); // This is probably the wrong syntax but I hope you get the idea
So you some have to transfer three values per face from one code to the other. Or if you transfer just the magnitude of the vector and the resulting vector should be orientated normal to the patch surface you could something like this:
Code:
         this->refValue() = this->patch().nf() * temp;
This would set one value to the whole patch (temp would be one double value). If you want to assign individual values for each face you have to do something like this:
Code:
         this->refValue()[faceI] = faceINormal  * temp[faceI];
I am not sure how to get the face normal vectors, but this might help:
http://www.cfd-online.com/Forums/ope...tml#post424141
perhaps in your case:
Code:
vector faceINormal = this->patch().Sf()[facesI] / this->patch().magSf()[facesI] ;
peteryuan likes this.
jherb is offline   Reply With Quote

Old   February 3, 2014, 19:51
Default
  #9
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
Hi Joachim:
thank you so much for your help.

I added this two lins in my forAll loop:
Code:
        vector faceINormal = this->patch().Sf()[faceI] / this->patch().magSf()[faceI];
        this->refValue()[faceI] = faceINormal * temp[faceI];
Got a very familiar error:
Code:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33: error: no match for ‘operator=’ (operand types are ‘Foam::SymmTensor<double>’ and ‘Foam::Vector<double>’)
         this->refValue()[faceI] = faceINormal * temp[faceI];
Here the full error message:
Code:
[xy@fuji finiteVolume]$ wmake
SOURCE=fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/triSurface/lnInclude -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/meshTools/lnInclude -I/home/xy/pvm3/include -IlnInclude -I. -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/externalCoupledMixedFvPatchFields.o
In file included from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:349:0,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::Tensor<double>]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     tid = pvm_gettid("xf", 0);
                             ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::SymmTensor<double>]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33: error: no match for ‘operator=’ (operand types are ‘Foam::SymmTensor<double>’ and ‘Foam::Vector<double>’)
         this->refValue()[faceI] = faceINormal * temp[faceI];
                                 ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33: note: candidates are:
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SymmTensor.H:158:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/symmTensor.H:38,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/symmTensorField.H:41,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/tensorField.H:41,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SymmTensorI.H:168:13: note: void Foam::SymmTensor<Cmpt>::operator=(const Foam::SphericalTensor<Cmpt>&) [with Cmpt = double]
 inline void SymmTensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
             ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SymmTensorI.H:168:13: note:   no known conversion for argument 1 from ‘Foam::Vector<double>’ to ‘const Foam::SphericalTensor<double>&’
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/symmTensor.H:38:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/symmTensorField.H:41,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/tensorField.H:41,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SymmTensor.H:54:7: note: Foam::SymmTensor<double>& Foam::SymmTensor<double>::operator=(const Foam::SymmTensor<double>&)
 class SymmTensor
       ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SymmTensor.H:54:7: note:   no known conversion for argument 1 from ‘Foam::Vector<double>’ to ‘const Foam::SymmTensor<double>&’
In file included from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:349:0,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::SphericalTensor<double>]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     tid = pvm_gettid("xf", 0);
                             ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33: error: no match for ‘operator=’ (operand types are ‘Foam::SphericalTensor<double>’ and ‘Foam::Vector<double>’)
         this->refValue()[faceI] = faceINormal * temp[faceI];
                                 ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33: note: candidate is:
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/sphericalTensor.H:38:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/sphericalTensorField.H:39,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/tensorField.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SphericalTensor.H:52:7: note: Foam::SphericalTensor<double>& Foam::SphericalTensor<double>::operator=(const Foam::SphericalTensor<double>&)
 class SphericalTensor
       ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/SphericalTensor.H:52:7: note:   no known conversion for argument 1 from ‘Foam::Vector<double>’ to ‘const Foam::SphericalTensor<double>&’
In file included from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:349:0,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::Vector<double>]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     tid = pvm_gettid("xf", 0);
                             ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = double]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33: error: cannot convert ‘Foam::Vector<double>’ to ‘double’ in assignment
         this->refValue()[faceI] = faceINormal * temp[faceI];
                                 ^
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpaceI.H:28:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpace.H:168,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Vector.H:44,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/vector.H:39,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/point.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpaceM.H: In instantiation of ‘static void VectorSpaceOps<N, I>::eqOp(V1&, const V2&, EqOp) [with V1 = Foam::VectorSpace<Foam::Vector<Foam::Vector<double> >, Foam::Vector<double>, 3>; V2 = Foam::VectorSpace<Foam::Vector<double>, double, 3>; EqOp = Foam::eqOp<Foam::Vector<double> >; int N = 3; int I = 0]’:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpaceI.H:60:58:   required from ‘Foam::VectorSpace<Form, Cmpt, nCmpt>::VectorSpace(const Foam::VectorSpace<Form2, Cmpt2, nCmpt>&) [with Form2 = Foam::Vector<double>; Cmpt2 = double; Form = Foam::Vector<Foam::Vector<double> >; Cmpt = Foam::Vector<double>; int nCmpt = 3]’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorI.H:42:42:   required from ‘Foam::Vector<Cmpt>::Vector(const Foam::VectorSpace<Foam::Vector<Cmpt2>, Cmpt2, 3>&) [with Cmpt2 = double; Cmpt = Foam::Vector<double>]’
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:352:33:   required from ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::Tensor<double>]’
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpaceM.H:26:32: error: no match for call to ‘(Foam::eqOp<Foam::Vector<double> >) (Foam::Vector<double>&, const double&)’
         eo(vs1.v_[I], vs2.v_[I]);
                                ^
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpaceI.H:29:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/VectorSpace.H:168,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Vector.H:44,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/vector.H:39,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/point.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/ops.H:70:6: note: candidate is:
 EqOp(eq, x = y)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/ops.H:60:7: note: in definition of macro ‘EqOp’
 class opName##Op                                                            \
       ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/ops.H:64:10: note: void Foam::eqOp<T>::operator()(T&, const T&) const [with T = Foam::Vector<double>]
     void operator()(T& x, const T& y) const                                 \
          ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/ops.H:70:1: note: in expansion of macro ‘EqOp’
 EqOp(eq, x = y)
 ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/ops.H:64:10: note:   no known conversion for argument 2 from ‘const double’ to ‘const Foam::Vector<double>&’
     void operator()(T& x, const T& y) const                                 \
          ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/ops.H:70:1: note: in expansion of macro ‘EqOp’
 EqOp(eq, x = y)
 ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.dep:481: recipe for target 'Make/linux64GccDPOpt/externalCoupledMixedFvPatchFields.o' failed
make: *** [Make/linux64GccDPOpt/externalCoupledMixedFvPatchFields.o] Error 1
peteryuan is offline   Reply With Quote

Old   February 4, 2014, 04:36
Default
  #10
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Ok, could you try somethings:
I have programmed a new boundary conditions with this inheritance:
Code:
class couplingNormalInletOutletVelocityFvPatchVectorField
:
    public mixedFvPatchVectorField
In this class I use the following code (to set the boundary values to all surfaces of a patch to one value:
Code:
double refValue_ = 1.0 // here your value goes
refValue() = refValue_*patch().nf();
valueFraction() = 1.0 // use to value not the (zero) gradient
I am not sure, if you need to add this-> before the functions calls to refValue() and valueFraction().

Does this work? What is the base class of your new boundary condition? The error messages point to some tensor class.
jherb is offline   Reply With Quote

Old   February 4, 2014, 17:13
Default
  #11
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
Thanks Joachim, I will try that.
Actually I did not know how to implement a new BC. So I simply backed up the original file and modified my src directory, then recompile.
"I modified the transferData() in externalCoupledTemperatureMixedFvPatchScalarField. C and readData() in externalCoupledMixedFvPatchField.C with pvm data transfer."
But I just found some tutorials on how ot do that more "properly". I might try to move my modified classe out of src and give them another name.

Now I have another question, which is more important for me:

How can I make heat flux external coupled like I did with tempratur? There is not even a qDot file in 0 dir...

Last edited by peteryuan; February 4, 2014 at 18:31.
peteryuan is offline   Reply With Quote

Old   February 4, 2014, 17:36
Default
  #12
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
just a quick feed back:
I have not tried this with a new class.
But if I put
this->refValue() = this->patch().nf() * temp[faceI];
in my old code, which assign a single value for the whole patch, I get the following message:
error: no match for ‘operator=’ (operand types are ‘Foam::Field<Foam::Tensor<double> >’ and ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’)
this->refValue() = this->patch().nf() * temp[faceI];

Code:
[xy@fuji finiteVolume]$ wmake
SOURCE=fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/triSurface/lnInclude -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/meshTools/lnInclude -I/home/xy/pvm3/include -IlnInclude -I. -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude -I/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/externalCoupledMixedFvPatchFields.o
In file included from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:349:0,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::Tensor<double>]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     tid = pvm_gettid("xf", 0);
                             ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:353:26: error: no match for ‘operator=’ (operand types are ‘Foam::Field<Foam::Tensor<double> >’ and ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’)
         this->refValue() = this->patch().nf() * temp[faceI];
                          ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:353:26: note: candidates are:
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:360:0,
...
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note: void Foam::Field<Type>::operator=(const Foam::Field<Type>&) [with Type = Foam::Tensor<double>]
 void Foam::Field<Type>::operator=(const Field<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::Field<Foam::Tensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note: void Foam::Field<Type>::operator=(const Foam::UList<T>&) [with Type = Foam::Tensor<double>]
 void Foam::Field<Type>::operator=(const UList<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::UList<Foam::Tensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note: void Foam::Field<Type>::operator=(const Foam::SubField<Type>&) [with Type = Foam::Tensor<double>]
 void Foam::Field<Type>::operator=(const SubField<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::SubField<Foam::Tensor<double> >&’
...
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note: template<class Form, class Cmpt, int nCmpt> void Foam::Field<Type>::operator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&) [with Form = Form; Cmpt = Cmpt; int nCmpt = nCmpt; Type = Foam::Tensor<double>]
         void operator=(const VectorSpace<Form,Cmpt,nCmpt>&);
              ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note:   template argument deduction/substitution failed:
In file included from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:349:0,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:353:26: note:   ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ is not derived from ‘const Foam::VectorSpace<Form, Cmpt, nCmpt>’
         this->refValue() = this->patch().nf() * temp[faceI];
                          ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::SymmTensor<double>]’:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:40:1:   required from here
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:334:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     tid = pvm_gettid("xf", 0);
                             ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:353:26: error: no match for ‘operator=’ (operand types are ‘Foam::Field<Foam::SymmTensor<double> >’ and ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’)
         this->refValue() = this->patch().nf() * temp[faceI];
                          ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:353:26: note: candidates are:
...
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note: void Foam::Field<Type>::operator=(const Foam::Field<Type>&) [with Type = Foam::SymmTensor<double>]
 void Foam::Field<Type>::operator=(const Field<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::Field<Foam::SymmTensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note: void Foam::Field<Type>::operator=(const Foam::UList<T>&) [with Type = Foam::SymmTensor<double>]
 void Foam::Field<Type>::operator=(const UList<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::UList<Foam::SymmTensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note: void Foam::Field<Type>::operator=(const Foam::SubField<Type>&) [with Type = Foam::SymmTensor<double>]
 void Foam::Field<Type>::operator=(const SubField<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::SubField<Foam::SymmTensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:653:6: note: void Foam::Field<Type>::operator=(const Foam::tmp<Foam::Field<Type> >&) [with Type = Foam::SymmTensor<double>]
 void Foam::Field<Type>::operator=(const tmp<Field>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:653:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::tmp<Foam::Field<Foam::SymmTensor<double> > >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note: void Foam::Field<Type>::operator=(const Type&) [with Type = Foam::SymmTensor<double>]
 void Foam::Field<Type>::operator=(const Type& t)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::SymmTensor<double>&’
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/labelField.H:39:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:37,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude
...
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note: void Foam::Field<Type>::operator=(const Foam::Field<Type>&) [with Type = Foam::SphericalTensor<double>]
 void Foam::Field<Type>::operator=(const Field<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:625:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::Field<Foam::SphericalTensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note: void Foam::Field<Type>::operator=(const Foam::UList<T>&) [with Type = Foam::SphericalTensor<double>]
 void Foam::Field<Type>::operator=(const UList<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::UList<Foam::SphericalTensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note: void Foam::Field<Type>::operator=(const Foam::SubField<Type>&) [with Type = Foam::SphericalTensor<double>]
 void Foam::Field<Type>::operator=(const SubField<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:639:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::SubField<Foam::SphericalTensor<double> >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:653:6: note: void Foam::Field<Type>::operator=(const Foam::tmp<Foam::Field<Type> >&) [with Type = Foam::SphericalTensor<double>]
 void Foam::Field<Type>::operator=(const tmp<Field>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:653:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::tmp<Foam::Field<Foam::SphericalTensor<double> > >&’
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note: void Foam::Field<Type>::operator=(const Type&) [with Type = Foam::SphericalTensor<double>]
 void Foam::Field<Type>::operator=(const Type& t)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ to ‘const Foam::SphericalTensor<double>&’
In file included from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/labelField.H:39:0,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitiveFields.H:37,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/pointField.H:36,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edge.H:40,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/edgeList.H:32,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note: template<class Form, class Cmpt, int nCmpt> void Foam::Field<Type>::operator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&) [with Form = Form; Cmpt = Cmpt; int nCmpt = nCmpt; Type = Foam::SphericalTensor<double>]
         void operator=(const VectorSpace<Form,Cmpt,nCmpt>&);
              ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note:   template argument deduction/substitution failed:
In file included from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:349:0,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C:353:26: note:   ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ is not derived from ‘const Foam::VectorSpace<Form, Cmpt, nCmpt>’
         this->refValue() = this->patch().nf() * temp[faceI];
                          ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C: In instantiation of ‘void Foam::externalCoupledMixedFvPatchField<Type>::readData() [with Type = Foam::Vector<double>]’:...
Type>::operator=(const Foam::UList<T>&) [with Type = double]
 void Foam::Field<Type>::operator=(const UList<Type>& rhs)
      ^
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:646:6: note:   no known conversion for argument 1 from 
...
/primitivePatch.H:35,
                 from /home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/polyPatch.H:43,
                 from lnInclude/fvPatch.H:39,
                 from lnInclude/fvPatchField.H:47,
                 from lnInclude/mixedFvPatchField.H:75,
                 from lnInclude/mixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.C:670:6: note: void Foam::Field<Type>::operator=(const Type&) [with Type = double]
 void Foam::Field<Type>::operator=(const Type& t)
...
/externalCoupledMixedFvPatchField.H:110,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H:29,
                 from fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C:26:
/home/xy/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/Field.H:320:14: note: template<class Form, class Cmpt, int nCmpt> void Foam::Field<Type>::operator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&) [with Form = Form; Cmpt = Cmpt; int nCmpt = nCmpt; Type = double]
         void operator=(const VectorSpace<Form,Cmpt,nCmpt>&);
              ^
...
‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ is not derived from ‘const Foam::VectorSpace<Form, Cmpt, nCmpt>’
         this->refValue() = this->patch().nf() * temp[faceI];
                          ^
fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.dep:481: recipe for target 'Make/linux64GccDPOpt/externalCoupledMixedFvPatchFields.o' failed
make: *** [Make/linux64GccDPOpt/externalCoupledMixedFvPatchFields.o] Error 1
peteryuan is offline   Reply With Quote

Old   February 5, 2014, 07:37
Default
  #13
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
The boundary conditions of which field do you want to couple? Is it a tensor field? Does the coupling work for scalar fields (like p, T, ...)? Is your code based on http://foam.sourceforge.net/docs/cpp/a04346_source.html (line 391)?
jherb is offline   Reply With Quote

Old   February 5, 2014, 08:01
Default
  #14
New Member
 
Y
Join Date: Feb 2013
Location: The Earth
Posts: 25
Rep Power: 13
peteryuan is on a distinguished road
yep, the receiving data part is based on that location. The sinding out data part is based on http://foam.sourceforge.net/docs/cpp/a09284_source.html on line
226 os << magSf[faceI] << token::SPACE
...
I need openfoam to receive temprature and heat flux as boundary condition from an external programm via pvm and send magSf, qDot and htc back to the external programm.
So T is a scalar field. Heat flux is a vector field. Right?
The sending out data part works pretty good already. The receiving data part works okay for temprature with my dummy solution through is and os. (we might be able to improve that later.)
Now I still do not know how to read in heat flux as a boudary condition from the external solver.
ylborg likes this.
peteryuan is offline   Reply With Quote

Old   August 29, 2018, 14:11
Default
  #15
Senior Member
 
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 10
randolph is on a distinguished road
Hi,

I know this is an old post. But do you have any updates on how to assign the values to the refValue or refGrad in the BC file?

Thanks,
Rdf

----

So there is another way to work around the issue.
// reinitialize the refValue_ with all 1
refValue_= pTraits<Type>:ne;

and then do the operation you want

refValue_ = refValue_* YourValue;

Last edited by wyldckat; August 31, 2018 at 18:59. Reason: merged posts a few minutes apart
randolph is offline   Reply With Quote

Reply


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



All times are GMT -4. The time now is 05:54.