CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

Udf: Define_grid_motion file

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   January 20, 2016, 18:51
Default Udf: Define_grid_motion file
New Member
Join Date: Nov 2015
Posts: 4
Rep Power: 3
silvi is on a distinguished road
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

#include "udf.h"
#include "stdlib.h"
#include "stdio.h"
#include "dynamesh_tools.h"
	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";
	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");
    if( fd==NULL ) 
    perror("Errore in apertura del file");

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


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
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


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

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Swak4Foam funkyDoCalc with OF2.3 massflow NiFl OpenFOAM 11 November 1, 2016 07:43
build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Installation 14 April 23, 2013 13:59
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00

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