Exemple #1
0
void print_grid(ElementsHashTable* HT_Elem_Ptr, NodeHashTable* HT_Node_Ptr, MatProps* matprops)
{
    
    FILE *fp = fopen("gridplot00.txt", "w");
    
    int no_of_buckets = HT_Elem_Ptr->get_no_of_buckets();
    vector<HashEntryLine> &bucket=HT_Elem_Ptr->bucket;
    tivector<Element> &elenode_=HT_Elem_Ptr->elenode_;

    //@ElementsBucketDoubleLoop
    for(int ibuck = 0; ibuck < no_of_buckets; ibuck++)
    {
        for(int ielm = 0; ielm < bucket[ibuck].ndx.size(); ielm++)
        {
            Element *EmTemp = &(elenode_[bucket[ibuck].ndx[ielm]]);
            
            if(EmTemp->adapted_flag() > 0)
            {
                double elevation;
                get_elem_elev(HT_Node_Ptr, matprops, EmTemp, elevation);
                
                fprintf(fp, "%20.14g %20.14g %20.14g\n", (EmTemp->coord(0)) * (matprops)->scale.length,
                        (EmTemp->coord(1)) * (matprops)->scale.length, elevation);
            }
        }
    }
    
    fclose(fp);
    
    assert(0);
    
    return;
}
Exemple #2
0
void print_grid(HashTable* HT_Elem_Ptr, HashTable* HT_Node_Ptr, MatProps* matprops) {

	FILE *fp=fopen("gridplot00.txt","w");


	int num_buckets=HT_Elem_Ptr->get_no_of_buckets();
	for(int ibucket=0; ibucket<num_buckets; ibucket++){

		HashEntry *entryp = *(HT_Elem_Ptr->getbucketptr() + ibucket);

		//check every element in bucket
		while(entryp){	
			Element *EmTemp = (Element*)entryp->value;
			assert(EmTemp);

			if(EmTemp->get_adapted_flag()>0){
				double elevation;
				get_elem_elev(HT_Node_Ptr,matprops,EmTemp,&elevation);

				fprintf(fp,"%20.14g %20.14g %20.14g\n",
						(*(EmTemp->get_coord()))*(matprops)->LENGTH_SCALE,
						(*(EmTemp->get_coord()+1))*(matprops)->LENGTH_SCALE,
						elevation);
			}
			entryp = entryp->next;
		}
	}

	fclose(fp);

	exit(1);

	return;
}
Exemple #3
0
//for use when writing ascii tecplot files
int print_bubble_node(FILE *fp, HashTable* NodeTable, MatProps* matprops,
		      Element *EmTemp){
  int num_missing_bubble_node;
  double velocity_scale, momentum_scale, elevation;

  velocity_scale = sqrt(matprops->LENGTH_SCALE * (matprops->GRAVITY_SCALE)); // scaling factor for the velocities
  momentum_scale = matprops->HEIGHT_SCALE * velocity_scale; // scaling factor for the momentums

  num_missing_bubble_node=
    get_elem_elev(NodeTable,matprops,EmTemp,&elevation);

  double Vel[4];
//  double phi ;
//  if (*(EmTemp->get_state_vars()) > 0 /*GEOFLOW_TINY*/)
//    phi=*(EmTemp->get_state_vars());
//  else
//    phi=0;
  EmTemp->eval_velocity(0.0,0.0,Vel);
  fprintf(fp, "%e %e %e %e %e %e %e %e %e %e %e %e\n",
	  (*(EmTemp->get_coord()))*(matprops)->LENGTH_SCALE,
	  (*(EmTemp->get_coord()+1))*(matprops)->LENGTH_SCALE,
	  (elevation+(*(EmTemp->get_state_vars()+1))*(matprops)->HEIGHT_SCALE), 
	  *(EmTemp->get_state_vars()+1)*(matprops)->HEIGHT_SCALE,
	  *(EmTemp->get_state_vars()),
	  *(EmTemp->get_state_vars()+2)*momentum_scale, 
	  *(EmTemp->get_state_vars()+3)*momentum_scale, 
	  *(EmTemp->get_state_vars()+4)/**momentum_scale*/, 
	  *(EmTemp->get_state_vars()+5)*momentum_scale, 
	  elevation, 
	  sqrt(Vel[0]*Vel[0]+Vel[1]*Vel[1])*velocity_scale,
	  sqrt(Vel[2]*Vel[2]+Vel[3]*Vel[3])*velocity_scale);

  return(num_missing_bubble_node);
}
Exemple #4
0
//for use when writing ascii tecplot files
int
print_bubble_node (FILE * fp, HashTable * NodeTable, MatProps * matprops,
                   Element * EmTemp)
{
  int num_missing_bubble_node;
  double velocity_scale, momentum_scale, elevation;

  velocity_scale = sqrt (matprops->LENGTH_SCALE * (matprops->GRAVITY_SCALE));   // scaling factor for the velocities
  momentum_scale = matprops->HEIGHT_SCALE * velocity_scale;     // scaling factor for the momentums

  num_missing_bubble_node =
    get_elem_elev (NodeTable, matprops, EmTemp, &elevation);


  double VxVy[2];
  EmTemp->eval_velocity (0.0, 0.0, VxVy);
  fprintf (fp, "%e %e %e %e %e %e %e %e\n",
           (*(EmTemp->get_coord ())) * (matprops)->LENGTH_SCALE,
           (*(EmTemp->get_coord () + 1)) * (matprops)->LENGTH_SCALE,
           (elevation + (*(EmTemp->get_state_vars ())) * (matprops)->HEIGHT_SCALE),
           *(EmTemp->get_state_vars ()) * (matprops)->HEIGHT_SCALE,
           *(EmTemp->get_state_vars () + 1) * momentum_scale,
           *(EmTemp->get_state_vars () + 2) * momentum_scale,
           elevation,
           sqrt (VxVy[0] * VxVy[0] + VxVy[1] * VxVy[1]) * velocity_scale);

  return (num_missing_bubble_node);
}