CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Udf: Define_grid_motion file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 20, 2016, 18:51
Default Udf: Define_grid_motion file
  #1
New Member
 
Join Date: Nov 2015
Posts: 4
Rep Power: 11
silvi is on a distinguished road
Hi,
I'm trying to use the define_grid_motion macro. I want to update the mesh every time steps with my file txt but during the simulation my nodal coordinates don't update as the udf isn't reading the file.

this is my UDF

Code:
#include "udf.h"
#include "stdlib.h"
#include "stdio.h"
#include<string.h>
#include "dynamesh_tools.h"
DEFINE_GRID_MOTION(remesh,domain,dt,time,dtime)
{
	FILE *fd;	
	Thread *tf = DT_THREAD(dt);
	face_t f;
	Node *v;	  
	real NV_VEC(vetcoord);
	int n,i,time_step;
	char nomefile[14]=“nodi_”, numero_file[5], estensione_file[5]=".txt";
  
	time_step=N_TIME+1;
	Message("time_step:%d\n", time_step);
  
	sprintf(numero_file, "%d", time_step);
	strcat(nomefile, numero_file);
	strcat(nomefile, estensione_file);
	fd=fopen(nomefile, "r");
  
	i=0;
    if( fd==NULL ) 
	{
    perror("Errore in apertura del file");
    exit(1);
	}
	
	SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));


	begin_f_loop(f,tf)	 
	{
		f_node_loop(f,tf,n)
     	{			
	 		v = F_NODE(f,tf,n);
						
            if (NODE_POS_NEED_UPDATE (v))
            {
			    NODE_POS_UPDATED(v);
				fscanf(fd, "%g %g %g", &vetcoord[0], &vetcoord[1], &vetcoord[2]);				
				NV_V(NODE_COORD(v), +=, vetcoord);
				i++;
				/*Message("coordinate:ID: %d %g %g %g \n",i,NODE_X(v), NODE_Z(v), NODE_Y(v));  */             
			}

		}
	}
	end_f_loop(f,tf);	

	fclose(fd);
}
and my file is a txt file written in matlab with dlmwrite with tab as delimiter. I didn't write nodes ids.
thank you
silvi is offline   Reply With Quote

Old   January 21, 2016, 02:02
Default
  #2
New Member
 
Join Date: Jan 2016
Posts: 1
Rep Power: 0
vaidot is on a distinguished road
I had a similar problem but I could not solve it!
vaidot is offline   Reply With Quote

Reply

Tags
define grid motion, file format, file problem, remeshing, udf code


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 16:29.