Anonymous avatar Anonymous committed 39fd243

add Grid_ClusterSMBHFeedback.C
change CallProblemSpecificRoutines
change Grid_SetFlaggingFieldStaticRegions

Comments (0)

Files changed (3)

src/enzo/CallProblemSpecificRoutines.C

     ThisGrid->GridData->SolveOneZoneFreefall();
   }
 
+  /* Add radio-mode jet feedback */
+  if (ClusterSMBHFeedback == TRUE)
+    ThisGrid->ClusterSMBHFeedback(level);
+ 
+
   return SUCCESS;
 }

src/enzo/Grid_ClusterSMBHFeedback.C

+/***********************************************************************
+/
+/  GRID: ADD RADIO-MODE JET-LIKE FEEDBACK BASED ON STATIC SMBH
+/
+/  written by: Yuan Li and Greg Bryan
+/  date:       December, 2011
+/  modified1: 
+/
+/  PURPOSE:
+/
+************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <time.h>
+#include "ErrorExceptions.h"
+#include "macros_and_parameters.h"
+#include "typedefs.h"
+#include "global_data.h"
+#include "Fluxes.h"
+#include "GridList.h"
+#include "ExternalBoundary.h"
+#include "Grid.h"
+#include "Hierarchy.h"
+#include "CosmologyParameters.h"
+
+
+int grid::ClusterSMBHFeedback(int level)
+{
+
+  if (MyProcessorNumber != ProcessorNumber)
+    return SUCCESS;
+
+  /* Return if not on most-refined level. */
+
+  if (level != MaximumRefnementLevel)
+    return SUCCESS;
+
+  /* Compute the jet launching region
+     (assume jet launched from PointSourceGravityPosition) */
+
+  FLOAT JetLeftCorner[MAX_DIMENSION], LeftRightCorner[MAX_DIMENSION];
+  int jet_dim = 2;  // z-axis (should make parameter?)
+
+  for (dim = 0; dim < GridRank; dim++) {
+    JetLeftCorner[dim] = PointSourceGravityPosition[dim];
+    JetRightCorner[dim] = PointSourceGravityPosition[dim];
+    if (dim != jet_dim) {
+      JetLeftCorner[dim] -= JetRadius*CellWidth[dim][0];
+      JetRightCorner[dim] += JetRadius*CellWidth[dim][0];
+    }
+  }
+
+  JetLeftCorner[jet_dim] -= JetLaunchOffset*CellWidth[jet_dim][0];
+  JetRightCorner[jet_dim] += JetLaunchOffset*CellWidth[jet_dim][0];
+ 
+  /* Compute indices of jet launch region. */
+
+  int JetStartIndex[MAX_DIMENSION], JetEndIndex[MAX_DIMENSION];
+
+  for (dim = 0; dim < GridRank; dim++) {
+
+    /* Compute start and end indices of jet */
+
+    JetStartIndex[dim] = nint((JetLeftCorner[dim] - CellLeftEdge[dim][0])/CellWidth[dim][0]);
+    JetEndIndex[dim] = nint((JetRightCorner[dim] - CellLeftEdge[dim][0])/CellWidth[dim][0]);
+
+    /* If Jet is not on this grid, return. */
+
+    if (JetStartIndex[dim] > GridDimension[dim]-1 || JetEndIndex[dim] < 0)
+      return SUCCESS;
+
+    /* Clip edge of jet launching disk */
+
+    if (dim != jet_dim) {
+      JetStartIndex[dim] = max(JetStartIndex[dim], 0);
+      JetEndIndex[dim] = min(JetStartIndex[dim], GridDimension[dim]-1);
+    }
+
+  } // end: loop over dim
+
+  /* Compute mass and momentum to be put into cells in code units. */
+
+  /* Loop over launch disks and set cell values. */
+
+  if (JetStartIndex[jet_dim] > 0 && JetStartIndex[jet_dim] < GridDimension[jet_dim]-1) 
+    
+
+  /* loop over cells to be modified, add jet mass, momentum, and energy. */
+
+  return SUCCESS;
+
+}
+ 

src/enzo/Grid_SetFlaggingFieldStaticRegions.C

   /* Loop over static regions. */
  
   for (region = 0; region < MAX_STATIC_REGIONS; region++)
-    if (StaticRefineRegionLevel[region] == level) {
+    if (StaticRefineRegionLevel[region] >= level) {
  
       /* Check if there is any overlap. */
  
 	
       } // end: if (Overlap)
  
-    } // end: if (StaticRefineRegionLevel[dim] == level)
+    } // end: if (StaticRefineRegionLevel[dim] >= level)
 
  
   /* Count up the number of flagged cells & report. */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.