CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Dynamic mesh & Negative volume in 3D (https://www.cfd-online.com/Forums/fluent/68930-dynamic-mesh-negative-volume-3d.html)

mahzironrazak October 6, 2009 15:15

Dynamic mesh & Negative volume in 3D
 
Hi All :)

I am trying to simulate 3D flapping wing using fluent and i keep getting negative volume when i run the mesh motion. I used smoothing and remeshing. I have reduce the time step and still it didnt work. I also changed the remeshing parameters but no go. I read that for dynamic mesh "the translation in one time step should not be more than half the cell size adjacent to the moving boundary". what does that means? How can i get the cell size adjacent to the moving boundary? By the way how do i determine the correct value for dynamic mesh parameters :


1) Minimum length scale
2) Maximum length scale
3) Adjacent zone cell height

I used the data from mesh scale info (button)

Will increasing the density of the grid reduces the possibility of getting negative volume.

cheers

herntan October 6, 2009 22:46

I think the Fluent guide also suggest you using the data from mesh scale info.

The Adjacent zone cell height should be the value of ur meshing size.
I not familiar with remeshing. But for layering, it means the meshing layer size.
For example i mesh the volume with 0.5mm mesh size, i will put either 0.5mm or smaller for Adjacent zone cell height.

mahzironrazak October 7, 2009 04:35

Hi Herntan

Thanks for the info. I should try it.

DarrenC March 4, 2010 03:18

Hi Mazhironrazak,

Have you managed to get this to work yet? I am doing something similar as you but it always displayes negative cells after 7 iterations

Cheers,
Darren

mrestrepo30 March 4, 2010 13:33

First of all what type of mesh do you have? structured or unstructured? depending on that you have to set up the smoothing and remeshing parameters (remeshing doesn't work for structured 3D).

How are you defining you dynamic mesh zones? because if you are displacing the wing, you need to set the adjacent zones to deforming so they can move along.

Basically what happens, is that you cannot move your boundary more than half the size of the cell next to the moving boundary. To correct this you can decrease the time step size so the displacements are smaller and you don' get negative volumes. To get the cell size next to the boundary, one thing you could do is load your mesh to a software package such as Tecplot, and there measure your cell size and then compare it to your displacement. However I think you can play around with the time step size first.

The values for the dynamic mesh parameters are obtained from the mesh scale info for each zone.

Finally, increasing the density of the grid will indeed increase the posibility of getting negative volumes if you don't change your time step size.

meb March 5, 2010 12:02

Take a look here: http://www.cfd-online.com/Forums/ope...nts-shape.html

I'm trying to solve the same problem using RBF http://www.rbf-morph.com/.

I can try to set-up the problem for your geometry...

DarrenC March 7, 2010 19:35

Hi there mrestrepo30 & meb

Thanks for your replies. My mesh is a Hybrid structured/unstructured mesh. Its a 3D extruded NACA0012 airfoil with structured (hex) elements for the boundary layer and unstructured (tri/tetra) elements on the rest of the farfield. Both mesh are joined together on an interface interior wall using pyramid elements.

As far as dynamic meshing is concerned, I use smoothing and remeshing. I set the structured mesh volume and its surrounding surface meshes to move with the airfoil (pitch up motion at quarter chord) ) so no remeshing will be done on them.

As for the remeshing/smoothing parameters, I am actually using grid default values for remeshing except I change remesh interval from 5 to 1. For smoothing, I use 0 for my spring constant, 0.001 for convergence tol, and 50 for no. of iterations.

I basically got these values from the same kind of simulation I did in 2D.

From what I can see, from tagging the negative volume elements after the dynamic meshing failed, all of the negative volumes were on the pyramid elements on the trailing edge of the wing. Ive tried to half my time step but it is still happening. Perhaps ill try something even smaller.

The other thing I am not sure about is if remeshing actually works on pyramid elements. Anyone have any idea?

MEB, your project looks very interesting. You mentioned that there is an addon for Fluent. I currently use a Fluent educational license from my uni. Is it possible to obtain the addon just with the educational license itself, or do I have to obtain a separate one? I would really like to investigate the potential of your project.

Thanks again for the help

Regards,
Darren

meb March 8, 2010 04:02

you can do it with RBF Morph
 
Darren,
you can definitely do the job with RBF Morph. Contact info@rbf-morph.com for details about an extended trial (usually it's 30 days but we can release a 90 days free license for Universities).
A similar problem has been faced in the past for a very complex geometry (take a look to attached image). Using RBF Morph smoothing only you can rotate the rear flap in the range +/- 6deg (that becomes +/-8deg if you enable also the remeshing).
http://www.rbf-morph.com/images/rnd_...rph-fw-200.gif
Meanwhile if you can send the Fluent case and the desired flapping motion I will post a preview of RBF Morph results in this thread.

MEB

mrestrepo30 March 8, 2010 11:35

Darren,

I think remeshing works on unstructured mesh, however I've found that the effect of smoothing is more significant than that of remeshing.

What you can do is play around with the spring constant (I usually use 0.5). Also check that the adjacent zones to the deforming zone are set as "deforming" so that the dynamic mesh parameters can be implemented on them, and change the zone parameters for each zone so that both the smoothing and remeshing work better.

Also type on the main screen:
/define/models/dynamic-mesh-controls/smoothing-parameter> soas
spring-based smoothing for all cell types [no] yes

and here you can activate the spring on all the elements, and this will make the smoothing work on your grid.

Hope that works!

DarrenC March 8, 2010 18:39

Hi mrestrepo30,

As my airfoil movement is very large (14 degree pitch at the quarter chord) I dont think smoothing will heavily influence my mesh. Probably only at the initial pitch as Fluent UG states that smoothing is only good at small movements if used alone.

Another thing I have found out is that remeshing only work on tri/tetra elements and that is where my problem is, as I have pyramid elements on my unstructured mesh.

I will continue to try and play around with the remeshing/smoothing parameter and see what happens but I doubt it will change much as remeshing is not supported for pyramid elements.

As for MEB, thanks for your reply. Do you have an email account that I can send my case file to you? Thanks.

Regards,
Chin Kiat See

meb March 9, 2010 04:41

smoothing and remeshing
 
Yes remeshing can be enabled only on tetra; however even for hybrid mesh (prisms layers+hexcore+tetra transition) some remeshing can be beneficial to fix some distorted cells that usually are in the transition layer.
The spring model that comes with fluent is very fast but has poor performances. I did a benchmark for a cube (the same used in this tutorial http://www.rbf-morph.com/index.php/tutorial/tutorial1, in the case of 1m translation) obtaining similar results using RBF and pseudosolid with a mesh quality loss that was about 50% lower with respect to fluent spring model.

enry July 19, 2010 06:33

Hi DarrenC.
How do u solve your problem? I'm studying a vertical axis wind turbine, and I have to move a little the blades of my turbine. I can move them without any problem with 2D mesh. When I try to move the blades with a 3D mesh, I have negative volume. How do you solve your problem? It seems that spring constant factor don't work well in 3D model. What do u think?
Thanks in advance.

DarrenC July 19, 2010 19:55

Hi enry,

Try doing a plot of where the negative volumes are. There is a function in Fluent (i think its called iso-value) that will allow you to do this. For me it was between the volume mesh and the end surface mesh in the spanwise directions. I found out that I was not remeshing the surface of this mesh and only its volume, hence I was getting negative volumes after a certain amount of pitch. So you'll probably need to set both the end surfaces to dynamic meshing as well. Hope this helps

Cheers
Darren

enry July 20, 2010 02:34

Hi DarrenC, thanks a lot for your reply.
I tried , as exercise, to build a box and I tried to move the "floor" of the box. The problem is that the mesh inside the box don't move, and so when the "floor" go up, fluent give me negative volume. How should I set the moving condition? I want to use only a spring based movement, without remeshing, because the movement is quite small.
I tried as follows:
-UDF for the "floor"
-DEFORMING for the interior fluid


Should I set some condition on the lateral face?
Thanks in advance.

enry July 20, 2010 03:14

I found an error; moving mesh don't work with "cooper" gambit scheme; i tried to mesh the end of box with tri-elements, and mesh the entire box as "cooper", but fluent can't move as spring based the domain.
If I mesh the lateral face as tri-map-split, up and down as tri-elements, and the volume as Tet-Hybrid-tgri, mesh motion work well.
How can I use mesh motion with cooper scheme?
Thanks a lot!!!
ps. I use gambit to build my mesh.

DarrenC July 20, 2010 03:15

I think what you would need here is face deformation of the four vertical faces of your box. Then you would need volume deformation as you have done. Your roof shoud be rigid bodies and you floor should be rigid body with a prescribed motion which you will use udf to define. Hope this helps

DarrenC July 20, 2010 03:28

Im afraid i wont be able to help you as I dont use the cooper mesh at all. In fact I only use ICEM to build all my meshes.

Cheers,
Darren

enry July 20, 2010 04:18

Ok, don't worry.
Thanks ;)

enry July 20, 2010 09:31

I solved the problem. In case somebody is interested:
-UDF for the moving surface
-DEFORMING with re-meshing for fluid around moving surface
-DEFORMING with re-meshing for surface that is moving with fluid (i.e. re-meshing for surface that will be deformed because of moving surface)
-spring constant factor 0
-boundary node relaxation 1
-if there is a boundary layer, define a fluid-zone for the boundary layer, mesh it with map scheme, and in FLUENT define that fluid-zone as DEFORMING without re-meshing
-enable spring-on-all-shapes through the following command line: define models dynamic-mesh-controls smoothing-parameter spring-on-all-shapes yes

Bye. :cool:

almostafa67 August 5, 2010 09:58

update-dynamic-mesh failed. negative cell volume detected.
 
hi dear all...
i have this problem as you;i changed time step from 0.0001 to 0.00001 but again this message(update-dynamic-mesh failed. negative cell volume detected.) showed up,could u help me out plz?
thank u in advance for any help provided:)

enry August 5, 2010 12:47

Hi, give me some information about your problem. Do you have Boundary layer? Is you problem 3d? If yes, have you enabled deforming with remeshing for fluid around moving face and for face delimiting the volume of fluid that is moving?

akash.iitb August 24, 2010 13:09

Help on my dynamic mesh simplified problem
 
1 Attachment(s)
Hi enry,

I read your problem and the way you have solved. I have a similar problem on using dynamic mesh for moving solid-fluid interface. (negative cell volume after some time steps). I have also meshed my volume using cooper scheme. I have posted my problem yesterday on another thread as given below (image is also attached)-

can you please help me out on what things i need to setup for moving the interface successfully.

also, i am not worked with UDFs before so can you please share your UDF is possible here. I used the define_geom macro but i am not sure on that.

Many thanks,
akash



************************************************** ********
[IMG]file:///C:/Users/jasonhzy/AppData/Local/Temp/moz-screenshot.png[/IMG]Hi,

I am trying to apply dynamic mesh in Fluent for the first time thereby seeking help.

Project - The overall problem concerns multiphase wax deposition modeling in subsea pipeline where the pipe diameter shrinks because of wax clogging. This is oil and gas company project.

Background - Hence, as a basic preliminary model consisting of single phase, it consists of a fluid and solid region , solid being the wall + wax deposit, I have developed a small computational domain where i have incorporated hydrodynamics, heat and species transport.

Current problem help - I want to move the solid-liquid interface at some specific rate (for the simplest model case say by 10 mm in all in 500 time steps - my geometry domain height is 40 mm). So, how should i set up my dynamic mesh for moving this solid-fluid interface?

My attempt -
I created a pretty simple UDF which asks to move the solid-fluid interface y position by 0.5 mm each time step. I applied the deforming dynamic mesh zone to interface using layering scheme. Length scales were chosen equal to half the adjacent cell sizes ( 0.5 mm on fluid and 0.1 mm on solid zone side)
But as i progress through 20 odd time steps (0.0005 second per step), i get the negative cell volume error. I see from the mesh that once my interface cells reach the first fluid zone cell, the program gives negative cell volume error. I believe there is something fundamentally wrong - probably in UDF itself or dynamic mesh setup. So, please help. I have not worked with UDFs before.

Based on what little i know and what i have tried, these are some queries -

  • What kind of dynamic mesh UDF should i write for deforming interface - CG motion , grid motion, geom ? Can someone please share a similar UDF if possible to help me start.
  • I have read that for linear moving boundary, layering scheme is applicable. What other options - remeshing and smoothing should i use?
  • Any recommended settings for shrink factor, collapse factor, minimum and maximum length scales?
I have seen quite a lot of people have already worked on dynamic mesh in this forum and hence they know a lot to help me solve this simple problem. I will really appreciate the help.

enry August 25, 2010 10:39

Hi Akash, here is UDF. It should work well, control if I forget some initialization:

#include"udf.h"
DEFINE_GRID_MOTION(delta,domain,dt,time,dtime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real delta;
real NV_VEC(axis);

NV_D(axis, =, 0.0, 1.0, 0.0); /* y vector */

begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if the current node has not been previously
visited when looping through previous faces */
if ( NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it's not updated more than once */
NODE_POS_UPDATED(v);
delta = your value ;
NV_V_VS(NODE_COORD(v), =, NODE_COORD(v), +, axis,*,delta);


}
}
}
end_f_loop(f,tf);
}



Try with the following set-up:

-build and load UDF as COMPILED;
-verify the absence of errors.

As command line (or GUI):
-define models steady yes
-define models dynamic-mesh-controls remeshing yes
-
define models dynamic-mesh-controls smoothing-parameter spring-on-all-shapes yes
-define models dynamic-mesh-controls smoothing-parameter constant-factor 0
-define models dynamic-mesh-controls smoothing-parameter bnd-node-relaxation 1
-define models dynamic-mesh-controls smoothing-parameter max-iter 500
-define models dynamic-mesh-controls smoothing-parameter convergence-tolerance 0.0001


For the dynamic zone, try:
- UDF for moving surface
- DEFORMING for fluid around it with SMOOTHING,and trying also with REMESHING (or not, try...)
- DEFORMING for lateral fluid faces (with smoothing and remeshing)


Try and tell me if it works.Bye.

akash.iitb August 25, 2010 11:21

hey Enry,

Thanks a lot for your reply. Before getting your reply, I was able to correct the error in my simulation using a different approach but I want to ask if i am doing right. Earlier , I was using a DEFINE_GEOM macro and then i switched to CG_MOTION macro. The negative cell volume error disappeared and mesh seem to work fine.

But, I am not very clear on the fundamental differences of these macros. And probably they don't matter in this simplest case of moving the planar interface with a given rate.

The UDF you have sent seems more practical when i work on the actual complex geometry. In my actual problem, each of the nodes of the interface is moving with a different rate (solidification at different rate at different places in the pipe wall). I will try to solve my simplified problem again using the UDF by you and post the results.

Please tell me if i am not wrong that CG_MOTION macro cannot be applied in that case and GRID_MOTION macro as given by you is much more suitable.

One more thing, can you please tell me how to extract some variables from a case file and write to a output file. Also, how can i read some parameters into a case file.

Many thanks,

Akash

enry August 26, 2010 07:33

Hi Akash, I used DEFINE_GRID_MOTION because my delta depends on geometry position, and so geometry movement is not a CG translation. I think that CG_MOTION macro work well and simpler if you have only to translate CG interface. In UDF I posted there isn't the dependence on time, but if you want you can move the interface depending on dt (dt is simply an available variable... however take a look on UDF manual, there is some examples) , and also move the interface depending on position of the interface itself.



About your questions: form .cas file you can only read all the variable at the last time step ( or iteration if steady simulation). It depends on what variable do you need. For example all the force could be written through GUI.
What do you mean saying: Also, how can i read some parameters into a case file. ?

Regards.
Herman.

akash.iitb August 26, 2010 11:37

Hello Enry,

thank you for your reply. The UDF you posted for grid motion worked nicely for moving my interface in planar motion. I used delta value of 0.00001 per time step to specify the y-velocity.

now, i have achieved that, i want to exactly do what you have mentioned in your last reply. I want to specify y-velocity of interface which is dependent of the coordinate of the interface and this function applies for certain time. in brief, my function is

Vy = -a*Z*(Z-0.48) for t < 5seconds


where Z is the length coordinate of the interface and a is a constant value.

can you please tell me how to specify that in the grid motion UDF.

Also, regarding my question accessing the variables, I want to access the species transport flux coming to the interface and output it to output window as well as write it to a separate text file. (later on , this interface flux will act as an input for another UDF.) Will DEFINE_RW_FILE do that and how? I am not able to find the access variable for mass transport flux for a particular species.

thank you,

akash

akash.iitb August 29, 2010 12:25

1 Attachment(s)
Hello Enry,

I tried to implement the velocity function as mentioned in my earlier mail. I was able to move the interface but there were some problems with the remeshing. I am attaching the image for your reference.

As you can see, when i move the interface, the cells on the solid side get separated from the interface with each advancement of time step. There is proper remeshing on the fluid side as interface moves upwards. Can you please look at it and let me know what is wrong?

Other parameters -

Interface & Interface Shadow - UDF applied with Fluid side cell size 0.001 m and solid side cell size 0.00025 m (half of mesh cell element sizes on each side)

Layering with ratio as well as height based method tried

Smoothing enabled -default options

Re meshing enabled - tried with and without sizing function

Below is the UDF used - (basically a slight modified version of yours one)

#include"udf.h"
DEFINE_GRID_MOTION(planemove5,domain,dt,time,dtime )
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real a;
real NV_VEC(axis),NV_VEC(dv);
int n;

NV_D(axis, =, 0.0, 1.0, 0.0); /* y vector */

begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if the current node has not been previously
visited when looping through previous faces */
if ( NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it's not updated more than once */
NODE_POS_UPDATED(v);
a = -.000173611;
dv[1] = a*NODE_Z(v)*(NODE_Z(v) - 0.48);
NV_V(NODE_COORD(v), +=, dv);
}
}
}
end_f_loop(f,tf);
}


Appreciate your help.
thanks a lot,
Akash

mrestrepo30 August 29, 2010 17:51

You can also play around with the dynamic mesh parameters to see if that gives you a better result. And if this doesn't work reduce even more your time step.

akash.iitb August 29, 2010 17:55

Hello mrestrepo30,

Thank you for your reply. Well, i tried changing various dynamic mesh parameters as well as changing time step from 0.01 to 0.002 but all of these modifications didnt help in the shown mesh movement.

Since, i am applying the node movement to only the nodes of the interface and not the cells connected, is this causing a problem for splitting the solid domain cells. I am not very clear on the dynamics layering approach. Somehow, the cells dont split when the interface move upwards.

Looking forward for your comment and suggestion on this.

akash

mrestrepo30 August 30, 2010 08:36

I am also applying node displacement to certain zones using a UDF. Then what I do is that I set up the rest of the zones as "Deforming" in the dynamic mesh zones. Are you also doing this?

enry August 30, 2010 13:25

Hi akash, sorry for my delay. Have u you solved your problem?
As I can understand from your picture, you have 2 different meshed zone, one fluid and one solid, isn't it? If it's true, you have to disable re-meshing on the "fluid" adjacent the moving interface, and enable re-meshing on the "fluid" connected to the fluid adjacent to the moving interface.

For example, if you have a simple oscillating airfoil with boundary layer, you have to create a zone fluid for the boundary layer and apply the re-meshing to all fluid except the boundary layer ( fluid connected to the moving surface).

You have to follow the same instruction for the surface surrounding the fluid.

I hope that my advice can help you.
Bye.
Enry.

akash.iitb August 30, 2010 17:43

Hello Enry,

Thank you very much for your reply. The help and suggestion from you until now have been very valuable for me in approaching my problem.

I have not been able to still solve the meshing problem. You are correct in interpreting the image - the bottom one is the solid zone and the top one is the fluid zone and i am moving the solid-fluid interface. I was not able to understand your suggestion so I am highlighting what I do in dynamic mesh setting.

I create dynamic mesh zones for interface and interface shadow. I use user-defined option and subsequently choose the compiled UDF among the four options. Then I Put adjacent fluid and solid cell sizes equal to half the mesh cell size in each respective domains.

In terms of main dynamic zone options, I check mark Layering with ratio based scheme (tried with height based too but no difference noticed) and then preview the mesh motion.

I have attempted the re meshing and smoothing options in dynamic mesh menu with different parameters along with the above mentioned zones.

Now, as you mentioned, is something wrong with my layering and cell size specifications. OR the reason is (which i believe is more probable) that Do I need to create more dynamic zones out of fluid /default interior /solid/ solid interior and what kind of zone should they be?

I tried with fluid and setting it to deforming with minimum length scale 1 m (much larger than my mesh domain) and max length scale 0 m. But this didn't made any difference.

I wasn't able to understand your reply and that's why again requesting to further clarification. If you want more information on my procedure , i can post screen shots of what i do.

Thanks a lot,
Akash

enry August 31, 2010 04:19

Sorry, I believed that you moved both interface and solid. :rolleyes:

Your approach seems to be good... A question: before the corruption of your mesh, does the mesh move all together ? Or is only the first cell adjacent to interface that follow the interface?
If the mesh is moving all together before corruption, I think that you should change constant factor, boundary node relaxation, max iteration and convergence tolerance.
If only the first cell is moving with the interface, your set up is wrong.

Let me know.
Bye.

akash.iitb August 31, 2010 13:36

Hello,

I think only the first cell is moving with the interface. That's why when interface moves, the size of cell attached to the interface increases in size on the solid domain side. On the fluid size, sine the cell is shrinking, eventually the layer collapses. But the problem persists and grows on the solid side. So, my setup is wrong. What can i do to make it right?

I saw that when i was using a simple planar movement velocity condition in CG_MOTION as well as in GRID_MOTION macro, the layers were properly moving and splitting and collapsing. But when i use the parabolic velocity function profile in my GRID_MOTION macro, the cell size attached to the interface increases continuously without splitting. So, what should be correct form of setup for this. Please help.

Also, one other query - Later on in the project, I want to access cell and face temperature and gradient vector values on which i will apply some equations and finally, that will determine my node movement in GRID_Motion (instead of current velocity function). So, how can i use cell values to update node movement?

Thanks,
Akash

enry September 1, 2010 04:21

Hi Akash,
I think that there is no difference in set-up between CG_MOTION and GRID_MOTION macro... I suggest to build a simpler domain, like a simple box with moving interface, with the same fluid, with a simple planar movement, and try to move it. I think it's better,easier and faster. Have you setting up the motion conditions also to the face surrounding the fluid?

About your second question, I never access the face and cell temperature. Take a look to the UDF manual, I'm sure that there is the answer to your question, or search in the forum.

Bye.

akash.iitb September 3, 2010 16:53

1 Attachment(s)
Hi Enry,

Sorry for the late reply on your post. Well, I have worked earlier on precisely what you have suggested. My first attempt was to build a simple box with fluid (0.04 m height) and solid (0.01 m height) as the computational domain (this can be considered as a small section portion of 3d pipe). This had the fluid dynamics, heat transfer and species transport models activated with moving solid-liquid interface.

My first UDF attempt was to realize planar movement of the interface which i did both using CG_Motion and GRID_MOTION macro with layering enabled (Ratio based with 0.2 as split and collapse factors; no smoothing and remeshing). The attached image shows the mesh movement in the planar case successfully.

However, when i used the parabolic velocity function for the movement profile as described by the UDF (shown below), i had the problem with the splitting with the mesh layers at the solid-liquid interface which I had told earlier too.

I hope this gives you better idea about my approach and the root of the problem faced. I am not being able to figure out whether the problem is in the way parabolic profile in UDF is written or in setting of dynamic mesh zones.

The UDF provided by you as well as example in UDF manual loops over nodes to update the velocity (or any function). Later when I will be using functions over faces or cells (like Define or adjust macros) for further operations, how can that information be transmitted to node movements. This is one of my doubts and primary reason for my second question in the previous post. Is there a way that i can write a grid_motion_macro looping over faces/cells only and defining movements in terms of faces/cells rather nodes? Please let me know on this if you ever done or seen such a UDF. Appreciate your help.

Akash


************************************************** **

#include"udf.h"
DEFINE_GRID_MOTION(planemove5,domain,dt,time,dtime )
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real a;
real NV_VEC(axis),NV_VEC(dv),NV_VEC(dv2);
int n;
real zcor;
NV_D(axis, =, 0.0, 1.0, 0.0); /* y vector */

begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if the current node has not been previously
visited when looping through previous faces */
if ( NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it's not updated more than once */
NODE_POS_UPDATED(v);
a = -.000173611;
zcor = NODE_Z(v);
/* dv2 used for planar movement */
dv2[1] = 0.0001;
/* dv1 used for parabolic movement */
dv[1] = a*NODE_Z(v)*(NODE_Z(v) - 0.48);
/* just replacing dv2 and dv for different movements */
NV_V(NODE_COORD(v), +=, dv);
}
}
}
end_f_loop(f,tf);
}

akash.iitb September 10, 2010 01:01

Hi Enry,

Sorry to bother you again with the same post but I am kind of stuck at this juncture and I believe your suggestion can be of great help for me to tackle this problem. As you suggested in earlier post, I have worked on precisely what you have suggested. My first attempt was to build a simple box with fluid (0.04 m height) and solid (0.01 m height) as the computational domain (this can be considered as a small section portion of 3d pipe). This had the fluid dynamics, heat transfer and species transport models activated with moving solid-liquid interface.

My first UDF attempt was to realize planar movement of the interface which i did both using CG_Motion and GRID_MOTION macro with layering enabled (Ratio based with 0.2 as split and collapse factors; no smoothing and remeshing).

However, when i used the parabolic velocity function for the movement profile as described by the UDF (shown below), i had the problem with the splitting with the mesh layers at the solid-liquid interface which I had told earlier too.

I hope this gives you better idea about my approach and the root of the problem faced. I am not being able to figure out whether the problem is in the way parabolic profile in UDF is written or in setting of dynamic mesh menu options.

The UDF provided by you as well as example in UDF manual loops over nodes to update the velocity (or any function). Later when I will be using functions over faces or cells (like Define or adjust macros) for further operations, how can that information be transmitted to node movements. This is one of my doubts and primary reason for my second question in the previous post. Is there a way that i can write a grid_motion_macro looping over faces/cells only and defining movements in terms of faces/cells rather nodes? Please let me know on this if you ever done or seen such a UDF.

Really appreciate your help.

thanks

Akash


************************************************** **

#include"udf.h"
DEFINE_GRID_MOTION(planemove5,domain,dt,time,dtime )
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real a;
real NV_VEC(axis),NV_VEC(dv),NV_VEC(dv2);
int n;
real zcor;
NV_D(axis, =, 0.0, 1.0, 0.0); /* y vector */

begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
/* update node if the current node has not been previously
visited when looping through previous faces */
if ( NODE_POS_NEED_UPDATE (v))
{
/* indicate that node position has been update
so that it's not updated more than once */
NODE_POS_UPDATED(v);
a = -.000173611;
zcor = NODE_Z(v);
/* dv2 used for planar movement */
dv2[1] = 0.0001;
/* dv1 used for parabolic movement */
dv[1] = a*NODE_Z(v)*(NODE_Z(v) - 0.48);
/* just replacing dv2 and dv for different movements */
NV_V(NODE_COORD(v), +=, dv);
}
}
}
end_f_loop(f,tf);
}

enry September 14, 2010 04:16

Hi Akash, sorry for my delay. I was on holiday for 2 weeks ;).

Well, I send to you a box.zip file in which there is what I can do with GRID_MOTION. There is a simple example of moving surface with parabolic motion. There are 2 fluent journal, one for fluent 6.3.26 and the other for fluent 12. I have fluent 6.3.26 but I know the setting for fluent 12, so I write also a journal for fluent 12. I have just run journal file of fluent 6.3.26 and it works. Run the fluent.jou file, move the grid with solve mesh-motion yes command and then look at the grid.

About your question:
Is there a way that i can write a grid_motion_macro looping over faces/cells only and defining movements in terms of faces/cells rather nodes?
I think that there is a way to do it, but I never work on it.

I hope that my simple example can help you.

bye

enry September 14, 2010 04:19

PS. I work on Ubuntu. If you use Windows, the command is the same, but I think that you should re-write the journal that I send to you because the "hyphen" is different between linux and windows.

Bye.

akash.iitb September 14, 2010 12:22

Hello Enry,

Thank you very much for your reply. Hope your vacation has been good.You have gone to a lot of trouble to help me and I really appreciate that. I ran the journal file sent by you on Fluent 12 and it ran perfectly. I would like to mention some points -

  • In your case, you have moved the floor with a parabolic function. Since smoothing and remeshing are enabled, the wall-down and fluid down domain move consistently.
  • Since my aim is to move the interface between the two domains, I modified the gambit geometry mesh provided by you to define the interface between the two volumes. Rather than having fluid down and fluid up, i changed the domains to solid and fluid respectively. In Fluent, i set up the case same as you - using delta.c as udf, smoothing and remeshing enabled - and created the dynamic mesh zones where my intention is to move the interface. When i tried, even though i defined floor as stationary, it deformed with the mesh and secondly, after certain iteration, i got the negative cell volume error. I have uploaded the zip file - screenshot, gambit2.mesh, delta.c and trialbox.cas for you to check on if I have done something wrong. (I work with GUI and not with TUI as i am not familiar with that.So i understood the journal file and redid the setting using GUI)
http://www.mediafire.com/?t1q1vjjauycjyr7
  • Thirdly, in my actual model, I have been using layering since all along when I try to move the interface. I want to send you the whole case which has complete physics as well as dynamic mesh setup for your reference. I have tried many combination of available dynamic zone options. My interface moves according to parabolic profile but when it moves, the cells collapse with the fluid domain cells nicely as per the layering settings but the cells of the solid domain side dont split and hence, this becomes a problem.
http://www.mediafire.com/?nofc6554cqlrs3k


If you get time, please have a look at these files to check what I am doing wrong and let me know.

Thank you very much for all your help and support.
Akash


P.S. - These files are created in Fluent 12 as I dont use Journal files. IIf you cannot access these files, please let me know. I will redo them using journal file and send to you either on your email if you like or upload them on third party website.


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