@@ -68,16 +68,22 @@ program DAMASK_mesh
6868 loadcase_string
6969 integer :: &
7070 stagItMax, & ! < max number of field level staggered iterations
71- maxCutBack ! < max number of cutbacks
71+ maxCutBack, & ! < max number of cutbacks
72+ skipBCTagDigits, & ! < number of characters to skip to print BC tag (T descriptor)
73+ BCTag ! < tag value read from YAML load file
74+ integer , allocatable , dimension (:) :: &
75+ knownBCTags ! < array of read BC tags (check for duplicates)
76+
7277
7378 type (tLoadCase), allocatable , dimension (:) :: loadCases ! < array of all load cases
7479 type (tSolutionState), allocatable , dimension (:) :: solres
75- PetscInt :: faceSet, currentFaceSet , dimPlex
80+ PetscInt :: boundary , dimPlex
7681 PetscErrorCode :: err_PETSc
7782 external :: &
7883 quit
7984 character (len= :), allocatable :: &
80- fileContent, fname
85+ fileContent, fname, tagPrintFormat
86+ character (len= 6 ) :: BC_elem
8187
8288
8389!- -------------------------------------------------------------------------------------------------
@@ -114,34 +120,40 @@ program DAMASK_mesh
114120 load_steps = > load% get_list(' loadstep' )
115121
116122 allocate (loadCases(size (load_steps)))
117-
118-
119123 do l = 1 , size (load_steps)
120124 load_step = > load_steps% get_dict(l)
121125 step_bc = > load_step% get_dict(' boundary_conditions' )
122126 step_mech = > step_bc% get_list(' mechanical' )
123127 allocate (loadCases(l)% mechBC(mesh_Nboundaries))
124128 loadCases(l)% mechBC(:)% nComponents = dimPlex ! < X, Y (, Z) displacements
125- do faceSet = 1 , mesh_Nboundaries
126- allocate (loadCases(l)% mechBC(faceSet) % Value (dimPlex), source = 0.0_pREAL )
127- allocate (loadCases(l)% mechBC(faceSet) % Mask (dimPlex), source = .false. )
129+ do boundary = 1_pPETSCINT , mesh_Nboundaries
130+ allocate (loadCases(l)% mechBC(boundary) % dot_u (dimPlex), source = 0.0_pREAL )
131+ allocate (loadCases(l)% mechBC(boundary) % active (dimPlex), source = .false. )
128132 end do
129133
134+ allocate (knownBCTags(size (step_mech)), source = - 1 )
130135 do m = 1 , size (step_mech)
131136 mech_BC = > step_mech% get_dict(m)
132- currentFaceSet = - 1
133- do faceSet = 1 , mesh_Nboundaries
134- if (mesh_boundaries(faceSet) == mech_BC% get_asInt(' tag' )) currentFaceSet = faceSet
135- end do
136- if (currentFaceSet < 0 ) call IO_error(error_ID = 837 , ext_msg = ' invalid BC' )
137+ BCTag = mech_BC% get_asInt(' tag' )
138+ boundary = findloc(mesh_boundariesIS, BCtag, dim = 1 )
139+ if (boundary == 0 ) then ! < tag not defined in mesh file
140+ call IO_error(error_ID = 837 , ext_msg = ' BC tag ' // mech_BC% get_asStr(' tag' )// &
141+ ' refers to inexistent node/edge/face mesh group' )
142+ else if (findloc(knownBCTags, BCTag, dim = 1 ) /= 0 ) then ! < duplicated tag
143+ call IO_error(error_ID = 837 , ext_msg = ' BC redefinition not allowed (tag ' // &
144+ mech_BC% get_asStr(' tag' )// ' )' )
145+ end if
146+ knownBCTags(m) = BCTag
137147 mech_u = > mech_BC% get_list(' dot_u' )
138148 do component = 1 , dimPlex
139149 if (mech_u% get_asStr(component) /= ' x' ) then
140- loadCases(l)% mechBC(currentFaceSet) % Mask (component) = .true.
141- loadCases(l)% mechBC(currentFaceSet) % Value (component) = mech_u% get_asReal(component)
150+ loadCases(l)% mechBC(boundary) % active (component) = .true.
151+ loadCases(l)% mechBC(boundary) % dot_u (component) = mech_u% get_asReal(component)
142152 end if
143153 end do
144154 end do
155+ deallocate (knownBCTags)
156+
145157 step_discretization = > load_step% get_dict(' discretization' )
146158 loadCases(l)% t = step_discretization% get_asReal(' t' )
147159 loadCases(l)% N = step_discretization% get_asInt (' N' )
@@ -157,28 +169,33 @@ program DAMASK_mesh
157169!- -------------------------------------------------------------------------------------------------
158170! consistency checks and output of load case
159171 errorID = 0
172+ skipBCTagDigits = 4+6+1 + floor (log10 (real (maxval (mesh_boundariesIS))))+ 1+2 ! < Indentation(4)+BC_elem(6)+blank(1)+descriptor T(1)+NumDigits(floor(..)+1)+2(start printing after 1 blank)
173+ allocate (character (len= skipBCTagDigits) :: tagPrintFormat)
174+ write (tagPrintFormat,' (i0)' ) skipBCTagDigits
160175 checkLoadcases: do l = 1 , size (load_steps)
161176 write (loadcase_string, ' (i0)' ) l
162177 print ' (/,1x,a,1x,i0)' , ' load case:' , l
163178 if (.not. loadCases(l)% estimate_rate) &
164179 print ' (2x,a)' , ' drop guessing along trajectory'
165180 print ' (2x,a)' , ' Field ' // trim (FIELD_MECH_label)
166181
167- do faceSet = 1 , mesh_Nboundaries
168- do component = 1 , dimPlex
169- if (loadCases(l)% mechBC(faceSet)% Mask(component)) &
170- print ' (a,i2,a,i2,a,f12.7)' , &
171- ' Face ' , mesh_boundaries(faceSet), &
172- ' Component ' , component, &
173- ' Value ' , loadCases(l)% mechBC(faceSet)% Value(component)
182+ do boundary = 1_pPETSCINT , mesh_Nboundaries
183+ BC_elem = merge (' Vertex' , merge (' Edge ' , ' Face ' , dimplex == 2_pPETSCINT ), &
184+ mesh_boundariesIdx(boundary) == 1_pPETSCINT )
185+ do component = 1_pPETSCINT , dimPlex
186+ if (loadCases(l)% mechBC(boundary)% active(component)) &
187+ print ' (4x,a,1x,i0,T' // tagPrintFormat// ' ,a,1x,i1,1x,a,1x,f12.7)' , &
188+ BC_elem, mesh_boundariesIS(boundary), &
189+ ' Component' , component, &
190+ ' Value' , loadCases(l)% mechBC(boundary)% dot_u(component)
174191 end do
175192 end do
176- print ' (2x,a,f12.6) ' , ' time: ' , loadCases(l) % t
177- if ( loadCases(l)% N < 1 ) errorID = 835 ! non-positive incs count
178- print ' (2x,a,i5) ' , ' increments: ' , loadCases(l) % N
179- if (loadCases(l) % f_out < 1 ) errorID = 836 ! non-positive result frequency
180- print ' (2x,a,i5) ' , ' output frequency: ' , &
181- loadCases(l)% f_out
193+
194+ print ' (2x,a,T21,g0.6) ' , ' time: ' , loadCases(l)% t
195+ if (loadCases(l) % N < 1 ) errorID = 835 ! non-positive incs count
196+ print ' (2x,a,T21,i0) ' , ' increments: ' , loadCases(l) % N
197+ if (loadCases(l) % f_out < 1 ) errorID = 836 ! non-positive result frequency
198+ print ' (2x,a,T21,i0) ' , ' output frequency: ' , loadCases(l)% f_out
182199 if (errorID > 0 ) call IO_error(error_ID = errorID, ext_msg = loadcase_string) ! exit with error message
183200 end do checkLoadcases
184201
@@ -222,7 +239,7 @@ program DAMASK_mesh
222239 ' Time' , t, &
223240 ' s: Increment ' , inc, ' /' , loadCases(l)% N,&
224241 ' -' , stepFraction, ' /' , subStepFactor** cutBackLevel,&
225- ' of load case ' , l,' /' ,size (load_steps)
242+ ' of load case ' , l,' /' , size (load_steps)
226243 write (incInfo,' (4(a,i0))' ) &
227244 ' Increment ' ,totalIncsCounter,' /' ,sum (loadCases% N),&
228245 ' -' ,stepFraction, ' /' , subStepFactor** cutBackLevel
0 commit comments