print , "Project : ",ProjectName print , "is Exported as : ",FileFormat," format" print *, "File Name is : ",FileName
print ,obj%Boundary%DBoundNodID(j,i) print ,obj%Boundary%DBoundVal(j,i) print *, "ERROR :: ExportFEMDomain >> only .scf file can be exported."
character*4::FileFormat character*70::ProjectName character*74 ::FileName character*9 :: DataType integer,allocatable::IntMat(:,:) real(8),allocatable::RealMat(:,:) integer,optional,intent(in)::FileHandle integer :: fh,i,j,k,NumOfDomain,n,m,DimNum,GpNum character*70 Msg,name !call DeallocateFEMDomain(obj) name="untitled" obj%FileName=input(default=name,option=trim(OptionalProjectName)) if(present(FileHandle) )then fh=FileHandle else fh =104 endif if(present(OptionalFileFormat) )then FileFormat=trim(OptionalFileFormat) else FileFormat=".scf" endif if(present(OptionalProjectName) )then ProjectName=trim(OptionalProjectName) else ProjectName="untitled" endif FileName = trim(ProjectName)//trim(FileFormat) !!print *, "Project : ",ProjectName !!print *, "is Exported as : ",FileFormat," format" !!print *, "File Name is : ",FileName open(fh,file=FileName,status="old") if(trim(FileFormat)==".scf" )then read(fh,*) DataType if(DataType/="domain")then print *, "ERROR :: Datatype ",DataType," is not valid." return endif obj%Dtype=DataType read(fh,*) obj%SolverType read(fh,*) NumOfDomain allocate(IntMat(NumOfDomain,2)) allocate(obj%Mesh%SubMeshNodFromTo(NumOfDomain,3) ) allocate(obj%Mesh%SubMeshElemFromTo(NumOfDomain,3) ) do i=1,NumOfDomain obj%Mesh%SubMeshNodFromTo(i,1)=i read(fh,*) obj%Mesh%SubMeshNodFromTo(i,2),obj%Mesh%SubMeshNodFromTo(i,3) enddo do i=1,NumOfDomain obj%Mesh%SubMeshElemFromTo(i,1)=i read(fh,*) obj%Mesh%SubMeshElemFromTo(i,3) if(i==1)then obj%Mesh%SubMeshElemFromTo(i,2)=1 else obj%Mesh%SubMeshElemFromTo(i,2)=obj%Mesh%SubMeshElemFromTo(i-1,3)+1 endif enddo read(fh,*) n,m DimNum=m allocate(obj%Mesh%NodCoord(n,m) ) call ImportArray(obj%Mesh%NodCoord,OptionalFileHandle=fh) call CopyArray(obj%Mesh%NodCoord,obj%Mesh%NodCoordInit ) read(fh,*) n,m read(fh,*)obj%Mesh%ElemType obj%ShapeFunction%ElemType=obj%Mesh%ElemType allocate(obj%Mesh%ElemNod(n,m) ) allocate(obj%Mesh%ElemMat(n ) ) call ImportArray(obj%Mesh%ElemNod,OptionalFileHandle=fh) do i=1,n read(fh,*) obj%Mesh%ElemMat(i) enddo read(fh,*) n,m allocate(obj%MaterialProp%MatPara(n,m) ) call ImportArray(obj%MaterialProp%MatPara,OptionalFileHandle=fh) !DirichletBoundary read(fh,*) n !DirichletBoundaryDimension if(n<=0)then print *, "ImportFEMDomain >> Caution :: no Dirichlet Boundary Condition is loaded. " else allocate(obj%Boundary%DBoundNum(n )) read(fh,*) obj%Boundary%DBoundNum(:) allocate(obj%Boundary%DBoundNodID( maxval(obj%Boundary%DBoundNum), size(obj%Boundary%DBoundNum) ) ) allocate(obj%Boundary%DBoundVal( maxval(obj%Boundary%DBoundNum), size(obj%Boundary%DBoundNum) ) ) obj%Boundary%DBoundNodID(:,:)=-1 obj%Boundary%DBoundVal(:,:) =0.0d0 do i=1,size(obj%Boundary%DBoundNum,1) do j=1,obj%Boundary%DBoundNum(i) read(fh,*) obj%Boundary%DBoundNodID(j,i) !!print *,obj%Boundary%DBoundNodID(j,i) enddo do j=1,obj%Boundary%DBoundNum(i) read(fh,*) obj%Boundary%DBoundVal(j,i) !!print *,obj%Boundary%DBoundVal(j,i) enddo enddo endif read(fh,*) DimNum if(DimNum<=0)then print *, "ImportFEMDomain >> Caution :: no Neumann Boundary Condition is loaded. " else read(fh,*) n allocate( obj%Boundary%NBoundNum(DimNum)) allocate(obj%Boundary%NBoundNodID(n, size(obj%Boundary%NBoundNum) ) ) allocate(obj%Boundary%NBoundVal( n, size(obj%Boundary%NBoundNum) ) ) obj%Boundary%NBoundNodID(:,:)=-1 obj%Boundary%NBoundVal(:,:) =0.0d0 obj%Boundary%NBoundNum(:)=n do i=1,n read(fh,*) m obj%Boundary%NBoundNodID(i,:)=m enddo do i=1,n read(fh,*) obj%Boundary%NBoundVal(i,:) enddo endif !######### Initial conditions ################# ! For node-wize read(fh,*) DimNum if(DimNum<=0)then print *, "Caution :: no Initial Condition (Node-wise) Condition is loaded. " else read(fh,*) n allocate(obj%Boundary%TBoundNodID(n,DimNum) ) allocate(obj%Boundary%TBoundVal( n,DimNum) ) allocate(obj%Boundary%TBoundNum( DimNum) ) obj%Boundary%TBoundNum(:)=n if(n/=0)then if(n<0)then print *, "ERROR :: number of initial conditions are to be zero" else do i=1,n read(fh,*) obj%Boundary%TBoundNodID(i,:) enddo do i=1,n read(fh,*) obj%Boundary%TBoundVal(i,:) enddo endif endif endif !######### Initial conditions ################# !######### Initial conditions ################# ! For ElementGP-wize read(fh,*) DimNum if(DimNum<=0)then print *, "Caution :: no Initial Condition (Gp) is loaded. " else read(fh,*) GpNum read(fh,*) n allocate(obj%Boundary%TBoundElemID(n) ) allocate(obj%Boundary%TBoundElemGpVal(n,GpNum,DimNum) ) if(n/=0)then if(n<0)then print *, "ERROR :: number of initial conditions are to be zero" else do i=1,n read(fh,*) obj%Boundary%TBoundElemID(i) enddo do i=1,n do j=1,GpNum do k=1,DimNum read(fh,*) obj%Boundary%TBoundElemGpVal(i,j,k) enddo enddo enddo endif endif endif !######### Initial conditions ################# read(fh,*) obj%ControlPara%SimMode ,obj%ControlPara%ItrTol,obj%ControlPara%Timestep close(fh) else !!print *, "ERROR :: ExportFEMDomain >> only .scf file can be exported." endif