Skip to content

Commit

Permalink
Clean Up Figures
Browse files Browse the repository at this point in the history
  • Loading branch information
Oluwatobi Quadri Raji committed Aug 8, 2024
1 parent 51e00c7 commit a434ec5
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ In the ``Tasks`` section, ``SinglePhasePoromechanicsInitialization`` tasks are d
:start-after: <!-- SPHINX_TASKS -->
:end-before: <!-- SPHINX_TASKS_END -->

The initialization is triggered into action using the ``Event`` management section, where the ``soloEvent`` function calls the task at the target time (in this case -1e10s).
The initialization is triggered into action using the ``Event`` management section, where the ``soloEvent`` function calls the task at the target time (in this case -1e10\u00A0s).

.. literalinclude:: ../../../../../inputFiles/initialization/gravityInducedStress_initialization_benchmark.xml
:language: xml
Expand Down Expand Up @@ -197,11 +197,11 @@ The parameters used in the simulation are summarized in the following table.
Inspecting Results
---------------------------------

In the example, we request vtk output files for time-series (time history). We use paraview to visualize the outcome at the time 0s.
In the example, we request vtk output files for time-series (time history). We use paraview to visualize the outcome at the time 0\u00A0s.
The following figure shows the final gradient of pressure and of the effective vertical stress after initialization is completed.

.. _problemInitializationPres:
.. figure:: vertical_grad.png
.. figure:: pressure_field.png
:align: center
:width: 500
:figclass: align-center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def getHydromechanicalParametersFromXML(xmlFilePath):

def main():
# File path
xmlFile1Path = "../../../../../inputFiles/initialization/gravityInducedStress_initialization_base.xml"
xmlFile1Path = "../../../../../inputFiles/initialization/gravityInducedStress_initialization_base.xml"
xmlFile2Path = "../../../../../inputFiles/initialization/gravityInducedStress_initialization_benchmark.xml"

hydromechanicalParameters = getHydromechanicalParametersFromXML(xmlFile1Path)
Expand All @@ -66,18 +66,23 @@ def main():
traction = hydromechanicalParameters["traction"]
gravity = 9.81

# rename this file to the name of your Paraview output file
file = open("simulation_result_0.csv")
csvreader = csv.reader(file)
header = next(csvreader)
header_index = {column_name: index for index, column_name in enumerate(header)}

rows = []
for row in csvreader:
rows.append(row)
file.close()


zloc_index = header_index["elementCenter:2"]
pressure_index = header_index["pressure"]
tsxx_index = header_index["rockSolid_stress:0"] # the solidModelName="rockSolid" has been defined in the gravityInducedStress_initialization_base.xml file, please change if you have a different solidModelName
tsyy_index = header_index["rockSolid_stress:1"]
tszz_index = header_index["rockSolid_stress:2"]

z_analytical= np.linspace(0, 1000, 100)

rows = np.array(rows)
zloc_0 = np.empty(len(rows[:,1]))
Expand All @@ -86,13 +91,11 @@ def main():
tsyy_0 = np.empty(len(rows[:,1]))
tszz_0 = np.empty(len(rows[:,1]))
for i in range(0,len(rows[:,1])):
zloc_0[i]=-(float(rows[i,2]))
pressure_0[i]=float(rows[i,3])
tsxx_0[i]=-(float(rows[i,4])-BiotCoefficient*pressure_0[i])/1.0e6
tsyy_0[i]=-(float(rows[i,5])-BiotCoefficient*pressure_0[i])/1.0e6
tszz_0[i]=-(float(rows[i,6])-BiotCoefficient*pressure_0[i])/1.0e6


zloc_0[i]=-(float(rows[i,zloc_index]))
pressure_0[i]=float(rows[i,pressure_index])
tsxx_0[i]=-(float(rows[i,tsxx_index])-BiotCoefficient*pressure_0[i])/1.0e6
tsyy_0[i]=-(float(rows[i,tsyy_index])-BiotCoefficient*pressure_0[i])/1.0e6
tszz_0[i]=-(float(rows[i,tszz_index])-BiotCoefficient*pressure_0[i])/1.0e6


z_analytical= np.linspace(0, 1000, 100)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,24 @@ In addition to generating the files listed above, the script prints out the resu
Inspecting Results
---------------------------------

In the example, we request vtk output files for time-series (time history). We use Python scripts to visualize the outcome at the time 0s.
The following figure shows the final gradient of pressure after initialization is completed.
In the example, we request vtk output files for time-series (time history). We use Python scripts to visualize the outcome at the time 0\u00A0s.
The following figure shows the final gradient of pressure and of the effective vertical stress after initialization is completed.

.. _problemInitializationPres:
.. figure:: pressure_gradient.png
.. figure:: pressure_field.png
:align: center
:width: 500
:figclass: align-center

Simulation result of pressure

.. _problemInitializationSZZ:
.. figure:: stressZZ_field.png
:align: center
:width: 500
:figclass: align-center

Simulation result of effective vertical stress

The figure below shows the comparisons between the numerical predictions (marks) and the corresponding user-provided stress gradients.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def main():
xmlFile1Path = "../../../../../inputFiles/initialization/userdefinedStress_initialization_base.xml"
xmlFile2Path = "../../../../../inputFiles/initialization/userdefinedStress_initialization_benchmark.xml"


hydromechanicalParameters = getHydromechanicalParametersFromXML(xmlFile1Path)
stress_gradients = inputStressGradientsMPa(0.17,0.27,0.24,0.1)
sxx_grad = stress_gradients["stressXX"]
Expand All @@ -78,27 +79,36 @@ def main():
traction = hydromechanicalParameters["traction"]
gravity = 9.81

# rename this file to the name of your Paraview output file
file = open("simulation_result_0.csv")
csvreader = csv.reader(file)
header = next(csvreader)
header_index = {column_name: index for index, column_name in enumerate(header)}

rows = []
for row in csvreader:
rows.append(row)
file.close()

zloc_index = header_index["elementCenter:2"]
pressure_index = header_index["pressure"]
tsxx_index = header_index["rockSolid_stress:0"] # the solidModelName="rockSolid" has been defined in the gravityInducedStress_initialization_base.xml file, please change if you have a different solidModelName
tsyy_index = header_index["rockSolid_stress:1"]
tszz_index = header_index["rockSolid_stress:2"]


rows = np.array(rows)
zloc_0 = np.empty(len(rows[:,1]))
pressure_0 = np.empty(len(rows[:,1]))
tsxx_0 = np.empty(len(rows[:,1]))
tsyy_0 = np.empty(len(rows[:,1]))
tszz_0 = np.empty(len(rows[:,1]))
for i in range(0,len(rows[:,1])):
zloc_0[i]=-(float(rows[i,2]))
pressure_0[i]=float(rows[i,3])
tsxx_0[i]=-(float(rows[i,4])-BiotCoefficient*pressure_0[i])/1.0e6
tsyy_0[i]=-(float(rows[i,5])-BiotCoefficient*pressure_0[i])/1.0e6
tszz_0[i]=-(float(rows[i,6])-BiotCoefficient*pressure_0[i])/1.0e6
zloc_0[i]=-(float(rows[i,zloc_index]))
pressure_0[i]=float(rows[i,pressure_index])
tsxx_0[i]=-(float(rows[i,tsxx_index])-BiotCoefficient*pressure_0[i])/1.0e6
tsyy_0[i]=-(float(rows[i,tsyy_index])-BiotCoefficient*pressure_0[i])/1.0e6
tszz_0[i]=-(float(rows[i,tszz_index])-BiotCoefficient*pressure_0[i])/1.0e6


z_analytical= np.linspace(0, 1000, 100)
Expand Down

0 comments on commit a434ec5

Please sign in to comment.