@@ -549,6 +549,191 @@ namespace aspect
549
549
unsigned int phase_index;
550
550
};
551
551
552
+ /* *
553
+ * A class that bundles functionality to look up the dominant phase in
554
+ * tables for each respective composition and export the values
555
+ * of phase functions. The class can handle arbitrary numbers of
556
+ * dominant phases for each composition, but the calling side
557
+ * has to determine how to use the return values of this object
558
+ * (e.g. in terms of density or viscosity).
559
+ */
560
+ template <int dim>
561
+ class PhaseFunctionDiscrete : public ::aspect::SimulatorAccess<dim>
562
+ {
563
+ public:
564
+
565
+ /* *
566
+ * The initialization process loads the contents of the material files
567
+ * for the respective compositions.
568
+ */
569
+ void initialize ();
570
+
571
+ /* *
572
+ * Percentage of material that has already undergone the phase
573
+ * transition to the higher-pressure material. For this class
574
+ * this function only returns 1.0 or 0.0, depending on whether
575
+ * the selected phase transition has been crossed or not.
576
+ */
577
+ double compute_value (const PhaseFunctionInputs<dim> &in) const ;
578
+
579
+ /* *
580
+ * No valid implementation exists for this function, as the derivative of a
581
+ * discrete function is undefined at locations of phase jumps. This function raises an
582
+ * error to ensure that a phase derivative request is not made for this phase function.
583
+ */
584
+ double compute_derivative () const ;
585
+
586
+ /* *
587
+ * Return the total number of phase transitions.
588
+ */
589
+ unsigned int n_phase_transitions () const ;
590
+
591
+ /* *
592
+ * Return the total number of phases.
593
+ */
594
+ unsigned int n_phases () const ;
595
+
596
+ /* *
597
+ * Return the total number of phases over all chemical compositions.
598
+ */
599
+ unsigned int n_phases_over_all_chemical_compositions () const ;
600
+
601
+ /* *
602
+ * Return how many phase transitions there are for each chemical composition.
603
+ */
604
+ const std::vector<unsigned int > &
605
+ n_phase_transitions_for_each_chemical_composition () const ;
606
+
607
+ /* *
608
+ * Return how many phases there are for each chemical composition.
609
+ */
610
+ const std::vector<unsigned int > &
611
+ n_phases_for_each_chemical_composition () const ;
612
+
613
+ /* *
614
+ * Return how many phase transitions there are for each composition.
615
+ * Note, that most likely you only need the number of phase transitions
616
+ * for each chemical composition, so use the function above instead.
617
+ * This function is only kept for backward compatibility.
618
+ */
619
+ const std::vector<unsigned int > &
620
+ n_phase_transitions_for_each_composition () const ;
621
+
622
+ /* *
623
+ * Return how many phases there are for each composition.
624
+ * Note, that most likely you only need the number of phase transitions
625
+ * for each chemical composition, so use the function above instead.
626
+ * This function is only kept for backward compatibility.
627
+ */
628
+ const std::vector<unsigned int > &
629
+ n_phases_for_each_composition () const ;
630
+
631
+ /* *
632
+ * Declare the parameters this class takes through input files.
633
+ * Note that this class does not declare its own subsection,
634
+ * i.e. the parameters will be declared in the subsection that
635
+ * was active before calling this function.
636
+ */
637
+ static
638
+ void
639
+ declare_parameters (ParameterHandler &prm);
640
+
641
+ /* *
642
+ * Read the parameters this class declares from the parameter file.
643
+ * Note that this class does not declare its own subsection,
644
+ * i.e. the parameters will be parsed from the subsection that
645
+ * was active before calling this function.
646
+ */
647
+ void
648
+ parse_parameters (ParameterHandler &prm);
649
+
650
+
651
+ private:
652
+ /* *
653
+ * Directory path where data files are stored.
654
+ */
655
+ std::string data_directory;
656
+
657
+ /* *
658
+ * List of file names containing material data for each composition.
659
+ */
660
+ std::vector<std::string> material_file_names;
661
+
662
+ /* *
663
+ * Minimum temperature values for each composition in the P-T table.
664
+ */
665
+ std::vector<double > minimum_temperature;
666
+
667
+ /* *
668
+ * Maximum temperature values for each composition in the P-T table.
669
+ */
670
+ std::vector<double > maximum_temperature;
671
+
672
+ /* *
673
+ * Temperature intervals used for each composition in the P-T table.
674
+ */
675
+ std::vector<double > interval_temperature;
676
+
677
+ /* *
678
+ * Minimum pressure values for each composition in the P-T table.
679
+ */
680
+ std::vector<double > minimum_pressure;
681
+
682
+ /* *
683
+ * Maximum pressure values for each composition in the P-T table.
684
+ */
685
+ std::vector<double > maximum_pressure;
686
+
687
+ /* *
688
+ * Pressure intervals used for each composition in the P-T table.
689
+ */
690
+ std::vector<double > interval_pressure;
691
+
692
+ /* *
693
+ * List of pointers to objects that read and process data we get from
694
+ * material data files. There is one pointer/object per lookup file.
695
+ */
696
+ std::vector<std::unique_ptr<Utilities::StructuredDataLookup<2 >>> material_lookup;
697
+
698
+ /* *
699
+ * List of phase indicators of the most dominant phases in the material data files
700
+ * to construct the different phase transitions in this class. For a description of
701
+ * the use of the phase indicators, please see the documentation of the input parameter
702
+ * 'Phase transition indicators' in the function declare_parameters().
703
+ */
704
+ std::vector<unsigned int > transition_indicators;
705
+
706
+ /* *
707
+ * A vector that stores how many phase transitions there are for each compositional field.
708
+ */
709
+ std::unique_ptr<std::vector<unsigned int >> n_phase_transitions_per_composition;
710
+
711
+ /* *
712
+ * A vector that stores how many phases there are for each compositional field.
713
+ */
714
+ std::vector<unsigned int > n_phases_per_composition;
715
+
716
+ /* *
717
+ * A vector that stores how many phase transitions there are for each chemical compositional field.
718
+ */
719
+ std::vector<unsigned int > n_phase_transitions_per_chemical_composition;
720
+
721
+ /* *
722
+ * A vector that stores how many phases there are for each chemical compositional field.
723
+ */
724
+ std::vector<unsigned int > n_phases_per_chemical_composition;
725
+
726
+ /* *
727
+ * Total number of phases over all compositional fields
728
+ */
729
+ unsigned int n_phases_total;
730
+
731
+ /* *
732
+ * Total number of phases over all compositional fields
733
+ */
734
+ unsigned int n_phases_total_chemical_compositions;
735
+ };
736
+
552
737
/* *
553
738
* A class that bundles functionality to compute the values and
554
739
* derivatives of phase functions. The class can handle arbitrary
0 commit comments