Skip to content

Commit 35ed6ea

Browse files
committed
Merge remote-tracking branch 'origin/fix-marc-ddm' into development
2 parents 268c522 + 0d0f2cf commit 35ed6ea

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

PRIVATE

python/damask/solver/_marc.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def tools_path(self):
5656
def submit_job(self, model: str, job: str,
5757
compile: bool = False,
5858
optimization: Literal['', 'l', 'h'] = '',
59+
domains: int = 1,
5960
env = None):
6061
"""
6162
Assemble command line arguments and call Marc executable.
@@ -72,6 +73,9 @@ def submit_job(self, model: str, job: str,
7273
optimization : {'', 'l', 'h'}, optional
7374
Optimization level '': -O0, 'l': -O1, or 'h': -O3.
7475
Defaults to ''.
76+
domains: int, optional
77+
Number of domains.
78+
Defaults to 1.
7579
env : dict, optional
7680
Environment for execution.
7781
@@ -83,7 +87,10 @@ def submit_job(self, model: str, job: str,
8387
# Define options [see Marc Installation and Operation Guide, pp 23]
8488
script = f'run_damask_{optimization}mp'
8589

86-
cmd = f'{self.tools_path/script} -jid {model}_{job} -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no ' \
90+
cmd = f'{self.tools_path/script} -jid {model}_{job} '\
91+
+ ('-nprocd 1 ' if (domains == 1) else\
92+
f'-nprocd {domains} -nsolver {domains} -nthread_elem {domains} -nthread_solver {domains} ')\
93+
+ '-autorst 0 -ci n -cr n -dcoup 0 -b no -v no '\
8794
+ (f'-u {usersub} -save y' if compile else f'-prog {usersub.with_suffix("")}')
8895
print(cmd)
8996

src/Marc/discretization_Marc.f90

+8-4
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,10 @@ subroutine inputRead_NelemSets(nElemSets,maxNelemInSet,&
438438
if (chunkPos(1) < 2) cycle
439439
if (IO_lc(strValue(fileContent(l),chunkPos,1)) == 'define' .and. &
440440
IO_lc(strValue(fileContent(l),chunkPos,2)) == 'element') then
441+
chunkPos = strPos(fileContent(l+1))
442+
if (chunkPos(1) == 0) cycle
441443
nElemSets = nElemSets + 1
442444

443-
chunkPos = strPos(fileContent(l+1))
444445
if (containsRange(fileContent(l+1),chunkPos)) then
445446
elemInCurrentSet = 1 + abs( intValue(fileContent(l+1),chunkPos,3) &
446447
-intValue(fileContent(l+1),chunkPos,1))
@@ -488,9 +489,12 @@ subroutine inputRead_mapElemSets(nameElemSet,mapElemSet,&
488489
if (chunkPos(1) < 2) cycle
489490
if (IO_lc(strValue(fileContent(l),chunkPos,1)) == 'define' .and. &
490491
IO_lc(strValue(fileContent(l),chunkPos,2)) == 'element') then
491-
elemSet = elemSet+1
492-
nameElemSet(elemSet) = trim(strValue(fileContent(l),chunkPos,4))
493-
mapElemSet(:,elemSet) = continuousIntValues(fileContent(l+1:),size(mapElemSet,1)-1,nameElemSet,mapElemSet,size(nameElemSet))
492+
chunkPos = strPos(fileContent(l+1))
493+
if (chunkPos(1) == 0) cycle
494+
chunkPos = strPos(fileContent(l))
495+
elemSet = elemSet+1
496+
nameElemSet(elemSet) = trim(strValue(fileContent(l),chunkPos,4))
497+
mapElemSet(:,elemSet) = continuousIntValues(fileContent(l+1:),size(mapElemSet,1)-1,nameElemSet,mapElemSet,size(nameElemSet))
494498
end if
495499
end do
496500

0 commit comments

Comments
 (0)