Hi all, I am trying to spec
I am trying to specify Marangoni boundary condition on the top boundary of a cavity. At first, I am trying to 'enforce' this b.c in the main code I am using (boussinesqBouyantFoam). Later, I will try to learn how to incorporate it in a new b.c library (i.e the elegant way).
The b.c is:
du/dy = (dSigma/dT)*(dT/dx)/mu
dw/dy = (dSigma/dT)*(dT/dz)/mu
where (dSigma/dT) is temperature gradient of surface tension, assumed to be constant.
The implementation is as follows:
volVectorField gradT = fvc::grad(T);
volScalarField dTdx = gradT.component(0);
volScalarField dTdy = gradT.component(1);
volScalarField dTdz = gradT.component(2);
label patchI1 = mesh.boundaryMesh().findPatchID("top");
volScalarField u = U.component(0);
volScalarField v = U.component(1);
volScalarField w = U.component(2);
fixedGradientFvPatchScalarField& bufferu = refCast<fixedgradientfvpatchscalarfield>(u.boundar yField()[patchI1]);
fixedGradientFvPatchScalarField& bufferv = refCast<fixedgradientfvpatchscalarfield>(v.boundar yField()[patchI1]);
fixedGradientFvPatchScalarField& bufferw = refCast<fixedgradientfvpatchscalarfield>(w.boundar yField()[patchI1]);
scalarField graduyTop = bufferu.snGrad();
scalarField gradwyTop = bufferw.snGrad();
fvPatchScalarField& dTdxTop = dTdx.boundaryField()[patchI1];
fvPatchScalarField& dTdzTop = dTdz.boundaryField()[patchI1];
forAll (graduyTop, faceI1)
graduyTop[faceI1] = dsigmadT.value()*dTdxTop[faceI1]/mu.value();
forAll (gradwyTop, faceI1)
gradwyTop[faceI1] = dsigmadT.value()*dTdzTop[faceI1]/mu.value();
There was no error message upon compiling. For the simulation, I used fixedGradient b.c for velocity at top surface, i.e:
gradient uniform (0 0 0);
When running the simulation, I got this error message:
--> FOAM FATAL ERROR : Attempt to cast type calculated to type fixedGradient
From function refCast<to>(From&)
in file /home/zaki/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude/typeInfo.H at line 103.
Could anyone explain and help me with this problem?
Hi Zaid, I have not really
I have not really lookked at your error - but I have implemented (and tested) a Marangoni boundary condition.
Have a look at it, maybe it serves you.
Hi Thomas, Thanks for the b
Thanks for the b.c code you provided. Sorry for not replying for long time since I've been busy with other things. Now I want to concentrate back on marangoni b.c.
I tried to compile the marangoni b.c but I got the following error:
/home/zaki/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:132 : instantiated from 'Foam::fvPatchField<type>::adddictionaryConstructo rToTable<fvpatchfieldtype>:: adddictionaryConstructorToTable(const Foam::word&) [with fvPatchFieldType = Foam::marangoniFvPatchVectorField, Type = Foam::Vector<double>]'
marangoniFvPatchVectorField.C:228: instantiated from here
/home/zaki/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:132 : error: cannot allocate an object of abstract type 'Foam::marangoniFvPatchVectorField'
marangoniFvPatchVectorField.H:51: note: since type 'Foam::marangoniFvPatchVectorField' has pure virtual functions
make: *** [Make/linux64GccDPOpt/marangoniFvPatchVectorField.o] Error 1
Could you explain what might happen?
Hi Zaki, I think that versi
I think that version I posted worked for OpenFoam-1.3.
I have a version adapted to version 1.4.1, which you are apparently using, but I have to say I right now do not remember if I tested that. I have set up an installation for 1.4.1 some time ago, compiled it, but am actually still using the 1.4 version. So, here, at your own risk, the 1.4.1 version.
Please note, that in 1.4.1 also the directory structure in fvPatchFields changed, if I remember correctly.
Hi Thomas, Thanks a lot! ht
Thanks a lot! http://www.cfd-online.com/OpenFOAM_D...part/happy.gif The compilation was successfully done. Now I'm trying to run a test case.
Hi Thomas and Zaki, Is it
Hi Thomas and Zaki,
Is it possible for one of you to upload an example solver and case file using this boundary file?
Hello FOAMers, I am havi
I am having difficulty getting the marangoni BC to operate correctly and I am hoping for a hint about what I am doing wrong.
First, I am integrating this BC into a solver which uses the conjugateHeatFoam as a template and so have two mesh regions coupled by the energy equation (the fluid portion is replaced with the mhdFoam solver).
Second, I have compiled the BC with the help of the instructions here. It compiles and apparently links correctly.
Third, I have a case file and the <case>/0/U file includes the BC as follows:
I dutifully add the line:
The solver compiles without a hitch.
However, when I run the solver, I get the following error message:
Can anyone help me with this error?
Hi Mike, The BC is looking
The BC is looking for gradT in database, so you should create it like you do for fields that are written and read from time dumps, i.e. something with IOobject.
Hi Kati, This did, indeed
This did, indeed, solve my problem. Thank you.
I'm new to OpenFOAM and C++ language.
I have a diffucult using the "MarangoniFvPatchVectorField".
Now, I am bringing this BC in solver (icoheatMaFOAM).
However, I couldn't compile the solver and getting following error message.
…/lnInclude/marangoniFvPatchVectorField.H:107: error: cannot allocate an object of abstract type ‘Foam::marangoniFvPatchVectorField’
…/lnInclude/marangoniFvPatchVectorField.H:58: note: because the following virtual functions are pure within ‘Foam::marangoniFvPatchVectorField’:
…/lnInclude/transformFvPatchField.H:109: note: Foam::tmp<Foam::fvPatchField<Type> > Foam::transformFvPatchField<Type>::clone(const Foam::DimensionedField<Type, Foam::volMesh>&) const [with Type = Foam::Vector<double>]
…/lnInclude/marangoniFvPatchVectorField.H: In member function ‘virtual Foam::tmp<Foam::fvPatchField<Foam::Vector<double> > > Foam::marangoniFvPatchVectorField::clone(const Foam::vectorField&) const’:
…/lnInclude/marangoniFvPatchVectorField.H:123: error: cannot allocate an object of abstract type ‘Foam::marangoniFvPatchVectorField’
…/lnInclude/marangoniFvPatchVectorField.H:58: note: since type ‘Foam::marangoniFvPatchVectorField’ has pure virtual functions
Could anyone help me with this error.
I have succesfully compiled the boundary condition which Thomas tehache supplied.
In the solver, I have created the gradT as an IOobject:
In the boundary conditions I wrote this:
The code compiles and runs ok. But when I execute the command foamDataToFluent (I am using Fluent as a posprocessor) I have the following warning:
Time = 0
Converting field pd
Converting field T
marangoniFvPatchVectorField::snGrad(): object gradT not found!
marangoniFvPatchVectorField::snGrad(): object gradT not found!
Converting field gradT
gradT is defined but the solver do not find it. And in the postprocessor I can see that gradT is not zero and is calculated oK.
Other problem is that the solver is not aplying this condition, i.e. although I set the marangonicoeff = 1000000, I have no difference between marangonicoeff = 0.05 or marangonicoeff = 0
Does anybody know which is the problem. May be the boundary conditions of temperature or velocity?
I have to leave now (urgent holidays...:)) ... but promise to post next week the version I am currently using with OpenFoam 1.6.x, where the value field is beeing written, and which needed changes to work with 1.6.x.
I updated the boundary condition a little (its now writing also its value, was missing before..), and its working for me now with 1.6.x.
As the testcase was too large to upload here, please find it (and the B.C.) at the links given below.
Under the link named MarangoniTest I add a small testcase. Gravity is set to 0, Marangoni-Number is small in order to obtain a stationary and axisymmetric solution (although calculation is 3D), which I have compared to results from our own 2D-Code Crysmas, and with Fluent, results are (within some percent, did not check grid dependence..) the same.
Therefore, I personally trust it, but dont give any guarantee :)
I have run the testcase using a slightly modified buoyantBoussinesqSimpleFoam:
add this to createFields to store temperature gradients:
Info<< "Generating/reading field gradT\n" << endl;
and add this in the solver code:
specify the B.C. in U as follows:
the marangonicoeff to specifiy is the usual marangonicoefficient (d sigma/dT) divided by DYNAMIC viscosity!
Thank you very much, tehache. Now my problem works Ok.
i am trying to simulate selective laser sintering process with marangoni stress function wrt time as a boundary condition can u suggest me where i can apply this condition. i am using fluent as my solver and if udf is required can somebody help me with that..
returning gradient at the boundary
I have gone through the marangoniFvPatchVectorField.C file and I have difficulty in understanding parts of the code as I'm not very good at C++ and am new to OpenFOAM
what do the following lines of the code mean?
Thanks in advance.
Hi sherlock (and others),
As I am getting a lot of private messages regarding the Marangoni B.C.:
I posted this thing 4 years ago just as an example of how I tried to solve the problem, not as something I would consider a good programming example.
It worked for me, and some others, in OpenFoam 1.6, since then, I have not touched it, and actually dont really remember what I did and why.
Perhaps I should not have posted it.
As far as I remember, the transform you are asking for gives the projection of the patch internal vector field onto the patch plane, I think you can figure that out looking at the implementation of the base class, transformFvPatchVectorField.
Thank you. I shall have a look at the base class to try and understand this better.
I have a 2 questions.
Firstly, I have a doubt in the volVectorField definition of gradT. Why is it READ_IF_PRESENT? I'm not able to view the test case attached and so i'm not able to have a look into the 0/gradT file.
Second, if the internal and boundary fields are at constant temperature initially, won't gradT have the same value at all points?
Kindly excuse me if the questions are too naive. I have just started with OpenFOAM.
|All times are GMT -4. The time now is 01:24.|