-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathCompositionalMultiphaseBase.cpp
More file actions
1605 lines (1334 loc) · 76.8 KB
/
CompositionalMultiphaseBase.cpp
File metadata and controls
1605 lines (1334 loc) · 76.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/
/**
* @file CompositionalMultiphaseBase.cpp
*/
#include "CompositionalMultiphaseBase.hpp"
#include "common/DataTypes.hpp"
#include "common/TimingMacros.hpp"
#include "constitutive/ConstitutiveManager.hpp"
#include "constitutive/capillaryPressure/capillaryPressureSelector.hpp"
#include "constitutive/ConstitutivePassThru.hpp"
#include "constitutive/fluid/multiFluidSelector.hpp"
#include "constitutive/relativePermeability/relativePermeabilitySelector.hpp"
#include "fieldSpecification/AquiferBoundaryCondition.hpp"
#include "fieldSpecification/EquilibriumInitialCondition.hpp"
#include "fieldSpecification/FieldSpecificationManager.hpp"
#include "fieldSpecification/SourceFluxBoundaryCondition.hpp"
#include "mesh/DomainPartition.hpp"
#include "mesh/mpiCommunications/CommunicationTools.hpp"
#include "physicsSolvers/fluidFlow/FlowSolverBaseExtrinsicData.hpp"
#include "physicsSolvers/fluidFlow/CompositionalMultiphaseBaseExtrinsicData.hpp"
#include "physicsSolvers/fluidFlow/CompositionalMultiphaseBaseKernels.hpp"
#if defined( __INTEL_COMPILER )
#pragma GCC optimize "O0"
#endif
namespace geosx
{
using namespace dataRepository;
using namespace constitutive;
using namespace CompositionalMultiphaseBaseKernels;
CompositionalMultiphaseBase::CompositionalMultiphaseBase( const string & name,
Group * const parent )
:
FlowSolverBase( name, parent ),
m_numPhases( 0 ),
m_numComponents( 0 ),
m_computeCFLNumbers( 0 ),
m_capPressureFlag( 0 ),
m_maxCompFracChange( 1.0 ),
m_minScalingFactor( 0.01 ),
m_allowCompDensChopping( 1 )
{
//START_SPHINX_INCLUDE_00
this->registerWrapper( viewKeyStruct::inputTemperatureString(), &m_inputTemperature ).
setInputFlag( InputFlags::REQUIRED ).
setDescription( "Temperature" );
//END_SPHINX_INCLUDE_00
this->registerWrapper( viewKeyStruct::useMassFlagString(), &m_useMass ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Use mass formulation instead of molar" );
this->registerWrapper( viewKeyStruct::computeCFLNumbersString(), &m_computeCFLNumbers ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Flag indicating whether CFL numbers are computed or not" );
this->registerWrapper( viewKeyStruct::relPermNamesString(), &m_relPermModelNames ).
setInputFlag( InputFlags::REQUIRED ).
setSizedFromParent( 0 ).
setDescription( "Name of the relative permeability constitutive model to use" );
this->registerWrapper( viewKeyStruct::capPressureNamesString(), &m_capPressureModelNames ).
setSizedFromParent( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Name of the capillary pressure constitutive model to use" );
this->registerWrapper( viewKeyStruct::maxCompFracChangeString(), &m_maxCompFracChange ).
setSizedFromParent( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( 1.0 ).
setDescription( "Maximum (absolute) change in a component fraction between two Newton iterations" );
this->registerWrapper( viewKeyStruct::allowLocalCompDensChoppingString(), &m_allowCompDensChopping ).
setSizedFromParent( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( 1 ).
setDescription( "Flag indicating whether local (cell-wise) chopping of negative compositions is allowed" );
}
void CompositionalMultiphaseBase::postProcessInput()
{
FlowSolverBase::postProcessInput();
checkModelNames( m_relPermModelNames, viewKeyStruct::relPermNamesString() );
m_capPressureFlag = checkModelNames( m_capPressureModelNames, viewKeyStruct::capPressureNamesString(), true );
GEOSX_ERROR_IF_GT_MSG( m_maxCompFracChange, 1.0,
"The maximum absolute change in component fraction must smaller or equal to 1.0" );
GEOSX_ERROR_IF_LT_MSG( m_maxCompFracChange, 0.0,
"The maximum absolute change in component fraction must larger or equal to 0.0" );
}
void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies )
{
using namespace extrinsicMeshData::flow;
FlowSolverBase::registerDataOnMesh( meshBodies );
DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
ConstitutiveManager const & cm = domain.getConstitutiveManager();
// 1. Set key dimensions of the problem
// Empty check needed to avoid accessing m_fluidModelNames when running in schema generation mode.
if( !m_fluidModelNames.empty() )
{
MultiFluidBase const & fluid0 = cm.getConstitutiveRelation< MultiFluidBase >( m_fluidModelNames[0] );
m_numPhases = fluid0.numFluidPhases();
m_numComponents = fluid0.numFluidComponents();
}
m_numDofPerCell = m_numComponents + 1;
// 2. Register and resize all fields as necessary
meshBodies.forSubGroups< MeshBody >( [&]( MeshBody & meshBody )
{
MeshLevel & mesh = meshBody.getMeshLevel( 0 );
forTargetSubRegions( mesh, [&]( localIndex const targetIndex, ElementSubRegionBase & subRegion )
{
MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, m_fluidModelNames[targetIndex] );
subRegion.registerExtrinsicData< pressure >( getName() );
subRegion.registerExtrinsicData< initialPressure >( getName() );
subRegion.registerExtrinsicData< deltaPressure >( getName() );
subRegion.registerExtrinsicData< bcPressure >( getName() );
subRegion.registerExtrinsicData< temperature >( getName() );
// The resizing of the arrays needs to happen here, before the call to initializePreSubGroups,
// to make sure that the dimensions are properly set before the timeHistoryOutput starts its initialization.
subRegion.registerExtrinsicData< globalCompDensity >( getName() ).
setDimLabels( 1, fluid.componentNames() ).
reference().resizeDimension< 1 >( m_numComponents );
subRegion.registerExtrinsicData< deltaGlobalCompDensity >( getName() ).
reference().resizeDimension< 1 >( m_numComponents );
subRegion.registerExtrinsicData< globalCompFraction >( getName() ).
setDimLabels( 1, fluid.componentNames() ).
reference().resizeDimension< 1 >( m_numComponents );
subRegion.registerExtrinsicData< dGlobalCompFraction_dGlobalCompDensity >( getName() ).
reference().resizeDimension< 1, 2 >( m_numComponents, m_numComponents );
subRegion.registerExtrinsicData< phaseVolumeFraction >( getName() ).
setDimLabels( 1, fluid.phaseNames() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< dPhaseVolumeFraction_dPressure >( getName() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< dPhaseVolumeFraction_dGlobalCompDensity >( getName() ).
reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents );
subRegion.registerExtrinsicData< phaseMobility >( getName() ).
setDimLabels( 1, fluid.phaseNames() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< dPhaseMobility_dPressure >( getName() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< dPhaseMobility_dGlobalCompDensity >( getName() ).
reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents );
if( m_computeCFLNumbers )
{
subRegion.registerExtrinsicData< phaseOutflux >( getName() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< componentOutflux >( getName() ).
reference().resizeDimension< 1 >( m_numComponents );
subRegion.registerExtrinsicData< phaseCFLNumber >( getName() );
subRegion.registerExtrinsicData< componentCFLNumber >( getName() );
}
subRegion.registerExtrinsicData< phaseVolumeFractionOld >( getName() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< totalDensityOld >( getName() );
subRegion.registerExtrinsicData< phaseDensityOld >( getName() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< phaseMobilityOld >( getName() ).
reference().resizeDimension< 1 >( m_numPhases );
subRegion.registerExtrinsicData< phaseComponentFractionOld >( getName() ).
reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents );
} );
FaceManager & faceManager = mesh.getFaceManager();
{
faceManager.registerExtrinsicData< facePressure >( getName() );
}
} );
}
namespace
{
template< typename MODEL1_TYPE, typename MODEL2_TYPE >
void compareMultiphaseModels( MODEL1_TYPE const & lhs, MODEL2_TYPE const & rhs )
{
GEOSX_THROW_IF_NE_MSG( lhs.numFluidPhases(), rhs.numFluidPhases(),
GEOSX_FMT( "Mismatch in number of phases between constitutive models {} and {}", lhs.getName(), rhs.getName() ),
InputError );
for( localIndex ip = 0; ip < lhs.numFluidPhases(); ++ip )
{
GEOSX_THROW_IF_NE_MSG( lhs.phaseNames()[ip], rhs.phaseNames()[ip],
GEOSX_FMT( "Mismatch in phase names between constitutive models {} and {}", lhs.getName(), rhs.getName() ),
InputError );
}
}
template< typename MODEL1_TYPE, typename MODEL2_TYPE >
void compareMulticomponentModels( MODEL1_TYPE const & lhs, MODEL2_TYPE const & rhs )
{
GEOSX_THROW_IF_NE_MSG( lhs.numFluidComponents(), rhs.numFluidComponents(),
GEOSX_FMT( "Mismatch in number of components between constitutive models {} and {}", lhs.getName(), rhs.getName() ),
InputError );
for( localIndex ic = 0; ic < lhs.numFluidComponents(); ++ic )
{
GEOSX_THROW_IF_NE_MSG( lhs.componentNames()[ic], rhs.componentNames()[ic],
GEOSX_FMT( "Mismatch in component names between constitutive models {} and {}", lhs.getName(), rhs.getName() ),
InputError );
}
}
}
void CompositionalMultiphaseBase::validateConstitutiveModels( constitutive::ConstitutiveManager const & cm ) const
{
MultiFluidBase const & fluid0 = cm.getConstitutiveRelation< MultiFluidBase >( m_fluidModelNames[0] );
for( localIndex i = 1; i < m_fluidModelNames.size(); ++i )
{
MultiFluidBase const & fluid = cm.getConstitutiveRelation< MultiFluidBase >( m_fluidModelNames[i] );
compareMultiphaseModels( fluid, fluid0 );
compareMulticomponentModels( fluid, fluid0 );
}
RelativePermeabilityBase const & relPerm0 = cm.getConstitutiveRelation< RelativePermeabilityBase >( m_relPermModelNames[0] );
compareMultiphaseModels( relPerm0, fluid0 );
for( localIndex i = 1; i < m_relPermModelNames.size(); ++i )
{
RelativePermeabilityBase const & relPerm = cm.getConstitutiveRelation< RelativePermeabilityBase >( m_relPermModelNames[i] );
compareMultiphaseModels( relPerm, relPerm0 );
}
if( m_capPressureFlag )
{
CapillaryPressureBase const & capPres0 = cm.getConstitutiveRelation< CapillaryPressureBase >( m_capPressureModelNames[0] );
compareMultiphaseModels( capPres0, fluid0 );
for( localIndex i = 1; i < m_capPressureModelNames.size(); ++i )
{
CapillaryPressureBase const & capPres = cm.getConstitutiveRelation< CapillaryPressureBase >( m_capPressureModelNames[i] );
compareMultiphaseModels( capPres, capPres0 );
}
}
}
void CompositionalMultiphaseBase::initializeAquiferBC( ConstitutiveManager const & cm ) const
{
FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance();
MultiFluidBase const & fluid0 = cm.getConstitutiveRelation< MultiFluidBase >( m_fluidModelNames[0] );
fsManager.forSubGroups< AquiferBoundaryCondition >( [&] ( AquiferBoundaryCondition & bc )
{
// set the gravity vector (needed later for the potential diff calculations)
bc.setGravityVector( gravityVector() );
// set the water phase index in the Aquifer boundary condition
// note: if the water phase is not found, the fluid model is going to throw an error
integer const waterPhaseIndex = fluid0.getWaterPhaseIndex();
bc.setWaterPhaseIndex( waterPhaseIndex );
} );
}
void CompositionalMultiphaseBase::validateAquiferBC( ConstitutiveManager const & cm ) const
{
FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance();
MultiFluidBase const & fluid0 = cm.getConstitutiveRelation< MultiFluidBase >( m_fluidModelNames[0] );
fsManager.forSubGroups< AquiferBoundaryCondition >( [&] ( AquiferBoundaryCondition const & bc )
{
arrayView1d< real64 const > const & aquiferWaterPhaseCompFrac = bc.getWaterPhaseComponentFraction();
arrayView1d< string const > const & aquiferWaterPhaseCompNames = bc.getWaterPhaseComponentNames();
GEOSX_ERROR_IF_NE_MSG( fluid0.numFluidComponents(), aquiferWaterPhaseCompFrac.size(),
"Mismatch in number of components between constitutive model "
<< fluid0.getName() << " and the water phase composition in aquifer " << bc.getName() );
for( localIndex ic = 0; ic < fluid0.numFluidComponents(); ++ic )
{
GEOSX_ERROR_IF_NE_MSG( fluid0.componentNames()[ic], aquiferWaterPhaseCompNames[ic],
"Mismatch in component names between constitutive model "
<< fluid0.getName() << " and the water phase components in aquifer " << bc.getName() );
}
} );
}
void CompositionalMultiphaseBase::initializePreSubGroups()
{
FlowSolverBase::initializePreSubGroups();
DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
ConstitutiveManager const & cm = domain.getConstitutiveManager();
// 1. Validate various models against each other (must have same phases and components)
validateConstitutiveModels( cm );
// 2. Validate constitutive models in regions
for( auto & mesh : domain.getMeshBodies().getSubGroups() )
{
MeshLevel & meshLevel = dynamicCast< MeshBody * >( mesh.second )->getMeshLevel( 0 );
validateModelMapping< MultiFluidBase >( meshLevel.getElemManager(), m_fluidModelNames );
validateModelMapping< RelativePermeabilityBase >( meshLevel.getElemManager(), m_relPermModelNames );
if( m_capPressureFlag )
{
validateModelMapping< CapillaryPressureBase >( meshLevel.getElemManager(), m_capPressureModelNames );
}
// 3. Set the value of temperature
forTargetSubRegions( meshLevel, [&]( localIndex const, ElementSubRegionBase & subRegion )
{
arrayView1d< real64 > const temp = subRegion.getExtrinsicData< extrinsicMeshData::flow::temperature >();
temp.setValues< parallelHostPolicy >( m_inputTemperature );
} );
}
// 3. Initialize and validate the aquifer boundary condition
initializeAquiferBC( cm );
validateAquiferBC( cm );
}
void CompositionalMultiphaseBase::updateComponentFraction( ObjectManagerBase & dataGroup ) const
{
GEOSX_MARK_FUNCTION;
ComponentFractionKernelFactory::
createAndLaunch< parallelDevicePolicy<> >( m_numComponents,
dataGroup );
}
void CompositionalMultiphaseBase::updatePhaseVolumeFraction( ObjectManagerBase & dataGroup,
localIndex const targetIndex ) const
{
GEOSX_MARK_FUNCTION;
MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( dataGroup, m_fluidModelNames[targetIndex] );
PhaseVolumeFractionKernelFactory::
createAndLaunch< parallelDevicePolicy<> >( m_numComponents,
m_numPhases,
dataGroup,
fluid );
}
void CompositionalMultiphaseBase::updateFluidModel( ObjectManagerBase & dataGroup, localIndex const targetIndex ) const
{
GEOSX_MARK_FUNCTION;
arrayView1d< real64 const > const pres = dataGroup.getExtrinsicData< extrinsicMeshData::flow::pressure >();
arrayView1d< real64 const > const dPres = dataGroup.getExtrinsicData< extrinsicMeshData::flow::deltaPressure >();
arrayView1d< real64 const > const temp = dataGroup.getExtrinsicData< extrinsicMeshData::flow::temperature >();
arrayView2d< real64 const, compflow::USD_COMP > const compFrac =
dataGroup.getExtrinsicData< extrinsicMeshData::flow::globalCompFraction >();
MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( dataGroup, m_fluidModelNames[targetIndex] );
constitutiveUpdatePassThru( fluid, [&] ( auto & castedFluid )
{
using FluidType = TYPEOFREF( castedFluid );
using ExecPolicy = typename FluidType::exec_policy;
typename FluidType::KernelWrapper fluidWrapper = castedFluid.createKernelWrapper();
FluidUpdateKernel::launch< ExecPolicy >( dataGroup.size(),
fluidWrapper,
pres,
dPres,
temp,
compFrac );
} );
}
void CompositionalMultiphaseBase::updateRelPermModel( ObjectManagerBase & dataGroup, localIndex const targetIndex ) const
{
GEOSX_MARK_FUNCTION;
arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac =
dataGroup.getExtrinsicData< extrinsicMeshData::flow::phaseVolumeFraction >();
RelativePermeabilityBase & relPerm =
getConstitutiveModel< RelativePermeabilityBase >( dataGroup, m_relPermModelNames[targetIndex] );
constitutive::constitutiveUpdatePassThru( relPerm, [&] ( auto & castedRelPerm )
{
typename TYPEOFREF( castedRelPerm ) ::KernelWrapper relPermWrapper = castedRelPerm.createKernelWrapper();
RelativePermeabilityUpdateKernel::launch< parallelDevicePolicy<> >( dataGroup.size(),
relPermWrapper,
phaseVolFrac );
} );
}
void CompositionalMultiphaseBase::updateCapPressureModel( ObjectManagerBase & dataGroup, localIndex const targetIndex ) const
{
GEOSX_MARK_FUNCTION;
if( m_capPressureFlag )
{
arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac =
dataGroup.getExtrinsicData< extrinsicMeshData::flow::phaseVolumeFraction >();
CapillaryPressureBase & capPressure =
getConstitutiveModel< CapillaryPressureBase >( dataGroup, m_capPressureModelNames[targetIndex] );
constitutive::constitutiveUpdatePassThru( capPressure, [&] ( auto & castedCapPres )
{
typename TYPEOFREF( castedCapPres ) ::KernelWrapper capPresWrapper = castedCapPres.createKernelWrapper();
CapillaryPressureUpdateKernel::launch< parallelDevicePolicy<> >( dataGroup.size(),
capPresWrapper,
phaseVolFrac );
} );
}
}
void CompositionalMultiphaseBase::updateFluidState( ObjectManagerBase & subRegion, localIndex targetIndex ) const
{
GEOSX_MARK_FUNCTION;
updateComponentFraction( subRegion );
updateFluidModel( subRegion, targetIndex );
updatePhaseVolumeFraction( subRegion, targetIndex );
updateRelPermModel( subRegion, targetIndex );
updatePhaseMobility( subRegion, targetIndex );
updateCapPressureModel( subRegion, targetIndex );
}
void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh )
{
GEOSX_MARK_FUNCTION;
integer const numComp = m_numComponents;
integer const numPhase = m_numPhases;
// 1. Compute hydrostatic equilibrium in the regions for which corresponding field specification tag has been specified
computeHydrostaticEquilibrium();
forTargetSubRegions( mesh, [&]( localIndex const targetIndex, ElementSubRegionBase & subRegion )
{
// 2. Assume global component fractions have been prescribed.
// Initialize constitutive state to get fluid density.
updateFluidModel( subRegion, targetIndex );
// 3. Back-calculate global component densities from fractions and total fluid density
// in order to initialize the primary solution variables
MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidModelNames()[targetIndex] );
arrayView2d< real64 const, multifluid::USD_FLUID > const totalDens = fluid.totalDensity();
arrayView2d< real64 const, compflow::USD_COMP > const compFrac =
subRegion.getExtrinsicData< extrinsicMeshData::flow::globalCompFraction >();
arrayView2d< real64, compflow::USD_COMP > const compDens =
subRegion.getExtrinsicData< extrinsicMeshData::flow::globalCompDensity >();
forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOSX_HOST_DEVICE ( localIndex const ei )
{
for( localIndex ic = 0; ic < numComp; ++ic )
{
compDens[ei][ic] = totalDens[ei][0] * compFrac[ei][ic];
}
} );
} );
// for some reason CUDA does not want the host_device lambda to be defined inside the generic lambda
// I need the exact type of the subRegion for updateSolidflowProperties to work well.
forTargetSubRegions< CellElementSubRegion, SurfaceElementSubRegion >( mesh, [&]( localIndex const targetIndex,
auto & subRegion )
{
// 4. Update dependent state quantities
updatePhaseVolumeFraction( subRegion, targetIndex );
updatePorosityAndPermeability( subRegion, targetIndex );
updateRelPermModel( subRegion, targetIndex );
updatePhaseMobility( subRegion, targetIndex );
updateCapPressureModel( subRegion, targetIndex );
CoupledSolidBase const & porousSolid = getConstitutiveModel< CoupledSolidBase >( subRegion, m_solidModelNames[targetIndex] );
// saves porosity in oldPorosity
porousSolid.initializeState();
} );
// 5. Save initial pressure and total mass density (needed by the poromechanics solvers)
// Specifically, the initial pressure is used to compute a deltaPressure = currentPres - initPres in the total stress
// And the initial total mass density is used to compute a deltaBodyForce
forTargetSubRegions( mesh, [&]( localIndex const targetIndex, ElementSubRegionBase & subRegion )
{
arrayView1d< real64 const > const pres = subRegion.getExtrinsicData< extrinsicMeshData::flow::pressure >();
arrayView1d< real64 > const initPres = subRegion.getExtrinsicData< extrinsicMeshData::flow::initialPressure >();
MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidModelNames()[targetIndex] );
arrayView3d< real64 const, multifluid::USD_PHASE > const phaseMassDens = fluid.phaseMassDensity();
arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseVolumeFraction >();
arrayView2d< real64, multifluid::USD_FLUID > const initTotalMassDens =
fluid.getReference< array2d< real64, multifluid::LAYOUT_FLUID > >( MultiFluidBase::viewKeyStruct::initialTotalMassDensityString() );
forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOSX_HOST_DEVICE ( localIndex const ei )
{
initPres[ei] = pres[ei];
initTotalMassDens[ei][0] = 0.0;
for( localIndex ip = 0; ip < numPhase; ++ip )
{
initTotalMassDens[ei][0] += phaseVolFrac[ei][ip] * phaseMassDens[ei][0][ip];
}
} );
} );
}
void CompositionalMultiphaseBase::computeHydrostaticEquilibrium()
{
FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance();
DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
localIndex const numComps = m_numComponents;
localIndex const numPhases = m_numPhases;
real64 const gravVector[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() );
// Step 1: count individual equilibriums (there may be multiple ones)
std::map< string, localIndex > equilNameToEquilId;
localIndex equilCounter = 0;
fsManager.forSubGroups< EquilibriumInitialCondition >( [&] ( EquilibriumInitialCondition const & bc )
{
// collect all the equilibrium names to idx
equilNameToEquilId[bc.getName()] = equilCounter;
equilCounter++;
// check that the gravity vector is aligned with the z-axis
GEOSX_THROW_IF( !isZero( gravVector[0] ) || !isZero( gravVector[1] ),
catalogName() << " " << getName() <<
": the gravity vector specified in this simulation (" << gravVector[0] << " " << gravVector[1] << " " << gravVector[2] <<
") is not aligned with the z-axis. \n"
"This is incompatible with the " << EquilibriumInitialCondition::catalogName() << " called " << bc.getName() <<
"used in this simulation. To proceed, you can either: \n" <<
" - Use a gravityVector aligned with the z-axis, such as (0.0,0.0,-9.81)\n" <<
" - Remove the hydrostatic equilibrium initial condition from the XML file",
InputError );
} );
if( equilCounter == 0 )
{
return;
}
// Step 2: find the min elevation and the max elevation in the targetSets
array1d< real64 > globalMaxElevation( equilNameToEquilId.size() );
array1d< real64 > globalMinElevation( equilNameToEquilId.size() );
findMinMaxElevationInEquilibriumTarget( domain,
equilNameToEquilId,
globalMaxElevation,
globalMinElevation );
// Step 3: for each equil, compute a fine table with hydrostatic pressure vs elevation if the region is a target region
// first compute the region filter
std::set< string > regionFilter;
for( string const & regionName : targetRegionNames() )
{
regionFilter.insert( regionName );
}
fsManager.apply< EquilibriumInitialCondition >( 0.0,
domain,
"ElementRegions",
EquilibriumInitialCondition::catalogName(),
[&] ( EquilibriumInitialCondition const & fs,
string const &,
SortedArrayView< localIndex const > const & targetSet,
Group & subRegion,
string const & )
{
// Step 3.1: retrieve the data necessary to construct the pressure table in this subregion
integer const maxNumEquilIterations = fs.getMaxNumEquilibrationIterations();
real64 const equilTolerance = fs.getEquilibrationTolerance();
real64 const datumElevation = fs.getDatumElevation();
real64 const datumPressure = fs.getDatumPressure();
string const initPhaseName = fs.getInitPhaseName(); // will go away when GOC/WOC are implemented
localIndex const equilIndex = equilNameToEquilId.at( fs.getName() );
real64 const minElevation = LvArray::math::min( globalMinElevation[equilIndex], datumElevation );
real64 const maxElevation = LvArray::math::max( globalMaxElevation[equilIndex], datumElevation );
real64 const elevationIncrement = LvArray::math::min( fs.getElevationIncrement(), maxElevation - minElevation );
localIndex const numPointsInTable = std::ceil( (maxElevation - minElevation) / elevationIncrement ) + 1;
real64 const eps = 0.1 * (maxElevation - minElevation); // we add a small buffer to only log in the pathological cases
GEOSX_LOG_RANK_0_IF( ( (datumElevation > globalMaxElevation[equilIndex]+eps) || (datumElevation < globalMinElevation[equilIndex]-eps) ),
CompositionalMultiphaseBase::catalogName() << " " << getName()
<< ": By looking at the elevation of the cell centers in this model, GEOSX found that "
<< "the min elevation is " << globalMinElevation[equilIndex] << " and the max elevation is " << globalMaxElevation[equilIndex] <<
"\n"
<< "But, a datum elevation of " << datumElevation << " was specified in the input file to equilibrate the model.\n "
<< "The simulation is going to proceed with this out-of-bound datum elevation, but the initial condition may be inaccurate." );
array1d< array1d< real64 > > elevationValues;
array1d< real64 > pressureValues;
elevationValues.resize( 1 );
elevationValues[0].resize( numPointsInTable );
pressureValues.resize( numPointsInTable );
// Step 3.2: retrieve the user-defined tables (temperature and comp fraction)
FunctionManager & functionManager = FunctionManager::getInstance();
array1d< TableFunction::KernelWrapper > compFracTableWrappers;
arrayView1d< string const > compFracTableNames = fs.getComponentFractionVsElevationTableNames();
for( localIndex ic = 0; ic < numComps; ++ic )
{
TableFunction const & compFracTable = functionManager.getGroup< TableFunction >( compFracTableNames[ic] );
compFracTableWrappers.emplace_back( compFracTable.createKernelWrapper() );
}
string const tempTableName = fs.getTemperatureVsElevationTableName();
TableFunction const & tempTable = functionManager.getGroup< TableFunction >( tempTableName );
TableFunction::KernelWrapper tempTableWrapper = tempTable.createKernelWrapper();
// Step 3.3: retrieve the fluid model to compute densities
// we end up with the same issue as in applyDirichletBC: there is not a clean way to retrieve the fluid info
Group const & region = subRegion.getParent().getParent();
auto itRegionFilter = regionFilter.find( region.getName() );
if( itRegionFilter == regionFilter.end() )
{
return; // the region is not in target, there is nothing to do
}
string const & fluidName = m_fluidModelNames[ targetRegionIndex( region.getName() ) ];
MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName );
arrayView1d< string const > componentNames = fs.getComponentNames();
GEOSX_THROW_IF( fluid.componentNames().size() != componentNames.size(),
"Mismatch in number of components between constitutive model "
<< fluid.getName() << " and the Equilibrium initial condition " << fs.getName(),
InputError );
for( localIndex ic = 0; ic < fluid.numFluidComponents(); ++ic )
{
GEOSX_THROW_IF( fluid.componentNames()[ic] != componentNames[ic],
"Mismatch in component names between constitutive model "
<< fluid.getName() << " and the Equilibrium initial condition " << fs.getName(),
InputError );
}
// Note: for now, we assume that the reservoir is in a single-phase state at initialization
arrayView1d< string const > phaseNames = fluid.phaseNames();
auto const itPhaseNames = std::find( std::begin( phaseNames ), std::end( phaseNames ), initPhaseName );
GEOSX_THROW_IF( itPhaseNames == std::end( phaseNames ),
CompositionalMultiphaseBase::catalogName() << " " << getName() << ": phase name " << initPhaseName
<< " not found in the phases of " << fluid.getName(),
InputError );
integer const ipInit = std::distance( std::begin( phaseNames ), itPhaseNames );
// Step 3.4: compute the hydrostatic pressure values
constitutiveUpdatePassThru( fluid, [&] ( auto & castedFluid )
{
using FluidType = TYPEOFREF( castedFluid );
typename FluidType::KernelWrapper fluidWrapper = castedFluid.createKernelWrapper();
// note: inside this kernel, serialPolicy is used, and elevation/pressure values don't go to the GPU
HydrostaticPressureKernel::ReturnType const returnValue =
HydrostaticPressureKernel::launch( numPointsInTable,
numComps,
numPhases,
ipInit,
maxNumEquilIterations,
equilTolerance,
gravVector,
minElevation,
elevationIncrement,
datumElevation,
datumPressure,
fluidWrapper,
compFracTableWrappers.toViewConst(),
tempTableWrapper,
elevationValues.toNestedView(),
pressureValues.toView() );
GEOSX_THROW_IF( returnValue == HydrostaticPressureKernel::ReturnType::FAILED_TO_CONVERGE,
CompositionalMultiphaseBase::catalogName() << " " << getName()
<< ": hydrostatic pressure initialization failed to converge in region " << region.getName() << "! \n"
<< "Try to loosen the equilibration tolerance, or increase the number of equilibration iterations. \n"
<< "If nothing works, something may be wrong in the fluid model, see <Constitutive> ",
std::runtime_error );
GEOSX_LOG_RANK_0_IF( returnValue == HydrostaticPressureKernel::ReturnType::DETECTED_MULTIPHASE_FLOW,
CompositionalMultiphaseBase::catalogName() << " " << getName()
<< ": currently, GEOSX assumes that there is only one mobile phase when computing the hydrostatic pressure. \n"
<< "We detected multiple phases using the provided datum pressure, temperature, and component fractions. \n"
<< "Please make sure that only one phase is mobile at the beginning of the simulation. \n"
<< "If this is not the case, the problem will not be at equilibrium when the simulation starts" );
} );
// Step 3.5: create hydrostatic pressure table
string const tableName = fs.getName() + "_" + subRegion.getName() + "_" + phaseNames[ipInit] + "_table";
TableFunction * const presTable = dynamicCast< TableFunction * >( functionManager.createChild( TableFunction::catalogName(), tableName ) );
presTable->setTableCoordinates( elevationValues );
presTable->setTableValues( pressureValues );
presTable->setInterpolationMethod( TableFunction::InterpolationType::Linear );
TableFunction::KernelWrapper presTableWrapper = presTable->createKernelWrapper();
// Step 4: assign pressure, temperature, and component fraction as a function of elevation
// TODO: this last step should probably be delayed to wait for the creation of FaceElements
// TODO: this last step should be modified to account for GOC and WOC
arrayView2d< real64 const > const elemCenter =
subRegion.getReference< array2d< real64 > >( ElementSubRegionBase::viewKeyStruct::elementCenterString() );
arrayView1d< real64 > const pres = subRegion.getReference< array1d< real64 > >( extrinsicMeshData::flow::pressure::key() );
arrayView1d< real64 > const temp = subRegion.getReference< array1d< real64 > >( extrinsicMeshData::flow::temperature::key() );
arrayView2d< real64, compflow::USD_COMP > const compFrac =
subRegion.getReference< array2d< real64, compflow::LAYOUT_COMP > >( extrinsicMeshData::flow::globalCompFraction::key() );
arrayView1d< TableFunction::KernelWrapper const > compFracTableWrappersViewConst =
compFracTableWrappers.toViewConst();
forAll< parallelDevicePolicy<> >( targetSet.size(), [targetSet,
elemCenter,
presTableWrapper,
tempTableWrapper,
compFracTableWrappersViewConst,
numComps,
pres,
temp,
compFrac] GEOSX_HOST_DEVICE ( localIndex const i )
{
localIndex const k = targetSet[i];
real64 const elevation = elemCenter[k][2];
pres[k] = presTableWrapper.compute( &elevation );
temp[k] = tempTableWrapper.compute( &elevation );
for( localIndex ic = 0; ic < numComps; ++ic )
{
compFrac[k][ic] = compFracTableWrappersViewConst[ic].compute( &elevation );
}
} );
} );
}
void CompositionalMultiphaseBase::initializePostInitialConditionsPreSubGroups()
{
GEOSX_MARK_FUNCTION;
FlowSolverBase::initializePostInitialConditionsPreSubGroups();
DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
MeshLevel & mesh = domain.getMeshBody( 0 ).getMeshLevel( 0 );
std::map< string, string_array > fieldNames;
fieldNames["elems"].emplace_back( extrinsicMeshData::flow::pressure::key() );
fieldNames["elems"].emplace_back( extrinsicMeshData::flow::globalCompDensity::key() );
CommunicationTools::getInstance().synchronizeFields( fieldNames, mesh, domain.getNeighbors(), false );
// set mass fraction flag on fluid models
forTargetSubRegions( mesh, [&]( localIndex const targetIndex, ElementSubRegionBase & subRegion )
{
MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, m_fluidModelNames[targetIndex] );
fluid.setMassFlag( m_useMass );
} );
// Initialize primary variables from applied initial conditions
initializeFluidState( mesh );
}
real64 CompositionalMultiphaseBase::solverStep( real64 const & time_n,
real64 const & dt,
integer const cycleNumber,
DomainPartition & domain )
{
GEOSX_MARK_FUNCTION;
// Only build the sparsity pattern once
// TODO: this should be triggered by a topology change indicator
static bool systemSetupDone = false;
if( !systemSetupDone )
{
setupSystem( domain, m_dofManager, m_localMatrix, m_rhs, m_solution );
systemSetupDone = true;
}
implicitStepSetup( time_n, dt, domain );
// currently the only method is implicit time integration
real64 const dt_return = nonlinearImplicitStep( time_n, dt, cycleNumber, domain );
// final step for completion of timestep. typically secondary variable updates and cleanup.
implicitStepComplete( time_n, dt_return, domain );
return dt_return;
}
void CompositionalMultiphaseBase::backupFields( MeshLevel & mesh ) const
{
GEOSX_MARK_FUNCTION;
integer const numComp = m_numComponents;
integer const numPhase = m_numPhases;
// backup some fields used in time derivative approximation
forTargetSubRegions( mesh, [&]( localIndex const targetIndex, ElementSubRegionBase & subRegion )
{
arrayView1d< integer const > const elemGhostRank = subRegion.ghostRank();
arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseVolumeFraction >();
arrayView2d< real64 const, compflow::USD_PHASE > const & phaseMob =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseMobility >();
MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidModelNames()[targetIndex] );
arrayView2d< real64 const, multifluid::USD_FLUID > const totalDens = fluid.totalDensity();
arrayView3d< real64 const, multifluid::USD_PHASE > const phaseDens = fluid.phaseDensity();
arrayView4d< real64 const, multifluid::USD_PHASE_COMP > const phaseCompFrac = fluid.phaseCompFraction();
arrayView1d< real64 > const totalDensOld =
subRegion.getExtrinsicData< extrinsicMeshData::flow::totalDensityOld >();
arrayView2d< real64, compflow::USD_PHASE > const phaseDensOld =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseDensityOld >();
arrayView2d< real64, compflow::USD_PHASE > const phaseVolFracOld =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseVolumeFractionOld >();
arrayView2d< real64, compflow::USD_PHASE > const phaseMobOld =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseMobilityOld >();
arrayView3d< real64, compflow::USD_PHASE_COMP > const phaseCompFracOld =
subRegion.getExtrinsicData< extrinsicMeshData::flow::phaseComponentFractionOld >();
forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOSX_HOST_DEVICE ( localIndex const ei )
{
if( elemGhostRank[ei] >= 0 )
return;
for( localIndex ip = 0; ip < numPhase; ++ip )
{
phaseDensOld[ei][ip] = phaseDens[ei][0][ip];
phaseVolFracOld[ei][ip] = phaseVolFrac[ei][ip];
phaseMobOld[ei][ip] = phaseMob[ei][ip];
for( localIndex ic = 0; ic < numComp; ++ic )
{
phaseCompFracOld[ei][ip][ic] = phaseCompFrac[ei][0][ip][ic];
}
}
totalDensOld[ei] = totalDens[ei][0];
} );
} );
}
void
CompositionalMultiphaseBase::implicitStepSetup( real64 const & GEOSX_UNUSED_PARAM( time_n ),
real64 const & GEOSX_UNUSED_PARAM( dt ),
DomainPartition & domain )
{
MeshLevel & mesh = domain.getMeshBody( 0 ).getMeshLevel( 0 );
// bind the stored views to the current domain
static bool viewsSet = false;
if( !viewsSet )
{
resetViews( mesh );
viewsSet = true;
}
// set deltas to zero and recompute dependent quantities
resetStateToBeginningOfStep( domain );
// backup fields used in time derivative approximation
backupFields( mesh );
}
void CompositionalMultiphaseBase::assembleSystem( real64 const GEOSX_UNUSED_PARAM( time_n ),
real64 const dt,
DomainPartition & domain,
DofManager const & dofManager,
CRSMatrixView< real64, globalIndex const > const & localMatrix,
arrayView1d< real64 > const & localRhs )
{
GEOSX_MARK_FUNCTION;
assembleAccumulationAndVolumeBalanceTerms( domain,
dofManager,
localMatrix,
localRhs );
assembleFluxTerms( dt,
domain,
dofManager,
localMatrix,
localRhs );
}
void CompositionalMultiphaseBase::assembleAccumulationAndVolumeBalanceTerms( DomainPartition & domain,
DofManager const & dofManager,
CRSMatrixView< real64, globalIndex const > const & localMatrix,
arrayView1d< real64 > const & localRhs ) const
{
GEOSX_MARK_FUNCTION;
MeshLevel & mesh = domain.getMeshBody( 0 ).getMeshLevel( 0 );
forTargetSubRegions( mesh,
[&]( localIndex const targetIndex,
ElementSubRegionBase const & subRegion )
{
string const dofKey = dofManager.getKey( viewKeyStruct::elemDofFieldString() );
MultiFluidBase const & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidModelNames()[targetIndex] );
CoupledSolidBase const & solid = getConstitutiveModel< CoupledSolidBase >( subRegion, m_solidModelNames[targetIndex] );
ElementBasedAssemblyKernelFactory::
createAndLaunch< parallelDevicePolicy<> >( m_numComponents,
m_numPhases,
dofManager.rankOffset(),
dofKey,
subRegion,
fluid,
solid,
localMatrix,
localRhs );
} );
}
void CompositionalMultiphaseBase::applyBoundaryConditions( real64 const time_n,
real64 const dt,
DomainPartition & domain,
DofManager const & dofManager,
CRSMatrixView< real64, globalIndex const > const & localMatrix,
arrayView1d< real64 > const & localRhs )
{
GEOSX_MARK_FUNCTION;
// apply pressure boundary conditions.
applyDirichletBC( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() );
// apply flux boundary conditions
applySourceFluxBC( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() );
// apply aquifer boundary conditions
applyAquiferBC( time_n, dt, dofManager, domain, localMatrix.toViewConstSizes(), localRhs.toView() );
}
namespace internal
{
string const bcLogMessage = string( "CompositionalMultiphaseBase {}: at time {}s, " )
+ string( "the <{}> boundary condition '{}' is applied to the element set '{}' in subRegion '{}'. " )
+ string( "\nThe scale of this boundary condition is {} and multiplies the value of the provided function (if any). " )
+ string( "\nThe total number of target elements (including ghost elements) is {}. " )
+ string( "\nNote that if this number is equal to zero for all subRegions, the boundary condition will not be applied on this element set." );
}
void CompositionalMultiphaseBase::applySourceFluxBC( real64 const time,
real64 const dt,
DofManager const & dofManager,
DomainPartition & domain,
CRSMatrixView< real64, globalIndex const > const & localMatrix,
arrayView1d< real64 > const & localRhs ) const
{
GEOSX_MARK_FUNCTION;
FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance();
string const dofKey = dofManager.getKey( viewKeyStruct::elemDofFieldString() );