[cig-commits] [commit] master: Unify temperature and composition boundary conditions. (cbf1eae)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue Jan 13 05:45:53 PST 2015


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/1a11b0a3b75cbf6d4140c7d0e4860b94c56c9198...7eb5dd7a1a7f54306391ab2a8555b149d6a5164e

>---------------------------------------------------------------

commit cbf1eae2d418aa0c2128de60ec1eae9450083d8d
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date:   Tue Jan 13 12:15:11 2015 +0100

    Unify temperature and composition boundary conditions.


>---------------------------------------------------------------

cbf1eae2d418aa0c2128de60ec1eae9450083d8d
 source/simulator/core.cc | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/source/simulator/core.cc b/source/simulator/core.cc
index 04f8d38..53ceb8c 100644
--- a/source/simulator/core.cc
+++ b/source/simulator/core.cc
@@ -124,7 +124,13 @@ namespace aspect
     material_model (MaterialModel::create_material_model<dim>(prm)),
     heating_model (HeatingModel::create_heating_model<dim>(prm)),
     gravity_model (GravityModel::create_gravity_model<dim>(prm)),
-    boundary_temperature (BoundaryTemperature::create_boundary_temperature<dim>(prm)),
+    // create a boundary temperature model, but only if we actually need
+    // it. otherwise, allow the user to simply specify nothing at all
+    boundary_temperature (parameters.fixed_temperature_boundary_indicators.empty()
+                          ?
+                          0
+                          :
+                          BoundaryTemperature::create_boundary_temperature<dim>(prm)),
     // create a boundary composition model, but only if we actually need
     // it. otherwise, allow the user to simply specify nothing at all
     boundary_composition (parameters.fixed_composition_boundary_indicators.empty()
@@ -285,15 +291,18 @@ namespace aspect
     gravity_model->parse_parameters (prm);
     gravity_model->initialize ();
 
-    if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(boundary_temperature.get()))
-      sim->initialize (*this);
-    boundary_temperature->parse_parameters (prm);
-    boundary_temperature->initialize ();
+    if (boundary_temperature.get())
+      {
+        if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(boundary_temperature.get()))
+          sim->initialize (*this);
+        boundary_temperature->parse_parameters (prm);
+        boundary_temperature->initialize ();
+      }
 
-    if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(boundary_composition.get()))
-      sim->initialize (*this);
     if (boundary_composition.get())
       {
+        if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(boundary_composition.get()))
+          sim->initialize (*this);
         boundary_composition->parse_parameters (prm);
         boundary_composition->initialize ();
       }
@@ -666,8 +675,10 @@ namespace aspect
     // do the same for the temperature variable: evaluate the current boundary temperature
     // and add these constraints as well
     {
-      //Update the temperature boundary condition.
-      boundary_temperature->update();
+      // If there is a fixed boundary temperature,
+      // update the temperature boundary condition.
+      if (boundary_temperature.get())
+        boundary_temperature->update();
 
       // obtain the boundary indicators that belong to Dirichlet-type
       // temperature boundary conditions and interpolate the temperature
@@ -690,9 +701,10 @@ namespace aspect
                                                     current_constraints,
                                                     introspection.component_masks.temperature);
         }
+    }
 
       // now do the same for the composition variable:
-
+    {
       // If there are fixed boundary compositions,
       // update the composition boundary condition.
       if (boundary_composition.get())



More information about the CIG-COMMITS mailing list