Hi Niels,
http://www.cfd-on
Hi Niels,
http://www.cfd-online.com/OpenFOAM_D...part/happy.gifhttp://www.cfd-online.com/OpenFOAM_D...part/happy.gifhttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif You see how stupid I am, as you suggested, we could use a simple code to do this work if the syntax is not available for this repeat problem. Have a nice weekend. By the way, please allow me to send my best wished to you, your family and all Foamers here. Because on Sep 14, it is Mid-autum day, which means the family get-together and have fun. Best regards, Bin |
Dear Niels and all friends her
Dear Niels and all friends here,
I am glad to tell you that I find great pleasure writing my own code now, it is near completed. Now pls allow me to ask a question: Briefly: How to get three points on the boundary? Detailed:The way to provide the three points around the circle below is right? label patchID = mesh.boundaryMesh().findPatchID("circle"); volVectorField point1=U.mesh().boundary()[patchID].[0]; volVectorField point2=U.mesh().boundary()[patchID].[1]; volVectorField point3=U.mesh().boundary()[patchID].[2]; I need your hint at his point. Best regards, Bin |
Dear all,
I know it is not
Dear all,
I know it is not good to ask so many questions. I have followed one principle "problem is important when we compile". Now please allow me to ask one more questions (till now the above question is unsolved). I am thinking... abelAs you could see: If I want to use "mesh.boundary()[circlePatchID].Sf() / mesh.boundary()[circlePatchID].magSf();", I must do: circlePatchID=Mesh().boundary().findPatchID("circl e1"); But I have 100 circles. What I am thinking is that: if I specify whatever circles I have ( circle1, circle2, ...), as long as I specify "circleSlip", they will use my own boundary. I am doing this, I hope I could find a way out this evening.Otherwise I will be sleepless. Good luck to me. Best regards, bin |
Hi Bin
Glad to hear that yo
Hi Bin
Glad to hear that you are having progress. @First post: I would do something like this, say circle1: label patchID = mesh.boundaryMesh().findPatchID("circle1"); const vectorField & pp = mesh.boundary()[patchID].Cf(); if (pp.size() >= 3) { vector p0 = pp[0]; vector p1 = pp[1]; vector p2 = pp[2]; } I have had a bad experience with the way you mentioned, as it not always points to the correct value in the memory, but returns random values, therefore the seperate vectorField for the boundary field. @second question Still I assume that you are coding this directly in the solver? So what if you where doing something like this: forAll(mesh.boundary(),patchID) { if(mesh.boundary()[patchID].type() == "circleSlip") { Do your magic... } } I am doing this away from a working OF, but it should work, as far as I recall. On the other hand, if you have made a boundary-object, then if does know which patch you are dealing with, and thus it knows exactly which points are on the present patch, i.e. circle1, circle2, etc. Good luckhttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif Niels |
Hi Niels,
You are so kind,
Hi Niels,
You are so kind, and what you said is valuable for me. I do this one step by one step, I hope I could deserve my carefulness. When I compile, I get: circleSlipFvPatchVectorField.C:156: error: 'grad' was not declared in this scope This error points to: //gradient of the above "tangential component"; vectorField GradTan= grad(phi_t); As you could see the above equation, after I get the tangential velocity phi_t, I should perform the gradient on it. I search the Doxgen online help, only to find that gradient is used for boundary normal gradient (without any input parameters). From the programmerGuide.pdf P-37, I know that we have many ways i.e. grad(chi), gGrad(phi), lsGrad(phi), snGrad(phi),snGradCorrection(phi), for vectorField, chi and phi are both ok. This is the reason why I have the above mentioned code. Hope you and any other friends could understand my situation now. Well, I benefit a lot from your suggestions and by the way from the error during compiling. Best regards, Bin |
Hello,
Can I show my think
Hello,
Can I show my thinking: 1. is it possible to use the one as the solver in the boundary condition, but not solver. Like: ------------------------- fvVectorMatrix UEqn ( n*fvc::grad(phi_t) ); solve(UEqn == (remda_+diam)/remda_*phi_t); ------------------------- 2. If there is no such function as "supposed" grad(phi_t), after I define "phi_t=phi_-n*(n & phi_)" I am struggling about this. Gook luck to me. Best regards, bin |
Sorry, the 2 method is to defi
Sorry, the 2 method is to define a self gradient for this parameter, let me work on it....
|
Dear all,
I could see that
Dear all,
I could see that fvm::grad(phi) could be used in the solver/applications. Therefore can I build a file named "tanUGrad.H" ------------------------- fvPatchTensorField tanUGrad ( IOobject ( "tanUGrad", runTime.timeName(), mesh, IOobject::NO_READ ), fvm::grad(U-(patch().Sf()/patch().magSf())*((patch().Sf()/patch().magSf()) & U)) ); tanUGrad.write(); ------------------------- Then #include "tanUGrad.H" in the solver when we want to use this boundary condition, so as to write the data "tanUGrad" in each time directory. Although this will generate the gradient of the previous, they are used for the current boundary calculation. This may generate error during the simulation. This is my stupid thinking. Welcome your comments for my current gradient function problem. Best regards, Bin |
Dear all,
I find the functi
Dear all,
I find the function of snGrad () ---------------------------------- //- Return gradient at boundary tmp<vectorfield> circleSlipFvPatchVectorField::snGrad() const { vectorField nHat=patch().nf(); vectorField pif_=this->patchInternalField(); return ( transform(I - sqr(nHat),pif_)-pif_ )*patch().deltaCoeffs(); } ------------------------------- First of all, I do not fully understand "transform(I - sqr(nHat),pif_)"; Second, after I look at the function transform(), I find what is written upbove is not right (because this function only needs one parameter input, maybe I am "wrong", welcome help); Third, one option to replace "transform(I - sqr(nHat),pif_)-pif_ " maybe "*this - patchInternalField()"; Ok, since as we could see snGrad () returns gradient at boundary. In my boundary condition "circleSlip", we can get the grad(U) only with snGrad(). But in the expression, we also know the vector "tangential velocity": tanU=U-n*(n & U). I really do not know how could I get grad(tanU) on the boundary using snGrad(). (It should return any gradient at boundary) Welcome suggestions for the syntax. Thank you. Best regards, Bin |
Hello,
I find one "possible
Hello,
I find one "possible" way to define a member function for the gradient of tangential velocity: grad(u_tangential), but still I need your suggestions if possible. In the .H file -------------------- virtual tmp<vectorfield> tanUGrad() const; -------------------- In the .C file -------------------- tmp<vectorfield> circleSlipFvPatchVectorField::tanUGrad() const { vectorField nHat=patch().nf(); iPt=this->patchInternalField()-n*(n & this->patchInternalField()); vectorField bPt=(*this)-n*(n & (*this)); vectorField iPt=(this->patchInternalField())-n*(n & (this->patchInternalField())); return ( bPt - iPt )*patch().deltaCoeffs(); } -------------------- However, it seems strange to me that when I compile, I get: -------------------- circleSlipFvPatchVectorField.C: In member function 'virtual Foam::tmp<foam::field<foam::vector<double> > > Foam::circleSlipFvPatchVectorField::tanUGrad() const': circleSlipFvPatchVectorField.C:143: error: no match for 'operator&' in '((const Foam::circleSlipFvPatchVectorField*)this)->Foam::circleSlipFvPatchVectorField::n & *(const Foam::circleSlipFvPatchVectorField*)this' /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/wordI.H:146: note: candidates are: Foam::word Foam::operator&(const Foam::word&, const Foam::word&) /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionSet.H:278: note: Foam::dimensionSet Foam::operator&(const Foam::dimensionSet&, const Foam::dimensionSet&) -------------------- You know what I do next? I think why I could not use the innerProduct function. I search the Doxgen, and find that this function is defined in "products.H", and In "FieldFieldFunctions.C". I could not solve this till now, would anybody give me a hint? Many thanks to you. Best regards, Bin |
Hi,
Let allow me to answer
Hi,
Let allow me to answer myself for this problem. In the .C file, replace "n" with "nHat". Best regards, Bin |
Dear all,
When I apply my b
Dear all,
When I apply my boundary, the simulation suddenly stops. I check the output value, and get: 1. The three point coordinates are (4.41226e-05,5.79779e-05), (4.71079e-05,6.24456e-05), (4.2272e-05,5.92143e-05); The circle center coordinate ishttp://www.cfd-online.com/OpenFOAM_D...lipart/sad.gif4.469e-05,6.083e-05)-----this is correct, I have compared with gmsh geo file The diamter of the circle is:5.81612e-06-----however, the diameter should be 5.93 micrometer (I am sure the equation to calculate diameter is right: 2*sqrt(....)). Would you mind if I ask how could I improve the accuracy for diameter??? 2. Circle surface normal unit vetor is 16 ( (7.63918e-313 1.11173e+171 1.57793e+161) (2.06999e+161 1.01199e+261 2.31634e-152) (4.90982e-311 -7.84048e-45 0) (0.831478 -0.555558 4.60283e-19) (-0.980786 -0.195085 5.31636e-19) (0.980786 -0.195085 -5.31636e-19) (-0.831478 0.555558 -1.15071e-18) (0.555558 -0.831478 6.88294e-19) (-0.980786 0.195085 5.59336e-19) (-0.555558 -0.831478 -1.25939e-18) (-0.195085 -0.980786 5.31636e-19) (0.555558 0.831478 -4.60283e-19) (0.195085 -0.980786 -5.31636e-19) (-0.195085 0.980786 5.59336e-19) (0.980786 0.195085 -5.59336e-19) (-0.555558 0.831478 1.03138e-18) ) I really do not know why the first three has so large numbers? Just for your information. Best regards, Bin |
Dear all,
The second proble
Dear all,
The second problem is solved without "reference" to the vectorField n. Now I have a severe problems, when I run my case with simpleFoam and this boundary condition is implemented. The set is the same as what I have successfully done using slip, partialSlip boundary existing in OpenFOAM 1.5. But I find from the output file that: the case just apply "circleSlip" on the first circle, it runs only at time=0, and it writes the same thing repeatedly and seems endless. My log file becomes 58.2 M at the first several runs. I really do not know why the algorithm just repeat on the first "circle1" patch, and always on the time 0 ??? If you need some more information, I would be glad to share with you. I would appreciate it if you could give me a hand. Thank you. Bin |
Hi, deal all,
In order to s
Hi, deal all,
In order to solve this problem, I copy the partialSlip directory into name-1.5/application, and change "partial" into "circle", add Make directory, in which we have the "files" and "options": In "files": circleSlipFvPatchField.C LIB = $(FOAM_USER_LIBBIN)/libcircleSlip In "options": EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = When I compile, I get: ------------------------- Making dependency list for source file circleSlipFvPatchField.C SOURCE=circleSlipFvPatchField.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/zhou/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/zhou/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/circleSlipFvPatchField.o circleSlipFvPatchField.C:42: error: redefinition of 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&)' circleSlipFvPatchField.C:42: error: 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&)' previously declared here circleSlipFvPatchField.C:56: error: redefinition of 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::circleSlipFvPatchField<type>&, const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::fvPatchFieldMapper&)' circleSlipFvPatchField.C:56: error: 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::circleSlipFvPatchField<type>&, const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::fvPatchFieldMapper&)' previously declared here circleSlipFvPatchField.C:69: error: redefinition of 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::dictionary&)' circleSlipFvPatchField.C:69: error: 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::fvPatch&, const Foam::DimensionedField<type,>&, const Foam::dictionary&)' previously declared here circleSlipFvPatchField.C:82: error: redefinition of 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::circleSlipFvPatchField<type>&)' circleSlipFvPatchField.C:82: error: 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::circleSlipFvPatchField<type>&)' previously declared here circleSlipFvPatchField.C:94: error: redefinition of 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::circleSlipFvPatchField<type>&, const Foam::DimensionedField<type,>&)' circleSlipFvPatchField.C:94: error: 'Foam::circleSlipFvPatchField<type>::circleSlipFvP atchField(const Foam::circleSlipFvPatchField<type>&, const Foam::DimensionedField<type,>&)' previously declared here circleSlipFvPatchField.C:107: error: redefinition of 'void Foam::circleSlipFvPatchField<type>::autoMap(const Foam::fvPatchFieldMapper&)' circleSlipFvPatchField.C:107: error: 'virtual void Foam::circleSlipFvPatchField<type>::autoMap(const Foam::fvPatchFieldMapper&)' previously declared here circleSlipFvPatchField.C:119: error: redefinition of 'void Foam::circleSlipFvPatchField<type>::rmap(const Foam::fvPatchField<type>&, const Foam::labelList&)' circleSlipFvPatchField.C:119: error: 'virtual void Foam::circleSlipFvPatchField<type>::rmap(const Foam::fvPatchField<type>&, const Foam::labelList&)' previously declared here circleSlipFvPatchField.C:131: error: redefinition of 'Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::snGrad() const' circleSlipFvPatchField.C:131: error: 'virtual Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::snGrad() const' previously declared here circleSlipFvPatchField.C:144: error: redefinition of 'void Foam::circleSlipFvPatchField<type>::evaluate(Foam: :Pstream::commsTypes)' circleSlipFvPatchField.C:144: error: 'virtual void Foam::circleSlipFvPatchField<type>::evaluate(Foam: :Pstream::commsTypes)' previously declared here circleSlipFvPatchField.C:164: error: redefinition of 'Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::snGradTransfor mDiag() const' circleSlipFvPatchField.C:164: error: 'virtual Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::snGradTransfor mDiag() const' previously declared here circleSlipFvPatchField.C:181: error: redefinition of 'void Foam::circleSlipFvPatchField<type>::write(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) const' circleSlipFvPatchField.C:181: error: 'virtual void Foam::circleSlipFvPatchField<type>::write(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) const' previously declared here make: *** [Make/linuxGccDPOpt/circleSlipFvPatchField.o] Error 1 ----------------------- Does anybody have experience dealing with "redefinition"? Thank you. Bin |
Hi, share with you.
Solutio
Hi, share with you.
Solution: in Make/files: replace "circleSlipFvPatchField.C" with "circleSlipFvPatchFields.C" |
Dear all,
I find it is str
Dear all,
I find it is strange, because when I use the existing partialSlip boundary file as a base, I could not use the operator "&" in vectorField iPt=(this->patchInternalField())-n*(n & (this->patchInternalField())); I get the error: ------------------------ circleSlipFvPatchField.C: In member function 'Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::tanUGrad() const [with Type = Foam::SymmTensor<double>]': circleSlipFvPatchFields.C:42: instantiated from here circleSlipFvPatchField.C:150: error: conversion from 'Foam::tmp<foam::field<foam::tensor<double> > >' to non-scalar type 'Foam::Field<foam::symmtensor<double> >' requested circleSlipFvPatchField.C: In member function 'Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::tanUGrad() const [with Type = Foam::SphericalTensor<double>]': circleSlipFvPatchFields.C:42: instantiated from here circleSlipFvPatchField.C:150: error: conversion from 'Foam::tmp<foam::field<foam::tensor<double> > >' to non-scalar type 'Foam::Field<foam::sphericaltensor<double> >' requested /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/products.H: At global scope: /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/products.H: In instantiation of 'Foam::innerProduct<foam::vector<double>, double>': circleSlipFvPatchField.C:150: instantiated from 'Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::tanUGrad() const [with Type = double]' circleSlipFvPatchFields.C:42: instantiated from here /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/products.H:100: error: no type named 'type' in 'class Foam::typeOfRank<double,>' circleSlipFvPatchField.C: In member function 'Foam::tmp<foam::field<type> > Foam::circleSlipFvPatchField<type>::tanUGrad() const [with Type = double]': circleSlipFvPatchFields.C:42: instantiated from here circleSlipFvPatchField.C:150: error: no match for 'operator&' in 'nHat2 & iPt0_' /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/wordI.H:146: note: candidates are: Foam::word Foam::operator&(const Foam::word&, const Foam::word&) /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionSet.H:278: note: Foam::dimensionSet Foam::operator&(const Foam::dimensionSet&, const Foam::dimensionSet&) /home/zhou/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/quaternionI.H:290: note: Foam::scalar Foam::operator&(const Foam::quaternion&, const Foam::quaternion&) make: *** [Make/linuxGccDPOpt/circleSlipFvPatchFields.o] Error 1 ------------------------ This time I checked very carefully, because I only add vectorField iPt=(this->patchInternalField())-n*(n & (this->patchInternalField())); where n is well defined. Is it because I miss some included files? Bin |
Here is my code:
template
Here is my code:
template<class> tmp<field<type> > circleSlipFvPatchField<type>::tanUGrad() const { vectorField nHat2=this->patch().nf(); Field<type> iPt0_=this->patchInternalField(); Field<type> iPt=iPt0_-nHat2*(nHat2 & iPt0_); return ( transform(I - sqr(nHat2),iPt)-iPt )*this->patch().deltaCoeffs(); } |
I have checked the programmerG
I have checked the programmerGuide.pdf again, I get:
The inner product of two vectors a and b is commutative and produces a scalar s = a • b where s = aibi = a1b1 + a2b2 + a3b3 Inner product in OpenFOAM could be used for rank a, b >= 1(in Math: a • b, in OpenFOAM a & b) Well, I hope I could find a solution to this soon. |
Dear all,
I am glad that I
Dear all,
I am glad that I could make my boundary condition work, but only the first step. I need your help because I have an error: --------------------------- zhou@ENERGETICSAEROSOL:~/OpenFOAM/zhou-1.5/zhou/media_sep23> simpleFoam > log_circleSlip3 & [1] 9923 zhou@ENERGETICSAEROSOL:~/OpenFOAM/zhou-1.5/zhou/media_sep23> #0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/zhou/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/home/zhou/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so" #2 Uninterpreted: [0xffffe420] #3 Foam::tmp<foam::field<foam::vector<double> > > Foam::operator*<foam::vector<double> >(Foam::tmp<foam::field<double> > const&, Foam::tmp<foam::field<foam::vector<double> > > const&) in "/home/zhou/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/simpleFoam" #4 Foam::fv::gaussConvectionScheme<foam::vector<doubl e> >::fvmDiv(Foam::GeometricField<double,> const&, Foam::GeometricField<foam::vector<double>, Foam::fvPatchField, Foam::volMesh>&) const in "/home/zhou/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libfiniteVolume.so" #5 Foam::tmp<foam::fvmatrix<foam::vector<double> > > Foam::fvm::div<foam::vector<double> >(Foam::GeometricField<double,> const&, Foam::GeometricField<foam::vector<double>, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) in "/home/zhou/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/simpleFoam" #6 Foam::tmp<foam::fvmatrix<foam::vector<double> > > Foam::fvm::div<foam::vector<double> >(Foam::GeometricField<double,> const&, Foam::GeometricField<foam::vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/home/zhou/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/simpleFoam" #7 main in "/home/zhou/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/simpleFoam" #8 __libc_start_main in "/lib/libc.so.6" #9 Foam::regIOobject::readIfModified() in "/home/zhou/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/simpleFoam" -------------------- I searched this forum, and I see that I could find one solution, but I get some "nan" values on my output files. I would appreciative if you could have some comments for this. Best regards, Bin |
Dear all,
When I run the ca
Dear all,
When I run the case with my boundary, I get: DILUPBiCG: Solving for Ux: solution singularity DILUPBiCG: Solving for Uy: solution singularity DICPCG: Solving for p: solution singularity time step continuity errors : sum local = nan, global = nan, cumulative = nan After I take a look at lduMatrixTests.C, I know that bool Foam::lduMatrix::solverPerformance::checkSingulari ty ( const scalar residual ) { if (residual > VSMALL) { singular_ = false; } else { singular_ = true; } return singular_; } void Foam::lduMatrix::solverPerformance::print() const { if (debug) { Info<< solverName_ << ": Solving for " << fieldName_; if (singular()) { Info<< ": solution singularity" << endl; } else { Info<< ", Initial residual = " << initialResidual_ << ", Final residual = " << finalResidual_ << ", No Iterations " << noIterations_ << endl; } } } But I am not sure for my problem, where is the possible cause. Thank you for your attention. Best regards, Bin |
All times are GMT -4. The time now is 16:38. |