|
[Sponsors] |
January 20, 2016, 18:51 |
Udf: Define_grid_motion file
|
#1 |
New Member
Join Date: Nov 2015
Posts: 4
Rep Power: 11 |
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); } thank you |
|
January 21, 2016, 02:02 |
|
#2 |
New Member
Join Date: Jan 2016
Posts: 1
Rep Power: 0 |
I had a similar problem but I could not solve it!
|
|
Tags |
define grid motion, file format, file problem, remeshing, udf code |
|
|
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 |